cso: don't cycle through PIPE_MAX_SHADER_SAMPLER_VIEWS on context destroy
authorRoland Scheidegger <sroland@vmware.com>
Wed, 28 Feb 2018 02:01:23 +0000 (03:01 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 28 Feb 2018 17:22:28 +0000 (18:22 +0100)
There's no point, we know the highest non-null one.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/cso_cache/cso_context.c

index 1b5d4b559874dfd93a25b76860b0073a2048102b..3fa57f16ff4db64aa7274baad0a09acd35226a72 100644 (file)
@@ -407,8 +407,10 @@ void cso_destroy_context( struct cso_context *ctx )
          ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, NULL);
    }
 
-   for (i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
+   for (i = 0; i < ctx->nr_fragment_views; i++) {
       pipe_sampler_view_reference(&ctx->fragment_views[i], NULL);
+   }
+   for (i = 0; i < ctx->nr_fragment_views_saved; i++) {
       pipe_sampler_view_reference(&ctx->fragment_views_saved[i], NULL);
    }