Mesa (7.11): i965: Remove unused region calculations in brw_update_draw_buffer().

Eric Anholt anholt at kemper.freedesktop.org
Wed Jul 20 19:53:26 UTC 2011


Module: Mesa
Branch: 7.11
Commit: 108e807b7ba7647d5667e9534eadecf21a08fdb6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=108e807b7ba7647d5667e9534eadecf21a08fdb6

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jul 12 09:49:23 2011 -0700

i965: Remove unused region calculations in brw_update_draw_buffer().

Reviewed-by: Chad Versace <chad at chad-versace.us>
(cherry picked from commit c68270a26b110e97ee93d49249025d56c771cc5f)

---

 src/mesa/drivers/dri/i965/brw_vtbl.c |   62 +--------------------------------
 1 files changed, 2 insertions(+), 60 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index da337f0..25b3010 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -94,7 +94,6 @@ brw_update_draw_buffer(struct intel_context *intel)
 {
    struct gl_context *ctx = &intel->ctx;
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL;
    struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
    bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
 
@@ -143,58 +142,9 @@ brw_update_draw_buffer(struct intel_context *intel)
       return;
    }
 
-   /* How many color buffers are we drawing into?
-    *
-    * If there are zero buffers or the buffer is too big, don't configure any
-    * regions for hardware drawing.  We'll fallback to software below.  Not
-    * having regions set makes some of the software fallback paths faster.
+   /* Check some stencil invariants.  These should probably be in
+    * emit_depthbuffer().
     */
-   if ((fb->Width > ctx->Const.MaxRenderbufferSize)
-       || (fb->Height > ctx->Const.MaxRenderbufferSize)
-       || (fb->_NumColorDrawBuffers == 0)) {
-      /* writing to 0  */
-      colorRegions[0] = NULL;
-   }
-   else if (fb->_NumColorDrawBuffers > 1) {
-       int i;
-       struct intel_renderbuffer *irb;
-
-       for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
-           irb = intel_renderbuffer(fb->_ColorDrawBuffers[i]);
-           colorRegions[i] = irb ? irb->region : NULL;
-       }
-   }
-   else {
-      /* Get the intel_renderbuffer for the single colorbuffer we're drawing
-       * into.
-       */
-      if (fb->Name == 0) {
-	 /* drawing to window system buffer */
-	 if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
-	    colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
-	 else
-	    colorRegions[0] = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
-      }
-      else {
-	 /* drawing to user-created FBO */
-	 struct intel_renderbuffer *irb;
-	 irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]);
-	 colorRegions[0] = (irb && irb->region) ? irb->region : NULL;
-      }
-   }
-
-   /* Check for depth fallback. */
-   if (irbDepth && irbDepth->region) {
-      assert(!fb_has_hiz || irbDepth->Base.Format != MESA_FORMAT_S8_Z24);
-      depthRegion = irbDepth->region;
-   } else if (irbDepth && !irbDepth->region) {
-      depthRegion = NULL;
-   } else { /* !irbDepth */
-      /* No fallback is needed because there is no depth buffer. */
-      depthRegion = NULL;
-   }
-
-   /* Check for stencil fallback. */
    if (irbStencil && irbStencil->region) {
       if (!intel->has_separate_stencil)
 	 assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
@@ -204,14 +154,6 @@ brw_update_draw_buffer(struct intel_context *intel)
 	 assert(intel->has_separate_stencil);
    }
 
-   /* If we have a (packed) stencil buffer attached but no depth buffer,
-    * we still need to set up the shared depth/stencil state so we can use it.
-    */
-   if (depthRegion == NULL && irbStencil && irbStencil->region
-       && irbStencil->Base.Format == MESA_FORMAT_S8_Z24) {
-      depthRegion = irbStencil->region;
-   }
-
    /*
     * Update depth and stencil test state
     */




More information about the mesa-commit mailing list