cso: make sure all sampler states are set/cleared
authorBrian Paul <brianp@vmware.com>
Thu, 12 Sep 2013 23:30:50 +0000 (17:30 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 3 Oct 2013 20:05:28 +0000 (14:05 -0600)
src/gallium/auxiliary/cso_cache/cso_context.c

index 95df28e92485316922afa4dcbce0774adb85f9e7..6642c454e5696832d2065ac714e71edba7b22447 100644 (file)
@@ -1089,10 +1089,17 @@ single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
       memcpy(info->hw.samplers,
              info->samplers,
              info->nr_samplers * sizeof(void *));
-      info->hw.nr_samplers = info->nr_samplers;
+
+      /* set remaining slots/pointers to null */
+      for (i = info->nr_samplers; i < info->hw.nr_samplers; i++)
+         info->samplers[i] = NULL;
 
       ctx->pipe->bind_sampler_states(ctx->pipe, shader_stage, 0,
-                                     info->nr_samplers, info->samplers);
+                                     MAX2(info->nr_samplers,
+                                          info->hw.nr_samplers),
+                                     info->samplers);
+
+      info->hw.nr_samplers = info->nr_samplers;
    }
 }