diff options
| author | Yong He <yonghe@outlook.com> | 2023-10-09 14:03:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-09 14:03:43 -0700 |
| commit | 67e186f0169591c48d24bd8ff7e4e4e715e8fa45 (patch) | |
| tree | 9b46dc35145d18d5b25d9b3b16759c9b7343615c /source/slang/slang-emit-spirv.cpp | |
| parent | 17c7163c2ae8fc290e70b43d8700b68ef18b1ee1 (diff) | |
Run curated spirv-opt passes through slang-glslang. (#3266)
* Run curated spirv-opt passes through slang-glslang.
* Cleanup.
* Replace spirv-dis downstream compiler with glslang.
* delete slang-spirv-opt.cpp.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 6d71f1a2c..16a88b8af 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -4815,18 +4815,22 @@ SlangResult emitSPIRVFromIR( (uint8_t const*) context.m_words.getBuffer(), context.m_words.getCount() * Index(sizeof(context.m_words[0]))); - const auto validationResult = debugValidateSPIRV(spirvOut); - // If validation isn't available, don't say it failed, it's just a debug - // feature so we can skip - if(SLANG_FAILED(validationResult) && validationResult != SLANG_E_NOT_AVAILABLE) + StringBuilder runSpirvValEnvVar; + PlatformUtil::getEnvironmentVariable(UnownedStringSlice("SLANG_RUN_SPIRV_VALIDATION"), runSpirvValEnvVar); + if (runSpirvValEnvVar.getUnownedSlice() == "1") { - codeGenContext->getSink()->diagnoseWithoutSourceView( - SourceLoc{}, - Diagnostics::spirvValidationFailed - ); - return validationResult; + const auto validationResult = debugValidateSPIRV(spirvOut); + // If validation isn't available, don't say it failed, it's just a debug + // feature so we can skip + if (SLANG_FAILED(validationResult) && validationResult != SLANG_E_NOT_AVAILABLE) + { + codeGenContext->getSink()->diagnoseWithoutSourceView( + SourceLoc{}, + Diagnostics::spirvValidationFailed + ); + return validationResult; + } } - return SLANG_OK; } |
