]> git.tdb.fi Git - libs/gl.git/commitdiff
Generate a passthrough for gl_Position in geometry shader
authorMikko Rasa <tdb@tdb.fi>
Sat, 12 Nov 2016 18:09:16 +0000 (20:09 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 12 Nov 2016 18:09:16 +0000 (20:09 +0200)
source/programcompiler.cpp

index 541fd8e29cd1c6ddb059e4f3cf155e5cf4d4a5c2..2bb2694609f89277b9d36efc50a0df5de0354d34 100644 (file)
@@ -656,6 +656,24 @@ void ProgramCompiler::InterfaceGenerator::visit(Passthrough &pass)
                }
        }
 
+       if(stage->type==GEOMETRY)
+       {
+               VariableReference *ref = new VariableReference;
+               ref->name = "gl_in";
+
+               BinaryExpression *subscript = new BinaryExpression;
+               subscript->left = ref;
+               subscript->oper = "[";
+               subscript->right = pass.subscript;
+               subscript->after = "]";
+
+               MemberAccess *memacc = new MemberAccess;
+               memacc->left = subscript;
+               memacc->member = "gl_Position";
+
+               insert_assignment("gl_Position", memacc);
+       }
+
        for(vector<VariableDeclaration *>::const_iterator i=pass_vars.begin(); i!=pass_vars.end(); ++i)
        {
                string out_name = change_prefix((*i)->name, out_prefix);