diff options
author | Ian Romanick <[email protected]> | 2013-07-18 17:39:22 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-08-06 10:46:05 -0700 |
commit | 4a9522a5a0c11b6e162188337fd5938f9e2695fd (patch) | |
tree | b0fdfa4bc7fe25c42138ffaececec5ff7d2ad163 /src | |
parent | 97965e87fc0771a99c16b639caed01e5d0b64353 (diff) |
mesa: Treat glBindFramebuffer and glBindFramebufferEXT more correctly
Allow user-generated names for glBindFramebufferEXT on desktop GL.
Disallow its use altogether for core profiles.
Names bound with glBindFramebuffer in desktop OpenGL are still
(incorrectly) shared across the share group instead of being
per-context. This gets us a bit closer to being strictly conformant.
v2: Disallow glBindFramebufferEXT in 3.1 by not installing it in the
dispatch table. Suggested by Jordan.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]> [v1]
Reviewed-by: Jordan Justen <[email protected]> [v1]
Cc: [email protected]
Diffstat (limited to 'src')
-rw-r--r-- | src/mapi/glapi/gen/EXT_framebuffer_object.xml | 2 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 27 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 3 |
3 files changed, 20 insertions, 12 deletions
diff --git a/src/mapi/glapi/gen/EXT_framebuffer_object.xml b/src/mapi/glapi/gen/EXT_framebuffer_object.xml index 5fea61610b5..2cf75bc6783 100644 --- a/src/mapi/glapi/gen/EXT_framebuffer_object.xml +++ b/src/mapi/glapi/gen/EXT_framebuffer_object.xml @@ -112,7 +112,7 @@ <return type="GLboolean"/> </function> - <function name="BindFramebufferEXT" offset="assign"> + <function name="BindFramebufferEXT" offset="assign" deprecated="3.1"> <param name="target" type="GLenum"/> <param name="framebuffer" type="GLuint"/> <glx rop="4319"/> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c0f617d6971..8fdeff5827d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1918,8 +1918,8 @@ check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) } -void GLAPIENTRY -_mesa_BindFramebuffer(GLenum target, GLuint framebuffer) +static void +bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names) { struct gl_framebuffer *newDrawFb, *newReadFb; struct gl_framebuffer *oldDrawFb, *oldReadFb; @@ -1965,9 +1965,7 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer) /* ID was reserved, but no real framebuffer object made yet */ newDrawFb = NULL; } - else if (!newDrawFb - && _mesa_is_desktop_gl(ctx) - && ctx->Extensions.ARB_framebuffer_object) { + else if (!newDrawFb && !allow_user_names) { /* All FBO IDs must be Gen'd */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(buffer)"); return; @@ -2045,12 +2043,25 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer) } void GLAPIENTRY -_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) +_mesa_BindFramebuffer(GLenum target, GLuint framebuffer) { - _mesa_BindFramebuffer(target, framebuffer); -} + GET_CURRENT_CONTEXT(ctx); + /* OpenGL ES glBindFramebuffer and glBindFramebufferOES use this same entry + * point, but they allow the use of user-generated names. + */ + bind_framebuffer(target, framebuffer, _mesa_is_gles(ctx)); +} +void GLAPIENTRY +_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) +{ + /* 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_framebuffer(target, framebuffer, true); +} void GLAPIENTRY _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 45642562842..8d3774775fc 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -527,9 +527,6 @@ const struct function gl_core_functions_possible[] = { { "glEGLImageTargetRenderbufferStorageOES", 31, -1 }, { "glEGLImageTargetTexture2DOES", 31, -1 }, - /* GL_EXT_framebuffer_object */ - { "glBindFramebufferEXT", 31, -1 }, - /* GL 3.2 */ { "glGetInteger64i_v", 32, -1 }, { "glGetBufferParameteri64v", 32, -1 }, |