]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/generate.cpp
Avoid incorrectly matching interfaces in certain cases
[libs/gl.git] / source / glsl / generate.cpp
index d435d29a37e87b2c38f3d7e09ef5ebc6243f0989..952f1f0bfa4f1bddb2e1bc7585f3829fda9ce78b 100644 (file)
@@ -10,7 +10,7 @@ namespace SL {
 
 void DeclarationCombiner::apply(Stage &stage)
 {
-       visit(stage.content);
+       stage.content.visit(*this);
        NodeRemover().apply(stage, nodes_to_remove);
 }
 
@@ -96,7 +96,7 @@ void VariableResolver::apply(Stage &stage)
 {
        Stage *builtin_stage = get_builtins(stage.type);
        builtins = (builtin_stage ? &builtin_stage->content : 0);
-       visit(stage.content);
+       stage.content.visit(*this);
 }
 
 Block *VariableResolver::next_block(Block &block)
@@ -285,7 +285,7 @@ void InterfaceGenerator::apply(Stage &s)
        if(stage->previous)
                in_prefix = get_out_prefix(stage->previous->type);
        out_prefix = get_out_prefix(stage->type);
-       visit(s.content);
+       s.content.visit(*this);
        NodeRemover().apply(s, nodes_to_remove);
 }
 
@@ -358,6 +358,10 @@ void InterfaceGenerator::visit(VariableReference &var)
 {
        if(var.declaration || !stage->previous)
                return;
+       /* Don't pull a variable from previous stage if we just generated an out
+       interface in this stage */
+       if(stage->out_variables.count(var.name))
+               return;
 
        const map<string, VariableDeclaration *> &prev_out = stage->previous->out_variables;
        map<string, VariableDeclaration *>::const_iterator i = prev_out.find(var.name);