glsl: Add infrastructure for aggregate initializers.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner
2013-06-29 19:27:50 -07:00
parent 8d45caaeba
commit ae79e86d4c
4 changed files with 72 additions and 1 deletions

View File

@@ -1699,3 +1699,33 @@ ast_function_expression::hir(exec_list *instructions,
return ir_rvalue::error_value(ctx);
}
ir_rvalue *
ast_aggregate_initializer::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
YYLTYPE loc = this->get_location();
const char *name;
const glsl_type *const constructor_type =
this->constructor_type->glsl_type(&name, state);
if (!state->ARB_shading_language_420pack_enable) {
_mesa_glsl_error(&loc, state, "C-style initialization requires the "
"GL_ARB_shading_language_420pack extension");
return ir_rvalue::error_value(ctx);
}
if (this->constructor_type->is_array) {
return process_array_constructor(instructions, constructor_type, &loc,
&this->expressions, state);
}
if (this->constructor_type->structure) {
return process_record_constructor(instructions, constructor_type, &loc,
&this->expressions, state);
}
return process_vec_mat_constructor(instructions, constructor_type, &loc,
&this->expressions, state);
}