summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-01-06 08:15:54 -0700
committerBrian Paul <brianp@vmware.com>2009-01-06 08:15:54 -0700
commit374cf77b2f0f13f9380fb0c9d804222a83bdc2e0 (patch)
tree39cfbbcbbbdc9b2d64e4ad134472cf747101dc7b /src/mesa/shader/slang/slang_codegen.c
parent52d5d25537a9291f7d247211d2881ed56edaca94 (diff)
parenta8ee35c1c59c23938e0a18b163515acc892ed407 (diff)
Merge commit 'origin/master' into gallium-0.2
Conflicts: src/mesa/drivers/dri/common/dri_util.c
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 4976daf533..8e28be8abd 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -3323,6 +3323,22 @@ is_store_writable(const slang_assemble_ctx *A, const slang_ir_storage *store)
/**
+ * Walk up an IR storage path to compute the final swizzle.
+ * This is used when we find an expression such as "foo.xz.yx".
+ */
+static GLuint
+root_swizzle(const slang_ir_storage *st)
+{
+ GLuint swizzle = st->Swizzle;
+ while (st->Parent) {
+ st = st->Parent;
+ swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle);
+ }
+ return swizzle;
+}
+
+
+/**
* Generate IR tree for an assignment (=).
*/
static slang_ir_node *
@@ -3397,9 +3413,9 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
rhs = _slang_gen_operation(A, &oper->children[1]);
if (lhs && rhs) {
/* convert lhs swizzle into writemask */
+ const GLuint swizzle = root_swizzle(lhs->Store);
GLuint writemask, newSwizzle;
- if (!swizzle_to_writemask(A, lhs->Store->Swizzle,
- &writemask, &newSwizzle)) {
+ if (!swizzle_to_writemask(A, swizzle, &writemask, &newSwizzle)) {
/* Non-simple writemask, need to swizzle right hand side in
* order to put components into the right place.
*/