Acked-by: Marek Olšák <marek.ol...@amd.com> Marek
On Tue, Mar 18, 2014 at 4:16 PM, Maarten Lankhorst <maarten.lankho...@canonical.com> wrote: > Use the recursive copy from emit_block_mov to allow constant declarations to > work. > > This allows the following code to work without a weird crash: > > struct Foo { > int value[1]; > }; > > int actual_value = Foo[2](Foo(int[1](100)), Foo(int[1](200)))[i].value[0]; > > Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> > --- > diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > index 0871dd0..924f333 100644 > --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp > @@ -459,7 +459,7 @@ public: > void merge_registers(void); > void renumber_registers(void); > - void emit_block_mov(ir_assignment *ir, const struct glsl_type *type, > + void emit_block_mov(ir_instruction *ir, const struct glsl_type *type, > st_dst_reg *l, st_src_reg *r); > void *mem_ctx; > @@ -2289,7 +2289,7 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue > *ir) > } > void > -glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct > glsl_type *type, > +glsl_to_tgsi_visitor::emit_block_mov(ir_instruction *ir, const struct > glsl_type *type, > st_dst_reg *l, st_src_reg *r) > { > if (type->base_type == GLSL_TYPE_STRUCT) { > @@ -2465,10 +2465,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) > src = this->result; > for (i = 0; i < (unsigned int)size; i++) { > - emit(ir, TGSI_OPCODE_MOV, temp, src); > - > - src.index++; > - temp.index++; > + emit_block_mov(ir, field_value->type, &temp, &src); > } > } > this->result = temp_base; > @@ -2487,10 +2484,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) > ir->array_elements[i]->accept(this); > src = this->result; > for (int j = 0; j < size; j++) { > - emit(ir, TGSI_OPCODE_MOV, temp, src); > - > - src.index++; > - temp.index++; > + emit_block_mov(ir, ir->type->fields.array, &temp, &src); > } > } > this->result = temp_base; > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev