X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.cpp;h=05bf421cd422428dbf1b09b5eef3d0daf737c3f9;hb=2b1dc627491c987b0459226dcb8ac6aadd7ee4d3;hp=16ac375ca57f05660aa83ae89d9e75b4aff2a941;hpb=b23a9af95c65c01d949153fc49e5091aaa7c3d30;p=libs%2Fgl.git diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 16ac375c..05bf421c 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); @@ -299,6 +317,9 @@ void Compiler::generate(Stage &stage) variables through interfaces. */ InterfaceGenerator().apply(stage); resolve(stage, RESOLVE_BLOCKS|RESOLVE_TYPES|RESOLVE_VARIABLES); + + ArraySizer().apply(stage); + resolve(stage, RESOLVE_EXPRESSIONS); } template