From 460cd99ea540fa5b8f0a063b9943afaf29b6cf06 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 25 Mar 2024 15:57:10 -0400 Subject: [PATCH] zink: don't clobber indirect array reads with missing components this breaks interfaces where the consumer reads its input indirectly and only some of the components are written by clobbering all the components, even if the unwritten components are never accessed Fixes: 459b49a1749 ("zink: add a new linker pass to handle mismatched i/o components") Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index a3ed707becd..5b183084ced 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -2687,13 +2687,11 @@ fill_zero_reads(nir_builder *b, nir_intrinsic_instr *intr, void *data) if (intr->def.bit_size == 64) num_components *= 2; nir_src *src_offset = nir_get_io_offset_src(intr); - if (nir_src_is_const(*src_offset)) { - unsigned slot_offset = nir_src_as_uint(*src_offset); - if (s.location + slot_offset != wc->slot) - return false; - } else if (s.location > wc->slot || s.location + s.num_slots <= wc->slot) { + if (!nir_src_is_const(*src_offset)) + return false; + unsigned slot_offset = nir_src_as_uint(*src_offset); + if (s.location + slot_offset != wc->slot) return false; - } uint32_t readmask = BITFIELD_MASK(intr->num_components) << c; if (intr->def.bit_size == 64) readmask |= readmask << (intr->num_components + c);