From 38178d34b523b4663b73dd763c9a907b74591035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 5 May 2023 00:03:20 +0200 Subject: [PATCH] Sanity checks in InitSwapchain --- Common/GPU/Vulkan/VulkanContext.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Common/GPU/Vulkan/VulkanContext.cpp b/Common/GPU/Vulkan/VulkanContext.cpp index c1531801cacb..e57345cfab6d 100644 --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -1199,6 +1199,12 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans } bool VulkanContext::InitSwapchain() { + _assert_(physical_device_ >= 0 && physical_device_ < physical_devices_.size()); + if (!surface_) { + ERROR_LOG(G3D, "VK: No surface, can't create swapchain"); + return false; + } + VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_); if (res == VK_ERROR_SURFACE_LOST_KHR) { // Not much to do.