X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.cpp;h=4e9f94d86b51e0044786927f7bc77c6d8e32c720;hp=3f25935064beafe5c0fbecd86bcf4dae40eaa16c;hb=76cc18518fc8b0b4fa11fda153e7d9b3899ed112;hpb=4b05add0a40cc7503b9dc7ff3b15844b02f51e16 diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 3f259350..4e9f94d8 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); @@ -101,6 +102,11 @@ void Compiler::compile(Mode mode) ++i; } + for(Stage &s: module->stages) + { + StructuralFeatureConverter().apply(s, features); + resolve(s, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS); + } LocationAllocator().apply(*module, features); for(Stage &s: module->stages) finalize(s, mode); @@ -324,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); @@ -389,14 +395,9 @@ Compiler::OptimizeResult Compiler::optimize(Stage &stage) void Compiler::finalize(Stage &stage, Mode mode) { - if(mode==PROGRAM) - { - StructuralFeatureConverter().apply(stage, features); - QualifierConverter().apply(stage, features); - resolve(stage, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS); - PrecisionConverter().apply(stage); - } - else if(mode==SPIRV) + QualifierConverter().apply(stage, features); + PrecisionConverter().apply(stage); + if(mode==SPIRV) StructOrganizer().apply(stage); // Collect bindings from all stages into the shared stage's maps