[PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

Brian Paul brianp at vmware.com
Tue Oct 11 07:20:29 PDT 2011


This fixes a bug where we'd wind up emitting an invalid instruction like
MOVE R[0]., R[1];  - note the empty/zero writemask.  If we don't write to
any dest register channels, cull the instruction.

v2: simply change/fix the existing test for instruction culling.
---
 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 f68270d..19b7c1c 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3780,7 +3780,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
       
       if (!inst->dead_mask || !inst->dst.writemask)
          continue;
-      else if (inst->dead_mask == inst->dst.writemask) {
+      else if ((inst->dst.writemask & ~inst->dead_mask) == 0) {
          iter.remove();
          delete inst;
          removed++;
-- 
1.7.3.4


--------------020301030708000304000907--


More information about the mesa-dev mailing list