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:
parent
96c78ec737
commit
509b811a75
|
@ -111,7 +111,7 @@ namespace dawn_native { namespace vulkan { namespace external_memory {
|
||||||
VkImportMemoryFdInfoKHR importMemoryFdInfo;
|
VkImportMemoryFdInfoKHR importMemoryFdInfo;
|
||||||
importMemoryFdInfo.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR;
|
importMemoryFdInfo.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR;
|
||||||
importMemoryFdInfo.pNext = nullptr;
|
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;
|
importMemoryFdInfo.fd = handle;
|
||||||
|
|
||||||
VkMemoryAllocateInfo allocateInfo;
|
VkMemoryAllocateInfo allocateInfo;
|
||||||
|
@ -129,7 +129,13 @@ namespace dawn_native { namespace vulkan { namespace external_memory {
|
||||||
|
|
||||||
ResultOrError<VkImage> Service::CreateImage(const ExternalImageDescriptor* descriptor,
|
ResultOrError<VkImage> Service::CreateImage(const ExternalImageDescriptor* descriptor,
|
||||||
const VkImageCreateInfo& baseCreateInfo) {
|
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;
|
VkImageCreateInfo createInfo = baseCreateInfo;
|
||||||
|
createInfo.pNext = &externalMemoryImageCreateInfo;
|
||||||
createInfo.flags = VK_IMAGE_CREATE_ALIAS_BIT_KHR;
|
createInfo.flags = VK_IMAGE_CREATE_ALIAS_BIT_KHR;
|
||||||
createInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
createInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
createInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
createInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
|
|
Loading…
Reference in New Issue