Mesa (master): st/mesa: fix incorrect loop over instruction src regs

Brian Paul brianp at kemper.freedesktop.org
Wed Aug 17 07:27:41 PDT 2011


Module: Mesa
Branch: master
Commit: 718b894dbb585af52dd24defb2e8c130216e5485
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=718b894dbb585af52dd24defb2e8c130216e5485

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Aug 16 16:30:52 2011 -0600

st/mesa: fix incorrect loop over instruction src regs

The array of src regs is of size 3, not 4.

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index aef23e7..7b90c81 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3443,7 +3443,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
          /* Continuing the block, clear any channels from the write array that
           * are read by this instruction.
           */
-         for (int i = 0; i < 4; i++) {
+         for (unsigned i = 0; i < Elements(inst->src); i++) {
             if (inst->src[i].file == PROGRAM_TEMPORARY && inst->src[i].reladdr){
                /* Any temporary might be read, so no dead code elimination 
                 * across this instruction.



More information about the mesa-commit mailing list