diff options
author | Matt Turner <[email protected]> | 2013-06-29 19:27:50 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2013-07-11 20:58:59 -0700 |
commit | ae79e86d4c0d82b4102e2ec65c93c8240fd22e9d (patch) | |
tree | 680138963d2e10b66964d350efd8836c20bff596 /src/glsl/ast_function.cpp | |
parent | 8d45caaebaa017e910ae985e005fadc6b626de7d (diff) |
glsl: Add infrastructure for aggregate initializers.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/ast_function.cpp')
-rw-r--r-- | src/glsl/ast_function.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 459a17a3dca..39182639f33 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -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); +} |