diff options
author | Jason Ekstrand <[email protected]> | 2019-11-25 10:27:02 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-12-06 22:32:05 +0000 |
commit | 865ffe4e02038104481530e156380a9b0ae20fa1 (patch) | |
tree | 0ce5f1995aec265594176aec8bb7b132e25b633f /src/intel | |
parent | e3b249f1665612cab63795cfee4dd54ec7f513f6 (diff) |
anv: Return VK_ERROR_OUT_OF_DEVICE_MEMORY for too-large buffers
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 027a908f8e7..210136bb500 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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, |