diff options
| author | 2020-12-25 02:42:03 -0300 | |
|---|---|---|
| committer | 2020-12-31 02:07:33 -0300 | |
| commit | 53ea06dc17ccf9232aa3326a4621500058f9d253 (patch) | |
| tree | 944449c1810bd515d2b7882c2b2b15cf4a32f9e7 /src/video_core/vulkan_common | |
| parent | renderer_vulkan: Throw when enumerating devices fails (diff) | |
| download | yuzu-53ea06dc17ccf9232aa3326a4621500058f9d253.tar.gz yuzu-53ea06dc17ccf9232aa3326a4621500058f9d253.tar.xz yuzu-53ea06dc17ccf9232aa3326a4621500058f9d253.zip | |
renderer_vulkan: Remove two step initialization on VKDevice
The Vulkan device abstraction either initializes successfully on the
constructor or throws a Vulkan exception.
Diffstat (limited to 'src/video_core/vulkan_common')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.h | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index 8698c3f92..5e15ad607 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp | |||
| @@ -580,7 +580,7 @@ void Semaphore::SetObjectNameEXT(const char* name) const { | |||
| 580 | 580 | ||
| 581 | Device Device::Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, | 581 | Device Device::Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, |
| 582 | Span<const char*> enabled_extensions, const void* next, | 582 | Span<const char*> enabled_extensions, const void* next, |
| 583 | DeviceDispatch& dispatch) noexcept { | 583 | DeviceDispatch& dispatch) { |
| 584 | const VkDeviceCreateInfo ci{ | 584 | const VkDeviceCreateInfo ci{ |
| 585 | .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, | 585 | .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, |
| 586 | .pNext = next, | 586 | .pNext = next, |
| @@ -593,11 +593,8 @@ Device Device::Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreate | |||
| 593 | .ppEnabledExtensionNames = enabled_extensions.data(), | 593 | .ppEnabledExtensionNames = enabled_extensions.data(), |
| 594 | .pEnabledFeatures = nullptr, | 594 | .pEnabledFeatures = nullptr, |
| 595 | }; | 595 | }; |
| 596 | |||
| 597 | VkDevice device; | 596 | VkDevice device; |
| 598 | if (dispatch.vkCreateDevice(physical_device, &ci, nullptr, &device) != VK_SUCCESS) { | 597 | Check(dispatch.vkCreateDevice(physical_device, &ci, nullptr, &device)); |
| 599 | return {}; | ||
| 600 | } | ||
| 601 | Load(device, dispatch); | 598 | Load(device, dispatch); |
| 602 | return Device(device, dispatch); | 599 | return Device(device, dispatch); |
| 603 | } | 600 | } |
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h index af3083c84..912cab46c 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.h +++ b/src/video_core/vulkan_common/vulkan_wrapper.h | |||
| @@ -796,7 +796,7 @@ class Device : public Handle<VkDevice, NoOwner, DeviceDispatch> { | |||
| 796 | public: | 796 | public: |
| 797 | static Device Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, | 797 | static Device Create(VkPhysicalDevice physical_device, Span<VkDeviceQueueCreateInfo> queues_ci, |
| 798 | Span<const char*> enabled_extensions, const void* next, | 798 | Span<const char*> enabled_extensions, const void* next, |
| 799 | DeviceDispatch& dispatch) noexcept; | 799 | DeviceDispatch& dispatch); |
| 800 | 800 | ||
| 801 | Queue GetQueue(u32 family_index) const noexcept; | 801 | Queue GetQueue(u32 family_index) const noexcept; |
| 802 | 802 | ||