Mesa (glsl-to-tgsi): glsl_to_tgsi: fix mistake in new dead code elimination pass

Bryan Cain bryanc at kemper.freedesktop.org
Mon Jun 27 22:28:20 UTC 2011


Module: Mesa
Branch: glsl-to-tgsi
Commit: dc66cfd63feacb7e1343ed699fb372c4e5fc7b90
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc66cfd63feacb7e1343ed699fb372c4e5fc7b90

Author: Bryan Cain <bryancain3 at gmail.com>
Date:   Mon Jun 27 17:25:50 2011 -0500

glsl_to_tgsi: fix mistake in new dead code elimination pass

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 |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e38617a..f87c64f 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -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.




More information about the mesa-commit mailing list