diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-12-13 15:42:46 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2011-01-03 17:05:24 -0800 |
commit | 0d98ceb4bfc9f0ac5462e060fa1d66c9b8b7d031 (patch) | |
tree | 88f856aea7bd24f9174946d675c3006d5651c16a | |
parent | 40390b80e93ce83fc796e6048ec5dc7e15b4f05e (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.
(cherry picked from commit 2d577ee730c30caacf711babde6542766aa0b655)
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 8 |
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 4737c6df39..01785a944c 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1544,7 +1544,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; } |