Use vkBindImageMemory2 to bind disjoint images
authorMarc Alcala Prieto <marc.alcalaprieto@arm.com>
Wed, 1 Apr 2020 13:37:09 +0000 (15:37 +0200)
committerMarc Alcala Prieto <marc.alcalaprieto@arm.com>
Thu, 2 Apr 2020 11:58:25 +0000 (13:58 +0200)
Vulkan specification says that applications must not use
vkBindImageMemory to attach memory to a VkImage object created with
the VK_IMAGE_CREATE_DISJOINT_BIT.

Component: Vulkan

Affects: dEQP-VK.ycbcr.plane_view.memory_alias.*

VK-GL-CTS Issue: 2289

Change-Id: Icdcf802ff9da6018e71a66fd27954923600863d2

external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp

index 630364b..378a917 100644 (file)
@@ -490,7 +490,32 @@ tcu::TestStatus testPlaneView (Context& context, TestParameters params)
        const vector<AllocationSp>              allocations             (allocateAndBindImageMemory(vkd, device, context.getDefaultAllocator(), *image, format, createFlags));
 
        if (imageAlias)
-               VK_CHECK(vkd.bindImageMemory(device, *imageAlias, allocations[params.planeNdx]->getMemory(), allocations[params.planeNdx]->getOffset()));
+       {
+               if ((createFlags & VK_IMAGE_CREATE_DISJOINT_BIT) != 0)
+               {
+                       VkBindImagePlaneMemoryInfo      planeInfo       =
+                       {
+                               VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR,
+                               DE_NULL,
+                               VK_IMAGE_ASPECT_PLANE_0_BIT_KHR
+                       };
+
+                       VkBindImageMemoryInfo coreInfo  =
+                       {
+                               VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR,
+                               &planeInfo,
+                               *imageAlias,
+                               allocations[params.planeNdx]->getMemory(),
+                               allocations[params.planeNdx]->getOffset(),
+                       };
+
+                       VK_CHECK(vkd.bindImageMemory2(device, 1, &coreInfo));
+               }
+               else
+               {
+                       VK_CHECK(vkd.bindImageMemory(device, *imageAlias, allocations[params.planeNdx]->getMemory(), allocations[params.planeNdx]->getOffset()));
+               }
+       }
 
        const VkSamplerYcbcrConversionCreateInfo        conversionInfo  =
        {