agx: Restrict copyprop of uniforms

Some instructions don't accept uniform registers as sources (yet?),
avoid this hazard in the optimizer.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18813>
This commit is contained in:
Alyssa Rosenzweig
2022-09-25 20:08:52 -04:00
parent cef13f8ab1
commit 1521d9c58c
+17
View File
@@ -170,6 +170,23 @@ agx_optimizer_copyprop(agx_instr **defs, agx_instr *I)
/* Immediate inlining happens elsewhere */
if (def->src[0].type == AGX_INDEX_IMMEDIATE) continue;
/* Not all instructions can take uniforms. Memory instructions can take
* uniforms, but only for their base (first) source and only in the
* low-half of the uniform file.
*/
if (def->src[0].type == AGX_INDEX_UNIFORM &&
(I->op == AGX_OPCODE_TEXTURE_LOAD ||
I->op == AGX_OPCODE_TEXTURE_SAMPLE ||
(I->op == AGX_OPCODE_DEVICE_LOAD &&
(s != 0 || def->src[0].value >= 256)) ||
I->op == AGX_OPCODE_PHI ||
I->op == AGX_OPCODE_ST_TILE ||
I->op == AGX_OPCODE_LD_TILE ||
/*I->op == AGX_OPCODE_DEVICE_STORE ||*/
I->op == AGX_OPCODE_UNIFORM_STORE ||
I->op == AGX_OPCODE_ST_VARY))
continue;
I->src[s] = agx_replace_index(src, def->src[0]);
}
}