Fix dedicated allocations in split frame rendering tests
authorziga-lunarg <ziga@lunarg.com>
Mon, 19 Sep 2022 21:23:16 +0000 (23:23 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 6 Oct 2022 15:47:29 +0000 (15:47 +0000)
The image bound to dedicated memory must match the image from
VkMemoryDedicatedAllocateInfo

Components: Vulkan

VK-GL-CTS issue: 3971

Affected tests:
dEQP-VK.device_group.sfr_*

Change-Id: I23684ae6777d575da5eb244dfd856946ba67aa4a

external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp

index 3f0940a5be3b6115985e51c790be929328cbde91..c52ae2201205c74ce1cb9ece0e91fd0e6df53e90 100644 (file)
@@ -402,7 +402,8 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                vk::Move<vk::VkDeviceMemory>    indexBufferMemory;
                vk::Move<vk::VkDeviceMemory>    uniformBufferMemory;
                vk::Move<vk::VkDeviceMemory>    sboBufferMemory;
-               vk::Move<vk::VkDeviceMemory>    imageMemory;
+               vk::Move<vk::VkDeviceMemory>    renderImageMemory;
+               vk::Move<vk::VkDeviceMemory>    readImageMemory;
 
                Move<VkRenderPass>                              renderPass;
                Move<VkImage>                                   renderImage;
@@ -791,11 +792,19 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                        memoryTypeNdx = getMemoryIndex(memReqs.memoryTypeBits, m_useHostMemory ? 0 : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
                        allocInfo.allocationSize = memReqs.size;
                        allocInfo.memoryTypeIndex = memoryTypeNdx;
-                       imageMemory = allocateMemory(vk, *m_deviceGroup, &allocInfo);
+                       renderImageMemory = allocateMemory(vk, *m_deviceGroup, &allocInfo);
+
+                       dedicatedAllocInfo.image = *readImage;
+                       dedicatedAllocInfo.buffer = DE_NULL;
+                       memReqs = getImageMemoryRequirements(vk, *m_deviceGroup, readImage.get());
+                       memoryTypeNdx = getMemoryIndex(memReqs.memoryTypeBits, m_useHostMemory ? 0 : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+                       allocInfo.allocationSize = memReqs.size;
+                       allocInfo.memoryTypeIndex = memoryTypeNdx;
+                       readImageMemory = allocateMemory(vk, *m_deviceGroup, &allocInfo);
                }
 
-               VK_CHECK(vk.bindImageMemory(*m_deviceGroup, *renderImage, imageMemory.get(), 0));
-               VK_CHECK(vk.bindImageMemory(*m_deviceGroup, *readImage, imageMemory.get(), 0));
+               VK_CHECK(vk.bindImageMemory(*m_deviceGroup, *renderImage, renderImageMemory.get(), 0));
+               VK_CHECK(vk.bindImageMemory(*m_deviceGroup, *readImage, readImageMemory.get(), 0));
 
                // Create renderpass
                {
@@ -1186,7 +1195,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                                VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,                                       // sType
                                &devGroupBindInfo,                                                                                      // pNext
                                *renderImage,                                                                                           // image
-                               imageMemory.get(),                                                                                      // memory
+                               renderImageMemory.get(),                                                                        // memory
                                0u,                                                                                                                     // memoryOffset
                        };
                        VK_CHECK(vk.bindImageMemory2(*m_deviceGroup, 1, &bindInfo));
@@ -1475,7 +1484,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                                        VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,                                       // sType
                                        &devGroupBindInfo,                                                                                      // pNext
                                        peerImage.get(),                                                                                        // image
-                                       imageMemory.get(),                                                                                      // memory
+                                       renderImageMemory.get(),                                                                        // memory
                                        0u,                                                                                                                     // memoryOffset
                                };
                                VK_CHECK(vk.bindImageMemory2(*m_deviceGroup, 1, &bindInfo));