Formatter::Formatter():
stage(0),
+ mode(Compiler::PROGRAM),
source_index(0),
source_line(1),
indent(0),
parameter_list(false)
{ }
-const string &Formatter::apply(Stage &s)
+const string &Formatter::apply(Stage &s, Compiler::Mode m)
{
+ mode = m;
stage = &s;
GLApi api = get_gl_api();
else
{
unsigned l = line;
- if(stage && stage->required_version<Version(3, 30))
+ if(mode==Compiler::PROGRAM && stage && stage->required_version<Version(3, 30))
--l;
formatted += format("#line %d %d\n", l, index);
}
if(!var.interface.empty() && var.interface!=block_interface)
{
string interface = var.interface;
- if(stage && stage->required_version<Version(1, 30))
+ if(mode==Compiler::PROGRAM && stage && stage->required_version<Version(1, 30))
{
if(stage->type==Stage::VERTEX && var.interface=="in")
interface = "attribute";