From ac4218f733b4c8f09b64e72164bd4321a4c1abd2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 8 Nov 2021 23:10:34 +0200 Subject: [PATCH] Always apply feature conversion in the GLSL compiler Also convert structural features before allocating locations. This gives flattened push constant uniforms locations too. --- source/glsl/compiler.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index 3f259350..00efbd94 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -101,6 +101,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); @@ -389,14 +394,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 -- 2.43.0