Mesa (glsl2): ir_to_mesa: When generating a swizzle, respect the reg' s current swizzle.

Eric Anholt anholt at kemper.freedesktop.org
Wed Jun 30 15:30:22 PDT 2010


Module: Mesa
Branch: glsl2
Commit: 698b84444343189357ad252856d3c5493e47e4fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=698b84444343189357ad252856d3c5493e47e4fa

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jun 30 15:26:41 2010 -0700

ir_to_mesa: When generating a swizzle, respect the reg's current swizzle.

Fixes depth-tex-modes-glsl.

---

 src/mesa/shader/ir_to_mesa.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 8c074a8..61a1f30 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -817,23 +817,23 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir)
       if (i < ir->type->vector_elements) {
 	 switch (i) {
 	 case 0:
-	    swizzle[i] = ir->mask.x;
+	    swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.x);
 	    break;
 	 case 1:
-	    swizzle[i] = ir->mask.y;
+	    swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.y);
 	    break;
 	 case 2:
-	    swizzle[i] = ir->mask.z;
+	    swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.z);
 	    break;
 	 case 3:
-	    swizzle[i] = ir->mask.w;
+	    swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.w);
 	    break;
 	 }
       } else {
 	 /* If the type is smaller than a vec4, replicate the last
 	  * channel out.
 	  */
-	 swizzle[i] = ir->type->vector_elements - 1;
+	 swizzle[i] = swizzle[ir->type->vector_elements - 1];
       }
    }
 



More information about the mesa-commit mailing list