mesa: glsl: fix a swizzle bug in storage_to_src_reg()
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 20 Aug 2008 20:40:02 +0000 (14:40 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 20 Aug 2008 20:40:02 +0000 (14:40 -0600)
Need to remove the 'nil' components before swizzling a swizzle

src/mesa/shader/slang/slang_emit.c

index f5f41eb116dcff9ee08b5942bb81d0071f8fdd7e..9e8daa10517c28570b60a8e2116d33db1eb75114 100644 (file)
@@ -108,7 +108,9 @@ writemask_to_swizzle(GLuint writemask)
 
 
 /**
- * Swizzle a swizzle.  That is, return swz2(swz1)
+ * Swizzle a swizzle (function composition).
+ * That is, return swz2(swz1), or said another way: swz1.szw2
+ * Example: swizzle_swizzle(".zwxx", ".xxyw") yields ".zzwx"
  */
 GLuint
 _slang_swizzle_swizzle(GLuint swz1, GLuint swz2)
@@ -279,7 +281,7 @@ storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st)
    while (st->Parent) {
       st = st->Parent;
       index += st->Index;
-      swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle);
+      swizzle = _slang_swizzle_swizzle(fix_swizzle(st->Swizzle), swizzle);
    }
 
    assert(st->File >= 0);