mesa: Only allow queries of window system FBO on desktop GL w/ARB_fbo
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 3 Oct 2011 19:04:09 +0000 (12:04 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 11 Oct 2011 16:01:09 +0000 (09:01 -0700)
Neither OES_framebuffer_object nor EXT_framebuffer_object allow
querying the window system FBO.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/mesa/main/fbobject.c

index e945f0b64e193d9cd5b828f74bbf40ab097cd69a..f9da54e73c065f818ca3c84ffa6374c8cc986c14 100644 (file)
@@ -2276,6 +2276,21 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
    }
 
    if (is_winsys_fbo(buffer)) {
+      /* Page 126 (page 136 of the PDF) of the OpenGL ES 2.0.25 spec
+       * says:
+       *
+       *     "If the framebuffer currently bound to target is zero, then
+       *     INVALID_OPERATION is generated."
+       *
+       * The EXT_framebuffer_object spec has the same wording, and the
+       * OES_framebuffer_object spec refers to the EXT_framebuffer_object
+       * spec.
+       */
+      if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object) {
+        _mesa_error(ctx, GL_INVALID_OPERATION,
+                    "glGetFramebufferAttachmentParameteriv(bound FBO = 0)");
+        return;
+      }
       /* the default / window-system FBO */
       att = _mesa_get_fb0_attachment(ctx, buffer, attachment);
    }