1 struct ir_instruction
*
2 _mesa_ast_constructor_to_hir(const struct ast_node
*n
,
3 const struct ast_node
*parameters
,
4 struct _mesa_glsl_parse_state
*state
)
6 const struct ast_type_specifier
*type
= (struct ast_type_specifier
*) n
;
9 /* There are effectively three kinds of constructors. Each has its own set
12 * * Built-in scalar, vector, and matrix types: For each of these the only
13 * matching requirement is that the number of values supplied is
14 * sufficient to initialize all of the fields of the type.
15 * * Array types: The number of initializers must match the size of the
16 * array, if a size is specified. Each of the initializers must
17 * exactly match the base type of the array.
18 * * Structure types: These initializers must exactly match the fields of
19 * the structure in order. This is the most restrictive type.
21 * In all cases the built-in promotions from integer to floating-point types
27 } else if ((type
->type_specifier
== ast_struct
)
28 || (type
->type_specifier
== ast_type_name
)) {
31 const struct glsl_type
*ctor_type
;
33 /* Look-up the type, by name, in the symbol table.
37 /* Generate a series of assignments of constructor parameters to fields
38 * of the object being initialized.