X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramcompiler.cpp;h=fd27839da25e1f7cb377a7fdf46079bfb1e862f3;hb=b3caa9f93c865a54a5d338af1ef474ad383f8099;hp=f9a14f2f00a119ffbd7ba7604fd36a84e5a96585;hpb=6b89fb751617dd51eddf2adcc55e9a8da66f8e84;p=libs%2Fgl.git diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index f9a14f2f..fd27839d 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -1494,11 +1494,13 @@ void ProgramCompiler::NodeRemover::visit(VariableDeclaration &var) 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) @@ -1513,7 +1515,7 @@ bool ProgramCompiler::LegacyConverter::check_version(const Version &feature_vers 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; @@ -1525,6 +1527,13 @@ void ProgramCompiler::LegacyConverter::visit(VariableReference &var) 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))) @@ -1581,7 +1590,7 @@ void ProgramCompiler::LegacyConverter::visit(VariableDeclaration &var) { if(stage->type==FRAGMENT && var.interface=="out") { - frag_out_name = var.name; + frag_out = &var; remove_node = true; } }