Mesa (master): mesa: Fix GL error generation in _mesa_GetFramebufferAttachmentParameteriv()

Ian Romanick idr at kemper.freedesktop.org
Tue Jan 15 23:21:18 UTC 2013


Module: Mesa
Branch: master
Commit: 2f2801f876a4c637273bd3ddefb8a5b7a840e604
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f2801f876a4c637273bd3ddefb8a5b7a840e604

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Tue Dec 11 20:08:13 2012 -0800

mesa: Fix GL error generation in _mesa_GetFramebufferAttachmentParameteriv()

This allows query on default framebuffer in
glGetFramebufferAttachmentParameteriv() for gles3. Fixes unexpected GL
errors in gles3 conformance test case:
framebuffer_blit_functionality_multisampled_to_singlesampled_blit

V2: Use _mesa_is_gles3() check to restrict allowed attachment types to
specific APIs.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/fbobject.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 4e960ad..9919472 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -245,6 +245,25 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
 {
    assert(_mesa_is_winsys_fbo(fb));
 
+   if (_mesa_is_gles3(ctx)) {
+      assert(attachment == GL_BACK ||
+             attachment == GL_DEPTH ||
+             attachment == GL_STENCIL);
+      switch (attachment) {
+      case GL_BACK:
+         /* Since there is no stereo rendering in ES 3.0, only return the
+          * LEFT bits.
+          */
+         if (ctx->DrawBuffer->Visual.doubleBufferMode)
+            return &fb->Attachment[BUFFER_BACK_LEFT];
+         return &fb->Attachment[BUFFER_FRONT_LEFT];
+      case GL_DEPTH:
+      return &fb->Attachment[BUFFER_DEPTH];
+      case GL_STENCIL:
+         return &fb->Attachment[BUFFER_STENCIL];
+      }
+   }
+
    switch (attachment) {
    case GL_FRONT_LEFT:
       return &fb->Attachment[BUFFER_FRONT_LEFT];
@@ -2363,11 +2382,19 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
        * OES_framebuffer_object spec refers to the EXT_framebuffer_object
        * spec.
        */
-      if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object) {
+      if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object)
+          && !_mesa_is_gles3(ctx)) {
 	 _mesa_error(ctx, GL_INVALID_OPERATION,
 		     "glGetFramebufferAttachmentParameteriv(bound FBO = 0)");
 	 return;
       }
+
+      if (_mesa_is_gles3(ctx) && attachment != GL_BACK &&
+          attachment != GL_DEPTH && attachment != GL_STENCIL) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetFramebufferAttachmentParameteriv(attachment)");
+         return;
+      }
       /* the default / window-system FBO */
       att = _mesa_get_fb0_attachment(ctx, buffer, attachment);
    }




More information about the mesa-commit mailing list