mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
zink: move memoryTypeIndex selection down in general bo allocation
no functional changes Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22567>
This commit is contained in:
parent
907621dc09
commit
27dd6245d3
2 changed files with 20 additions and 18 deletions
|
|
@ -148,7 +148,7 @@
|
|||
"description": "zink: move memoryTypeIndex selection down in general bo allocation",
|
||||
"nominated": false,
|
||||
"nomination_type": null,
|
||||
"resolution": 4,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -985,23 +985,6 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
|
|||
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,
|
||||
|
|
@ -1077,6 +1060,25 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
|
|||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue