Assignment targets to the output variable need to be cleared, lest the
unused variable locator tries to access deleted nodes.
ProgramCompiler::LegacyConverter::LegacyConverter():
ProgramCompiler::LegacyConverter::LegacyConverter():
- target_version(get_glsl_version())
+ target_version(get_glsl_version()),
+ frag_out(0)
{ }
ProgramCompiler::LegacyConverter::LegacyConverter(const Version &v):
{ }
ProgramCompiler::LegacyConverter::LegacyConverter(const Version &v):
+ target_version(v),
+ frag_out(0)
{ }
bool ProgramCompiler::LegacyConverter::check_version(const Version &feature_version)
{ }
bool ProgramCompiler::LegacyConverter::check_version(const Version &feature_version)
void ProgramCompiler::LegacyConverter::visit(VariableReference &var)
{
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;
{
var.name = "gl_FragColor";
var.declaration = 0;
+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)))
void ProgramCompiler::LegacyConverter::visit(FunctionCall &call)
{
if(call.name=="texture" && !call.declaration && !check_version(Version(1, 30)))
{
if(stage->type==FRAGMENT && var.interface=="out")
{
{
if(stage->type==FRAGMENT && var.interface=="out")
{
- frag_out_name = var.name;
{
Version target_version;
std::string type;
{
Version target_version;
std::string type;
- std::string frag_out_name;
+ ProgramSyntax::VariableDeclaration *frag_out;
LegacyConverter();
LegacyConverter(const Version &);
LegacyConverter();
LegacyConverter(const Version &);
bool check_version(const Version &);
using Visitor::visit;
virtual void visit(ProgramSyntax::VariableReference &);
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 &);
virtual void visit(ProgramSyntax::FunctionCall &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
virtual void visit(ProgramSyntax::InterfaceBlock &);