draw: don't needlessly iterate through all sampler view slots
authorRoland Scheidegger <sroland@vmware.com>
Sun, 25 Feb 2018 03:26:37 +0000 (04:26 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 28 Feb 2018 17:22:28 +0000 (18:22 +0100)
We already stored the highest (potentially) used number.

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

index 9791ec5506a298b22a4dee9d39693e8a504ae127..e887272e154a52d92029e8f7c5541281167176a3 100644 (file)
@@ -973,7 +973,7 @@ draw_set_sampler_views(struct draw_context *draw,
 
    for (i = 0; i < num; ++i)
       draw->sampler_views[shader_stage][i] = views[i];
-   for (i = num; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; ++i)
+   for (i = num; i < draw->num_sampler_views[shader_stage]; ++i)
       draw->sampler_views[shader_stage][i] = NULL;
 
    draw->num_sampler_views[shader_stage] = num;