X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.cpp;h=97c234f79285f3c253e94d76dd36b937d13e55b4;hb=b6c4e1a794276ca343c0c9bb0a300e729ca41931;hp=f1ab6d088e4e1bdedd5d4188685ef2f6a55f02e0;hpb=89f26eba675defb38542faacacde6b9d4a2248c5;p=libs%2Fgl.git diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index f1ab6d08..97c234f7 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -93,6 +93,11 @@ void Compiler::compile(Mode mode) for(Stage &s: module->stages) ConstantSpecializer().apply(s, spec_values); } + if(mode==PROGRAM) + { + for(Stage &s: module->stages) + DepthRangeConverter().apply(s, features); + } for(auto i=module->stages.begin(); i!=module->stages.end(); ) { OptimizeResult result = optimize(*i); @@ -102,6 +107,19 @@ void Compiler::compile(Mode mode) ++i; } + Stage *prev_stage = 0; + for(auto i=module->stages.begin(); i!=module->stages.end(); ) + { + if(i->functions.empty()) + i = module->stages.erase(i); + else + { + i->previous = prev_stage; + prev_stage = &*i; + ++i; + } + } + for(Stage &s: module->stages) { StructuralFeatureConverter().apply(s, features); @@ -300,6 +318,7 @@ void Compiler::generate(Stage &stage) InterfaceGenerator().apply(stage); resolve(stage, RESOLVE_BLOCKS|RESOLVE_TYPES|RESOLVE_VARIABLES); + LayoutDefaulter().apply(stage); ArraySizer().apply(stage); resolve(stage, RESOLVE_EXPRESSIONS); }