Browse Source

mesa: check dst reg in _mesa_find_free_register()

If a register was only being used as a destination (as will happen when
generated condition-codes) we missed its use.  So we'd errantly return
a register index that was really in-use, not free.

Fixes bug 25579.
tags/mesa-7.6.1-rc3-1
Brian Paul 16 years ago
parent
commit
5076a4f53a
1 changed files with 11 additions and 3 deletions
  1. 11
    3
      src/mesa/shader/program.c

+ 11
- 3
src/mesa/shader/program.c View File

@@ -813,9 +813,17 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile)
const struct prog_instruction *inst = prog->Instructions + i;
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);

for (k = 0; k < n; k++) {
if (inst->SrcReg[k].File == regFile) {
used[inst->SrcReg[k].Index] = GL_TRUE;
/* check dst reg first */
if (inst->DstReg.File == regFile) {
used[inst->DstReg.Index] = GL_TRUE;
}
else {
/* check src regs otherwise */
for (k = 0; k < n; k++) {
if (inst->SrcReg[k].File == regFile) {
used[inst->SrcReg[k].Index] = GL_TRUE;
break;
}
}
}
}

Loading…
Cancel
Save