[Mesa-dev] [PATCH] st/mesa: In update_samplers(), clear all samplers at once.

Keith Whitwell keithw at vmware.com
Mon Mar 21 11:43:10 PDT 2011


On Mon, 2011-03-21 at 19:28 +0100, Tilman Sauerbeck wrote:
> Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>
> ---
> 
> update_samplers() showed up in a profile of Heroes of Newerth;
> this patch pushes it down the profile by ~3%.
> 
> Does this seem plausible?
> 
>  src/mesa/state_tracker/st_atom_sampler.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
> index 474cbd5..4374ac1 100644
> --- a/src/mesa/state_tracker/st_atom_sampler.c
> +++ b/src/mesa/state_tracker/st_atom_sampler.c
> @@ -129,12 +129,13 @@ update_samplers(struct st_context *st)
>  
>     st->state.num_samplers = 0;
>  
> +   memset(st->state.samplers, 0, st->ctx->Const.MaxTextureImageUnits *
> +          sizeof(struct pipe_sampler_state));
> +

At a glance, could the memset be moved up another couple of lines and
changed to:

 memset(st->state.samplers, 0, st->state.num_samplers * sizeof(struct pipe_sampler_state));


Keith




More information about the mesa-dev mailing list