summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-07-16 09:09:05 -0700
committerEric Anholt <[email protected]>2014-08-08 18:59:47 -0700
commit32948ca768fec6debdcdafa58bce2b65c328250d (patch)
tree78d8202736f4799c148a19f74f6c2c5bf0b6dd3e
parent6ff2129d5842898eb87d2a457ee018fe66471f06 (diff)
vc4: Add more useful debug for the undefined-source case
We could get undefined sources in real programs from the wild, so we'll need to turn off this debug eventually. But for now, using undefined sources is typically me just mistyping something.
-rw-r--r--src/gallium/drivers/vc4/vc4_qpu_emit.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index da47539af0f..6b047023e56 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -266,11 +266,18 @@ vc4_generate_code(struct qcompile *c)
src[i] = qpu_rn(0);
break;
case QFILE_TEMP:
- assert(reg_allocated[index] != -1);
- src[i] = allocate_to_qpu_reg[reg_allocated[index]];
- reg_uses_remaining[index]--;
- if (reg_uses_remaining[index] == 0)
- reg_in_use[reg_allocated[index]] = false;
+ if (reg_allocated[index] == -1) {
+ fprintf(stderr, "undefined reg use: ");
+ qir_dump_inst(qinst);
+ fprintf(stderr, "\n");
+
+ src[i] = qpu_rn(0);
+ } else {
+ src[i] = allocate_to_qpu_reg[reg_allocated[index]];
+ reg_uses_remaining[index]--;
+ if (reg_uses_remaining[index] == 0)
+ reg_in_use[reg_allocated[index]] = false;
+ }
break;
case QFILE_UNIF:
src[i] = qpu_unif();