pan/bi: Ignore swizzle in unwritten component

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>
This commit is contained in:
Alyssa Rosenzweig
2020-03-27 14:40:30 -04:00
committed by Marge Bot
parent aa77d8128e
commit 375a7d0f32
3 changed files with 13 additions and 0 deletions
+4
View File
@@ -128,6 +128,10 @@ bi_adjust_src_ra(bi_instruction *ins, struct lcra_state *l, unsigned src)
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 */
+8
View File
@@ -144,3 +144,11 @@ bi_get_immediate(bi_instruction *ins, unsigned index)
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)));
}
+1
View File
@@ -539,6 +539,7 @@ unsigned bi_get_component_count(bi_instruction *ins, unsigned s);
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 */