diff options
author | Eric Anholt <eric@anholt.net> | 2010-07-20 16:47:25 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-07-20 17:30:10 -0700 |
commit | 21b0dbd79937e9d6787f045af7d60d4b6c649ec8 (patch) | |
tree | ffba1dbb2896d9ab9ddc24a062b69763d55a1826 /src/glsl/ast_to_hir.cpp | |
parent | b6e92ad7da9d4f00607caca90bd0b8853623a493 (diff) |
glsl2: talloc the glsl_struct_field[] we use to look up structure types.
Since the types are singletons across the lifetime of the compiler,
repeatedly compiling a program with the same structure type defined
would drop a copy of the array on the floor per compile.
This is a bit tricky because the static GLSL types are not called with
the talloc-based new, so we have to use the global type context, which
may not be initialized yet.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 41371e7536..f20c7ead33 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2471,8 +2471,8 @@ ast_struct_specifier::hir(exec_list *instructions, * the types to HIR. This ensures that structure definitions embedded in * other structure definitions are processed. */ - glsl_struct_field *const fields = (glsl_struct_field *) - malloc(sizeof(*fields) * decl_count); + glsl_struct_field *const fields = talloc_array(state, glsl_struct_field, + decl_count); unsigned i = 0; foreach_list_typed (ast_declarator_list, decl_list, link, |