summaryrefslogtreecommitdiff
path: root/source/slang-glslang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang-glslang')
-rw-r--r--source/slang-glslang/slang-glslang.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/source/slang-glslang/slang-glslang.cpp b/source/slang-glslang/slang-glslang.cpp
index e89581740..6cb6db995 100644
--- a/source/slang-glslang/slang-glslang.cpp
+++ b/source/slang-glslang/slang-glslang.cpp
@@ -399,14 +399,18 @@ static void glslang_optimizeSPIRV(spv_target_env targetEnv, const glslang_Compil
spvOptOptions.set_run_validator(false); // Don't run the validator by default
- // Put the output optimized spirv into optSpirv
- std::vector<unsigned int> optSpirv;
-
- // Optimize
- optimizer.Run(ioSpirv.data(), ioSpirv.size(), &optSpirv, spvOptOptions);
+ {
+ // Put the output optimized spirv into optSpirv
+ std::vector<unsigned int> optSpirv;
- // Make the ioSpirv the optimized spirv
- ioSpirv.swap(optSpirv);
+ // Optimize
+ if (optimizer.Run(ioSpirv.data(), ioSpirv.size(), &optSpirv, spvOptOptions))
+ {
+ assert(optSpirv.size() > 0);
+ // Make the ioSpirv the optimized spirv
+ ioSpirv.swap(optSpirv);
+ }
+ }
}
static glslang::EShTargetLanguageVersion _makeTargetLanguageVersion(int majorVersion, int minorVersion)
@@ -636,13 +640,6 @@ static int glslang_compileGLSLToSPIRV(const glslang_CompileRequest_1_1& request)
{
for (const auto& diag : optDiags)
{
- // TODO(JS):
- // Hack to stop CapabilityRayTracingMotionBlurNV outputting an error
- if (diag.level == SPV_MSG_ERROR && diag.message == "Invalid capability operand: 5341")
- {
- continue;
- }
-
// Count the number of errors
optErrorCount += int(diag.level <= SPV_MSG_ERROR);