]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/generate.cpp
Fix a bug with resolving member declarations
[libs/gl.git] / 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)