summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/precompiled-module-2.cpp
diff options
context:
space:
mode:
authorcheneym2 <acheney@nvidia.com>2025-03-11 14:12:33 -0400
committerGitHub <noreply@github.com>2025-03-11 11:12:33 -0700
commit5d6578b9d58d7ad46503d9124cccf8a68ecd5902 (patch)
tree4582cea2e4f47d63b39c2afc34c7497fc54c8bf5 /tools/gfx-unit-test/precompiled-module-2.cpp
parentf59e0ef409844f2514435a8df8ceeff3663e5db3 (diff)
Don't crash when precompiling twice (#6576)
Abort precompileForTarget if it's already done. Fixes #6516
Diffstat (limited to 'tools/gfx-unit-test/precompiled-module-2.cpp')
-rw-r--r--tools/gfx-unit-test/precompiled-module-2.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/gfx-unit-test/precompiled-module-2.cpp b/tools/gfx-unit-test/precompiled-module-2.cpp
index 792f328b0..87420aa6e 100644
--- a/tools/gfx-unit-test/precompiled-module-2.cpp
+++ b/tools/gfx-unit-test/precompiled-module-2.cpp
@@ -59,8 +59,15 @@ static Slang::Result precompileProgram(
(void**)precompileService.writeRef()) == SLANG_OK)
{
Slang::ComPtr<slang::IBlob> diagnosticsBlob;
- precompileService->precompileForTarget(target, diagnosticsBlob.writeRef());
+ auto res = precompileService->precompileForTarget(target, diagnosticsBlob.writeRef());
diagnoseIfNeeded(diagnosticsBlob);
+ SLANG_RETURN_ON_FAIL(res);
+
+ // compile a second time to check for driver bugs.
+ diagnosticsBlob = nullptr;
+ res = precompileService->precompileForTarget(target, diagnosticsBlob.writeRef());
+ diagnoseIfNeeded(diagnosticsBlob);
+ SLANG_RETURN_ON_FAIL(res);
}
}