for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
{
glsl += format("#pragma MSP stage(%s)\n", Stage::get_stage_name(i->type));
- glsl += Formatter().apply(*i, MODULE);
+ glsl += Formatter().apply(*i);
glsl += '\n';
}
{
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
if(i->type==stage_type)
- return Formatter().apply(*i, PROGRAM);
+ return Formatter().apply(*i);
throw key_error(Stage::get_stage_name(stage_type));
}
Formatter::Formatter():
stage(0),
- mode(Compiler::PROGRAM),
source_index(0),
source_line(1),
indent(0),
parameter_list(false)
{ }
-const string &Formatter::apply(Stage &s, Compiler::Mode m)
+const string &Formatter::apply(Stage &s)
{
- mode = m;
stage = &s;
const Version &ver = s.required_features.glsl_version;
else
{
unsigned l = line;
- if(mode==Compiler::PROGRAM && stage && stage->required_features.glsl_version<Version(3, 30))
+ if(stage && stage->required_features.glsl_version && stage->required_features.glsl_version<Version(3, 30))
--l;
formatted += format("#line %d %d\n", l, index);
}
if(!var.interface.empty())
{
string interface = var.interface;
- if(mode==Compiler::PROGRAM && stage && stage->required_features.glsl_version<Version(1, 30))
+ if(stage && stage->required_features.glsl_version && stage->required_features.glsl_version<Version(1, 30))
{
if(stage->type==Stage::VERTEX && var.interface=="in")
interface = "attribute";
{
private:
Stage *stage;
- Compiler::Mode mode;
std::string formatted;
unsigned source_index;
unsigned source_line;
public:
Formatter();
- const std::string &apply(Stage &, Compiler::Mode);
+ const std::string &apply(Stage &);
const std::string &apply(Node &n) { n.visit(*this); return formatted; }
private: