diff options
Diffstat (limited to 'src/panfrost/bifrost/bir.c')
-rw-r--r-- | src/panfrost/bifrost/bir.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c index 5fe0ae48409..48c06ab776e 100644 --- a/src/panfrost/bifrost/bir.c +++ b/src/panfrost/bifrost/bir.c @@ -74,3 +74,24 @@ bi_has_arg(bi_instruction *ins, unsigned arg) return false; } + +uint16_t +bi_bytemask_of_read_components(bi_instruction *ins, unsigned node) +{ + uint16_t mask = 0x0; + + bi_foreach_src(ins, s) { + if (ins->src[s] != node) continue; + nir_alu_type T = ins->src_types[s]; + unsigned size = nir_alu_type_get_type_size(T); + unsigned bytes = (MAX2(size, 8) / 8); + unsigned cmask = (1 << bytes) - 1; + + for (unsigned i = 0; i < ARRAY_SIZE(ins->swizzle[s]); ++i) { + unsigned c = ins->swizzle[s][i]; + mask |= (cmask << (c * bytes)); + } + } + + return mask; +} |