From b92a363a1a710562df9416c07bb7c0b8f4833bc2 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Fri, 17 Jul 2020 07:30:36 +0000 Subject: [PATCH] Vulkan: Fix MemoryServiceZirconHandle CreateImage vkCreateImage when bound to imported memory, must also have a VkExternalImageCreateInfo struct in its pNext chain that has VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA as a handleType. This was discovered when tests started failing after a roll of the Vulkan validation layers. Bug: none Change-Id: Ic7fc95f963062c8740e714a490adf6a020fed220 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25100 Commit-Queue: Corentin Wallez Reviewed-by: Stephen White Reviewed-by: Corentin Wallez --- .../vulkan/external_memory/MemoryServiceZirconHandle.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp b/src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp index 08d8d63004..85c4e4a8d3 100644 --- a/src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp +++ b/src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp @@ -131,7 +131,14 @@ namespace dawn_native { namespace vulkan { namespace external_memory { ResultOrError 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_TEMP_ZIRCON_VMO_BIT_FUCHSIA; + 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;