]> git.tdb.fi Git - libs/gl.git/commitdiff
Run a tighter ship with extensions
authorMikko Rasa <tdb@tdb.fi>
Wed, 15 Oct 2014 16:49:47 +0000 (19:49 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 15 Oct 2014 18:01:00 +0000 (21:01 +0300)
extensions/arb_shadow.glext [new file with mode: 0644]
gl.fixes.xml
source/buffer.cpp
source/buffer.h
source/framebuffer.h
source/pixelformat.h
source/pixelstore.cpp
source/texture.cpp

diff --git a/extensions/arb_shadow.glext b/extensions/arb_shadow.glext
new file mode 100644 (file)
index 0000000..24e32e2
--- /dev/null
@@ -0,0 +1 @@
+extension ARB_shadow
index 39ec23e7c621d1840d777415fb5a69842dda69c7..f0f12fa1b0239c8385b44104ec79bf0a63ac5e8e 100644 (file)
         </command>
     </commands>
 
+    <enums>
+        <!-- These error codes weren't promoted to core with the rest of
+        EXT_framebuffer_object.  There's no harm in taking them in since
+        they're not passed to GL at any point. -->
+        <enum value="0x8CD9" name="GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"/>
+        <enum value="0x8CDA" name="GL_FRAMEBUFFER_INCOMPLETE_FORMATS"/>
+    </enums>
+
+    <feature api="gl" name="MSPGL">
+        <require>
+            <enum name="GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS" />
+            <enum name="GL_FRAMEBUFFER_INCOMPLETE_FORMATS" />
+        </require>
+    </feature>
+
     <feature api="gl" name="MSPGL_REMOVE">
         <remove>
             <!-- These have no counterparts in the core version of
             ARB_shader_objects. -->
             <command name="glGetHandleARB" />
             <command name="glGetObjectParameterfvARB" />
+            <enum name="GL_PROGRAM_OBJECT_ARB" />
+            <enum name="GL_SHADER_OBJECT_ARB" />
+            <enum name="GL_OBJECT_TYPE_ARB" />
 
             <!-- Ignore this, as it comes from ARB_vertex_program and I'm not
             sure if it works with ARB_shader_objects. -->
@@ -49,7 +67,9 @@
     </feature>
 
     <extensions>
-        <extension name="GL_ARB_uniform_buffer_object" supported="gl">
+        <!-- Some functions mentioned in GL_ARB_uniform_buffer_object
+        specification are missing from gl.xml. -->
+        <extension name="GL_ARB_uniform_buffer_object" supported="gl|glcore">
             <require>
                 <command name="glBindBufferRange" />
                 <command name="glBindBufferBase" />
index 066ab96c5919b2c154879224323f704662ce2e14..1226dbe3223f41e438ddcc7ca1c2f9b107b0fd17 100644 (file)
@@ -1,7 +1,4 @@
 #include <stdexcept>
-#include <msp/gl/extensions/arb_pixel_buffer_object.h>
-#include <msp/gl/extensions/arb_uniform_buffer_object.h>
-#include <msp/gl/extensions/arb_vertex_buffer_object.h>
 #include "buffer.h"
 #include "error.h"
 #include "mesh.h"
index e254bcc70ca76a2f6cf7701cdff71faaeb8627d0..c473d7edc918202e9c7f3cfff2d23f77badebcaa 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <vector>
 #include "gl.h"
+#include <msp/gl/extensions/arb_pixel_buffer_object.h>
 #include <msp/gl/extensions/arb_vertex_buffer_object.h>
 #include <msp/gl/extensions/arb_uniform_buffer_object.h>
 
index 2e29dbc3f440c7f1b9f1646e7dd611d39e977dc4..07cae8671d22ef153b927e5fb2e64bdbb5c11d30 100644 (file)
@@ -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,
index a0e578a6a65443dab00fd69007f669ac1d546730..6d68bbc170d0b9f2228087567ef0984bb951aa3d 100644 (file)
@@ -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 &);
index 011866e3e72410a44031a0b154367c621bebb44f..629162cd890b1a9dfd760bc47ddc60a41ef784a9 100644 (file)
@@ -1,4 +1,5 @@
 #include <algorithm>
+#include <msp/gl/extensions/ext_texture3d.h>
 #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;
index cf08ac6371ceeacad9f362a49b3970d887e3398f..187c2533acbea6fc9e30c33370ffb99ca2a15a18 100644 (file)
@@ -1,3 +1,5 @@
+#include <msp/gl/extensions/arb_shadow.h>
+#include <msp/gl/extensions/ext_texture3d.h>
 #include <msp/gl/extensions/ext_texture_filter_anisotropic.h>
 #include <msp/gl/extensions/sgis_generate_mipmap.h>
 #include <msp/strings/format.h>
@@ -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);
 }