glsl_to_tgsi: fix mistake in new dead code elimination pass
authorBryan Cain <bryancain3@gmail.com>
Mon, 27 Jun 2011 22:25:50 +0000 (17:25 -0500)
committerBryan Cain <bryancain3@gmail.com>
Mon, 1 Aug 2011 22:59:09 +0000 (17:59 -0500)
The conditions of IF opcodes were not being counted as reads, which sometimes
led to the condition register being wrong or undefined.

src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index e38617ae9fe6a569eb9afe8c90db222e74f91783..f87c64f62c794176be12963c0ccdc4b3e352844a 100644 (file)
@@ -3315,10 +3315,6 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
          memset(writes, 0, sizeof(*writes) * this->next_temp * 4);
          break;
 
-      case TGSI_OPCODE_IF:
-         ++level;
-         break;
-
       case TGSI_OPCODE_ENDIF:
          --level;
          break;
@@ -3341,6 +3337,10 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
          }
          break;
 
+      case TGSI_OPCODE_IF:
+         ++level;
+         /* fallthrough to default case to mark the condition as read */
+      
       default:
          /* Continuing the block, clear any channels from the write array that
           * are read by this instruction.