{
const struct shader_info *info = &nir->info;
- if (info->num_textures) {
+ unsigned num_textures = util_last_bit(info->textures_used);
+
+ if (num_textures) {
prog_data->binding_table.texture_start = next_binding_table_offset;
prog_data->binding_table.gather_texture_start = next_binding_table_offset;
- next_binding_table_offset += info->num_textures;
+ next_binding_table_offset += num_textures;
} else {
prog_data->binding_table.texture_start = 0xd0d0d0d0;
prog_data->binding_table.gather_texture_start = 0xd0d0d0d0;
prog_data->binding_table.plane_start[0] = prog_data->binding_table.texture_start;
prog_data->binding_table.plane_start[1] = next_binding_table_offset;
- next_binding_table_offset += info->num_textures;
+ next_binding_table_offset += num_textures;
prog_data->binding_table.plane_start[2] = next_binding_table_offset;
- next_binding_table_offset += info->num_textures;
+ next_binding_table_offset += num_textures;
/* Set the binding table size */
prog_data->binding_table.size_bytes = next_binding_table_offset * 4;
}
}
- bt_assert(texture_start, info->num_textures > 0);
+ unsigned num_textures = util_last_bit(info->textures_used);
- for (int i = 0; i < info->num_textures; i++) {
+ bt_assert(texture_start, num_textures > 0);
+
+ for (int i = 0; i < num_textures; i++) {
struct iris_sampler_view *view = shs->textures[i];
uint32_t addr = view ? use_sampler_view(batch, view)
: use_null_surface(batch, ice);