mai.pNext = NULL;
mai.allocationSize = reqs.size;
enum zink_heap heap = zink_heap_from_domain_flags(flags, aflags);
- mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits);
- if (mai.memoryTypeIndex == UINT32_MAX) {
- /* not valid based on reqs; demote to more compatible type */
- switch (heap) {
- case ZINK_HEAP_DEVICE_LOCAL_VISIBLE:
- heap = ZINK_HEAP_DEVICE_LOCAL;
- break;
- case ZINK_HEAP_HOST_VISIBLE_CACHED:
- heap = ZINK_HEAP_HOST_VISIBLE_COHERENT;
- break;
- default:
- break;
- }
- mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits);
- assert(mai.memoryTypeIndex != UINT32_MAX);
- }
- assert(reqs.memoryTypeBits & BITFIELD_BIT(mai.memoryTypeIndex));
VkMemoryDedicatedAllocateInfo ded_alloc_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
if (templ->usage == PIPE_USAGE_STAGING && obj->is_buffer)
alignment = MAX2(alignment, screen->info.props.limits.minMemoryMapAlignment);
obj->alignment = alignment;
+
+ mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits);
+ if (mai.memoryTypeIndex == UINT32_MAX) {
+ /* not valid based on reqs; demote to more compatible type */
+ switch (heap) {
+ case ZINK_HEAP_DEVICE_LOCAL_VISIBLE:
+ heap = ZINK_HEAP_DEVICE_LOCAL;
+ break;
+ case ZINK_HEAP_HOST_VISIBLE_CACHED:
+ heap = ZINK_HEAP_HOST_VISIBLE_COHERENT;
+ break;
+ default:
+ break;
+ }
+ mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits);
+ assert(mai.memoryTypeIndex != UINT32_MAX);
+ }
+ assert(reqs.memoryTypeBits & BITFIELD_BIT(mai.memoryTypeIndex));
+
retry:
obj->bo = zink_bo(zink_bo_create(screen, reqs.size, alignment, heap, mai.pNext ? ZINK_ALLOC_NO_SUBALLOC : 0, mai.memoryTypeIndex, mai.pNext));
if (!obj->bo) {