diff options
| author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-12-25 02:27:57 -0300 |
|---|---|---|
| committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-12-31 02:07:33 -0300 |
| commit | 085adfea00a525796a3bf4b2dd345e1df656c930 (patch) | |
| tree | f606a6c4fb19bf3207e9fe36b692c7c17d3fcca9 /src/video_core/vulkan_common/vulkan_wrapper.cpp | |
| parent | 11f0f7598df993c717752030c05f7b1eca3c762c (diff) | |
renderer_vulkan: Throw when enumerating devices fails
Report device enumeration errors with exceptions to be consistent with
other initialization related function calls. Reduces the amount of code
to maintain.
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_wrapper.cpp')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index f4177537b..8698c3f92 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp @@ -465,17 +465,13 @@ Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char return Instance(instance, dispatch); } -std::optional<std::vector<VkPhysicalDevice>> Instance::EnumeratePhysicalDevices() const { +std::vector<VkPhysicalDevice> Instance::EnumeratePhysicalDevices() const { u32 num; - if (dld->vkEnumeratePhysicalDevices(handle, &num, nullptr) != VK_SUCCESS) { - return std::nullopt; - } + Check(dld->vkEnumeratePhysicalDevices(handle, &num, nullptr)); std::vector<VkPhysicalDevice> physical_devices(num); - if (dld->vkEnumeratePhysicalDevices(handle, &num, physical_devices.data()) != VK_SUCCESS) { - return std::nullopt; - } + Check(dld->vkEnumeratePhysicalDevices(handle, &num, physical_devices.data())); SortPhysicalDevices(physical_devices, *dld); - return std::make_optional(std::move(physical_devices)); + return physical_devices; } DebugUtilsMessenger Instance::CreateDebugUtilsMessenger( |
