[Mesa-dev] [PATCH 06/24] st/mesa: don't unbind sampler states if none are used

Ilia Mirkin imirkin at alum.mit.edu
Mon Jun 12 18:23:58 UTC 2017


On Mon, Jun 12, 2017 at 2:18 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  src/mesa/state_tracker/st_atom_sampler.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
> index f33e334..11db6e1 100644
> --- a/src/mesa/state_tracker/st_atom_sampler.c
> +++ b/src/mesa/state_tracker/st_atom_sampler.c
> @@ -263,21 +263,21 @@ update_shader_samplers(struct st_context *st,
>                         struct pipe_sampler_state *samplers,
>                         unsigned *num_samplers)
>  {
>     GLbitfield samplers_used = prog->SamplersUsed;
>     GLbitfield free_slots = ~prog->SamplersUsed;
>     GLbitfield external_samplers_used = prog->ExternalSamplersUsed;
>     GLuint unit;
>     const GLuint old_max = *num_samplers;
>     const struct pipe_sampler_state *states[PIPE_MAX_SAMPLERS];
>
> -   if (*num_samplers == 0 && samplers_used == 0x0)
> +   if (samplers_used == 0x0)
>        return;
>
>     *num_samplers = 0;

Does this still need to get executed even if samplers_used == 0?

>
>     /* loop over sampler units (aka tex image units) */
>     for (unit = 0; unit < max_units; unit++, samplers_used >>= 1) {
>        struct pipe_sampler_state *sampler = samplers + unit;
>
>        if (samplers_used & 1) {
>           const GLuint texUnit = prog->SamplerUnits[unit];
> --
> 2.7.4
>
> _______________________________________________
> 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