mesa: Dispatch ARB_framebuffer_object and EXT_framebuffer_object differently
authorTomasz Lis <tomasz.lis@intel.com>
Tue, 16 Jul 2013 18:57:26 +0000 (20:57 +0200)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 19 Jul 2013 00:42:46 +0000 (17:42 -0700)
Almost all of the functions between the ARB and the EXT share the same
GLX protocol because the functionality is, essentially, identical.
However, there are some differences between the extensions:

- In the ARB extension, names must come from glGenBuffers.

- In the ARB extension, framebuffer objects are not shared (but they are
  in the EXT).

For these reasons, glBindFramebuffer and glBindRenderbuffer have
different GLX protocol opcodes than their EXT counterparts.  Currently
these functions alias each other in the dispatch table.  This makes it
impossible to be truly spec conformant.

This patch enables fixing the conformance issue by splitting
glBindFramebuffer / glBindFramebufferEXT and glBindRenderbuffer /
glBindRenderbufferEXT into separate dispatch table entries.

Patches will be available shortly to:

- Fix the conformance issue.

- Stop advertising the EXT in OpenGL 3.1 (or core profiles).

HOWEVER, this does represent a compatibility break between the loader
(libGL or the Xserver GLX module) and the driver.  Mesa drivers compiled
without this change will request a single dispatch table entry for
glBindFramebuffer and glBindFramebufferEXT.  Since the updated loader
has different entries for each, the request will fail, and the driver
will die in a fire.

Drivers built with the change should continue to load fine on loaders
without the change.  In this case, the driver will separately ask for
entries for glBindFramebuffer and glBindFramebufferEXT, and the loader
will tell it the same location.  Since the loader in the server's GLX
module is not (yet) updated, this should not be a problem.  We also do
not advertise the ARB extension from the server, so, again, this should
not be a problem for the server.

HOWEVER, this means that DRI1 drivers (remember mga_dri.so?) will no
longer load with libGL build hereafter.  That means this patch will need
to be back ported to the 8.0 branch.

v2 (idr): Added missing GLX protocol opcodes for the EXT functions and
corrected the opcodes for the ARB functions.  Updated GLX indirect_api
unit test and dispatch sanity unit test.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Bartosz Zawistowski <bartosz.l.zawistowski@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
src/glx/tests/indirect_api.cpp
src/mapi/glapi/gen/ARB_framebuffer_object.xml
src/mapi/glapi/gen/EXT_framebuffer_object.xml
src/mesa/main/fbobject.c
src/mesa/main/fbobject.h
src/mesa/main/tests/dispatch_sanity.cpp

index 4291c965bd382d3009b6fefdd620288f841e965d..52469a771c2925a2924c240758e3c088c4e0990f 100644 (file)
@@ -683,6 +683,8 @@ void __indirect_glProgramNamedParameter4dvNV(void) { }
 void __indirect_glProgramNamedParameter4fNV(void) { }
 void __indirect_glProgramNamedParameter4fvNV(void) { }
 void __indirect_glBlendEquationSeparate(void) { }
+void __indirect_glBindFramebufferEXT(void) { }
+void __indirect_glBindRenderbufferEXT(void) { }
 void __indirect_glBindFramebuffer(void) { }
 void __indirect_glBindRenderbuffer(void) { }
 void __indirect_glCheckFramebufferStatus(void) { }
@@ -1488,8 +1490,10 @@ TEST_F(IndirectAPI, EXT_blend_equation_separate)
 
 TEST_F(IndirectAPI, EXT_framebuffer_object)
 {
-   EXPECT_EQ((_glapi_proc) __indirect_glBindFramebuffer, table[_glapi_get_proc_offset("glBindFramebufferEXT")]);
-   EXPECT_EQ((_glapi_proc) __indirect_glBindRenderbuffer, table[_glapi_get_proc_offset("glBindRenderbufferEXT")]);
+   EXPECT_EQ((_glapi_proc) __indirect_glBindFramebufferEXT, table[_glapi_get_proc_offset("glBindFramebufferEXT")]);
+   EXPECT_EQ((_glapi_proc) __indirect_glBindRenderbufferEXT, table[_glapi_get_proc_offset("glBindRenderbufferEXT")]);
+   EXPECT_EQ((_glapi_proc) __indirect_glBindFramebuffer, table[_glapi_get_proc_offset("glBindFramebuffer")]);
+   EXPECT_EQ((_glapi_proc) __indirect_glBindRenderbuffer, table[_glapi_get_proc_offset("glBindRenderbuffer")]);
    EXPECT_EQ((_glapi_proc) __indirect_glCheckFramebufferStatus, table[_glapi_get_proc_offset("glCheckFramebufferStatusEXT")]);
    EXPECT_EQ((_glapi_proc) __indirect_glDeleteFramebuffers, table[_glapi_get_proc_offset("glDeleteFramebuffersEXT")]);
    EXPECT_EQ((_glapi_proc) __indirect_glDeleteRenderbuffers, table[_glapi_get_proc_offset("glDeleteRenderbuffersEXT")]);
index 87eda93eb5af13016fb764ca5d577aca40a6dd10..7c547c16742341c17313150a7ada7acdb55119db 100644 (file)
     <function name="BindRenderbuffer" es2="2.0" offset="assign">
         <param name="target" type="GLenum"/>
         <param name="renderbuffer" type="GLuint"/>
-       <glx rop="4316"/>
+        <glx rop="235"/>
     </function>
 
     <function name="DeleteRenderbuffers"
     <function name="BindFramebuffer" es2="2.0" offset="assign">
         <param name="target" type="GLenum"/>
         <param name="framebuffer" type="GLuint"/>
-       <glx rop="4319"/>
+        <glx rop="236"/>
     </function>
 
     <function name="DeleteFramebuffers"
index 85a05f6edad666e3598af0555b3809f725ae3267..16c82a4a2c0fc1eb16100775ee49f55edf0d9687 100644 (file)
        <return type="GLboolean"/>
     </function>
 
-    <function name="BindRenderbufferEXT" alias="BindRenderbuffer">
+    <function name="BindRenderbufferEXT" offset="assign">
         <param name="target" type="GLenum"/>
         <param name="renderbuffer" type="GLuint"/>
+        <glx rop="4316"/>
     </function>
 
     <function name="DeleteRenderbuffersEXT" alias="DeleteRenderbuffers">
        <return type="GLboolean"/>
     </function>
 
-    <function name="BindFramebufferEXT" alias="BindFramebuffer">
+    <function name="BindFramebufferEXT" offset="assign">
         <param name="target" type="GLenum"/>
         <param name="framebuffer" type="GLuint"/>
+        <glx rop="4319"/>
     </function>
 
     <function name="DeleteFramebuffersEXT" alias="DeleteFramebuffers">
index f59fdb12d086629ff2772dd01323ff8c7d6cb0e5..a29f1ab13c0f76930f70fab0d962c829f96f90e4 100644 (file)
@@ -1155,6 +1155,13 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
 }
 
 
+void GLAPIENTRY
+_mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
+{
+    _mesa_BindRenderbuffer(target, renderbuffer);
+}
+
+
 /**
  * If the given renderbuffer is anywhere attached to the framebuffer, detach
  * the renderbuffer.
@@ -2025,6 +2032,13 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer)
    }
 }
 
+void GLAPIENTRY
+_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
+{
+    _mesa_BindFramebuffer(target, framebuffer);
+}
+
+
 
 void GLAPIENTRY
 _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
index 4066ea65b194956a916d1b240bbf269924bf570d..0a2a5cc59a39925e3a99e81969ccade6c234d24c 100644 (file)
@@ -119,6 +119,9 @@ _mesa_IsRenderbuffer(GLuint renderbuffer);
 extern void GLAPIENTRY
 _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer);
 
+extern void GLAPIENTRY
+_mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer);
+
 extern void GLAPIENTRY
 _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
 
@@ -151,6 +154,9 @@ _mesa_IsFramebuffer(GLuint framebuffer);
 extern void GLAPIENTRY
 _mesa_BindFramebuffer(GLenum target, GLuint framebuffer);
 
+extern void GLAPIENTRY
+_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer);
+
 extern void GLAPIENTRY
 _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
 
index 8d3774775fcab092e08621ef22ff5b30918b3b99..34e0742655960bd52e779e7b73b653e7a96de7b9 100644 (file)
@@ -527,6 +527,10 @@ const struct function gl_core_functions_possible[] = {
    { "glEGLImageTargetRenderbufferStorageOES", 31, -1 },
    { "glEGLImageTargetTexture2DOES", 31, -1 },
 
+   /* GL_EXT_framebuffer_object */
+   { "glBindFramebufferEXT", 31, -1 },
+   { "glBindRenderbufferEXT", 31, -1 },
+
    /* GL 3.2 */
    { "glGetInteger64i_v", 32, -1 },
    { "glGetBufferParameteri64v", 32, -1 },