vulkan: Start collecting enabled features in vk_device

We're not trying to make this 100% complete.  For now, all we care about
is robustBufferAccess.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16276>
This commit is contained in:
Jason Ekstrand 2022-05-04 22:55:26 -05:00 committed by Marge Bot
parent a463c58e22
commit 6899cd2b6e
2 changed files with 31 additions and 0 deletions

View file

@ -75,6 +75,31 @@ get_timeline_mode(struct vk_physical_device *physical_device)
return VK_DEVICE_TIMELINE_MODE_ASSISTED;
}
static void
collect_enabled_features(struct vk_device *device,
const VkDeviceCreateInfo *pCreateInfo)
{
if (pCreateInfo->pEnabledFeatures) {
if (pCreateInfo->pEnabledFeatures->robustBufferAccess)
device->enabled_features.robustBufferAccess = true;
}
vk_foreach_struct_const(ext, pCreateInfo->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: {
const VkPhysicalDeviceFeatures2 *features = (const void *)ext;
if (features->features.robustBufferAccess)
device->enabled_features.robustBufferAccess = true;
break;
}
default:
/* Don't warn */
break;
}
}
}
VkResult
vk_device_init(struct vk_device *device,
struct vk_physical_device *physical_device,
@ -131,6 +156,8 @@ vk_device_init(struct vk_device *device,
if (result != VK_SUCCESS)
return result;
collect_enabled_features(device, pCreateInfo);
p_atomic_set(&device->private_data_next_index, 0);
list_inithead(&device->queues);

View file

@ -103,6 +103,10 @@ struct vk_device {
/** Table of enabled extensions */
struct vk_device_extension_table enabled_extensions;
struct {
bool robustBufferAccess;
} enabled_features;
/** Device-level dispatch table */
struct vk_device_dispatch_table dispatch_table;