Skip to content

Draft: vulkan: Add helper for GetPhysicalDevicesFeature2

Alyssa Rosenzweig requested to merge alyssa/mesa:common-vk-features into main

Add a new helper, vk_set_physical_device_features, which implements the guts of vkGetPhysicalDevicesFeature2. The Vulkan API needs to be backwards compatible, so new extensions advertised via extension structures. vkGetPhysicalDevicesFeature2 must parse the relevant chain of extension structures to set the appropriate feature bits. However, our internal API between the Vulkan runtime and drivers does not need to be stable or backwards compatible. For internal purposes, it's much nicer to have a flat vk_features structure containing just the feature bits without the extension struct baggage.

This patch reconciles those worlds: an internal vk_features struct is added, for drivers to enumerate their full set of features, along with a common vk_set_physical_device_features helper to translate the flat internal representation to the chained public representation.

The actual implementations are generated in Python from the Vulkan XML, so this implementation can come out ahead on "tree line count" even for a single driver :-)

Draft because this is only build-tested. We could probably do something similar for GetPhysicalDeviceProperties2 but might be diminishing returns

Edited by Alyssa Rosenzweig

Merge request reports