[Mesa-dev] [PATCH 05/14] i965/blorp: Use a designated initializer for blorp_surf

Nanley Chery nanleychery at gmail.com
Wed Nov 22 21:03:58 UTC 2017


On Mon, Nov 13, 2017 at 08:12:45AM -0800, Jason Ekstrand wrote:
> This way uninitialized fields get automatically zeroed and it's safe to
> add more fields to blorp_surf.
> ---
>  src/mesa/drivers/dri/i965/brw_blorp.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 

This patch is
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
> index 58e1f8a..eae8aaa 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.c
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
> @@ -154,15 +154,16 @@ blorp_surf_for_miptree(struct brw_context *brw,
>           intel_miptree_check_level_layer(mt, *level, start_layer + i);
>     }
>  
> -   surf->surf = &mt->surf;
> -   surf->addr = (struct blorp_address) {
> -      .buffer = mt->bo,
> -      .offset = mt->offset,
> -      .reloc_flags = is_render_target ? EXEC_OBJECT_WRITE : 0,
> +   *surf = (struct blorp_surf) {
> +      .surf = &mt->surf,
> +      .addr = (struct blorp_address) {
> +         .buffer = mt->bo,
> +         .offset = mt->offset,
> +         .reloc_flags = is_render_target ? EXEC_OBJECT_WRITE : 0,
> +      },
> +      .aux_usage = aux_usage,
>     };
>  
> -   surf->aux_usage = aux_usage;
> -
>     struct isl_surf *aux_surf = NULL;
>     if (mt->mcs_buf)
>        aux_surf = &mt->mcs_buf->surf;
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list