]> git.tdb.fi Git - libs/gl.git/commitdiff
Avoid incorrectly matching interfaces in certain cases
authorMikko Rasa <tdb@tdb.fi>
Tue, 23 Feb 2021 22:03:31 +0000 (00:03 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 23 Feb 2021 22:03:31 +0000 (00:03 +0200)
I removed this in ab5f2e6, thinking it was unnecessary.  But if a stage
declares a local output variable of the same name as an output variable
in the previous stage, this is needed to avoid a mismatch.

source/glsl/generate.cpp

index ca4d41e64c7a8c63bf51fd8d446e5ccb4dc8bd5a..952f1f0bfa4f1bddb2e1bc7585f3829fda9ce78b 100644 (file)
@@ -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);