]> git.tdb.fi Git - libs/gl.git/commitdiff
Always apply feature conversion in the GLSL compiler
authorMikko Rasa <tdb@tdb.fi>
Mon, 8 Nov 2021 21:10:34 +0000 (23:10 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 8 Nov 2021 21:10:34 +0000 (23:10 +0200)
Also convert structural features before allocating locations.  This
gives flattened push constant uniforms locations too.

source/glsl/compiler.cpp

index 3f25935064beafe5c0fbecd86bcf4dae40eaa16c..00efbd94393c4399d0dbc206551575f5bf93fc22 100644 (file)
@@ -101,6 +101,11 @@ void Compiler::compile(Mode mode)
                        ++i;
        }
 
                        ++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);
        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)
 {
 
 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
                StructOrganizer().apply(stage);
 
        // Collect bindings from all stages into the shared stage's maps