[Mesa-dev] [PATCH 3/9] glsl: do not add unnamed struct types to the symbol table

Nicolai Hähnle nhaehnle at gmail.com
Mon May 15 09:27:27 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

We removed the need for lookups, and we will assign them all the same
name in the future.
---
 src/compiler/glsl/ast_to_hir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 2221c5f..d64a98d 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -7479,21 +7479,21 @@ ast_struct_specifier::hir(exec_list *instructions,
                                                 0, /* for interface only */
                                                 0, /* for interface only */
                                                 0, /* for interface only */
                                                 expl_location,
                                                 0 /* for interface only */);
 
    validate_identifier(this->name, loc, state);
 
    type = glsl_type::get_record_instance(fields, decl_count, this->name);
 
-   if (!state->symbols->add_type(name, type)) {
+   if (!type->is_anonymous() && !state->symbols->add_type(name, type)) {
       const glsl_type *match = state->symbols->get_type(name);
       /* allow struct matching for desktop GL - older UE4 does this */
       if (match != NULL && state->is_version(130, 0) && match->record_compare(type, false)) {
          _mesa_glsl_warning(& loc, state, "struct `%s' previously defined", name);
          type = match;
       } else
          _mesa_glsl_error(& loc, state, "struct `%s' previously defined", name);
    } else {
       const glsl_type **s = reralloc(state, state->user_structures,
                                      const glsl_type *,
-- 
2.9.3



More information about the mesa-dev mailing list