diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index dcde90c0895..4e1203d3f6d 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -3704,6 +3704,28 @@ emit_deref_array(struct ntv_context *ctx, nir_deref_instr *deref) assert(deref->deref_type == nir_deref_type_array); nir_variable *var = nir_deref_instr_get_variable(deref); + if (!nir_src_is_always_uniform(deref->arr.index)) { + if (deref->modes & nir_var_mem_ubo) + spirv_builder_emit_cap(&ctx->builder, + SpvCapabilityUniformBufferArrayDynamicIndexing); + + if (deref->modes & nir_var_mem_ssbo) + spirv_builder_emit_cap(&ctx->builder, + SpvCapabilityStorageBufferArrayDynamicIndexing); + + if (deref->modes & (nir_var_uniform | nir_var_image)) { + const struct glsl_type *type = glsl_without_array(var->type); + assert(glsl_type_is_sampler(type) || glsl_type_is_image(type)); + + if (glsl_type_is_sampler(type)) + spirv_builder_emit_cap(&ctx->builder, + SpvCapabilitySampledImageArrayDynamicIndexing); + else + spirv_builder_emit_cap(&ctx->builder, + SpvCapabilityStorageImageArrayDynamicIndexing); + } + } + SpvStorageClass storage_class = get_storage_class(var); SpvId base, type; switch (var->data.mode) {