X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.cpp;h=16ac375ca57f05660aa83ae89d9e75b4aff2a941;hb=b23a9af95c65c01d949153fc49e5091aaa7c3d30;hp=00efbd94393c4399d0dbc206551575f5bf93fc22;hpb=ac4218f733b4c8f09b64e72164bd4321a4c1abd2;p=libs%2Fgl.git diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 00efbd94..16ac375c 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -75,6 +75,7 @@ void Compiler::compile(Mode mode) for(Stage &s: module->stages) generate(s); ConstantIdAssigner().apply(*module, features); + LocationAllocator().apply(*module, features, false); for(Stage &s: module->stages) validate(s); @@ -157,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(); } @@ -208,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)); } @@ -329,7 +330,7 @@ void Compiler::resolve(Stage &stage, unsigned flags) void Compiler::validate(Stage &stage) { - DeclarationValidator().apply(stage); + DeclarationValidator().apply(stage, features); IdentifierValidator().apply(stage); ReferenceValidator().apply(stage); ExpressionValidator().apply(stage); @@ -363,7 +364,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))