Clear all Views of Framebuffer Attachment to reference background color
authorMateusz Zych <Mateusz.Zych@amd.com>
Sat, 14 Apr 2018 00:11:14 +0000 (20:11 -0400)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 11 May 2018 11:03:05 +0000 (07:03 -0400)
The VK_KHR_multiview spec defines that during implicit clear (LOAD_OP_CLEAR)
all Active Views of Framebuffer attachment are cleared.
ViewMask defines which Views are active during particular subpass,
therefore a View is considered active during RenderPass
if it was active in any subpass of that RenderPass.

Without explicit clear of inactive Views their content will be undefined,
making test results unreliable.

This change removes MultiViewReadbackTestInstance::beforeDraw() and
relies on MultiViewRenderTestInstance::beforeDraw()
to clear all Views (array layers) of framebuffer attachment
by calling vkCmdClearColorImage().

Components: Vulkan

VK-GL-CTS Issue: 1085

Affects:
    dEQP-VK.multiview.readback*

Change-Id: I70d8b1c48cb157df2518b7d241a302c54d5842f3

external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderTests.cpp

index 87a7f4a..0c719f6 100644 (file)
@@ -2503,7 +2503,6 @@ public:
                                                MultiViewReadbackTestInstance   (Context& context, const TestParameters& parameters);
 protected:
        tcu::TestStatus         iterate                                                 (void);
-       void                            beforeDraw                                              (void);
        void                            drawClears                                              (const deUint32                         subpassCount,
                                                                                                                 VkRenderPass                           renderPass,
                                                                                                                 VkFramebuffer                          frameBuffer,
@@ -2576,23 +2575,6 @@ tcu::TestStatus MultiViewReadbackTestInstance::iterate (void)
        return tcu::TestStatus::pass("Pass");
 }
 
-void MultiViewReadbackTestInstance::beforeDraw (void)
-{
-       const VkImageSubresourceRange   subresourceRange                =
-       {
-               VK_IMAGE_ASPECT_COLOR_BIT,      //VkImageAspectFlags    aspectMask;
-               0u,                                                     //deUint32                              baseMipLevel;
-               1u,                                                     //deUint32                              levelCount;
-               0u,                                                     //deUint32                              baseArrayLayer;
-               m_parameters.extent.depth,      //deUint32                              layerCount;
-       };
-
-       imageBarrier(*m_device, *m_cmdBuffer, m_colorAttachment->getImage(), subresourceRange,
-               VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
-               0, 0,
-               VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
-}
-
 void MultiViewReadbackTestInstance::drawClears (const deUint32 subpassCount, VkRenderPass renderPass, VkFramebuffer frameBuffer, vector<PipelineSp>& pipelines, const bool clearPass)
 {
        const VkRect2D                                  renderArea                              = makeRect2D(m_parameters.extent);