From dd931b1d5b6372e3e8255475aeca34ad5a23c565 Mon Sep 17 00:00:00 2001 From: Piers Daniell Date: Tue, 13 Aug 2019 16:11:23 -0600 Subject: [PATCH] Fix incorrect layout transition in render pass For the dEQP-VK.device_group.* tests the renderImage was created with an UNDEFINED layout and then explicitly transitioned to COLOR_ATTACHMENT_OPTIMAL during the test initialization. Then the renderPass was created using the makeRenderPass() utility function which assumed the image was in the UNDEFINED state. This caused the image to be transitioned again from UNDEFINED to COLOR_ATTACHMENT_OPTIMAL at begin render pass time, which might modify any valid image data. The solution is to fix the render pass creation to indicate that the renderImage is already in the COLOR_ATTACHMENT_OPTIMAL layout. Affects: dEQP-VK.device_group.* VK-GL-CTS issue: 1922 Change-Id: I5e1dff19eb854af9651615a7318379a318b8c273 Components: Vulkan --- .../device_group/vktDeviceGroupRendering.cpp | 50 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp b/external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp index 4bb43cb..9bdcfa0 100644 --- a/external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp +++ b/external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp @@ -797,7 +797,55 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void) VK_CHECK(vk.bindImageMemory(*m_deviceGroup, *readImage, imageMemory.get(), 0)); // Create renderpass - renderPass = makeRenderPass(vk, *m_deviceGroup, colorFormat); + { + const VkAttachmentDescription colorAttachmentDescription = + { + (VkAttachmentDescriptionFlags)0, // VkAttachmentDescriptionFlags flags + colorFormat, // VkFormat format + VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples + VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp loadOp + VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp storeOp + VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp stencilLoadOp + VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp stencilStoreOp + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // VkImageLayout initialLayout + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // VkImageLayout finalLayout + }; + + const VkAttachmentReference colorAttachmentRef = + { + 0u, // deUint32 attachment + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // VkImageLayout layout + }; + + const VkSubpassDescription subpassDescription = + { + (VkSubpassDescriptionFlags)0, // VkSubpassDescriptionFlags flags + VK_PIPELINE_BIND_POINT_GRAPHICS, // VkPipelineBindPoint pipelineBindPoint + 0u, // deUint32 inputAttachmentCount + DE_NULL, // const VkAttachmentReference* pInputAttachments + 1u, // deUint32 colorAttachmentCount + &colorAttachmentRef, // const VkAttachmentReference* pColorAttachments + DE_NULL, // const VkAttachmentReference* pResolveAttachments + DE_NULL, // const VkAttachmentReference* pDepthStencilAttachment + 0u, // deUint32 preserveAttachmentCount + DE_NULL // const deUint32* pPreserveAttachments + }; + + const VkRenderPassCreateInfo renderPassInfo = + { + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // VkStructureType sType + DE_NULL, // const void* pNext + (VkRenderPassCreateFlags)0, // VkRenderPassCreateFlags flags + 1, // deUint32 attachmentCount + &colorAttachmentDescription, // const VkAttachmentDescription* pAttachments + 1u, // deUint32 subpassCount + &subpassDescription, // const VkSubpassDescription* pSubpasses + 0u, // deUint32 dependencyCount + DE_NULL // const VkSubpassDependency* pDependencies + }; + + renderPass = createRenderPass(vk, *m_deviceGroup, &renderPassInfo, DE_NULL); + } // Create descriptors { -- 2.7.4