zink: always set VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT for usermem

required by spec

backport-to: 23.3

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25914>
(cherry picked from commit 009d4a5fda)
This commit is contained in:
Mike Blumenkrantz 2023-10-26 11:00:57 -04:00 committed by Eric Engestrom
parent da8fcbaef5
commit dea50199a1
2 changed files with 14 additions and 1 deletions

View file

@ -874,7 +874,7 @@
"description": "zink: always set VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT for usermem",
"nominated": true,
"nomination_type": 4,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -847,6 +847,14 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
return obj;
} else if (templ->target == PIPE_BUFFER) {
VkBufferCreateInfo bci = create_bci(screen, templ, templ->bind);
VkExternalMemoryBufferCreateInfo embci;
if (user_mem) {
embci.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO;
embci.pNext = bci.pNext;
embci.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT;
bci.pNext = &embci;
}
if (VKSCR(CreateBuffer)(screen->dev, &bci, NULL, &obj->buffer) != VK_SUCCESS) {
mesa_loge("ZINK: vkCreateBuffer failed");
@ -983,6 +991,11 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
} else if (ici.tiling == VK_IMAGE_TILING_OPTIMAL) {
shared = false;
}
} else if (user_mem) {
emici.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO;
emici.pNext = ici.pNext;
emici.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT;
ici.pNext = &emici;
}
if (linear)