mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
vc4: Allow copy propagation of uniforms.
Fixes 12 piglit tests (and 8 more crash -> fail) from reducing register pressure.
This commit is contained in:
parent
79be2cc383
commit
71d4fc88d6
1 changed files with 15 additions and 1 deletions
|
|
@ -45,10 +45,22 @@ qir_opt_copy_propagation(struct vc4_compile *c)
|
|||
foreach(node, &c->instructions) {
|
||||
struct qinst *inst = (struct qinst *)node;
|
||||
|
||||
/* A single instruction can only read one uniform value. (It
|
||||
* could maybe read the same uniform value in two operands,
|
||||
* but that doesn't seem important to do).
|
||||
*/
|
||||
bool reads_a_uniform = false;
|
||||
for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
|
||||
if (inst->src[i].file == QFILE_UNIF)
|
||||
reads_a_uniform = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
|
||||
int index = inst->src[i].index;
|
||||
if (inst->src[i].file == QFILE_TEMP &&
|
||||
movs[index].file == QFILE_TEMP) {
|
||||
(movs[index].file == QFILE_TEMP ||
|
||||
(movs[index].file == QFILE_UNIF &&
|
||||
!reads_a_uniform))) {
|
||||
if (debug) {
|
||||
fprintf(stderr, "Copy propagate: ");
|
||||
qir_dump_inst(inst);
|
||||
|
|
@ -56,6 +68,8 @@ qir_opt_copy_propagation(struct vc4_compile *c)
|
|||
}
|
||||
|
||||
inst->src[i] = movs[index];
|
||||
if (movs[index].file == QFILE_UNIF)
|
||||
reads_a_uniform = true;
|
||||
|
||||
if (debug) {
|
||||
fprintf(stderr, "to: ");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue