[Mesa-dev] [PATCH 09/10] i830: Stop tracking an array of color regions if we only use element 0.

Eric Anholt eric at anholt.net
Mon Jan 28 21:00:37 PST 2013


---
 src/mesa/drivers/dri/i915/i830_vtbl.c |   23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 1d02c2c..67b4c96 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -720,7 +720,7 @@ i830_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_region *colorRegion, *depthRegion = NULL;
    struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
 
    if (!fb) {
@@ -759,16 +759,7 @@ i830_update_draw_buffer(struct intel_context *intel)
        || (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->mt) ? irb->mt->region : NULL;
-       }
+      colorRegion = NULL;
    }
    else {
       /* Get the intel_renderbuffer for the single colorbuffer we're drawing
@@ -777,19 +768,19 @@ i830_update_draw_buffer(struct intel_context *intel)
       if (_mesa_is_winsys_fbo(fb)) {
 	 /* drawing to window system buffer */
 	 if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
-	    colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
+	    colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
 	 else
-	    colorRegions[0] = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
+	    colorRegion = 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->mt->region) ? irb->mt->region : NULL;
+	 colorRegion = (irb && irb->mt->region) ? irb->mt->region : NULL;
       }
    }
 
-   if (!colorRegions[0]) {
+   if (!colorRegion) {
       FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, true);
    }
    else {
@@ -835,7 +826,7 @@ i830_update_draw_buffer(struct intel_context *intel)
    ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
 		      (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
 
-   i830_set_draw_region(intel, colorRegions[0], depthRegion);
+   i830_set_draw_region(intel, colorRegion, depthRegion);
    intel->NewGLState |= _NEW_BUFFERS;
 
    /* update viewport since it depends on window size */
-- 
1.7.10.4



More information about the mesa-dev mailing list