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: 459b49a174 ("zink: add a new linker pass to handle mismatched i/o components")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28466>
This commit is contained in:
Mike Blumenkrantz 2024-03-25 15:57:10 -04:00 committed by Marge Bot
parent a64f5ae9d7
commit 460cd99ea5

View file

@ -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);