diff options
author | Ian Romanick <[email protected]> | 2010-03-23 15:08:30 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-03-23 15:08:30 -0700 |
commit | abef9557642f77d406452f3c32e5e49ced212571 (patch) | |
tree | c2672c480e53ed9b8f490d5ca07f8004a447a2bd /ast_function.cpp | |
parent | cb7d066967b85c52fe15590b56529254516261e7 (diff) |
Begin processing constructors
Right now, reject constructors for samplers because the are illegal.
Diffstat (limited to 'ast_function.cpp')
-rw-r--r-- | ast_function.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/ast_function.cpp b/ast_function.cpp index a120eb8dd63..7082ed3c140 100644 --- a/ast_function.cpp +++ b/ast_function.cpp @@ -88,18 +88,35 @@ ast_function_expression::hir(exec_list *instructions, * 2. methods - Only the .length() method of array types. * 3. functions - Calls to regular old functions. * - * There are two kinds of constructor call. Constructors for built-in - * language types, such as mat4 and vec2, are free form. The only - * requirement is that the parameters must provide enough values of the - * correct scalar type. Constructors for arrays and structures must have - * the exact number of parameters with matching types in the correct order. - * These constructors follow essentially the same type matching rules as - * functions. - * * Method calls are actually detected when the ast_field_selection * expression is handled. */ if (is_constructor()) { + const ast_type_specifier *type = (ast_type_specifier *) subexpressions[0]; + YYLTYPE loc = type->get_location(); + + const glsl_type *const constructor_type = + state->symbols->get_type(type->type_name); + + + /* Constructors for samplers are illegal. + */ + if (constructor_type->is_sampler()) { + _mesa_glsl_error(& loc, state, "cannot construct sampler type `%s'", + constructor_type->name); + return ir_call::get_error_instruction(); + } + + + /* There are two kinds of constructor call. Constructors for built-in + * language types, such as mat4 and vec2, are free form. The only + * requirement is that the parameters must provide enough values of the + * correct scalar type. Constructors for arrays and structures must + * have the exact number of parameters with matching types in the + * correct order. These constructors follow essentially the same type + * matching rules as functions. + */ + return ir_call::get_error_instruction(); } else { const ast_expression *id = subexpressions[0]; |