diff options
author | dan sinclair <dj2@everburning.com> | 2019-03-17 16:11:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-17 16:11:51 -0700 |
commit | 6064a402932975f3d359b9798bc156886f6b18e8 (patch) | |
tree | a9336e3d119305e6bf09b0e2f0506719ab278bce /samples | |
parent | f9ccef4b3932b11f38e9ba93fbe951441573261e (diff) | |
download | amber-6064a402932975f3d359b9798bc156886f6b18e8.tar.gz |
[vulkan] Better error message when failing to make vulkan device. (#372)
This CL updates the sample app to list the requested extensions and
features when we fail to create a Vulkan device. This makes it a bit
clearer as to why the device creation failed.
Issue #336
Diffstat (limited to 'samples')
-rw-r--r-- | samples/config_helper_vulkan.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/samples/config_helper_vulkan.cc b/samples/config_helper_vulkan.cc index 0bf0ef5..23f07ab 100644 --- a/samples/config_helper_vulkan.cc +++ b/samples/config_helper_vulkan.cc @@ -19,6 +19,7 @@ #include <cstring> #include <iostream> #include <set> +#include <sstream> #include "samples/log.h" @@ -727,12 +728,11 @@ amber::Result ConfigHelperVulkan::ChooseVulkanPhysicalDevice( if (feature == kVariablePointers && var_ptrs.variablePointers != VK_TRUE) { - return amber::Result("Missing variable pointers feature"); + continue; } if (feature == kVariablePointersStorageBuffer && var_ptrs.variablePointersStorageBuffer != VK_TRUE) { - return amber::Result( - "Missing variable pointers storage buffer feature"); + continue; } } @@ -768,7 +768,14 @@ amber::Result ConfigHelperVulkan::ChooseVulkanPhysicalDevice( } } - return amber::Result("Vulkan::No physical device supports Vulkan"); + std::ostringstream out; + out << "Unable to find Vulkan device supporting:" << std::endl; + for (const auto& str : required_features) + out << " " << str << std::endl; + for (const auto& str : required_extensions) + out << " " << str << std::endl; + + return amber::Result(out.str()); } amber::Result ConfigHelperVulkan::CreateVulkanDevice( |