summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-10-27 15:21:09 -0400
committerGitHub <noreply@github.com>2021-10-27 15:21:09 -0400
commit95654c371e1b1c1916751d5dcd0d1f3fbfdc12a0 (patch)
tree5321adebc05176d4d7df146d770bf3a8cbfef2d7 /source
parent76a1ec517b24a44c97c33d7e1d67adc5bd086b35 (diff)
SPIR-V fixes (#1992)
* #include an absolute path didn't work - because paths were taken to always be relative. * Use updated slang-binaries that have SPIR-V diagnostics improvements. * Re-enable nv-ray-tracing-motion-blur, because with SPIR-V diagnostic fixes in glslang - there shouldn't be spurious errors from glslang compilation. * If optimization fails use the SPIR-V we have. * Update SPIR-V headers and generated files. Updated documentation. * Update spirv-headers/tools. Revert slang-binaries. * Remove hack around spir-v optimization as no longer needed. disable nv-ray-tracing-motion-blur.slang
Diffstat (limited to 'source')
-rw-r--r--source/slang-glslang/slang-glslang.cpp25
-rw-r--r--source/slang/hlsl.meta.slang2
2 files changed, 13 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);
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 465a7633f..2e1ab33f2 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -4516,6 +4516,8 @@ void TraceRay(
// NOTE!
// The name of the following functions may change when DXR supports
// a feature similar to the `GL_NV_ray_tracing_motion_blur` extension
+//
+// https://github.com/KhronosGroup/GLSL/blob/master/extensions/nv/GLSL_NV_ray_tracing_motion_blur.txt
void TraceMotionRay<payload_t>(
RaytracingAccelerationStructure AccelerationStructure,