Add support for VK_KHR_portability_enumeration

The use of this extension is required to enable the MoltenVK physical
device as of Vulkan SDK 1.3.216.0.  This is because MoltenVK is still
very (very) slightly non-conformant.
This commit is contained in:
Camilla Löwy
2022-07-06 23:07:20 +02:00
parent 510a08cde2
commit 3b3d58df47
2 changed files with 96 additions and 45 deletions

View File

@@ -1561,6 +1561,7 @@ static VkBool32 demo_check_layers(uint32_t check_count, const char **check_names
static void demo_init_vk(struct demo *demo) {
VkResult err;
VkBool32 portability_enumeration = VK_FALSE;
uint32_t i = 0;
uint32_t required_extension_count = 0;
uint32_t instance_extension_count = 0;
@@ -1668,6 +1669,13 @@ static void demo_init_vk(struct demo *demo) {
}
}
assert(demo->enabled_extension_count < 64);
if (!strcmp(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME,
instance_extensions[i].extensionName)) {
demo->extension_names[demo->enabled_extension_count++] =
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME;
portability_enumeration = VK_TRUE;
}
assert(demo->enabled_extension_count < 64);
}
free(instance_extensions);
@@ -1692,6 +1700,9 @@ static void demo_init_vk(struct demo *demo) {
.ppEnabledExtensionNames = (const char *const *)demo->extension_names,
};
if (portability_enumeration)
inst_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
uint32_t gpu_count;
err = vkCreateInstance(&inst_info, NULL, &demo->inst);