Mesa (master): mesa: Accept GL_DEPTH and GL_STENCIL for window system FBO only

Ian Romanick idr at kemper.freedesktop.org
Tue Oct 11 09:01:47 PDT 2011


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Oct  3 12:02:18 2011 -0700

mesa: Accept GL_DEPTH and GL_STENCIL for window system FBO only

Previously GL_DEPTH_BUFFER and GL_STENCIL_BUFFER were (incorrectly)
allowed for both.  Those enums don't even really exist!  Now GL_DEPTH
and GL_STENCIL are only allowed for the window system FBO.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/mesa/main/fbobject.c |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 7571155..e945f0b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -254,14 +254,8 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
       if (ctx->API != API_OPENGL)
 	 return NULL;
       /* fall-through */
-   case GL_DEPTH_BUFFER:
-      /* fall-through / new in GL 3.0 */
    case GL_DEPTH_ATTACHMENT_EXT:
       return &fb->Attachment[BUFFER_DEPTH];
-   case GL_STENCIL_BUFFER:
-      if (ctx->API != API_OPENGL)
-	 return NULL;
-      /* fall-through / new in GL 3.0 */
    case GL_STENCIL_ATTACHMENT_EXT:
       return &fb->Attachment[BUFFER_STENCIL];
    default:
@@ -294,13 +288,34 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
          return &fb->Attachment[BUFFER_AUX0];
       }
       return NULL;
-   case GL_DEPTH_BUFFER:
-      /* fall-through / new in GL 3.0 */
-   case GL_DEPTH_ATTACHMENT_EXT:
+
+   /* Page 336 (page 352 of the PDF) of the OpenGL 3.0 spec says:
+    *
+    *     "If the default framebuffer is bound to target, then attachment must
+    *     be one of FRONT LEFT, FRONT RIGHT, BACK LEFT, BACK RIGHT, or AUXi,
+    *     identifying a color buffer; DEPTH, identifying the depth buffer; or
+    *     STENCIL, identifying the stencil buffer."
+    *
+    * Revision #34 of the ARB_framebuffer_object spec has essentially the same
+    * language.  However, revision #33 of the ARB_framebuffer_object spec
+    * says:
+    *
+    *     "If the default framebuffer is bound to <target>, then <attachment>
+    *     must be one of FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, AUXi,
+    *     DEPTH_BUFFER, or STENCIL_BUFFER, identifying a color buffer, the
+    *     depth buffer, or the stencil buffer, and <pname> may be
+    *     FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE or
+    *     FRAMEBUFFER_ATTACHMENT_OBJECT_NAME."
+    *
+    * The enum values for DEPTH_BUFFER and STENCIL_BUFFER have been removed
+    * from glext.h, so shipping apps should not use those values.
+    *
+    * Note that neither EXT_framebuffer_object nor OES_framebuffer_object
+    * support queries of the window system FBO.
+    */
+   case GL_DEPTH:
       return &fb->Attachment[BUFFER_DEPTH];
-   case GL_STENCIL_BUFFER:
-      /* fall-through / new in GL 3.0 */
-   case GL_STENCIL_ATTACHMENT_EXT:
+   case GL_STENCIL:
       return &fb->Attachment[BUFFER_STENCIL];
    default:
       return NULL;



More information about the mesa-commit mailing list