X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.cpp;h=4b1d4edf11d0e6e29c8410ab123521b440826128;hb=6f06479b765946bdd3174b2c05e7a1dda24c31c2;hp=4f2080ab9c59afb8c8b6018aed6cac2d60c40d09;hpb=e9a898f315b5d1396f196d785913a283c30940f2;p=libs%2Fgl.git diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 4f2080ab..4b1d4edf 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -4,6 +4,7 @@ #include "builtin.h" #include "compiler.h" #include "debug.h" +#include "deviceinfo.h" #include "error.h" #include "finalize.h" #include "generate.h" @@ -24,17 +25,11 @@ namespace GL { namespace SL { Compiler::Compiler(): - features(Features::from_context()), - module(0), - compiled(false), - specialized(false) + features(DeviceInfo::get_global().glsl_features) { } Compiler::Compiler(const Features &f): - features(f), - module(0), - compiled(false), - specialized(false) + features(f) { } Compiler::~Compiler() @@ -157,7 +152,7 @@ string Compiler::get_stage_glsl(Stage::Type stage_type) const throw key_error(Stage::get_stage_name(stage_type)); } -vector Compiler::get_combined_spirv() const +vector Compiler::get_combined_spirv() const { if(!compiled) throw invalid_operation("Compiler::get_combined_spirv"); @@ -278,7 +273,7 @@ void Compiler::import(ModuleCache &mod_cache, const string &name) void Compiler::generate(Stage &stage) { - stage.required_features.gl_api = features.gl_api; + stage.required_features.target_api = features.target_api; if(module->shared.required_features.glsl_version>stage.required_features.glsl_version) stage.required_features.glsl_version = module->shared.required_features.glsl_version; @@ -368,6 +363,11 @@ Compiler::OptimizeResult Compiler::optimize(Stage &stage) resolve(stage, RESOLVE_TYPES|RESOLVE_VARIABLES|RESOLVE_FUNCTIONS|RESOLVE_EXPRESSIONS); any_inlined = true; } + if(AggregateDismantler().apply(stage)) + { + resolve(stage, RESOLVE_TYPES|RESOLVE_VARIABLES|RESOLVE_FUNCTIONS|RESOLVE_EXPRESSIONS); + any_inlined = true; + } if(ExpressionInliner().apply(stage)) { resolve(stage, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS|RESOLVE_EXPRESSIONS);