summaryrefslogtreecommitdiff
path: root/src/glsl/glsl_types.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/glsl_types.cpp')
-rw-r--r--src/glsl/glsl_types.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 6ca141ef48..77c591ed69 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -75,7 +75,20 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
name(name),
length(num_fields)
{
- this->fields.structure = fields;
+ unsigned int i;
+
+ if (glsl_type::ctx == NULL) {
+ glsl_type::ctx = talloc_init("glsl_type");
+ assert(glsl_type::ctx != NULL);
+ }
+
+ this->fields.structure = talloc_array(glsl_type::ctx,
+ glsl_struct_field, length);
+ for (i = 0; i < length; i++) {
+ this->fields.structure[i].type = fields[i].type;
+ this->fields.structure[i].name = talloc_strdup(this->fields.structure,
+ fields[i].name);
+ }
}
static void