From c3f7abaaef0387d4b319b46ea4af156336988ef5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 2 Feb 2023 22:27:17 -0500 Subject: [PATCH] agx: Fix storing to varying arrays The offset is in vec4s, not words (unlike the component). This doesn't matter right now since we get everything lowered (offset -> 0) but it will come up if we implement clip distances natively (instead of lowering in FS). Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 84afb8a0d94..fb933309453 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -423,8 +423,7 @@ agx_emit_store_vary(agx_builder *b, nir_intrinsic_instr *instr) unsigned imm_index = b->shader->out->varyings.vs.slots[sem.location]; assert(imm_index < ~0); - imm_index += nir_intrinsic_component(instr); - imm_index += nir_src_as_uint(*offset); + imm_index += (nir_src_as_uint(*offset) * 4) + nir_intrinsic_component(instr); /* nir_lower_io_to_scalar */ assert(nir_intrinsic_write_mask(instr) == 0x1);