ProgramCompiler::LegacyConverter::LegacyConverter():
- target_version(get_glsl_version())
+ target_version(get_glsl_version()),
+ frag_out(0)
{ }
ProgramCompiler::LegacyConverter::LegacyConverter(const Version &v):
- target_version(v)
+ target_version(v),
+ frag_out(0)
{ }
bool ProgramCompiler::LegacyConverter::check_version(const Version &feature_version)
void ProgramCompiler::LegacyConverter::visit(VariableReference &var)
{
- if(var.name==frag_out_name && !check_version(Version(1, 30)))
+ if(var.declaration==frag_out && !check_version(Version(1, 30)))
{
var.name = "gl_FragColor";
var.declaration = 0;
type = string();
}
+void ProgramCompiler::LegacyConverter::visit(Assignment &assign)
+{
+ TraversingVisitor::visit(assign);
+ if(assign.target_declaration==frag_out && !check_version(Version(1, 30)))
+ assign.target_declaration = 0;
+}
+
void ProgramCompiler::LegacyConverter::visit(FunctionCall &call)
{
if(call.name=="texture" && !call.declaration && !check_version(Version(1, 30)))
{
if(stage->type==FRAGMENT && var.interface=="out")
{
- frag_out_name = var.name;
+ frag_out = &var;
remove_node = true;
}
}
{
Version target_version;
std::string type;
- std::string frag_out_name;
+ ProgramSyntax::VariableDeclaration *frag_out;
LegacyConverter();
LegacyConverter(const Version &);
bool check_version(const Version &);
using Visitor::visit;
virtual void visit(ProgramSyntax::VariableReference &);
+ virtual void visit(ProgramSyntax::Assignment &);
virtual void visit(ProgramSyntax::FunctionCall &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
virtual void visit(ProgramSyntax::InterfaceBlock &);