From a209ca32465c61b38f3a57ee6577568f3994e8ab Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 12 Nov 2016 20:09:16 +0200 Subject: [PATCH] Generate a passthrough for gl_Position in geometry shader --- source/programcompiler.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index 541fd8e2..2bb26946 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -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::const_iterator i=pass_vars.begin(); i!=pass_vars.end(); ++i) { string out_name = change_prefix((*i)->name, out_prefix); -- 2.45.2