X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.cpp;h=f1ab6d088e4e1bdedd5d4188685ef2f6a55f02e0;hb=0859998b4d394cb31f92c1031339bf6404561a8a;hp=4e9f94d86b51e0044786927f7bc77c6d8e32c720;hpb=89de98315588ec89ad66e9a4f3f90bf03e1f7733;p=libs%2Fgl.git diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 4e9f94d8..f1ab6d08 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -158,7 +158,7 @@ vector Compiler::get_combined_spirv() const if(!compiled) throw invalid_operation("Compiler::get_combined_spirv"); SpirVGenerator gen; - gen.apply(*module); + gen.apply(*module, features); return gen.get_code(); } @@ -209,11 +209,11 @@ const SourceMap &Compiler::get_source_map() const return module->source_map; } -string Compiler::get_stage_debug(Stage::Type stage_type) const +string Compiler::get_stage_debug(Stage::Type stage_type, bool use_colors) const { auto i = find_member(module->stages, stage_type, &Stage::type); if(i!=module->stages.end()) - return DumpTree().apply(*i); + return DumpTree(use_colors).apply(*i); throw key_error(Stage::get_stage_name(stage_type)); } @@ -299,6 +299,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 @@ -364,7 +367,8 @@ Compiler::OptimizeResult Compiler::optimize(Stage &stage) { if(ConstantFolder().apply(stage)) resolve(stage, RESOLVE_EXPRESSIONS); - ConstantConditionEliminator().apply(stage); + if(ConstantConditionEliminator().apply(stage)) + resolve(stage, RESOLVE_VARIABLES); bool any_inlined = false; if(FunctionInliner().apply(stage))