summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-09-27 18:29:15 -0700
committerEric Anholt <eric@anholt.net>2010-09-27 18:29:15 -0700
commit3610e0c1a0edc87cef32b7d5d3f4d9004e31f6c4 (patch)
treec088e52ddb8593ec879c4033ac6692b25bd408ee /src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
parent169ff0cc9d189f5a00a2a94313a6ce1503d1d5b9 (diff)
downloadexternal_mesa3d-3610e0c1a0edc87cef32b7d5d3f4d9004e31f6c4.zip
external_mesa3d-3610e0c1a0edc87cef32b7d5d3f4d9004e31f6c4.tar.gz
external_mesa3d-3610e0c1a0edc87cef32b7d5d3f4d9004e31f6c4.tar.bz2
i965: Fix vector splitting RHS channel selection with sparse writemasks.
Fixes: glsl-fs-all-02 glsl-fs-dot-vec2
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
index 83b4af0..552254d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
@@ -264,8 +264,10 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir)
variable_entry *rhs = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL;
if (lhs_deref && rhs_deref && (lhs || rhs) && !ir->condition) {
+ unsigned int rhs_chan = 0;
+
/* Straight assignment of vector variables. */
- for (unsigned int i = 0; i < ir->rhs->type->vector_elements; i++) {
+ for (unsigned int i = 0; i < ir->lhs->type->vector_elements; i++) {
ir_dereference *new_lhs;
ir_rvalue *new_rhs;
void *mem_ctx = lhs ? lhs->mem_ctx : rhs->mem_ctx;
@@ -283,15 +285,18 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir)
}
if (rhs) {
- new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]);
+ new_rhs =
+ new(mem_ctx) ir_dereference_variable(rhs->components[rhs_chan]);
} else {
new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL),
- i, i, i, i, 1);
+ rhs_chan, 0, 0, 0, 1);
}
ir->insert_before(new(mem_ctx) ir_assignment(new_lhs,
new_rhs,
NULL, writemask));
+
+ rhs_chan++;
}
ir->remove();
} else if (lhs) {