summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-08-20 14:40:02 -0600
committerBrian Paul <[email protected]>2008-08-20 14:40:02 -0600
commitad9c862ffbb42d733595052d5769405ef7a98a75 (patch)
tree68df1efc0ccdf157da658271d8dac28fc7ac4036
parente55093bf2f4ff32a691f63409b9fea321cf8eb0f (diff)
mesa: glsl: fix a swizzle bug in storage_to_src_reg()
Need to remove the 'nil' components before swizzling a swizzle
-rw-r--r--src/mesa/shader/slang/slang_emit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index f5f41eb116d..9e8daa10517 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -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);