[Mesa-dev] [PATCH 1/4] i965: Remove unnecessary release/reference of brw_context.state.depth_region

chad at chad-versace.us chad at chad-versace.us
Tue Apr 12 15:33:55 PDT 2011


From: Chad Versace <chad at chad-versace.us>

Release the old depth region and reference the new one *only* if it has
changed.

Signed-off-by: Chad Versace <chad at chad-versace.us>
---
 src/mesa/drivers/dri/i965/brw_vtbl.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 152ee14..ce8712a 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -115,13 +115,11 @@ static void brw_set_draw_region( struct intel_context *intel,
 {
    struct brw_context *brw = brw_context(&intel->ctx);
 
-   /* release old color/depth regions */
-   if (brw->state.depth_region != depth_region)
+   if (brw->state.depth_region != depth_region) {
       brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER;
-   intel_region_release(&brw->state.depth_region);
-
-   /* reference new color/depth regions */
-   intel_region_reference(&brw->state.depth_region, depth_region);
+      intel_region_release(&brw->state.depth_region);
+      intel_region_reference(&brw->state.depth_region, depth_region);
+   }
 }
 
 
-- 
1.7.4.2



More information about the mesa-dev mailing list