diff options
author | Marek Olšák <[email protected]> | 2012-01-04 05:18:58 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-01-05 18:29:11 +0100 |
commit | c77efc6bb63f7ff3f1ddf500e57beff5b317b9b1 (patch) | |
tree | fabf8a62a35d5618c35164abbc87a1aff5bbb062 /src/gallium/drivers/r300/compiler/r500_fragprog_emit.c | |
parent | c2cc630f2896175ff0f368d9199acbe24afb7e75 (diff) |
r300/compiler: fix buffer underflow when setting SEM_WAIT on last instruction
Do it after we check whether inst_end != -1.
Also move the code structure at the beginning of r300_fragment_shader_code
to detect underflows easily with valgrind.
Diffstat (limited to 'src/gallium/drivers/r300/compiler/r500_fragprog_emit.c')
-rw-r--r-- | src/gallium/drivers/r300/compiler/r500_fragprog_emit.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/drivers/r300/compiler/r500_fragprog_emit.c b/src/gallium/drivers/r300/compiler/r500_fragprog_emit.c index bfd4aa82b95..87b96d15079 100644 --- a/src/gallium/drivers/r300/compiler/r500_fragprog_emit.c +++ b/src/gallium/drivers/r300/compiler/r500_fragprog_emit.c @@ -650,9 +650,6 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user) } } - /* Make sure TEX_SEM_WAIT is set on the last instruction */ - code->inst[code->inst_end].inst0 |= R500_INST_TEX_SEM_WAIT; - if (code->max_temp_idx >= compiler->Base.max_temp_regs) rc_error(&compiler->Base, "Too many hardware temporaries used"); @@ -674,6 +671,9 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user) code->inst[ip].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT; } + /* Make sure TEX_SEM_WAIT is set on the last instruction */ + code->inst[code->inst_end].inst0 |= R500_INST_TEX_SEM_WAIT; + /* Enable full flow control mode if we are using loops or have if * statements nested at least four deep. */ if (s.MaxBranchDepth >= 4 || s.LoopsReserved > 0) { |