i965: Remove unnecessary release/reference of brw_context.state.depth_region
authorChad Versace <chad.versace@intel.com>
Thu, 7 Apr 2011 22:44:24 +0000 (15:44 -0700)
committerChad Versace <chad.versace@intel.com>
Wed, 13 Apr 2011 00:52:09 +0000 (17:52 -0700)
Release the old depth region and reference the new one *only* if it has
changed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
src/mesa/drivers/dri/i965/brw_vtbl.c

index 152ee141568d6ad7062c27ec0da7ba4a06fc4595..ce8712a260f0c3a56fb723fcca75b8de0543fe29 100644 (file)
@@ -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);
+   }
 }