diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.h b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.h index f183b430..e8baa947 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.h +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.h @@ -1774,9 +1774,9 @@ namespace MobileGL::MG_Backend::DirectVulkan { void ResolveOptionalDeviceExtensions(const Vector& availableExtensions, Vector& inOutEnabledExtensions); static Bool IsNecessaryDeviceExtensionSupported(VkPhysicalDevice device); - static Bool GetMoreCapablePhysicalDevice(VkPhysicalDevice newVkDevice, VkSurfaceKHR surface, - const PhysicalDevice& compareWithDevice, - PhysicalDevice& outBetterDevice, Bool requireHardware); + Bool GetMoreCapablePhysicalDevice(VkPhysicalDevice newVkDevice, VkSurfaceKHR surface, + const PhysicalDevice& compareWithDevice, PhysicalDevice& outBetterDevice, + Bool requireHardware); static constexpr const char* s_validationLayerNames[] = {"VK_LAYER_KHRONOS_validation"}; // VK_KHR_image_format_list: lets MUTABLE_FORMAT images declare their exact view-format // set so the driver can keep bandwidth compression (see CreateLogicalDeviceAndQueues). diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRendererDevice.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRendererDevice.cpp index 06c72c06..253897d5 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRendererDevice.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRendererDevice.cpp @@ -71,14 +71,18 @@ namespace MobileGL::MG_Backend::DirectVulkan { #endif namespace { - Bool IsHardwareDevice(VkPhysicalDevice device, const VkPhysicalDeviceProperties& properties) { + Bool IsHardwareDevice(VkInstance instance, VkPhysicalDevice device, + const VkPhysicalDeviceProperties& properties) { if (properties.apiVersion < VK_API_VERSION_1_1 || properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU) { return false; } if (properties.apiVersion >= VK_API_VERSION_1_2) { VkPhysicalDeviceDriverProperties driver{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES}; VkPhysicalDeviceProperties2 extended{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &driver}; - vkGetPhysicalDeviceProperties2(device, &extended); + const auto getProperties2 = reinterpret_cast( + vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2")); + if (!getProperties2) return false; + getProperties2(device, &extended); if (driver.driverID == VK_DRIVER_ID_GOOGLE_SWIFTSHADER || driver.driverID == VK_DRIVER_ID_MESA_LLVMPIPE) return false; } @@ -436,7 +440,7 @@ namespace MobileGL::MG_Backend::DirectVulkan { VK_VERSION_MINOR(apiVersion), VK_VERSION_PATCH(apiVersion), deviceTypeToStr(deviceProperties.deviceType)); - if (requireHardware && !IsHardwareDevice(newVkDevice, deviceProperties)) return false; + if (requireHardware && !IsHardwareDevice(m_instance, newVkDevice, deviceProperties)) return false; // Check device extensions (including swapchain extension) Bool deviceExtSupported = IsNecessaryDeviceExtensionSupported(newVkDevice);