Fix validation errors in pipeline tests
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / pipeline / vktPipelineMultisampleTests.cpp
index c71979e..8c1e9b0 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "vktPipelineMultisampleTests.hpp"
 #include "vktPipelineMultisampleImageTests.hpp"
+#include "vktPipelineMultisampleSampleLocationsExtTests.hpp"
 #include "vktPipelineClearUtil.hpp"
 #include "vktPipelineImageUtil.hpp"
 #include "vktPipelineVertexUtil.hpp"
@@ -35,6 +36,7 @@
 #include "vkMemUtil.hpp"
 #include "vkPrograms.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "tcuImageCompare.hpp"
@@ -361,8 +363,6 @@ protected:
        Move<VkCommandPool>                                                     m_cmdPool;
        Move<VkCommandBuffer>                                           m_cmdBuffer;
 
-       Move<VkFence>                                                           m_fence;
-
        std::vector<de::SharedPtr<Allocation> >         m_allocations;
 
        ImageBackingMode                                                        m_backingMode;
@@ -2675,6 +2675,7 @@ void MultisampleRenderer::initialize (Context&                                                                    context,
                        &clearValues[0]                                                                                 // const VkClearValue*  pClearValues;
                };
 
+               vk::VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
                std::vector<VkImageMemoryBarrier> imageLayoutBarriers;
 
                {
@@ -2750,13 +2751,14 @@ void MultisampleRenderer::initialize (Context&                                                                  context,
                                { depthStencilAttachmentAspect, 0u, 1u, 0u, 1u },       // VkImageSubresourceRange      subresourceRange;
                        };
                        imageLayoutBarriers.push_back(depthStencilImageBarrier);
+                       dstStageMask |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT;
                };
 
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
 
-               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, dstStageMask, (VkDependencyFlags)0,
                        0u, DE_NULL, 0u, DE_NULL, (deUint32)imageLayoutBarriers.size(), &imageLayoutBarriers[0]);
 
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
@@ -2789,9 +2791,6 @@ void MultisampleRenderer::initialize (Context&                                                                    context,
 
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 MultisampleRenderer::~MultisampleRenderer (void)
@@ -2804,22 +2803,8 @@ de::MovePtr<tcu::TextureLevel> MultisampleRenderer::render (void)
        const VkDevice                          vkDevice                        = m_context.getDevice();
        const VkQueue                           queue                           = m_context.getUniversalQueue();
        const deUint32                          queueFamilyIndex        = m_context.getUniversalQueueFamilyIndex();
-       const VkSubmitInfo                      submitInfo      =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                      sType;
-               DE_NULL,                                                // const void*                          pNext;
-               0u,                                                             // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*           pWaitSemaphores;
-               (const VkPipelineStageFlags*)DE_NULL,
-               1u,                                                             // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                             // const VkCommandBuffer*       pCommandBuffers;
-               0u,                                                             // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*           pSignalSemaphores;
-       };
 
-       VK_CHECK(vk.resetFences(vkDevice, 1, &m_fence.get()));
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *m_fence));
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &m_fence.get(), true, ~(0ull) /* infinity*/));
+       submitCommandsAndWait(vk, vkDevice, queue, m_cmdBuffer.get());
 
        if (m_renderType == RENDER_TYPE_RESOLVE)
        {
@@ -3062,6 +3047,11 @@ tcu::TestCaseGroup* createMultisampleTests (tcu::TestContext& testCtx)
                multisampleTests->addChild(createMultisampleStorageImageTests(testCtx));
        }
 
+       // VK_EXT_sample_locations
+       {
+               multisampleTests->addChild(createMultisampleSampleLocationsExtTests(testCtx));
+       }
+
        return multisampleTests.release();
 }