diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 398bab55dd8..68af6baafae 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1676,15 +1676,13 @@ ast_struct_specifier::ast_struct_specifier(void *lin_ctx, const char *identifier ast_declarator_list *declarator_list) { if (identifier == NULL) { - static mtx_t mutex = _MTX_INITIALIZER_NP; - static unsigned anon_count = 1; - unsigned count; - - mtx_lock(&mutex); - count = anon_count++; - mtx_unlock(&mutex); - - identifier = linear_asprintf(lin_ctx, "#anon_struct_%04x", count); + /* All anonymous structs have the same name. This simplifies matching of + * globals whose type is an unnamed struct. + * + * It also avoids a memory leak when the same shader is compiled over and + * over again. + */ + identifier = "#anon_struct"; } name = identifier; this->declarations.push_degenerate_list_at_head(&declarator_list->link); |