Otherwise we can trip the assert for no good reason.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>
unsigned components = bi_get_component_count(ins, src);
for (unsigned i = 0; i < components; ++i) {
+ /* If we're not writing the component, who cares? */
+ if (!bi_writes_component(ins, i))
+ continue;
+
unsigned off = ins->swizzle[src][i] / comps_per_reg;
off *= 4; /* 32-bit registers */
unsigned shift = index & ~BIR_INDEX_CONSTANT;
return ins->constant.u64 >> shift;
}
+
+bool
+bi_writes_component(bi_instruction *ins, unsigned comp)
+{
+ nir_alu_type T = ins->dest_type;
+ unsigned size = nir_alu_type_get_type_size(T);
+ return ins->writemask & (0xF << (comp * (size / 8)));
+}
unsigned bi_load32_components(bi_instruction *ins);
uint16_t bi_bytemask_of_read_components(bi_instruction *ins, unsigned node);
uint64_t bi_get_immediate(bi_instruction *ins, unsigned index);
+bool bi_writes_component(bi_instruction *ins, unsigned comp);
/* BIR passes */