diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-11 13:11:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-11 13:11:15 -0700 |
| commit | e689d5ee8e9724fee018aa14be24f9679ec5c851 (patch) | |
| tree | b7aa24fddd41fe4e898a48984b23eae330964a62 /source/slang-glslang | |
| parent | 37223160be2543861bb795dc2d2d4cb6ac9843cb (diff) | |
Make sure glsl source in spirv is included when compiling with -g3 (#3099)
* Make sure glsl source in spirv is included when compiling with -g3.
* Exclude vulkan tests on github linux CI.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang-glslang')
| -rw-r--r-- | source/slang-glslang/slang-glslang.cpp | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/source/slang-glslang/slang-glslang.cpp b/source/slang-glslang/slang-glslang.cpp index 92a8d753b..bbf154a69 100644 --- a/source/slang-glslang/slang-glslang.cpp +++ b/source/slang-glslang/slang-glslang.cpp @@ -591,13 +591,35 @@ static int glslang_compileGLSLToSPIRV(const glslang_CompileRequest_1_2& request) int sourceTextLength = (int)(sourceTextEnd - sourceText); shader->setPreamble("#extension GL_GOOGLE_cpp_style_line_directive : require\n"); - shader->setStringsWithLengthsAndNames( &sourceText, &sourceTextLength, &request.sourcePath, 1); + // 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; + spvOptions.emitNonSemanticShaderDebugInfo = true; + shader->setDebugInfo(true); + } + + if (debugLevel == SLANG_DEBUG_INFO_LEVEL_MAXIMAL) + { + spvOptions.emitNonSemanticShaderDebugSource = true; + spvOptions.disableOptimizer = true; + request.optimizationLevel = SLANG_OPTIMIZATION_LEVEL_NONE; + } + + // Link program { const EShMessages messages = EShMessages(EShMsgSpvRules | EShMsgVulkanRules); @@ -625,30 +647,15 @@ static int glslang_compileGLSLToSPIRV(const glslang_CompileRequest_1_2& 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; - spvOptions.emitNonSemanticShaderDebugInfo = true; - } - - if (debugLevel == SLANG_DEBUG_INFO_LEVEL_MAXIMAL) - { - spvOptions.emitNonSemanticShaderDebugSource = true; - } - for(int stage = 0; stage < EShLangCount; ++stage) { auto stageIntermediate = program->getIntermediate((EShLanguage)stage); if(!stageIntermediate) continue; + if (debugLevel == SLANG_DEBUG_INFO_LEVEL_MAXIMAL) + { + stageIntermediate->addSourceText(sourceText, sourceTextLength); + } std::vector<unsigned int> spirv; spv::SpvBuildLogger logger; |
