diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index c10fd918fd8..751eb76e84b 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -181,8 +181,8 @@ prepare_shader_sampling( if (!num) return; - for (i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) { - struct pipe_sampler_view *view = i < num ? views[i] : NULL; + for (i = 0; i < num; i++) { + struct pipe_sampler_view *view = views[i]; if (view) { struct pipe_resource *tex = view->texture;