cso: drop inefficient checking for redundant sampler state changes
authorMarek Olšák <marek.olsak@amd.com>
Sun, 5 Jul 2015 14:10:54 +0000 (16:10 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Jul 2015 21:56:00 +0000 (23:56 +0200)
Drivers can do this better, because they can skip redundant state changes
at per-slot granularity.

src/gallium/auxiliary/cso_cache/cso_context.c

index 1705175d66055e89405e151668eb57f5ae758238..969a9a41650e72650a7422237a198b8e3832a546 100644 (file)
  */
 struct sampler_info
 {
-   struct {
-      void *samplers[PIPE_MAX_SAMPLERS];
-      unsigned nr_samplers;
-   } hw;
-
    void *samplers[PIPE_MAX_SAMPLERS];
    unsigned nr_samplers;
 
@@ -1187,27 +1182,8 @@ single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
    }
 
    info->nr_samplers = i;
-
-   if (info->hw.nr_samplers != info->nr_samplers ||
-       memcmp(info->hw.samplers,
-              info->samplers,
-              info->nr_samplers * sizeof(void *)) != 0)
-   {
-      memcpy(info->hw.samplers,
-             info->samplers,
-             info->nr_samplers * sizeof(void *));
-
-      /* 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,
-                                     MAX2(info->nr_samplers,
-                                          info->hw.nr_samplers),
-                                     info->samplers);
-
-      info->hw.nr_samplers = info->nr_samplers;
-   }
+   ctx->pipe->bind_sampler_states(ctx->pipe, shader_stage, 0, i,
+                                  info->samplers);
 }
 
 void