From: Alyssa Rosenzweig Date: Fri, 27 Mar 2020 18:40:30 +0000 (-0400) Subject: pan/bi: Ignore swizzle in unwritten component X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=375a7d0f32ff7ea94da9c975aa1a852d848e254b;p=mesa.git pan/bi: Ignore swizzle in unwritten component Otherwise we can trip the assert for no good reason. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c index f7feec222bd..6533d66b7df 100644 --- a/src/panfrost/bifrost/bi_ra.c +++ b/src/panfrost/bifrost/bi_ra.c @@ -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 */ diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c index cb24f459096..8256c45a780 100644 --- a/src/panfrost/bifrost/bir.c +++ b/src/panfrost/bifrost/bir.c @@ -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))); +} diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 3a895c2a6d1..554cd4e93d7 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -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 */