From ad9c862ffbb42d733595052d5769405ef7a98a75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 20 Aug 2008 14:40:02 -0600 Subject: mesa: glsl: fix a swizzle bug in storage_to_src_reg() Need to remove the 'nil' components before swizzling a swizzle --- src/mesa/shader/slang/slang_emit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index f5f41eb116..9e8daa1051 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); -- cgit v1.2.3