Vulkan: Fix MemoryServiceOpaqueFD CreateImage

vkCreateImage when bound to imported memory, must also have
a VkExternalImageCreateInfo struct in its pNext chain that
has VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT as a
handleType.

This was discovered when tests started failing after a roll
of the Vulkan validation layers.

Tbr=cwallez@chromium.org, senorblanco@chromium.com
Bug: none
Change-Id: I4692d650af27b9325342baeda34a0d982fc49041
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24200
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2020-07-01 20:44:47 +00:00 committed by Commit Bot service account
parent 96c78ec737
commit 509b811a75
1 changed files with 7 additions and 1 deletions

View File

@ -111,7 +111,7 @@ namespace dawn_native { namespace vulkan { namespace external_memory {
VkImportMemoryFdInfoKHR importMemoryFdInfo;
importMemoryFdInfo.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR;
importMemoryFdInfo.pNext = nullptr;
importMemoryFdInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
importMemoryFdInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
importMemoryFdInfo.fd = handle;
VkMemoryAllocateInfo allocateInfo;
@ -129,7 +129,13 @@ namespace dawn_native { namespace vulkan { namespace external_memory {
ResultOrError<VkImage> Service::CreateImage(const ExternalImageDescriptor* descriptor,
const VkImageCreateInfo& baseCreateInfo) {
VkExternalMemoryImageCreateInfo externalMemoryImageCreateInfo;
externalMemoryImageCreateInfo.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO;
externalMemoryImageCreateInfo.pNext = nullptr;
externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
VkImageCreateInfo createInfo = baseCreateInfo;
createInfo.pNext = &externalMemoryImageCreateInfo;
createInfo.flags = VK_IMAGE_CREATE_ALIAS_BIT_KHR;
createInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
createInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;