* the real limit.
*/
p->maxPerSetDescriptors = 1024;
- p->maxMemoryAllocationSize = MAX_MEMORY_ALLOCATION_SIZE;
+
+ for (uint32_t i = 0; i < pdevice->memory.heap_count; i++) {
+ p->maxMemoryAllocationSize = MAX2(p->maxMemoryAllocationSize,
+ pdevice->memory.heaps[i].size);
+ }
}
static void
VkDeviceSize aligned_alloc_size =
align64(pAllocateInfo->allocationSize, 4096);
- if (aligned_alloc_size > MAX_MEMORY_ALLOCATION_SIZE)
- return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
-
assert(pAllocateInfo->memoryTypeIndex < pdevice->memory.type_count);
const struct anv_memory_type *mem_type =
&pdevice->memory.types[pAllocateInfo->memoryTypeIndex];
struct anv_memory_heap *mem_heap =
&pdevice->memory.heaps[mem_type->heapIndex];
+ if (aligned_alloc_size > mem_heap->size)
+ return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
+
uint64_t mem_heap_used = p_atomic_read(&mem_heap->used);
if (mem_heap_used + aligned_alloc_size > mem_heap->size)
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
*/
#define MAX_BINDING_TABLE_SIZE 240
-/* The kernel relocation API has a limitation of a 32-bit delta value
- * applied to the address before it is written which, in spite of it being
- * unsigned, is treated as signed . Because of the way that this maps to
- * the Vulkan API, we cannot handle an offset into a buffer that does not
- * fit into a signed 32 bits. The only mechanism we have for dealing with
- * this at the moment is to limit all VkDeviceMemory objects to a maximum
- * of 2GB each. The Vulkan spec allows us to do this:
- *
- * "Some platforms may have a limit on the maximum size of a single
- * allocation. For example, certain systems may fail to create
- * allocations with a size greater than or equal to 4GB. Such a limit is
- * implementation-dependent, and if such a failure occurs then the error
- * VK_ERROR_OUT_OF_DEVICE_MEMORY should be returned."
- */
-#define MAX_MEMORY_ALLOCATION_SIZE (1ull << 31)
-
#define ANV_SVGS_VB_INDEX MAX_VBS
#define ANV_DRAWID_VB_INDEX (MAX_VBS + 1)