summaryrefslogtreecommitdiffstats
path: root/examples/hello-world/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hello-world/main.cpp')
-rw-r--r--examples/hello-world/main.cpp9
1 files changed, 8 insertions, 1 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++)
{