venus: clarify/fix device renderer version

Mostly docs and cleanups, except that renderer_version is now also
capped by the xml version.

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:
Chia-I Wu 2021-04-29 16:28:55 -07:00 committed by Marge Bot
parent 7f7742998e
commit d69f7b3e6a
2 changed files with 14 additions and 5 deletions

View file

@ -1603,7 +1603,8 @@ vn_physical_device_init_extensions(struct vn_physical_device *physical_dev)
}
static VkResult
vn_physical_device_init_version(struct vn_physical_device *physical_dev)
vn_physical_device_init_renderer_version(
struct vn_physical_device *physical_dev)
{
struct vn_instance *instance = physical_dev->instance;
@ -1623,9 +1624,10 @@ vn_physical_device_init_version(struct vn_physical_device *physical_dev)
return VK_ERROR_INITIALIZATION_FAILED;
}
physical_dev->renderer_version = props.apiVersion;
if (physical_dev->renderer_version > instance->renderer_api_version)
physical_dev->renderer_version = instance->renderer_api_version;
/* device version for internal use is capped */
physical_dev->renderer_version =
MIN3(props.apiVersion, instance->renderer_api_version,
instance->renderer_info.vk_xml_version);
return VK_SUCCESS;
}
@ -1636,7 +1638,7 @@ vn_physical_device_init(struct vn_physical_device *physical_dev)
struct vn_instance *instance = physical_dev->instance;
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
VkResult result = vn_physical_device_init_version(physical_dev);
VkResult result = vn_physical_device_init_renderer_version(physical_dev);
if (result != VK_SUCCESS)
return result;

View file

@ -74,7 +74,14 @@ struct vn_physical_device {
struct vn_instance *instance;
/* Between the driver and the app, properties.properties.apiVersion is what
* we advertise and is capped by VN_MAX_API_VERSION and others.
*
* Between the driver and the renderer, renderer_version is the device
* version we can use internally.
*/
uint32_t renderer_version;
struct vk_device_extension_table renderer_extensions;
uint32_t *extension_spec_versions;