On 05/07/2016 03:05 PM, Nicolai Hähnle wrote: > From: Nicolai Hähnle <nicolai.haeh...@amd.com> > > --- > src/compiler/glsl/ast_function.cpp | 4 ++-- > src/compiler/glsl/link_uniform_initializers.cpp | 8 +++----- > 2 files changed, 5 insertions(+), 7 deletions(-) > > diff --git a/src/compiler/glsl/ast_function.cpp > b/src/compiler/glsl/ast_function.cpp > index 37fb3e79..65d3be1 100644 > --- a/src/compiler/glsl/ast_function.cpp > +++ b/src/compiler/glsl/ast_function.cpp > @@ -1670,8 +1670,6 @@ process_record_constructor(exec_list *instructions, > > exec_node *node = actual_parameters.head; > for (unsigned i = 0; i < constructor_type->length; i++) { > - ir_rvalue *ir = (ir_rvalue *) node; > - > if (node->is_tail_sentinel()) { > _mesa_glsl_error(loc, state, > "insufficient parameters to constructor for `%s'", > @@ -1679,6 +1677,8 @@ process_record_constructor(exec_list *instructions, > return ir_rvalue::error_value(ctx); > } > > + ir_rvalue *ir = (ir_rvalue *) node; > + > if > (apply_implicit_conversion(constructor_type->fields.structure[i].type, > ir, state)) { > node->replace_with(ir); > diff --git a/src/compiler/glsl/link_uniform_initializers.cpp > b/src/compiler/glsl/link_uniform_initializers.cpp > index c6346d5..eec4e99 100644 > --- a/src/compiler/glsl/link_uniform_initializers.cpp > +++ b/src/compiler/glsl/link_uniform_initializers.cpp > @@ -179,17 +179,15 @@ set_uniform_initializer(void *mem_ctx, > gl_shader_program *prog, > { > const glsl_type *t_without_array = type->without_array(); > if (type->is_record()) { > - ir_constant *field_constant; > + exec_node *node = val->components.get_head(); > > - field_constant = (ir_constant *)val->components.get_head(); > - > - for (unsigned int i = 0; i < type->length; i++) { > + for (unsigned int i = 0; i < type->length; i++, node = node->next) { > + ir_constant *field_constant = (ir_constant *)node; ^ space here
Since field_constant should never be changed, I'd declare it as 'ir_constant *const'. With those changes, this patch is Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> > const glsl_type *field_type = type->fields.structure[i].type; > const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name, > type->fields.structure[i].name); > set_uniform_initializer(mem_ctx, prog, field_name, > field_type, field_constant, boolean_true); > - field_constant = (ir_constant *)field_constant->next; > } > return; > } else if (t_without_array->is_record() || > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev