mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 19 Jul 2013 00:38:16 +0000 (17:38 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 6 Aug 2013 17:46:05 +0000 (10:46 -0700)
Allow user-generated names for glBindRenderbufferEXT on desktop GL.
Disallow its use altogether for core profiles.

v2: Disallow glBindRenderbufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
src/mapi/glapi/gen/EXT_framebuffer_object.xml
src/mesa/main/fbobject.c
src/mesa/main/tests/dispatch_sanity.cpp

index 16c82a4a2c0fc1eb16100775ee49f55edf0d9687..5fea61610b52d8e24bfc1a8e3c18d49a37a196bc 100644 (file)
@@ -78,7 +78,7 @@
        <return type="GLboolean"/>
     </function>
 
-    <function name="BindRenderbufferEXT" offset="assign">
+    <function name="BindRenderbufferEXT" offset="assign" deprecated="3.1">
         <param name="target" type="GLenum"/>
         <param name="renderbuffer" type="GLuint"/>
         <glx rop="4316"/>
index c6e6dd5c5538ba8a877a27195b46d03a758e7b05..c0f617d6971a3d6e46673159a06f054beb046e26 100644 (file)
@@ -1104,8 +1104,8 @@ _mesa_IsRenderbuffer(GLuint renderbuffer)
 }
 
 
-void GLAPIENTRY
-_mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
+static void
+bind_renderbuffer(GLenum target, GLuint renderbuffer, bool allow_user_names)
 {
    struct gl_renderbuffer *newRb;
    GET_CURRENT_CONTEXT(ctx);
@@ -1125,9 +1125,7 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
          /* ID was reserved, but no real renderbuffer object made yet */
          newRb = NULL;
       }
-      else if (!newRb
-               && _mesa_is_desktop_gl(ctx)
-               && ctx->Extensions.ARB_framebuffer_object) {
+      else if (!newRb && !allow_user_names) {
          /* All RB IDs must be Gen'd */
          _mesa_error(ctx, GL_INVALID_OPERATION, "glBindRenderbuffer(buffer)");
          return;
@@ -1154,11 +1152,25 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
    _mesa_reference_renderbuffer(&ctx->CurrentRenderbuffer, newRb);
 }
 
+void GLAPIENTRY
+_mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   /* OpenGL ES glBindRenderbuffer and glBindRenderbufferOES use this same
+    * entry point, but they allow the use of user-generated names.
+    */
+   bind_renderbuffer(target, renderbuffer, _mesa_is_gles(ctx));
+}
 
 void GLAPIENTRY
 _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
 {
-    _mesa_BindRenderbuffer(target, renderbuffer);
+   /* This function should not be in the dispatch table for core profile /
+    * OpenGL 3.1, so execution should never get here in those cases -- no
+    * need for an explicit test.
+    */
+   bind_renderbuffer(target, renderbuffer, true);
 }
 
 
index 34e0742655960bd52e779e7b73b653e7a96de7b9..45642562842b768d1d7f3f4eed921b3144375df6 100644 (file)
@@ -529,7 +529,6 @@ const struct function gl_core_functions_possible[] = {
 
    /* GL_EXT_framebuffer_object */
    { "glBindFramebufferEXT", 31, -1 },
-   { "glBindRenderbufferEXT", 31, -1 },
 
    /* GL 3.2 */
    { "glGetInteger64i_v", 32, -1 },