[Mesa-dev] [PATCH 09/15] mesa: execute _mesa_init_remap_table() only once

Ian Romanick idr at freedesktop.org
Tue Jun 7 18:16:11 UTC 2016


On 06/07/2016 09:33 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> An earlier commit 16ee7a55ae2 ("mesa: Allow contexts of different APIs
> to coexist.") reworked the remapping so that the table and approach used
> is identical for all APIs.
> 
> Yet again with function itself not API specific, thus one should not
> need to invoke it multiple times.
> 
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> Alternatively (if we do), it would be great to add a comment.
> ---
>  src/mesa/main/context.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 172c854..f85ca1b 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -406,11 +406,10 @@ one_time_init( struct gl_context *ctx )
>     }
>  
>     /* per-API one-time init */
> -   if (!(api_init_mask & (1 << ctx->API))) {
> +   if (!(api_init_mask & (1 << ctx->API)))
>        _mesa_init_get_hash(ctx);
>  
> -      _mesa_init_remap_table();
> -   }
> +   _mesa_init_remap_table();

I think you want to move this up into the previous 'if (!api_init_mask)'
block.  With this change, we'll call _mesa_init_remap_table even more
often.  Right?

>  
>     api_init_mask |= 1 << ctx->API;
>  



More information about the mesa-dev mailing list