mesa: additional FBO/RB id error checking for ARB_fbo
authorBrian Paul <brianp@vmware.com>
Thu, 22 Jan 2009 22:06:17 +0000 (15:06 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 22 Jan 2009 22:06:17 +0000 (15:06 -0700)
It's illegal to bind a FBO/RB id that didn't come from glGenRender/Framebuffer().

src/mesa/main/fbobject.c

index faf3763b716dde4324c479bccc98b28ab6469a1b..f9049370784b763a5f30308123f1a65be9d540c3 100644 (file)
@@ -616,6 +616,11 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
          newRb = NULL;
       }
       if (!newRb) {
+         if (ctx->Extensions.ARB_framebuffer_object) {
+            /* All RB IDs must be Gen'd */
+           _mesa_error(ctx, GL_INVALID_OPERATION, "glBindRenderbuffer(buffer)");
+           return;
+         }
         /* create new renderbuffer object */
         newRb = ctx->Driver.NewRenderbuffer(ctx, renderbuffer);
         if (!newRb) {
@@ -1018,6 +1023,11 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
          newFb = NULL;
       }
       if (!newFb) {
+         if (ctx->Extensions.ARB_framebuffer_object) {
+            /* All FBO IDs must be Gen'd */
+           _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(buffer)");
+           return;
+         }
         /* create new framebuffer object */
         newFb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
         if (!newFb) {