From a7311ceafec7762734801ba1176dd1cff4ca5c66 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 30 Dec 2021 17:52:11 -0800 Subject: [PATCH] microsoft/compiler: Fix array-of-array handling for derefs of textures/images Reviewed-by: Sil Vilerino Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index e8b506183cc..9ef2b5a96a9 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -3609,6 +3609,12 @@ emit_deref(struct ntd_context* ctx, nir_deref_instr* instr) if (!base || !offset) return false; + if (glsl_type_is_array(instr->type)) { + offset = dxil_emit_binop(&ctx->mod, DXIL_BINOP_MUL, offset, + dxil_module_get_int32_const(&ctx->mod, glsl_get_aoa_size(instr->type)), 0); + if (!offset) + return false; + } binding = dxil_emit_binop(&ctx->mod, DXIL_BINOP_ADD, base, offset, 0); }