From 23044c8e43a7b900d556b09079c1b1c2660b05a0 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Tue, 19 Apr 2022 16:28:47 -0400 Subject: [PATCH] Enable VK_KHR_portability_enumeration for macOS on Vulkan SDK 1.3.211.0 or later --- neo/renderer/Vulkan/RenderBackend_VK.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neo/renderer/Vulkan/RenderBackend_VK.cpp b/neo/renderer/Vulkan/RenderBackend_VK.cpp index f147ba01..0e47dad8 100644 --- a/neo/renderer/Vulkan/RenderBackend_VK.cpp +++ b/neo/renderer/Vulkan/RenderBackend_VK.cpp @@ -309,8 +309,15 @@ static void CreateVulkanInstance() { vkcontext.instanceExtensions.AddUnique( VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME ); vkcontext.deviceProperties2Available = true; - break; } +#if defined(__APPLE__) && defined( VK_KHR_portability_enumeration ) + // SRS - Enable physical device enumeration when using the Vulkan loader on macOS (MoltenVK portability driver) + if( idStr::Icmp( instanceExtensionProps[ i ].extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME ) == 0 ) + { + vkcontext.instanceExtensions.AddUnique( VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME ); + createInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; + } +#endif } vkcontext.debugUtilsSupportAvailable = false;