From 761d79ec3eb232713cd67e597e3de03ff5203d84 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 8 Apr 2024 23:39:35 -0400 Subject: [PATCH] agx: fix indirect CF accounting if we have a non-compact indirectly indexed array of scalars Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index dd2f1937163..0ab832fa57f 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -144,10 +144,20 @@ gather_cf(nir_builder *b, nir_intrinsic_instr *intr, void *data) BITSET_SET_RANGE(set, start_comp, start_comp + nr - 1); } else { - unsigned start_comp = sem.location * 4; - unsigned count = sem.num_slots * 4; + unsigned start_comp = (sem.location * 4) + nir_intrinsic_component(intr); + bool compact = sem.location == VARYING_SLOT_CLIP_DIST0 || + sem.location == VARYING_SLOT_CLIP_DIST1; + unsigned stride = compact ? 1 : 4; - BITSET_SET_RANGE(set, start_comp, start_comp + count - 1); + /* For now we have to assign CF for the whole vec4 to make indirect + * indexiing work. This could be optimized later. + */ + nr = stride; + + for (unsigned i = 0; i < sem.num_slots; ++i) { + BITSET_SET_RANGE(set, start_comp + (i * stride), + start_comp + (i * stride) + nr - 1); + } } return false;