summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/hello-world/main.cpp9
-rw-r--r--examples/ray-tracing-pipeline/main.cpp4
-rw-r--r--examples/ray-tracing/main.cpp4
-rw-r--r--tests/expected-example-failure-github.txt5
-rw-r--r--tools/gfx/d3d12/d3d12-device.cpp1
5 files changed, 19 insertions, 4 deletions
diff --git a/examples/hello-world/main.cpp b/examples/hello-world/main.cpp
index 7e84d83e5..7e4211b12 100644
--- a/examples/hello-world/main.cpp
+++ b/examples/hello-world/main.cpp
@@ -80,7 +80,11 @@ int main(int argc, char* argv[])
int HelloWorldExample::run()
{
- RETURN_ON_FAIL(initVulkanInstanceAndDevice());
+ // If VK failed to initialize, skip running but return success anyway.
+ // This allows our automated testing to distinguish between essential failures and the
+ // case where the application is just not supported.
+ if (int result = initVulkanInstanceAndDevice())
+ return (vkAPI.device == VK_NULL_HANDLE) ? 0 : result;
RETURN_ON_FAIL(createComputePipelineFromShader());
RETURN_ON_FAIL(createInOutBuffers());
RETURN_ON_FAIL(dispatchCompute());
@@ -511,6 +515,9 @@ int HelloWorldExample::printComputeResults()
HelloWorldExample::~HelloWorldExample()
{
+ if (vkAPI.device == VK_NULL_HANDLE)
+ return;
+
vkAPI.vkDestroyPipeline(vkAPI.device, pipeline, nullptr);
for (int i = 0; i < 3; i++)
{
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;
diff --git a/examples/ray-tracing/main.cpp b/examples/ray-tracing/main.cpp
index 11529a753..6b908a14e 100644
--- a/examples/ray-tracing/main.cpp
+++ b/examples/ray-tracing/main.cpp
@@ -373,12 +373,16 @@ struct RayTracing : public WindowedAppBase
asDraftBufferDesc.defaultState = ResourceState::AccelerationStructure;
asDraftBufferDesc.sizeInBytes = 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;
scratchBufferDesc.sizeInBytes = accelerationStructurePrebuildInfo.scratchDataSize;
ComPtr<IBufferResource> scratchBuffer =
gDevice->createBufferResource(scratchBufferDesc);
+ if (!scratchBuffer)
+ return SLANG_FAIL;
// Build acceleration structure.
ComPtr<IQueryPool> compactedSizeQuery;
diff --git a/tests/expected-example-failure-github.txt b/tests/expected-example-failure-github.txt
index ee3ad2fa1..7801ee564 100644
--- a/tests/expected-example-failure-github.txt
+++ b/tests/expected-example-failure-github.txt
@@ -11,6 +11,5 @@ macos:aarch64:(debug|release):hello-world # See issue 5520
macos:aarch64:(debug|release):model-viewer # See issue 5520
macos:aarch64:(debug|release):ray-tracing # See issue 5520
macos:aarch64:(debug|release):ray-tracing-pipeline # See issue 5520
-windows:x86_64:debug:hello-world # See issue 5520
-windows:x86_64:debug:ray-tracing # See issue 5520
-windows:x86_64:debug:ray-tracing-pipeline # See issue 5520
+windows:x86_64:debug:ray-tracing # See issue 5988
+windows:x86_64:debug:ray-tracing-pipeline # See issue 5988
diff --git a/tools/gfx/d3d12/d3d12-device.cpp b/tools/gfx/d3d12/d3d12-device.cpp
index cb5404961..35192fd7d 100644
--- a/tools/gfx/d3d12/d3d12-device.cpp
+++ b/tools/gfx/d3d12/d3d12-device.cpp
@@ -2231,6 +2231,7 @@ Result DeviceImpl::createAccelerationStructure(
IAccelerationStructure** outAS)
{
#if SLANG_GFX_HAS_DXR_SUPPORT
+ assert(desc.buffer != nullptr);
RefPtr<AccelerationStructureImpl> result = new AccelerationStructureImpl();
result->m_device5 = m_device5;
result->m_buffer = static_cast<BufferResourceImpl*>(desc.buffer);