mesa: Branch 'master'

Brian Paul brianp at kemper.freedesktop.org
Thu Mar 15 17:53:10 UTC 2007


 src/mesa/shader/nvvertparse.c |    8 ++++----
 src/mesa/shader/program.h     |    7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

New commits:
diff-tree fc6b8f2d3012f97d5a1f0d4fbefd191268d6a263 (from 4e4ab2a62bf33a582420cff85775a6580167b5a9)
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Mar 15 11:51:54 2007 -0600

    added SWIZZLE_XXXX, YYYY, etc. macros

diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index ecfe8ec..6d395c6 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -686,13 +686,13 @@ Parse_SwizzleSrcReg(struct parse_state *
       if (token[1] == 0) {
          /* single letter swizzle */
          if (token[0] == 'x')
-            srcReg->Swizzle = MAKE_SWIZZLE4(0, 0, 0, 0);
+            srcReg->Swizzle = SWIZZLE_XXXX;
          else if (token[0] == 'y')
-            srcReg->Swizzle = MAKE_SWIZZLE4(1, 1, 1, 1);
+            srcReg->Swizzle = SWIZZLE_YYYY;
          else if (token[0] == 'z')
-            srcReg->Swizzle = MAKE_SWIZZLE4(2, 2, 2, 2);
+            srcReg->Swizzle = SWIZZLE_ZZZZ;
          else if (token[0] == 'w')
-            srcReg->Swizzle = MAKE_SWIZZLE4(3, 3, 3, 3);
+            srcReg->Swizzle = SWIZZLE_WWWW;
          else
             RETURN_ERROR1("Expected x, y, z, or w");
       }
diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h
index a0bde07..5b5d134 100644
--- a/src/mesa/shader/program.h
+++ b/src/mesa/shader/program.h
@@ -53,6 +53,13 @@
 
 #define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9))
 #define SWIZZLE_NOOP           MAKE_SWIZZLE4(0,1,2,3)
+
+#define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W)
+#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)
+#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y)
+#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z)
+#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)
+
 #define GET_SWZ(swz, idx)      (((swz) >> ((idx)*3)) & 0x7)
 #define GET_BIT(msk, idx)      (((msk) >> (idx)) & 0x1)
 



More information about the mesa-commit mailing list