Skip to content

Commit d53baba

Browse files
committed
Fix vkCreateInstance failure for Vulkan 1.3 or higher on macOS
1 parent cf8604e commit d53baba

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ if (PATHFINDER_BACKEND_VULKAN)
4848

4949
# Don't use add_compile_definitions, which doesn't propagate to parent projects.
5050
target_compile_definitions(pathfinder PRIVATE PATHFINDER_USE_VULKAN)
51+
52+
# Enable this for Vulkan 1.3 and higher on macOS.
53+
if (APPLE)
54+
target_compile_definitions(pathfinder PRIVATE PATHFINDER_VKB_ENABLE_PORTABILITY)
55+
endif ()
5156
else ()
5257
message("[Pathfinder] Disabled Vulkan backend")
5358
endif ()

pathfinder/gpu/vk/window_builder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ void WindowBuilderVk::create_instance() {
189189
const auto extensions = get_required_instance_extensions();
190190
instance_info.enabledExtensionCount = static_cast<uint32_t>(extensions.size());
191191
instance_info.ppEnabledExtensionNames = extensions.data();
192+
#ifdef PATHFINDER_VKB_ENABLE_PORTABILITY
193+
instance_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
194+
#endif
192195

193196
VkDebugUtilsMessengerCreateInfoEXT debug_create_info;
194197
if (enable_validation_layers_) {
@@ -390,6 +393,10 @@ std::vector<const char *> WindowBuilderVk::get_required_instance_extensions() {
390393
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
391394
}
392395

396+
#ifdef PATHFINDER_VKB_ENABLE_PORTABILITY
397+
extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
398+
#endif
399+
393400
return extensions;
394401
}
395402

0 commit comments

Comments
 (0)