@@ -124,10 +124,11 @@ namespace vk
124124 }
125125
126126#ifdef __APPLE__
127+ extensions.push_back (VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
128+ extensions.push_back (VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
127129 if (support.is_supported (VK_EXT_LAYER_SETTINGS_EXTENSION_NAME))
128130 {
129131 extensions.push_back (VK_EXT_LAYER_SETTINGS_EXTENSION_NAME);
130- layers.push_back (kMVKMoltenVKDriverLayerName );
131132
132133 mvk_settings.push_back (VkLayerSettingEXT{ kMVKMoltenVKDriverLayerName , " MVK_CONFIG_RESUME_LOST_DEVICE" , VK_LAYER_SETTING_TYPE_BOOL32_EXT, 1 , &setting_true });
133134 mvk_settings.push_back (VkLayerSettingEXT{ kMVKMoltenVKDriverLayerName , " MVK_CONFIG_FAST_MATH_ENABLED" , VK_LAYER_SETTING_TYPE_INT32_EXT, 1 , &setting_fast_math });
@@ -154,7 +155,7 @@ namespace vk
154155#ifdef _WIN32
155156 extensions.push_back (VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
156157#elif defined(__APPLE__)
157- extensions.push_back (VK_MVK_MACOS_SURFACE_EXTENSION_NAME );
158+ extensions.push_back (VK_EXT_METAL_SURFACE_EXTENSION_NAME );
158159#else
159160 bool found_surface_ext = false ;
160161#ifdef HAVE_X11
@@ -187,15 +188,32 @@ namespace vk
187188 if (g_cfg.video .debug_output )
188189 layers.push_back (" VK_LAYER_KHRONOS_validation" );
189190 }
191+ #ifdef __APPLE__
192+ // MoltenVK's ICD will not be detected without these extensions enabled.
193+ else
194+ {
195+ extensions_loaded = true ;
196+ extensions.push_back (VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
197+ extensions.push_back (VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
198+ }
199+ #endif
190200
191201 VkInstanceCreateInfo instance_info = {};
192202 instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
193203 instance_info.pApplicationInfo = &app;
194204 instance_info.enabledLayerCount = static_cast <u32 >(layers.size ());
195205 instance_info.ppEnabledLayerNames = layers.data ();
206+ #ifdef __APPLE__
207+ instance_info.enabledExtensionCount = static_cast <u32 >(extensions.size ());
208+ instance_info.ppEnabledExtensionNames = extensions.data ();
209+ #else
196210 instance_info.enabledExtensionCount = fast ? 0 : static_cast <u32 >(extensions.size ());
197211 instance_info.ppEnabledExtensionNames = fast ? nullptr : extensions.data ();
212+ #endif
198213 instance_info.pNext = next_info;
214+ #ifdef __APPLE__
215+ instance_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
216+ #endif
199217
200218 if (VkResult result = vkCreateInstance (&instance_info, nullptr , &m_instance); result != VK_SUCCESS)
201219 {
0 commit comments