mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
aux/vk: Refactor out optional extension handling
This commit is contained in:
parent
57d24ecdbb
commit
bf27691280
|
@ -1129,6 +1129,22 @@ vk_check_extension(struct vk_bundle *vk, VkExtensionProperties *props, uint32_t
|
|||
{
|
||||
for (uint32_t i = 0; i < num_props; i++) {
|
||||
if (strcmp(props[i].extensionName, ext) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
fill_in_has_extensions(struct vk_bundle *vk, const char **device_extensions, uint32_t num_device_extensions)
|
||||
{
|
||||
// Reset before filling out.
|
||||
vk->has_GOOGLE_display_timing = false;
|
||||
vk->has_EXT_global_priority = false;
|
||||
|
||||
for (uint32_t i = 0; i < num_device_extensions; i++) {
|
||||
const char *ext = device_extensions[i];
|
||||
|
||||
if (strcmp(ext, VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME) == 0) {
|
||||
vk->has_GOOGLE_display_timing = true;
|
||||
|
@ -1136,12 +1152,7 @@ vk_check_extension(struct vk_bundle *vk, VkExtensionProperties *props, uint32_t
|
|||
if (strcmp(ext, VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME) == 0) {
|
||||
vk->has_EXT_global_priority = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
@ -1207,6 +1218,9 @@ vk_build_device_extensions(struct vk_bundle *vk,
|
|||
}
|
||||
}
|
||||
|
||||
// Fill this out here.
|
||||
fill_in_has_extensions(vk, device_extensions, num_device_extensions);
|
||||
|
||||
free(props);
|
||||
|
||||
*out_device_extensions = device_extensions;
|
||||
|
|
Loading…
Reference in a new issue