From d1d52ca74a5f7a814a30128ba9653b53960a8d9b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 18 Jul 2023 12:25:34 +0300 Subject: [PATCH] Don't run conversion passes when compiling a GLSL module 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/glsl/compiler.cpp b/source/glsl/compiler.cpp index b746bb66..7355321e 100644 --- a/source/glsl/compiler.cpp +++ b/source/glsl/compiler.cpp @@ -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); -- 2.45.2