Support structures in glsl_type::generate_constructor_prototype
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 21 Apr 2010 19:13:48 +0000 (12:13 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Apr 2010 01:22:54 +0000 (18:22 -0700)
glsl_types.cpp

index 71d7dd36f84672f1788125877dfad1d59be88cd7..720dce79a1db108646d2c4f5bc341766524bf6ad 100644 (file)
@@ -135,9 +135,6 @@ const glsl_type *glsl_type::get_base_type() const
 ir_function *
 glsl_type::generate_constructor_prototype(glsl_symbol_table *symtab) const
 {
-   /* FINISHME: Add support for non-array types. */
-   assert(base_type == GLSL_TYPE_ARRAY);
-
    /* Generate the function name and add it to the symbol table.
     */
    ir_function *const f = new ir_function(name);
@@ -153,7 +150,9 @@ glsl_type::generate_constructor_prototype(glsl_symbol_table *symtab) const
 
       snprintf(param_name, 10, "p%08X", i);
 
-      ir_variable *var = new ir_variable(fields.array, param_name);
+      ir_variable *var = (this->base_type == GLSL_TYPE_ARRAY)
+        ? new ir_variable(fields.array, param_name)
+        : new ir_variable(fields.structure[i].type, param_name);
 
       var->mode = ir_var_in;
       sig->parameters.push_tail(var);