Mesa (master): intel: Simplify and touch up the FBO completeness test.

Eric Anholt anholt at kemper.freedesktop.org
Thu Dec 15 06:27:37 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Dec  7 17:51:14 2011 -0800

intel: Simplify and touch up the FBO completeness test.

Now that we have miptrees for everything, we can more easily test for
!has_separate_stencil completeness.  Also, test for whether the
stencil rb is the wrong kind of format for separate stencil, or if we
are trying to do packed to different images of a single miptree.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/intel/intel_fbo.c |   39 +++++++++++++++++--------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index b694129..671de81 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -852,26 +852,29 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
       intel_get_renderbuffer(fb, BUFFER_DEPTH);
    const struct intel_renderbuffer *stencilRb =
       intel_get_renderbuffer(fb, BUFFER_STENCIL);
+   struct intel_mipmap_tree *depth_mt = NULL, *stencil_mt = NULL;
    int i;
 
-   /*
-    * The depth and stencil renderbuffers are the same renderbuffer or wrap
-    * the same texture.
-    */
-   if (depthRb && stencilRb) {
-      bool depth_stencil_are_same;
-      if (depthRb == stencilRb)
-	 depth_stencil_are_same = true;
-      else if ((fb->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE) &&
-	       (fb->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE) &&
-	       (fb->Attachment[BUFFER_DEPTH].Texture->Name ==
-		fb->Attachment[BUFFER_STENCIL].Texture->Name))
-	 depth_stencil_are_same = true;
-      else
-	 depth_stencil_are_same = false;
-
-      if (!intel->has_separate_stencil && !depth_stencil_are_same) {
-	 fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+   if (depthRb)
+      depth_mt = depthRb->mt;
+   if (stencilRb)
+      stencil_mt = stencilRb->mt;
+
+   if (depth_mt && stencil_mt) {
+      if (depth_mt == stencil_mt) {
+	 /* For true packed depth/stencil (not faked on prefers-separate-stencil
+	  * hardware) we need to be sure they're the same level/layer, since
+	  * we'll be emitting a single packet describing the packed setup.
+	  */
+	 if (depthRb->mt_level != stencilRb->mt_level ||
+	     depthRb->mt_layer != stencilRb->mt_layer) {
+	    fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+	 }
+      } else {
+	 if (!intel->has_separate_stencil)
+	    fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+	 if (stencil_mt->format != MESA_FORMAT_S8)
+	    fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
       }
    }
 




More information about the mesa-commit mailing list