renderer: walk along samplers_used_mask instead of view-array

The result is the same, we just skip a bit quicker over unused entries.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
macos/master
Erik Faye-Lund 6 years ago
parent dcc542f514
commit 23ea840f08
  1. 7
      src/vrend_renderer.c

@ -3620,15 +3620,14 @@ static void vrend_draw_bind_samplers_shader(struct vrend_context *ctx,
int *sampler_id) int *sampler_id)
{ {
int index = 0; int index = 0;
for (int i = 0; i < ctx->sub->views[shader_type].num_views; i++) { uint32_t mask = ctx->sub->prog->samplers_used_mask[shader_type];
while (mask) {
int i = u_bit_scan(&mask);
struct vrend_sampler_view *tview = ctx->sub->views[shader_type].views[i]; struct vrend_sampler_view *tview = ctx->sub->views[shader_type].views[i];
if (!tview) if (!tview)
continue; continue;
if (!(ctx->sub->prog->samplers_used_mask[shader_type] & (1 << i)))
continue;
if (ctx->sub->prog->samp_locs[shader_type]) if (ctx->sub->prog->samp_locs[shader_type])
glUniform1i(ctx->sub->prog->samp_locs[shader_type][index], *sampler_id); glUniform1i(ctx->sub->prog->samp_locs[shader_type][index], *sampler_id);

Loading…
Cancel
Save