zink: fix instance/device versioning (for real this time)
the maximum allowable runtime version of vk can be computed by MIN(instance_version, device_version) despite this, instances and devices can be created using the maximum version available for each respective type. the restriction is applied only at the point of enabling/applying features and extensions, meaning that to correctly handle this, zink must: 1. create an instance using the maximum allowable version 2. select a physical device using the instance 3. compute MIN(instance_version, device_version) 4. only now begin to enable/use features requiring vk 1.1+ ref #4392 Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9479>
This commit is contained in:

committed by
Marge Bot

parent
1d70863c12
commit
5945d7d2e9
@@ -247,10 +247,6 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
%endfor
|
||||
uint32_t num_extensions = 0;
|
||||
|
||||
// get device API support
|
||||
vkGetPhysicalDeviceProperties(screen->pdev, &info->props);
|
||||
info->device_version = info->props.apiVersion;
|
||||
|
||||
// get device memory properties
|
||||
vkGetPhysicalDeviceMemoryProperties(screen->pdev, &info->mem_props);
|
||||
|
||||
@@ -268,7 +264,7 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
%if ext.core_since:
|
||||
%for version in versions:
|
||||
%if ext.core_since.struct_version == version.struct_version:
|
||||
if (${version.version()} >= info->device_version) {
|
||||
if (${version.version()} >= screen->vk_version) {
|
||||
%if not (ext.has_features or ext.has_properties):
|
||||
info->have_${ext.name_with_vendor()} = true;
|
||||
%else:
|
||||
@@ -305,7 +301,7 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
info->feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
|
||||
|
||||
%for version in versions:
|
||||
if (${version.version()} <= info->device_version) {
|
||||
if (${version.version()} <= screen->vk_version) {
|
||||
info->feats${version.struct()}.sType = ${version.stype("FEATURES")};
|
||||
info->feats${version.struct()}.pNext = info->feats.pNext;
|
||||
info->feats.pNext = &info->feats${version.struct()};
|
||||
@@ -336,7 +332,7 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
|
||||
%for version in versions:
|
||||
if (${version.version()} <= info->device_version) {
|
||||
if (${version.version()} <= screen->vk_version) {
|
||||
info->props${version.struct()}.sType = ${version.stype("PROPERTIES")};
|
||||
info->props${version.struct()}.pNext = props.pNext;
|
||||
props.pNext = &info->props${version.struct()};
|
||||
|
Reference in New Issue
Block a user