summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/compiler/radeon_program.c
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-08-26 22:53:24 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-08-27 01:46:45 +0200
commit2114acb044b1d8860350a9f14890fce1e2f315f0 (patch)
treed4d4b3ebf49def718298ebbaa39b5210e32e3281 /src/mesa/drivers/dri/r300/compiler/radeon_program.c
parente1d978775f982a450bd84588a4f9567d6bbccebd (diff)
r300/compiler: Fix bug in rc_find_free_temporary
Find used temporaries even if they are only written to in dead code. This fixes a bug in the NQSSADCE stage. Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/radeon_program.c')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index 208d3b90c8..bbbf0dd776 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -79,13 +79,19 @@ GLint rc_find_free_temporary(struct radeon_compiler * c)
for (struct rc_instruction * rcinst = c->Program.Instructions.Next; rcinst != &c->Program.Instructions; rcinst = rcinst->Next) {
const struct prog_instruction *inst = &rcinst->I;
- const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
+ const GLuint nsrc = _mesa_num_inst_src_regs(inst->Opcode);
+ const GLuint ndst = _mesa_num_inst_dst_regs(inst->Opcode);
GLuint k;
- for (k = 0; k < n; k++) {
+ for (k = 0; k < nsrc; k++) {
if (inst->SrcReg[k].File == PROGRAM_TEMPORARY)
used[inst->SrcReg[k].Index] = GL_TRUE;
}
+
+ if (ndst) {
+ if (inst->DstReg.File == PROGRAM_TEMPORARY)
+ used[inst->DstReg.Index] = GL_TRUE;
+ }
}
for (i = 0; i < MAX_PROGRAM_TEMPS; i++) {