X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompatibility.cpp;h=128902f3b9f473bb9df87559d40a231c139ac55e;hb=5c33b56c3b97ca0381ac216a603c7553f4bea499;hp=0769839430f371c646374f8150cfb0f245e17607;hpb=b482f6d59aca2b4f1d9e2cbcc0f596d62c057509;p=libs%2Fgl.git diff --git a/source/glsl/compatibility.cpp b/source/glsl/compatibility.cpp index 07698394..128902f3 100644 --- a/source/glsl/compatibility.cpp +++ b/source/glsl/compatibility.cpp @@ -17,7 +17,7 @@ DefaultPrecisionGenerator::DefaultPrecisionGenerator(): void DefaultPrecisionGenerator::apply(Stage &s) { stage = &s; - visit(s.content); + s.content.visit(*this); } void DefaultPrecisionGenerator::visit(Block &block) @@ -65,7 +65,7 @@ void DefaultPrecisionGenerator::visit(VariableDeclaration &var) void PrecisionRemover::apply(Stage &stage) { - visit(stage.content); + stage.content.visit(*this); NodeRemover().apply(stage, nodes_to_remove); } @@ -90,7 +90,7 @@ void LegacyConverter::apply(Stage &s, const Features &feat) features = feat; if(!supports_stage(s.type)) throw unsupported_shader(format("Stage %s is not supported", Stage::get_stage_name(s.type))); - visit(s.content); + s.content.visit(*this); } void LegacyConverter::visit(Block &block) @@ -264,20 +264,19 @@ void LegacyConverter::visit(VariableDeclaration &var) if(var.layout && !supports_interface_layouts()) { vector::iterator i; - for(i=var.layout->qualifiers.begin(); (i!=var.layout->qualifiers.end() && i->identifier!="location"); ++i) ; + for(i=var.layout->qualifiers.begin(); (i!=var.layout->qualifiers.end() && i->name!="location"); ++i) ; if(i!=var.layout->qualifiers.end()) { - unsigned location = lexical_cast(i->value); if(stage->type==Stage::VERTEX && var.interface=="in") { - stage->locations[var.name] = location; + stage->locations[var.name] = i->value; var.layout->qualifiers.erase(i); } else if(stage->type==Stage::FRAGMENT && var.interface=="out") { - if(location!=0 && !check_extension(&Features::ext_gpu_shader4)) + if(i->value!=0 && !check_extension(&Features::ext_gpu_shader4)) throw unsupported_shader("EXT_gpu_shader4 is required"); - stage->locations[var.name] = location; + stage->locations[var.name] = i->value; var.layout->qualifiers.erase(i); }