Mesa (master): glsl: handle partial swizzles in opt_dead_code_local correctly

Marek Olšák mareko at kemper.freedesktop.org
Thu Nov 10 17:47:18 UTC 2016


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Nov  7 22:56:21 2016 +0100

glsl: handle partial swizzles in opt_dead_code_local correctly

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/compiler/glsl/opt_dead_code_local.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
index fc979af..a403879 100644
--- a/src/compiler/glsl/opt_dead_code_local.cpp
+++ b/src/compiler/glsl/opt_dead_code_local.cpp
@@ -106,9 +106,12 @@ public:
 
       int used = 0;
       used |= 1 << ir->mask.x;
-      used |= 1 << ir->mask.y;
-      used |= 1 << ir->mask.z;
-      used |= 1 << ir->mask.w;
+      if (ir->mask.num_components > 1)
+         used |= 1 << ir->mask.y;
+      if (ir->mask.num_components > 2)
+         used |= 1 << ir->mask.z;
+      if (ir->mask.num_components > 3)
+         used |= 1 << ir->mask.w;
 
       use_channels(deref->var, used);
 




More information about the mesa-commit mailing list