Validation: Use correct aspects in renderpass2
authorGraeme Leese <gleese@broadcom.com>
Wed, 14 Nov 2018 13:12:44 +0000 (13:12 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 6 Dec 2018 12:08:56 +0000 (07:08 -0500)
Many of the tests were not setting up the aspect mask for input
attachments, meaning that the renderpass2 tests (for which it is
required) were failing validation.

Component: Vulkan
Affects: dEQP-VK.renderpass2.*

Change-Id: I7ca22cf1958a31137d1fb32ef84f944704354fb9

external/vulkancts/modules/vulkan/renderpass/vktRenderPassSampleReadTests.cpp
external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp

index 6160dd1..3a9eb88 100644 (file)
@@ -254,9 +254,12 @@ Move<VkRenderPass> createRenderPass (const DeviceInterface&        vkd,
                                                                         VkDevice                               device,
                                                                         VkFormat                               srcFormat,
                                                                         VkFormat                               dstFormat,
-                                                                        deUint32                               sampleCount)
+                                                                        deUint32                               sampleCount,
+                                                                        RenderPassType                 renderPassType)
 {
        const VkSampleCountFlagBits                     samples                                                 (sampleCountBitFromSampleCount(sampleCount));
+       const VkImageAspectFlagBits                     aspectFlag                                              ((renderPassType == RENDERPASS_TYPE_RENDERPASS2) ?      VK_IMAGE_ASPECT_COLOR_BIT :
+                                                                                                                                                                                                                                                       static_cast<VkImageAspectFlagBits>(0u));
        const AttachmentRef                                     srcAttachmentRef                //  VkAttachmentReference                                                                               ||  VkAttachmentReference2KHR
        (
                                                                                                                                //                                                                                                                              ||  VkStructureType                                             sType;
@@ -271,7 +274,7 @@ Move<VkRenderPass> createRenderPass (const DeviceInterface& vkd,
                DE_NULL,                                                                                                //                                                                                                                              ||  const void*                                                 pNext;
                0u,                                                                                                             //  deUint32                                            attachment;                                     ||  deUint32                                                    attachment;
                VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,                               //  VkImageLayout                                       layout;                                         ||  VkImageLayout                                               layout;
-               0u                                                                                                              //                                                                                                                              ||  VkImageAspectFlags                                  aspectMask;
+               aspectFlag                                                                                              //                                                                                                                              ||  VkImageAspectFlags                                  aspectMask;
        );
        const AttachmentRef                                     dstAttachmentRef                //  VkAttachmentReference                                                                               ||  VkAttachmentReference2KHR
        (
@@ -415,9 +418,9 @@ Move<VkRenderPass> createRenderPass (const DeviceInterface& vkd,
        switch (renderPassType)
        {
                case RENDERPASS_TYPE_LEGACY:
-                       return createRenderPass<AttachmentDescription1, AttachmentReference1, SubpassDescription1, SubpassDependency1, RenderPassCreateInfo1>(vkd, device, srcFormat, dstFormat, sampleCount);
+                       return createRenderPass<AttachmentDescription1, AttachmentReference1, SubpassDescription1, SubpassDependency1, RenderPassCreateInfo1>(vkd, device, srcFormat, dstFormat, sampleCount, renderPassType);
                case RENDERPASS_TYPE_RENDERPASS2:
-                       return createRenderPass<AttachmentDescription2, AttachmentReference2, SubpassDescription2, SubpassDependency2, RenderPassCreateInfo2>(vkd, device, srcFormat, dstFormat, sampleCount);
+                       return createRenderPass<AttachmentDescription2, AttachmentReference2, SubpassDescription2, SubpassDependency2, RenderPassCreateInfo2>(vkd, device, srcFormat, dstFormat, sampleCount, renderPassType);
                default:
                        TCU_THROW(InternalError, "Impossible");
        }
index fc47063..7472943 100644 (file)
@@ -5283,7 +5283,13 @@ void addAttachmentAllocationTests (tcu::TestCaseGroup* group, const TestConfigEx
 
                                                                lastUseOfAttachment[inputAttachmentIndex] = just(subpassIndex);
 
-                                                               inputAttachmentReferences.push_back(AttachmentReference((deUint32)subpassInputAttachments[inputAttachmentNdx], VK_IMAGE_LAYOUT_GENERAL));
+                                                               VkImageAspectFlags aspect = 0u;
+                                                               if (testConfigExternal.renderPassType == RENDERPASS_TYPE_RENDERPASS2)
+                                                               {
+                                                                       bool col = colorAttachments.find(inputAttachmentIndex) != colorAttachments.end();
+                                                                       aspect = col ? VK_IMAGE_ASPECT_COLOR_BIT : VK_IMAGE_ASPECT_DEPTH_BIT;
+                                                               }
+                                                               inputAttachmentReferences.push_back(AttachmentReference((deUint32)subpassInputAttachments[inputAttachmentNdx], VK_IMAGE_LAYOUT_GENERAL, aspect));
                                                        }
                                                }
 
@@ -5547,8 +5553,9 @@ void addAttachmentAllocationTests (tcu::TestCaseGroup* group, const TestConfigEx
 
                                        for (size_t subpassNdx = 1; subpassNdx < attachmentCount; subpassNdx++)
                                        {
+                                               const VkImageAspectFlags inputAttachmentAspectMask = (testConfigExternal.renderPassType == RENDERPASS_TYPE_RENDERPASS2) ? VK_IMAGE_ASPECT_COLOR_BIT : static_cast<VkImageAspectFlagBits>(0);
                                                subpasses.push_back(Subpass(VK_PIPELINE_BIND_POINT_GRAPHICS, 0u,
-                                                                                               vector<AttachmentReference>(1, AttachmentReference((deUint32)(subpassNdx - 1), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)),
+                                                                                               vector<AttachmentReference>(1, AttachmentReference((deUint32)(subpassNdx - 1), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, inputAttachmentAspectMask)),
                                                                                                vector<AttachmentReference>(1, AttachmentReference((deUint32)(subpassNdx), rng.choose<VkImageLayout>(DE_ARRAY_BEGIN(subpassLayoutsColor), DE_ARRAY_END(subpassLayoutsColor)))),
                                                                                                vector<AttachmentReference>(),
                                                                                                AttachmentReference(VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_GENERAL),