From 32948ca768fec6debdcdafa58bce2b65c328250d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 16 Jul 2014 09:09:05 -0700 Subject: [PATCH] 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. --- src/gallium/drivers/vc4/vc4_qpu_emit.c | 17 ++++++++++++----- 1 file 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(); -- 2.30.2