Module: Mesa Branch: main Commit: a923b1636dc65c2d4d37418f5e162442378cc915 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a923b1636dc65c2d4d37418f5e162442378cc915
Author: Erik Faye-Lund <[email protected]> Date: Fri Feb 4 13:25:26 2022 +0100 zink: set dynamic indexing caps If we're not using uniform indexing, we need to emit caps to enable dynamic indexing. Reviewed-by: Mike Blumenkrantz <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17734> --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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) {
