Fix BindImageMemoryInfo in *render.device_group2
authorArkadiusz Sarwa <arkadiusz.sarwa@amd.com>
Mon, 25 May 2020 22:31:41 +0000 (00:31 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 4 Jun 2020 07:46:58 +0000 (03:46 -0400)
If image was created with a valid swapchain handle
in VkImageSwapchainCreateInfoKHR::swapchain, then the pNext chain
must include a VkBindImageMemorySwapchainInfoKHR structure containing
the same swapchain handle.

Affects:
dEQP-VK.wsi.win32.swapchain.render.device_group2

Components: Vulkan

VK-GL-CTS Issue: 2385

Change-Id: I6fa4e36e273861623b8e00143022f19fd79fc0aa

external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp

index 93bd65c..f985db9 100644 (file)
@@ -1889,22 +1889,30 @@ tcu::TestStatus deviceGroupRenderTest2 (Context& context, Type wsiType)
        vector<VkImage>                                                         rawImages                                               (numImages);
        vector<ImageSp>                                                         imagesSfr                                               (numImages);
        vector<VkImage>                                                         rawImagesSfr                                    (numImages);
+       vector<VkBindImageMemorySwapchainInfoKHR>       bindImageMemorySwapchainInfo    (numImages);
 
        // Create non-SFR image aliases for image layout transition
        {
-       vector<VkBindImageMemorySwapchainInfoKHR>       bindImageMemorySwapchainInfo    (numImages);
-       vector<VkBindImageMemoryDeviceGroupInfo >       bindImageMemoryDeviceGroupInfo  (numImages);
-       vector<VkBindImageMemoryInfo>                           bindImageMemoryInfos                    (numImages);
+               vector<VkBindImageMemoryInfo>                           bindImageMemoryInfos                    (numImages);
 
-       for (deUint32 idx = 0; idx < numImages; ++idx)
-       {
-               // Create image
-               images[idx] = ImageSp(new UniqueImage(createImage(vkd, *groupDevice, &imageCreateInfo)));
+               for (deUint32 idx = 0; idx < numImages; ++idx)
+               {
+                       // Create image
+                       images[idx] = ImageSp(new UniqueImage(createImage(vkd, *groupDevice, &imageCreateInfo)));
+
+                       VkBindImageMemorySwapchainInfoKHR bimsInfo =
+                       {
+                               VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR,
+                               DE_NULL,
+                               *swapchain,
+                               idx
+                       };
+                       bindImageMemorySwapchainInfo[idx] = bimsInfo;
 
                        VkBindImageMemoryInfo bimInfo =
                        {
                                VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
-                               DE_NULL,
+                               &bindImageMemorySwapchainInfo[idx],
                                **images[idx],
                                DE_NULL,                                // If the pNext chain includes an instance of VkBindImageMemorySwapchainInfoKHR, memory must be VK_NULL_HANDLE
                                0u                                              // If swapchain <in VkBindImageMemorySwapchainInfoKHR> is not NULL, the swapchain and imageIndex are used to determine the memory that the image is bound to, instead of memory and memoryOffset.
@@ -1918,7 +1926,6 @@ tcu::TestStatus deviceGroupRenderTest2 (Context& context, Type wsiType)
 
        // Create the SFR images
        {
-               vector<VkBindImageMemorySwapchainInfoKHR>       bindImageMemorySwapchainInfo    (numImages);
                vector<VkBindImageMemoryDeviceGroupInfo >       bindImageMemoryDeviceGroupInfo  (numImages);
                vector<VkBindImageMemoryInfo>                           bindImageMemoryInfos                    (numImages);
                for (deUint32 idx = 0; idx < numImages; ++idx)
@@ -1926,15 +1933,6 @@ tcu::TestStatus deviceGroupRenderTest2 (Context& context, Type wsiType)
                        // Create image
                        imagesSfr[idx] = ImageSp(new UniqueImage(createImage(vkd, *groupDevice, &imageCreateInfo)));
 
-               VkBindImageMemorySwapchainInfoKHR bimsInfo =
-               {
-                       VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR,
-                       DE_NULL,
-                       *swapchain,
-                       idx
-               };
-               bindImageMemorySwapchainInfo[idx] = bimsInfo;
-
                // Split into 2 vertical halves
                // NOTE: the same split has to be done also in WsiTriangleRenderer::recordDeviceGroupFrame
                const deUint32  halfWidth                       = desiredSize.x() / 2;