diff options
author | Brian Paul <[email protected]> | 2009-12-11 09:16:25 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-12-11 09:16:27 -0700 |
commit | 5076a4f53a2f34cc9116b45951037f639885c7a1 (patch) | |
tree | 748c458183b785403f95bd6ace54f96d3a6819cf /src/mesa/shader | |
parent | f7f1211b9b0a8fa0e5f5427b74b4eee4dabf65af (diff) |
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.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/program.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 2cd6eb8a389..18d4ef97597 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -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; + } } } } |