mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 23:18:20 +02:00
anv: Return VK_ERROR_OUT_OF_DEVICE_MEMORY for too-large buffers
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
e3b249f166
commit
865ffe4e02
1 changed files with 9 additions and 0 deletions
|
|
@ -3912,8 +3912,17 @@ VkResult anv_CreateBuffer(
|
|||
VkBuffer* pBuffer)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
struct anv_physical_device *pdevice = &device->instance->physicalDevice;
|
||||
struct anv_buffer *buffer;
|
||||
|
||||
/* Don't allow creating buffers bigger than our address space. The real
|
||||
* issue here is that we may align up the buffer size and we don't want
|
||||
* doing so to cause roll-over. However, no one has any business
|
||||
* allocating a buffer larger than our GTT size.
|
||||
*/
|
||||
if (pCreateInfo->size > pdevice->gtt_size)
|
||||
return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
|
||||
|
||||
buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue