mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
anv: fix enumeration of properties
Driver should enumerate only up-to min2(num_available, num_requested)
properties and return VK_INCOMPLETE if the # of requested props is
smaller than the ones available.
Presently we assert out in such cases.
Inspired by a similar fix for RADV.
v2: Use MIN2 + typed_memcpy (Jason).
Should fix: dEQP-VK.api.info.device.extensions
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 5cc07d854c)
This commit is contained in:
parent
c10e1fb440
commit
e692630755
1 changed files with 8 additions and 6 deletions
|
|
@ -1007,10 +1007,11 @@ VkResult anv_EnumerateInstanceExtensionProperties(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
assert(*pPropertyCount >= ARRAY_SIZE(global_extensions));
|
||||
*pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(global_extensions));
|
||||
typed_memcpy(pProperties, global_extensions, *pPropertyCount);
|
||||
|
||||
*pPropertyCount = ARRAY_SIZE(global_extensions);
|
||||
memcpy(pProperties, global_extensions, sizeof(global_extensions));
|
||||
if (*pPropertyCount < ARRAY_SIZE(global_extensions))
|
||||
return VK_INCOMPLETE;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
@ -1026,10 +1027,11 @@ VkResult anv_EnumerateDeviceExtensionProperties(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
assert(*pPropertyCount >= ARRAY_SIZE(device_extensions));
|
||||
*pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(device_extensions));
|
||||
typed_memcpy(pProperties, device_extensions, *pPropertyCount);
|
||||
|
||||
*pPropertyCount = ARRAY_SIZE(device_extensions);
|
||||
memcpy(pProperties, device_extensions, sizeof(device_extensions));
|
||||
if (*pPropertyCount < ARRAY_SIZE(device_extensions))
|
||||
return VK_INCOMPLETE;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue