mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
nir: Fix nir_chase_binding() vecN handling
In the comments we claimed to handle vecN instructions, for the case where an offset is trimmed from the descriptor, but we didn't ignore the offset itself and in effect only handled identity vecN's (which copy propagation would normally remove already!), so the handling of vecN was useless and this relied on copy propagation cleaning things up. Fix it to ignore everything except the components in the original source. Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18703>
This commit is contained in:
parent
bd51305943
commit
e402d2dbe9
1 changed files with 3 additions and 2 deletions
|
|
@ -2804,17 +2804,18 @@ nir_binding nir_chase_binding(nir_src rsrc)
|
|||
* instructions to skip trimming of vec2_index_32bit_offset addresses after
|
||||
* lowering ALU to scalar.
|
||||
*/
|
||||
unsigned num_components = nir_src_num_components(rsrc);
|
||||
while (true) {
|
||||
nir_alu_instr *alu = nir_src_as_alu_instr(rsrc);
|
||||
nir_intrinsic_instr *intrin = nir_src_as_intrinsic(rsrc);
|
||||
if (alu && alu->op == nir_op_mov) {
|
||||
for (unsigned i = 0; i < alu->dest.dest.ssa.num_components; i++) {
|
||||
for (unsigned i = 0; i < num_components; i++) {
|
||||
if (alu->src[0].swizzle[i] != i)
|
||||
return (nir_binding){0};
|
||||
}
|
||||
rsrc = alu->src[0].src;
|
||||
} else if (alu && nir_op_is_vec(alu->op)) {
|
||||
for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
||||
for (unsigned i = 0; i < num_components; i++) {
|
||||
if (alu->src[i].swizzle[0] != i || alu->src[i].src.ssa != alu->src[0].src.ssa)
|
||||
return (nir_binding){0};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue