]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix a bug with resolving member declarations
authorMikko Rasa <tdb@tdb.fi>
Fri, 5 Mar 2021 00:17:23 +0000 (02:17 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 5 Mar 2021 23:00:31 +0000 (01:00 +0200)
The logic changes in 7daccf2 caused members of variables declared within
anonymous interface blocks to not be resolved correctly.

source/glsl/generate.cpp

index 42694a8affeca317ec9e71bf4456dedd522b8bd0..8626cac6761c6f42f896b76ef47d53111df5c460 100644 (file)
@@ -197,12 +197,7 @@ void VariableResolver::visit(VariableReference &var)
                        var.declaration = i->second;
        }
 
-       if(var.declaration)
-       {
-               if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(var.declaration->type_declaration))
-                       r_members = &strct->members.variables;
-       }
-       else
+       if(!var.declaration)
        {
                const map<string, InterfaceBlock *> &blocks = stage->interface_blocks;
                map<string, InterfaceBlock *>::const_iterator i = blocks.find("_"+var.name);
@@ -230,6 +225,10 @@ void VariableResolver::visit(VariableReference &var)
                }
        }
 
+       if(var.declaration)
+               if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(var.declaration->type_declaration))
+                       r_members = &strct->members.variables;
+
        if(record_target)
        {
                if(r_assignment_target)