diff options
| -rw-r--r-- | source/slang-glslang/slang-glslang.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/slang-glslang/slang-glslang.cpp b/source/slang-glslang/slang-glslang.cpp index 6cb6db995..0a9f2ec3b 100644 --- a/source/slang-glslang/slang-glslang.cpp +++ b/source/slang-glslang/slang-glslang.cpp @@ -619,6 +619,19 @@ static int glslang_compileGLSLToSPIRV(const glslang_CompileRequest_1_1& request) } } + // Options for compilation of glsl to Spv + + // spvOptions ctors with default options (this it the same as passing nullptr to GlslangToSpv) + glslang::SpvOptions spvOptions; + + const SlangDebugInfoLevel debugLevel = (SlangDebugInfoLevel)request.debugInfoType; + + // Enable generation of debug info, if any debug level other than none is requested + if (debugLevel != SLANG_DEBUG_INFO_LEVEL_NONE) + { + spvOptions.generateDebugInfo = true; + } + for(int stage = 0; stage < EShLangCount; ++stage) { auto stageIntermediate = program->getIntermediate((EShLanguage)stage); @@ -628,7 +641,10 @@ static int glslang_compileGLSLToSPIRV(const glslang_CompileRequest_1_1& request) std::vector<unsigned int> spirv; spv::SpvBuildLogger logger; - glslang::GlslangToSpv(*stageIntermediate, spirv, &logger); + // Copy options to make sure spvOptions not altered + glslang::SpvOptions copySpvOptions(spvOptions); + + glslang::GlslangToSpv(*stageIntermediate, spirv, &logger, ©SpvOptions); int optErrorCount = 0; |
