From 57de40e1e802e44ae5b4caa67b0bb8763828b5c3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 15 Oct 2014 19:49:47 +0300 Subject: [PATCH] Run a tighter ship with extensions --- extensions/arb_shadow.glext | 1 + gl.fixes.xml | 22 +++++++++++++++++++++- source/buffer.cpp | 3 --- source/buffer.h | 1 + source/framebuffer.h | 4 ++-- source/pixelformat.h | 25 +++++++++++++------------ source/pixelstore.cpp | 9 +++++++-- source/texture.cpp | 10 ++++++++-- 8 files changed, 53 insertions(+), 22 deletions(-) create mode 100644 extensions/arb_shadow.glext diff --git a/extensions/arb_shadow.glext b/extensions/arb_shadow.glext new file mode 100644 index 00000000..24e32e2e --- /dev/null +++ b/extensions/arb_shadow.glext @@ -0,0 +1 @@ +extension ARB_shadow diff --git a/gl.fixes.xml b/gl.fixes.xml index 39ec23e7..f0f12fa1 100644 --- a/gl.fixes.xml +++ b/gl.fixes.xml @@ -35,12 +35,30 @@ + + + + + + + + + + + + + + + + @@ -49,7 +67,9 @@ - + + diff --git a/source/buffer.cpp b/source/buffer.cpp index 066ab96c..1226dbe3 100644 --- a/source/buffer.cpp +++ b/source/buffer.cpp @@ -1,7 +1,4 @@ #include -#include -#include -#include #include "buffer.h" #include "error.h" #include "mesh.h" diff --git a/source/buffer.h b/source/buffer.h index e254bcc7..c473d7ed 100644 --- a/source/buffer.h +++ b/source/buffer.h @@ -3,6 +3,7 @@ #include #include "gl.h" +#include #include #include diff --git a/source/framebuffer.h b/source/framebuffer.h index 2e29dbc3..07cae867 100644 --- a/source/framebuffer.h +++ b/source/framebuffer.h @@ -28,8 +28,8 @@ enum FramebufferStatus { FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, - FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT, - FRAMEBUFFER_INCOMPLETE_FORMATS = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT, + FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS, + FRAMEBUFFER_INCOMPLETE_FORMATS = GL_FRAMEBUFFER_INCOMPLETE_FORMATS, FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER, FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED, diff --git a/source/pixelformat.h b/source/pixelformat.h index a0e578a6..6d68bbc1 100644 --- a/source/pixelformat.h +++ b/source/pixelformat.h @@ -18,29 +18,30 @@ enum PixelFormat RGB = GL_RGB, RGBA = GL_RGBA, RGB8 = GL_RGB8, - RGB16F = GL_RGB16F_ARB, - RGB32F = GL_RGB32F_ARB, + RGB16F = GL_RGB16F, + RGB32F = GL_RGB32F, RGBA8 = GL_RGBA8, - RGBA16F = GL_RGBA16F_ARB, - RGBA32F = GL_RGBA32F_ARB, - SRGB = GL_SRGB_EXT, - SRGB_ALPHA = GL_SRGB_ALPHA_EXT, - SRGB8 = GL_SRGB8_EXT, - SRGB8_ALPHA8 = GL_SRGB8_ALPHA8_EXT, + RGBA16F = GL_RGBA16F, + RGBA32F = GL_RGBA32F, + SRGB = GL_SRGB, + SRGB_ALPHA = GL_SRGB_ALPHA, + SRGB8 = GL_SRGB8, + SRGB8_ALPHA8 = GL_SRGB8_ALPHA8, BGR = GL_BGR, BGRA = GL_BGRA, LUMINANCE = GL_LUMINANCE, LUMINANCE8 = GL_LUMINANCE8, + // TODO Remove LUMINANCE(_ALPHA) float formats once ARB_texture_rg becomes supported LUMINANCE16F = GL_LUMINANCE16F_ARB, LUMINANCE32F = GL_LUMINANCE32F_ARB, LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA, LUMINANCE_ALPHA8 = GL_LUMINANCE8_ALPHA8, LUMINANCE_ALPHA16F = GL_LUMINANCE_ALPHA16F_ARB, LUMINANCE_ALPHA32F = GL_LUMINANCE_ALPHA32F_ARB, - SLUMINANCE = GL_SLUMINANCE_EXT, - SLUMINANCE8 = GL_SLUMINANCE8_EXT, - SLUMINANCE_ALPHA = GL_SLUMINANCE_ALPHA_EXT, - SLUMINANCE8_ALPHA8 = GL_SLUMINANCE8_ALPHA8_EXT + SLUMINANCE = GL_SLUMINANCE, + SLUMINANCE8 = GL_SLUMINANCE8, + SLUMINANCE_ALPHA = GL_SLUMINANCE_ALPHA, + SLUMINANCE8_ALPHA8 = GL_SLUMINANCE8_ALPHA8 }; void operator>>(const LexicalConverter &, PixelFormat &); diff --git a/source/pixelstore.cpp b/source/pixelstore.cpp index 011866e3..629162cd 100644 --- a/source/pixelstore.cpp +++ b/source/pixelstore.cpp @@ -1,4 +1,5 @@ #include +#include #include "gl.h" #include "pixelformat.h" #include "pixelstore.h" @@ -35,13 +36,15 @@ void PixelStore::update_parameter(int mask) const if(mask&SIZE) { glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length); - glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, image_height); + if(EXT_texture3D) + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, image_height); } if(mask&ORIGIN) { glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels); glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows); - glPixelStorei(GL_UNPACK_SKIP_IMAGES, skip_images); + if(EXT_texture3D) + glPixelStorei(GL_UNPACK_SKIP_IMAGES, skip_images); } if(mask&ALIGNMENT) glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); @@ -56,6 +59,8 @@ void PixelStore::set_canvas_size(unsigned w, unsigned h) void PixelStore::set_origin(unsigned x, unsigned y, unsigned z) { + if(z>0) + static Require _req3d(EXT_texture3D); skip_pixels = x; skip_rows = y; skip_images = z; diff --git a/source/texture.cpp b/source/texture.cpp index cf08ac63..187c2533 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include #include @@ -99,7 +101,7 @@ void Texture::update_parameter(int mask) const if(mask&WRAP_R) glTexParameteri(target, GL_TEXTURE_WRAP_R, wrap_r); if(mask&GENERATE_MIPMAP) - glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, gen_mipmap); + glTexParameteri(target, GL_GENERATE_MIPMAP, gen_mipmap); if(mask&COMPARE) glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, (compare ? GL_COMPARE_R_TO_TEXTURE : GL_NONE)); if(mask&COMPARE_FUNC) @@ -138,7 +140,8 @@ void Texture::set_wrap(TextureWrap w) { set_wrap_s(w); set_wrap_t(w); - set_wrap_r(w); + if(EXT_texture3D) + set_wrap_r(w); } void Texture::set_wrap_s(TextureWrap w) @@ -155,6 +158,7 @@ void Texture::set_wrap_t(TextureWrap w) void Texture::set_wrap_r(TextureWrap w) { + static Require _req(EXT_texture3D); wrap_r = w; update_parameter(WRAP_R); } @@ -169,12 +173,14 @@ void Texture::set_generate_mipmap(bool gm) void Texture::set_compare_enabled(bool c) { + static Require _req(ARB_shadow); compare = c; update_parameter(COMPARE); } void Texture::set_compare_func(Predicate f) { + static Require _req(ARB_shadow); cmp_func = f; update_parameter(COMPARE_FUNC); } -- 2.43.0