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

Kenneth Graunke kenneth at whitecape.org
Tue Apr 12 15:56:51 PDT 2011


On 04/12/2011 03:33 PM, chad at chad-versace.us wrote:
> 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);
> +   }
>   }

This seems like a very sensible change.  I am especially glad to see the 
comment about color regions go, since...there isn't any code relating to 
color buffers here.

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


More information about the mesa-dev mailing list