diff options
author | Eric Anholt <[email protected]> | 2010-07-22 16:11:08 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-07-22 16:17:57 -0700 |
commit | 85e93da18ca2c967ca12870b62ab1aac2f0b880c (patch) | |
tree | b4cda93a1230c1da311892199cfd04b2e1d4d95c /src/mesa/shader | |
parent | 9703ed05e684f4269cd8af27c94e9b6bf8781d85 (diff) |
ir_to_mesa: Fix the swizzles on record and array dereferences.
Fixes:
glsl1-struct (1)
glsl1-struct (2)
glsl1-struct (3)
glsl1-struct (4)
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/ir_to_mesa.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index ba45c87e59c..c397838e259 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1151,7 +1151,10 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) src_reg.file = entry->file; src_reg.index = entry->index; /* If the type is smaller than a vec4, replicate the last channel out. */ - src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); + if (ir->type->is_scalar() || ir->type->is_vector()) + src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); + else + src_reg.swizzle = SWIZZLE_NOOP; src_reg.reladdr = NULL; src_reg.negate = 0; @@ -1231,7 +1234,10 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir) } /* If the type is smaller than a vec4, replicate the last channel out. */ - src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + if (ir->type->is_scalar() || ir->type->is_vector()) + src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + else + src_reg.swizzle = SWIZZLE_NOOP; this->result = src_reg; } @@ -1250,6 +1256,7 @@ 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); this->result.index += offset; } @@ -1322,7 +1329,6 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) int i; assert(!ir->lhs->type->is_array()); - assert(ir->lhs->type->base_type != GLSL_TYPE_STRUCT); ir->rhs->accept(this); r = this->result; |