[Mesa-dev] [PATCH 1/4] cso: check for no sampler view changes in cso_set_sampler_views()
Marek Olšák
maraeo at gmail.com
Thu Apr 3 16:07:40 PDT 2014
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Thu, Apr 3, 2014 at 5:56 PM, Brian Paul <brianp at vmware.com> wrote:
> As we do for sampler states in single_sampler_done() and many other
> CSO functions.
> ---
> src/gallium/auxiliary/cso_cache/cso_context.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
> index dda3c20..dd0e3df 100644
> --- a/src/gallium/auxiliary/cso_cache/cso_context.c
> +++ b/src/gallium/auxiliary/cso_cache/cso_context.c
> @@ -1177,20 +1177,25 @@ cso_set_sampler_views(struct cso_context *ctx,
> {
> struct sampler_info *info = &ctx->samplers[shader_stage];
> unsigned i;
> + boolean any_change = FALSE;
>
> /* reference new views */
> for (i = 0; i < count; i++) {
> + any_change |= info->views[i] != views[i];
> pipe_sampler_view_reference(&info->views[i], views[i]);
> }
> /* unref extra old views, if any */
> for (; i < info->nr_views; i++) {
> + any_change |= info->views[i] != NULL;
> pipe_sampler_view_reference(&info->views[i], NULL);
> }
>
> /* bind the new sampler views */
> - ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0,
> - MAX2(info->nr_views, count),
> - info->views);
> + if (any_change) {
> + ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0,
> + MAX2(info->nr_views, count),
> + info->views);
> + }
>
> info->nr_views = count;
> }
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list