summaryrefslogtreecommitdiff
path: root/src/mesa/program
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-12-13 15:42:46 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-12-13 15:47:56 -0800
commit2d577ee730c30caacf711babde6542766aa0b655 (patch)
tree3772be7b9a25209820c926854f3f637071ad0cce /src/mesa/program
parentcb2b547a4771ddf56975ede566dbf3a8f5389689 (diff)
ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
This is the same as what the array dereference handler does. Fixes piglit test glsl-link-struct-array (bugzilla #31648). NOTE: This is a candidate for the 7.9 and 7.10 branches.
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index b274a961b2..490c4cab7a 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1569,7 +1569,13 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir)
break;
offset += type_size(struct_type->fields.structure[i].type);
}
- this->result.swizzle = swizzle_for_size(ir->type->vector_elements);
+
+ /* If the type is smaller than a vec4, replicate the last channel out. */
+ if (ir->type->is_scalar() || ir->type->is_vector())
+ this->result.swizzle = swizzle_for_size(ir->type->vector_elements);
+ else
+ this->result.swizzle = SWIZZLE_NOOP;
+
this->result.index += offset;
}