]> git.tdb.fi Git - libs/gl.git/commitdiff
Don't run conversion passes when compiling a GLSL module
authorMikko Rasa <tdb@tdb.fi>
Tue, 18 Jul 2023 09:25:34 +0000 (12:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 18 Jul 2023 09:25:34 +0000 (12:25 +0300)
Such modules are intended to be later consumed by the same compiler, so
there's no need to convert them to a lower version.

source/glsl/compiler.cpp

index b746bb668406f2dcd371b177c962e003162d05a8..7355321ea2bf5511602e03e3d61fc5e805d2ca34 100644 (file)
@@ -117,10 +117,13 @@ void Compiler::compile(Mode mode)
                }
        }
 
-       for(Stage &s: module->stages)
+       if(mode!=MODULE)
        {
-               StructuralFeatureConverter().apply(s, features);
-               resolve(s, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS);
+               for(Stage &s: module->stages)
+               {
+                       StructuralFeatureConverter().apply(s, features);
+                       resolve(s, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS);
+               }
        }
        LocationAllocator().apply(*module, features);
        for(Stage &s: module->stages)
@@ -415,8 +418,11 @@ Compiler::OptimizeResult Compiler::optimize(Stage &stage)
 
 void Compiler::finalize(Stage &stage, Mode mode)
 {
-       QualifierConverter().apply(stage, features);
-       PrecisionConverter().apply(stage);
+       if(mode!=MODULE)
+       {
+               QualifierConverter().apply(stage, features);
+               PrecisionConverter().apply(stage);
+       }
        if(mode==SPIRV)
                StructOrganizer().apply(stage);