summaryrefslogtreecommitdiff
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2013-07-18 17:38:16 -0700
committerIan Romanick <ian.d.romanick@intel.com>2013-08-06 10:46:05 -0700
commit97965e87fc0771a99c16b639caed01e5d0b64353 (patch)
tree37dd8ee8845de1fa0e4e180c0d215a962bd470a7 /src/mesa/main/fbobject.c
parent46b6f79fea1042604ebb61a8214188fb807316ff (diff)
mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly
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
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index c6e6dd5c553..c0f617d6971 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -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);
}