diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-01-07 12:51:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 10:51:51 +0000 |
| commit | 7d4142e6aca5257602a7d82db5625adbb6fbc832 (patch) | |
| tree | ae8271dbaa2ad5bafb64a5fc24a5a66b867346f5 /examples/ray-tracing-pipeline | |
| parent | 5621ace93b7665051f7e7c8a2fa68ceaf285ff8d (diff) | |
Fix some robustness issues in the examples (#5984)
* examples: Make hello-world example exit gracefully if VK cannot be initialized
- Check if VK API function pointers are valid before using them
- Return 0 and exit if VK initialization fails
- Enable hello-world example
* examples: Fixes for ray-tracing examples
- Assert that accelleration structure buffer is not nullptr
- Check if buffer creation succeeded before proceeding
- This makes initialization not hang, but it still fails.
Therefore, the test expectations are just updated to point to another issue.
- Enable ray-tracing tests on Windows
Diffstat (limited to 'examples/ray-tracing-pipeline')
| -rw-r--r-- | examples/ray-tracing-pipeline/main.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/ray-tracing-pipeline/main.cpp b/examples/ray-tracing-pipeline/main.cpp index 0fbb857f0..a288e75b5 100644 --- a/examples/ray-tracing-pipeline/main.cpp +++ b/examples/ray-tracing-pipeline/main.cpp @@ -382,6 +382,8 @@ struct RayTracing : public WindowedAppBase asDraftBufferDesc.sizeInBytes = (size_t)accelerationStructurePrebuildInfo.resultDataMaxSize; ComPtr<IBufferResource> draftBuffer = gDevice->createBufferResource(asDraftBufferDesc); + if (!draftBuffer) + return SLANG_FAIL; IBufferResource::Desc scratchBufferDesc; scratchBufferDesc.type = IResource::Type::Buffer; scratchBufferDesc.defaultState = ResourceState::UnorderedAccess; @@ -389,6 +391,8 @@ struct RayTracing : public WindowedAppBase (size_t)accelerationStructurePrebuildInfo.scratchDataSize; ComPtr<IBufferResource> scratchBuffer = gDevice->createBufferResource(scratchBufferDesc); + if (!scratchBuffer) + return SLANG_FAIL; // Build acceleration structure. ComPtr<IQueryPool> compactedSizeQuery; |
