vallium: limit buffer allocations to gallium max.

Don't allocate buffers greater than gallium can handle.

Fixes:
dEQP-VK.api.buffer.basic.size_max_uint64

Fixes: b38879f8c5 ("vallium: initial import of the vulkan frontend")

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6381>
This commit is contained in:
Dave Airlie 2020-07-17 11:30:25 +10:00
parent 857008850f
commit 668e4c2356

View file

@ -198,6 +198,10 @@ VkResult val_CreateBuffer(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
/* gallium has max 32-bit buffer sizes */
if (pCreateInfo->size > UINT32_MAX)
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (buffer == NULL)