mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
radv: add a size check in radv_create_buffer for Android
This is to make dEQP-VK.api.buffer.basic.size_max_uint64 pass on android. The test creates a buffer of size UINT64_MAX and makes sure the memory requirement for the buffer is sane. It fails because our memory requirement is "align64(UINT64_MAX, 16)" which is 0 after overflow. The test checks maintenance4's maxBufferSize and is skipped normally. But the extension can be disabled on an android build. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21346>
This commit is contained in:
parent
e13074d763
commit
4459668b6e
1 changed files with 8 additions and 0 deletions
|
|
@ -6820,6 +6820,14 @@ radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreate
|
|||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
|
||||
|
||||
#ifdef ANDROID
|
||||
/* reject buffers that are larger than maxBufferSize on Android, which
|
||||
* might not have VK_KHR_maintenance4
|
||||
*/
|
||||
if (pCreateInfo->size > RADV_MAX_MEMORY_ALLOCATION_SIZE)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
#endif
|
||||
|
||||
buffer = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*buffer), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (buffer == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue