i965: Fix nested loops in the VS.
authorEric Anholt <eric@anholt.net>
Tue, 9 Mar 2010 17:56:42 +0000 (09:56 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 16 Mar 2010 19:15:02 +0000 (12:15 -0700)
We were patching up all the break and continues between the start of
our loop and the end of our loop, even if they were breaks/continues
for an inner loop.  Avoiding patching already patched breaks/continues
fixes piglit glsl-vs-loop-nested.
(cherry picked from commit f6f547d87ea68f44c50a0b0231b7360ca94b2975)

src/mesa/drivers/dri/i965/brw_vs_emit.c

index a7c4b589727b97e6fb3df7b2d8992e9d44c8920f..a48804a660fb93d2735af5a6c45fdba3b7028bc1 100644 (file)
@@ -1717,11 +1717,13 @@ void brw_vs_emit(struct brw_vs_compile *c )
             /* patch all the BREAK/CONT instructions from last BEGINLOOP */
             while (inst0 > loop_inst[loop_depth]) {
                inst0--;
-               if (inst0->header.opcode == BRW_OPCODE_BREAK) {
+               if (inst0->header.opcode == BRW_OPCODE_BREAK &&
+                  inst0->bits3.if_else.jump_count == 0) {
                   inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
                   inst0->bits3.if_else.pop_count = 0;
                }
-               else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) {
+               else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
+                       inst0->bits3.if_else.jump_count == 0) {
                   inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
                   inst0->bits3.if_else.pop_count = 0;
                }