mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
venus: add VN_MAX_API_VERSION
Use VN_MAX_API_VERSION for the instance version such that we don't suddenly advertise 1.3 when the header is updated to 1.3 for example. Use it to cap the device version as well. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>
This commit is contained in:
parent
38e0067643
commit
773e318569
1 changed files with 16 additions and 10 deletions
|
|
@ -30,6 +30,13 @@
|
|||
*/
|
||||
#define VN_MIN_RENDERER_VERSION VK_API_VERSION_1_1
|
||||
|
||||
/* max advertised version at both instance and device levels */
|
||||
#ifdef ANDROID
|
||||
#define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 1, VK_HEADER_VERSION)
|
||||
#else
|
||||
#define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 2, VK_HEADER_VERSION)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Instance extensions add instance-level or physical-device-level
|
||||
* functionalities. It seems renderer support is either unnecessary or
|
||||
|
|
@ -1239,15 +1246,14 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
|
|||
if (version_override) {
|
||||
props->apiVersion = version_override;
|
||||
} else {
|
||||
if (props->apiVersion > VK_HEADER_VERSION_COMPLETE)
|
||||
props->apiVersion = VK_HEADER_VERSION_COMPLETE;
|
||||
if (props->apiVersion > vn_info_vk_xml_version())
|
||||
props->apiVersion = vn_info_vk_xml_version();
|
||||
#ifdef ANDROID
|
||||
if (props->apiVersion >= VK_API_VERSION_1_2)
|
||||
props->apiVersion =
|
||||
VK_MAKE_VERSION(1, 1, VK_VERSION_PATCH(props->apiVersion));
|
||||
#endif
|
||||
/* cap the advertised api version */
|
||||
uint32_t version = MIN3(props->apiVersion, VN_MAX_API_VERSION,
|
||||
instance->renderer_info.vk_xml_version);
|
||||
if (VK_VERSION_PATCH(version) > VK_VERSION_PATCH(props->apiVersion)) {
|
||||
version = version - VK_VERSION_PATCH(version) +
|
||||
VK_VERSION_PATCH(props->apiVersion);
|
||||
}
|
||||
props->apiVersion = version;
|
||||
}
|
||||
|
||||
props->driverVersion = vk_get_driver_version();
|
||||
|
|
@ -1770,7 +1776,7 @@ out:
|
|||
VkResult
|
||||
vn_EnumerateInstanceVersion(uint32_t *pApiVersion)
|
||||
{
|
||||
*pApiVersion = VK_HEADER_VERSION_COMPLETE;
|
||||
*pApiVersion = VN_MAX_API_VERSION;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue