cso: check for no sampler view changes in cso_set_sampler_views()
authorBrian Paul <brianp@vmware.com>
Wed, 2 Apr 2014 23:12:02 +0000 (17:12 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 4 Apr 2014 01:39:23 +0000 (19:39 -0600)
As we do for sampler states in single_sampler_done() and many other
CSO functions.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/cso_cache/cso_context.c

index dda3c205e22413e92b230591e63bdfb492efdcdf..dd0e3df8537df5eb27df831f11e4c16d0eb2de6d 100644 (file)
@@ -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;
 }