summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBryan Cain <[email protected]>2011-06-23 19:35:36 -0500
committerBryan Cain <[email protected]>2011-08-01 17:59:08 -0500
commit8b881ad1c3d9dd3c96afbdbb608a7240d40e9c92 (patch)
tree4a29b4b419ba022275ccd9cef479447947511677 /src
parent8c50f18b29637470539d05ccc32b0cae0092aeac (diff)
glsl_to_tgsi: use swizzle_for_size for src reg in conditional moves
This prevents the copy propagation pass from being confused by undefined channels and thus missing optimization opportunities.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index abeb44a4083..6d76686ab5d 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1882,10 +1882,13 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
st_src_reg condition = this->result;
for (i = 0; i < type_size(ir->lhs->type); i++) {
+ st_src_reg l_src = st_src_reg(l);
+ l_src.swizzle = swizzle_for_size(ir->lhs->type->vector_elements);
+
if (switch_order) {
- emit(ir, TGSI_OPCODE_CMP, l, condition, st_src_reg(l), r);
+ emit(ir, TGSI_OPCODE_CMP, l, condition, l_src, r);
} else {
- emit(ir, TGSI_OPCODE_CMP, l, condition, r, st_src_reg(l));
+ emit(ir, TGSI_OPCODE_CMP, l, condition, r, l_src);
}
l.index++;