From: Mikko Rasa Date: Sat, 12 Nov 2016 18:09:16 +0000 (+0200) Subject: Generate a passthrough for gl_Position in geometry shader X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a209ca32465c61b38f3a57ee6577568f3994e8ab;p=libs%2Fgl.git Generate a passthrough for gl_Position in geometry shader --- 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);