Use common utility function for queue submit and wait
authorAri Suonpaa <ari.suonpaa@siru.fi>
Tue, 20 Feb 2018 09:12:58 +0000 (11:12 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 5 Mar 2018 09:08:29 +0000 (04:08 -0500)
Queue submit and wait is being used in almost every test case. Some
test groups already implement an utility function to create a fence,
submit commands and wait for the fence. Others do it inline. These
are now replaced with a single utility function.

Affects:

dEQP-VK.api.buffer_view.access.*
dEQP-VK.api.command_buffers.*
dEQP-VK.api.copy_and_blit.*
dEQP-VK.api.fill_and_update_buffer.*
dEQP-VK.api.get_memory_commitment.*
dEQP-VK.api.smoke.*
dEQP-VK.api.image_clearing.*
dEQP-VK.binding_model.shader_access.*
dEQP-VK.device_group.*
dEQP-VK.draw.*
dEQP-VK.dynamic_state.*
dEQP-VK.fragment_operations.*
dEQP-VK.geometry.*
dEQP-VK.image.*
dEQP-VK.memory.binding.*
dEQP-VK.memory.pipeline_barrier.*
dEQP-VK.multiview.*
dEQP-VK.pipeline.*
dEQP-VK.query_pool.occlusion_query.*
dEQP-VK.query_pool.statistics_query.*
dEQP-VK.rasterization.*
dEQP-VK.renderpass.multisample_resolve.*
dEQP-VK.renderpass.multisample.*
dEQP-VK.renderpass.sampleread.*
dEQP-VK.renderpass.sparserendertarget.*
dEQP-VK.glsl.*
dEQP-VK.spirv_assembly.*
dEQP-VK.ssbo.*
dEQP-VK.synchronization.internally_synchronized_objects.*
dEQP-VK.synchronization.op.*queue.*
dEQP-VK.tessellation.*
dEQP-VK.texture.*
dEQP-VK.ubo.*
dEQP-VK.ycbcr.*

Components: Vulkan

VK-GL-CTS issue: 1015

Change-Id: I27c05269b1c546c7079f8197f84cdc7f2c8bda17

124 files changed:
AndroidGen.mk
external/vulkancts/framework/vulkan/CMakeLists.txt
external/vulkancts/framework/vulkan/vkCmdUtil.cpp [new file with mode: 0644]
external/vulkancts/framework/vulkan/vkCmdUtil.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/api/vktApiBufferViewAccessTests.cpp
external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.cpp
external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
external/vulkancts/modules/vulkan/api/vktApiFillBufferTests.cpp
external/vulkancts/modules/vulkan/api/vktApiGetMemoryCommitment.cpp
external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp
external/vulkancts/modules/vulkan/api/vktApiSmokeTests.cpp
external/vulkancts/modules/vulkan/binding_model/vktBindingShaderAccessTests.cpp
external/vulkancts/modules/vulkan/compute/vktComputeBasicComputeShaderTests.cpp
external/vulkancts/modules/vulkan/compute/vktComputeIndirectComputeDispatchTests.cpp
external/vulkancts/modules/vulkan/compute/vktComputeShaderBuiltinVarTests.cpp
external/vulkancts/modules/vulkan/compute/vktComputeTestsUtil.cpp
external/vulkancts/modules/vulkan/compute/vktComputeTestsUtil.hpp
external/vulkancts/modules/vulkan/device_group/vktDeviceGroupRendering.cpp
external/vulkancts/modules/vulkan/draw/vktBasicDrawTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawDifferingInterpolationTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawImageObjectUtil.cpp
external/vulkancts/modules/vulkan/draw/vktDrawIndexedTest.cpp
external/vulkancts/modules/vulkan/draw/vktDrawIndirectTest.cpp
external/vulkancts/modules/vulkan/draw/vktDrawInstancedTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawInvertedDepthRangesTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawNegativeViewportHeightTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawShaderDrawParametersTests.cpp
external/vulkancts/modules/vulkan/draw/vktDrawSimpleTest.cpp
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateCBTests.cpp
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateDSTests.cpp
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateGeneralTests.cpp
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateVPTests.cpp
external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsEarlyFragmentTests.cpp
external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsMakeUtil.cpp
external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsMakeUtil.hpp
external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsScissorMultiViewportTests.cpp
external/vulkancts/modules/vulkan/fragment_ops/vktFragmentOperationsScissorTests.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryBasicClass.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryBasicGeometryShaderTests.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryInstancedRenderingTests.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryLayeredRenderingTests.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryTestsUtil.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryTestsUtil.hpp
external/vulkancts/modules/vulkan/image/vktImageAtomicOperationTests.cpp
external/vulkancts/modules/vulkan/image/vktImageCompressionTranscodingSupport.cpp
external/vulkancts/modules/vulkan/image/vktImageLoadStoreTests.cpp
external/vulkancts/modules/vulkan/image/vktImageMultisampleLoadStoreTests.cpp
external/vulkancts/modules/vulkan/image/vktImageMutableTests.cpp
external/vulkancts/modules/vulkan/image/vktImageQualifiersTests.cpp
external/vulkancts/modules/vulkan/image/vktImageSizeTests.cpp
external/vulkancts/modules/vulkan/image/vktImageTestsUtil.cpp
external/vulkancts/modules/vulkan/image/vktImageTestsUtil.hpp
external/vulkancts/modules/vulkan/image/vktImageTranscodingSupportTests.cpp
external/vulkancts/modules/vulkan/memory/vktMemoryBindingTests.cpp
external/vulkancts/modules/vulkan/memory/vktMemoryPipelineBarrierTests.cpp
external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderTests.cpp
external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderUtil.cpp
external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderUtil.hpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineBlendTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineFramebufferAttachmentTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.hpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineInputAssemblyTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMakeUtil.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMakeUtil.hpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolve.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolveAndPerSampleFetch.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleImageTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleSampleLocationsExtTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelinePushConstantTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineSpecConstantTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineStencilTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineTimestampTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexInputTests.cpp
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolStatisticsTests.cpp
external/vulkancts/modules/vulkan/rasterization/vktRasterizationTests.cpp
external/vulkancts/modules/vulkan/renderpass/vktRenderPassMultisampleResolveTests.cpp
external/vulkancts/modules/vulkan/renderpass/vktRenderPassMultisampleTests.cpp
external/vulkancts/modules/vulkan/renderpass/vktRenderPassSampleReadTests.cpp
external/vulkancts/modules/vulkan/renderpass/vktRenderPassSparseRenderTargetTests.cpp
external/vulkancts/modules/vulkan/shaderexecutor/vktOpaqueTypeIndexingTests.cpp
external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp
external/vulkancts/modules/vulkan/shaderrender/vktShaderRender.cpp
external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmComputeShaderCase.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmCrossStageInterfaceTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp
external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutCase.cpp
external/vulkancts/modules/vulkan/ssbo/vktSSBOLayoutTests.cpp
external/vulkancts/modules/vulkan/synchronization/vktSynchronizationInternallySynchronizedObjectsTests.cpp
external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationMultiQueueTests.cpp
external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperationSingleQueueTests.cpp
external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.cpp
external/vulkancts/modules/vulkan/synchronization/vktSynchronizationUtil.hpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationCommonEdgeTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationCoordinatesTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationFractionalSpacingTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationGeometryGridRenderTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationGeometryPassthroughTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationGeometryPointSizeTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationMiscDrawTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationPrimitiveDiscardTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationShaderInputOutputTests.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationUserDefinedIO.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationUtil.cpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationUtil.hpp
external/vulkancts/modules/vulkan/tessellation/vktTessellationWindingTests.cpp
external/vulkancts/modules/vulkan/texture/vktTextureFilteringExplicitLodTests.cpp
external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.cpp
external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.hpp
external/vulkancts/modules/vulkan/ubo/vktUniformBlockCase.cpp
external/vulkancts/modules/vulkan/vktDrawUtil.cpp
external/vulkancts/modules/vulkan/vktShaderLibrary.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp

index e732328..cfd3c77 100644 (file)
@@ -31,6 +31,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/framework/vulkan/vkBinaryRegistry.cpp \
        external/vulkancts/framework/vulkan/vkBufferWithMemory.cpp \
        external/vulkancts/framework/vulkan/vkBuilderUtil.cpp \
+       external/vulkancts/framework/vulkan/vkCmdUtil.cpp \
        external/vulkancts/framework/vulkan/vkDebugReportUtil.cpp \
        external/vulkancts/framework/vulkan/vkDefs.cpp \
        external/vulkancts/framework/vulkan/vkDeviceUtil.cpp \
index fdc1132..ee40edc 100644 (file)
@@ -5,6 +5,8 @@ set(VKUTIL_SRCS
        vkApiVersion.hpp
        vkBuilderUtil.cpp
        vkBuilderUtil.hpp
+       vkCmdUtil.cpp
+       vkCmdUtil.hpp
        vkDefs.cpp
        vkDefs.hpp
        vkRef.cpp
diff --git a/external/vulkancts/framework/vulkan/vkCmdUtil.cpp b/external/vulkancts/framework/vulkan/vkCmdUtil.cpp
new file mode 100644 (file)
index 0000000..80c2fd8
--- /dev/null
@@ -0,0 +1,69 @@
+/*-------------------------------------------------------------------------
+ * Vulkan CTS Framework
+ * --------------------
+ *
+ * Copyright (c) 2018 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for commonly used command tasks
+ *//*--------------------------------------------------------------------*/
+
+#include "vkCmdUtil.hpp"
+#include "vkDefs.hpp"
+#include "vkRefUtil.hpp"
+
+namespace vk
+{
+
+void submitCommandsAndWait (const DeviceInterface&     vk,
+                                                       const VkDevice                  device,
+                                                       const VkQueue                   queue,
+                                                       const VkCommandBuffer   commandBuffer,
+                                                       const bool                              useDeviceGroups,
+                                                       const deUint32                  deviceMask)
+{
+       const Unique<VkFence>   fence                                   (createFence(vk, device));
+
+       VkDeviceGroupSubmitInfo deviceGroupSubmitInfo   =
+       {
+               VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR, //      VkStructureType         sType;
+               DE_NULL,                                                                                //      const void*                     pNext;
+               0u,                                                                                             //      uint32_t                        waitSemaphoreCount;
+               DE_NULL,                                                                                //      const uint32_t*         pWaitSemaphoreDeviceIndices;
+               1u,                                                                                             //      uint32_t                        commandBufferCount;
+               &deviceMask,                                                                    //      const uint32_t*         pCommandBufferDeviceMasks;
+               0u,                                                                                             //      uint32_t                        signalSemaphoreCount;
+               DE_NULL,                                                                                //      const uint32_t*         pSignalSemaphoreDeviceIndices;
+       };
+
+       const VkSubmitInfo              submitInfo                              =
+       {
+               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                          // VkStructureType                              sType;
+               useDeviceGroups ? &deviceGroupSubmitInfo : DE_NULL,     // const void*                                  pNext;
+               0u,                                                                                                     // deUint32                                             waitSemaphoreCount;
+               DE_NULL,                                                                                        // const VkSemaphore*                   pWaitSemaphores;
+               (const VkPipelineStageFlags*)DE_NULL,                           // const VkPipelineStageFlags*  pWaitDstStageMask;
+               1u,                                                                                                     // deUint32                                             commandBufferCount;
+               &commandBuffer,                                                                         // const VkCommandBuffer*               pCommandBuffers;
+               0u,                                                                                                     // deUint32                                             signalSemaphoreCount;
+               DE_NULL,                                                                                        // const VkSemaphore*                   pSignalSemaphores;
+       };
+
+       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
+       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
+}
+
+} // vk
diff --git a/external/vulkancts/framework/vulkan/vkCmdUtil.hpp b/external/vulkancts/framework/vulkan/vkCmdUtil.hpp
new file mode 100644 (file)
index 0000000..68f26b5
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _VKCMDUTIL_HPP
+#define _VKCMDUTIL_HPP
+/*-------------------------------------------------------------------------
+ * Vulkan CTS Framework
+ * --------------------
+ *
+ * Copyright (c) 2018 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for commonly used command tasks
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDefs.hpp"
+#include "tcuVector.hpp"
+
+namespace vk
+{
+
+void submitCommandsAndWait     (const DeviceInterface& vk,
+                                                        const VkDevice                 device,
+                                                        const VkQueue                  queue,
+                                                        const VkCommandBuffer  commandBuffer,
+                                                        const bool                             useDeviceGroups = false,
+                                                        const deUint32                 deviceMask = 1u);
+
+} // vk
+
+#endif // _VKCMDUTIL_HPP
index 809136d..370bb69 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "tcuTexture.hpp"
@@ -117,8 +118,6 @@ private:
 
        Move<VkBuffer>                                          m_resultBuffer;
        de::MovePtr<Allocation>                         m_resultBufferAlloc;
-
-       Move<VkFence>                                           m_fence;
 };
 
 static void generateBuffer                                                                                             (std::vector<deUint32>&         uniformData,
@@ -716,9 +715,6 @@ BufferViewTestInstance::BufferViewTestInstance                                                      (Context&                                       context,
 
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 tcu::TestStatus BufferViewTestInstance::checkResult                                            (deInt8                                         factor)
@@ -753,22 +749,8 @@ tcu::TestStatus BufferViewTestInstance::iterate                                                    (void)
        const DeviceInterface&                          vk                                                              = m_context.getDeviceInterface();
        const VkDevice                                          vkDevice                                                = m_context.getDevice();
        const VkQueue                                           queue                                                   = m_context.getUniversalQueue();
-       const VkSubmitInfo                                      submitInfo                                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-               DE_NULL,
-               0u,
-               (const VkSemaphore*)DE_NULL,
-               (const VkPipelineStageFlags*)DE_NULL,
-               1u,
-               &m_cmdBuffer.get(),
-               0u,
-               (const VkSemaphore*)DE_NULL,
-       };
 
-       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());
 
        tcu::TestStatus                                         testStatus                                              = checkResult(1);
        if (testStatus.getCode() != QP_TEST_RESULT_PASS)
@@ -783,9 +765,7 @@ tcu::TestStatus BufferViewTestInstance::iterate                                                     (void)
        deMemcpy(m_uniformBufferAlloc->getHostPtr(), uniformData.data(), (size_t)uniformSize);
        flushMappedMemoryRange(vk, vkDevice, m_uniformBufferAlloc->getMemory(), m_uniformBufferAlloc->getOffset(), uniformSize);
 
-       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());
 
        return checkResult(factor);
 }
index 9d363b9..3d21af9 100644 (file)
@@ -28,6 +28,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkMemUtil.hpp"
 #include "vkDeviceUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuTextureUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkPrograms.hpp"
@@ -367,24 +368,7 @@ void CommandBufferRenderPassTestEnvironment::beginSecondaryCommandBuffer(VkComma
 
 void CommandBufferRenderPassTestEnvironment::submitPrimaryCommandBuffer(void)
 {
-       const Unique<VkFence>                                   fence                                   (createFence(m_vkd, m_device));
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                  // VkStructureType                sType;
-               DE_NULL,                                                                                                // const void*                    pNext;
-               0u,                                                                                                             // deUint32                       waitSemaphoreCount;
-               DE_NULL,                                                                                                // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                                                                // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                                                             // deUint32                       commandBufferCount;
-               m_primaryCommandBuffers,                                                                // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                                                             // deUint32                       signalSemaphoreCount;
-               DE_NULL                                                                                                 // const VkSemaphore*             pSignalSemaphores;
-       };
-
-       VK_CHECK(m_vkd.queueSubmit(m_queue, 1, &submitInfo, *fence));
-
-       VK_CHECK(m_vkd.waitForFences(m_device, 1, &fence.get(), VK_TRUE, ~0ull));
-
+       submitCommandsAndWait(m_vkd, m_device, m_queue, *m_primaryCommandBuffers);
 }
 
 de::MovePtr<tcu::TextureLevel> CommandBufferRenderPassTestEnvironment::readColorAttachment ()
@@ -614,26 +598,8 @@ bool executeCommandBuffer (const VkDevice                  device,
        }
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 
-       {
-               const Unique<VkFence>                                   fence                   (createFence(vk, device));
-               const VkSubmitInfo                                              submitInfo              =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // sType
-                       DE_NULL,                                                                // pNext
-                       0u,                                                                             // waitSemaphoreCount
-                       DE_NULL,                                                                // pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // pWaitDstStageMask
-                       1u,                                                                             // commandBufferCount
-                       &commandBuffer,                                                 // pCommandBuffers
-                       0u,                                                                             // signalSemaphoreCount
-                       DE_NULL                                                                 // pSignalSemaphores
-               };
+       submitCommandsAndWait(vk, device, queue, commandBuffer);
 
-               // Submit the command buffer to the queue
-               VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-               // wait for end of execution of queue
-               VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), 0u, INFINITE_TIMEOUT));
-       }
        // check if buffer has been executed
        const VkResult result = vk.getEventStatus(device, *event);
        return result == VK_EVENT_SET;
@@ -889,27 +855,7 @@ tcu::TestStatus executePrimaryBufferTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // Submit the command buffer to the queue
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        // check if buffer has been executed
        VkResult result = vk.getEventStatus(vkDevice,*event);
@@ -969,27 +915,7 @@ tcu::TestStatus executeLargePrimaryBufferTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // Submit the command buffer to the queue
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        // check if the buffer was executed correctly - all events had their status
        // changed
@@ -1055,29 +981,7 @@ tcu::TestStatus resetBufferImplicitlyTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*cmdBuf));
 
-       // We'll use a fence to wait for the execution of the queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1u,                                                                                                                     // commandBufferCount
-               &cmdBuf.get(),                                                                                          // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // Submitting the command buffer that sets the event to the queue
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence.get()));
-
-       // Waiting for the queue to finish executing
-       VK_CHECK(vk.waitForFences(vkDevice, 1u, &fence.get(), 0u, INFINITE_TIMEOUT));
-       // Reset the fence so that we can reuse it
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &fence.get()));
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuf.get());
 
        // Check if the buffer was executed
        if (vk.getEventStatus(vkDevice, *event) != VK_EVENT_SET)
@@ -1095,9 +999,7 @@ tcu::TestStatus resetBufferImplicitlyTest(Context& context)
 
        // Submit the command buffer after resetting. It should have no commands
        // recorded, so the event should remain unsignaled.
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence.get()));
-       // Waiting for the queue to finish executing
-       VK_CHECK(vk.waitForFences(vkDevice, 1u, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuf.get());
 
        // Check if the event remained unset.
        if(vk.getEventStatus(vkDevice, *event) == VK_EVENT_RESET)
@@ -1417,27 +1319,7 @@ tcu::TestStatus recordLargePrimaryBufferTest(Context &context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // Submit the command buffer to the queue
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        return tcu::TestStatus::pass("hugeTest succeeded");
 }
@@ -1564,27 +1446,7 @@ tcu::TestStatus recordLargeSecondaryBufferTest(Context &context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // Submit the command buffer to the queue
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        return tcu::TestStatus::pass("hugeTest succeeded");
 }
@@ -1641,28 +1503,8 @@ tcu::TestStatus submitPrimaryBufferTwiceTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // submit primary buffer
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &fence.get()));
        // check if buffer has been executed
        VkResult result = vk.getEventStatus(vkDevice,*event);
        if (result != VK_EVENT_SET)
@@ -1671,10 +1513,7 @@ tcu::TestStatus submitPrimaryBufferTwiceTest(Context& context)
        // reset event
        VK_CHECK(vk.resetEvent(vkDevice, *event));
 
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        // check if buffer has been executed
        result = vk.getEventStatus(vkDevice,*event);
@@ -1780,27 +1619,7 @@ tcu::TestStatus submitSecondaryBufferTwiceTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf1));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo1                             =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf1.get(),                                                                                     // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo1, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &fence.get()));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf1.get());
 
        // check if secondary buffer has been executed
        VkResult result = vk.getEventStatus(vkDevice,*event);
@@ -1822,23 +1641,7 @@ tcu::TestStatus submitSecondaryBufferTwiceTest(Context& context)
        // end recording
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf2));
 
-       // submit second primary buffer, the secondary should be executed too
-       const VkSubmitInfo                                              submitInfo2                             =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf2.get(),                                                                                     // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo2, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf2.get());
 
        // check if secondary buffer has been executed
        result = vk.getEventStatus(vkDevice,*event);
@@ -1900,28 +1703,7 @@ tcu::TestStatus oneTimeSubmitFlagPrimaryBufferTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // submit primary buffer
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &fence.get()));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        // check if buffer has been executed
        VkResult result = vk.getEventStatus(vkDevice,*event);
@@ -1939,13 +1721,7 @@ tcu::TestStatus oneTimeSubmitFlagPrimaryBufferTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // reset event
-       VK_CHECK(vk.resetEvent(vkDevice, *event));
-
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        // check if buffer has been executed
        result = vk.getEventStatus(vkDevice,*event);
@@ -2051,27 +1827,7 @@ tcu::TestStatus oneTimeSubmitFlagSecondaryBufferTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf1));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo1                             =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf1.get(),                                                                                     // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo1, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &fence.get()));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf1.get());
 
        // check if secondary buffer has been executed
        VkResult result = vk.getEventStatus(vkDevice,*event);
@@ -2105,23 +1861,7 @@ tcu::TestStatus oneTimeSubmitFlagSecondaryBufferTest(Context& context)
        // end recording
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf2));
 
-       // submit second primary buffer, the secondary should be executed too
-       const VkSubmitInfo                                              submitInfo2                             =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf2.get(),                                                                                     // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo2, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf2.get());
 
        // check if secondary buffer has been executed
        result = vk.getEventStatus(vkDevice,*event);
@@ -2556,27 +2296,7 @@ tcu::TestStatus simultaneousUseSecondaryBufferOnePrimaryBufferTest(Context& cont
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence(createFence(vk, vkDevice));
-
-       const VkSubmitInfo                                              submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // submit primary buffer, the secondary should be executed too
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        deUint32 resultCount;
        result.readResultContentsTo(&resultCount);
@@ -3733,26 +3453,7 @@ tcu::TestStatus executeSecondaryBufferTest(Context& context)
        }
        VK_CHECK(vk.endCommandBuffer(*primCmdBuf));
 
-       // create fence to wait for execution of queue
-       const Unique<VkFence>                                   fence                                   (createFence(vk, vkDevice));
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1u,                                                                                                                     // commandBufferCount
-               &primCmdBuf.get(),                                                                                      // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-
-       // submit primary buffer, the secondary should be executed too
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence.get()));
-
-       // wait for end of execution of queue
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT));
+       submitCommandsAndWait(vk, vkDevice, queue, primCmdBuf.get());
 
        // check if secondary buffer has been executed
        VkResult result = vk.getEventStatus(vkDevice, *event);
@@ -4097,7 +3798,6 @@ tcu::TestStatus orderBindPipelineTest(Context& context)
                (const VkCommandBufferInheritanceInfo*)DE_NULL,
        };
 
-       const Unique<VkFence>                                   cmdCompleteFence                (createFence(vk, device));
        const Unique<VkCommandBuffer>                   cmd                                             (allocateCommandBuffer(vk, device, &cmdBufCreateInfo));
 
        VK_CHECK(vk.beginCommandBuffer(*cmd, &cmdBufBeginInfo));
@@ -4121,22 +3821,7 @@ tcu::TestStatus orderBindPipelineTest(Context& context)
 
        // run
        // submit second primary buffer, the secondary should be executed too
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                          // sType
-               DE_NULL,                                                                                                        // pNext
-               0u,                                                                                                                     // waitSemaphoreCount
-               DE_NULL,                                                                                                        // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,                                           // pWaitDstStageMask
-               1,                                                                                                                      // commandBufferCount
-               &cmd.get(),                                                                                                     // pCommandBuffers
-               0u,                                                                                                                     // signalSemaphoreCount
-               DE_NULL,                                                                                                        // pSignalSemaphores
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *cmdCompleteFence));
-
-       VK_CHECK(vk.waitForFences(device, 1u, &cmdCompleteFence.get(), 0u, INFINITE_TIMEOUT)); // \note: timeout is failure
-       VK_CHECK(vk.resetFences(device, 1u, &cmdCompleteFence.get()));
+       submitCommandsAndWait(vk, device, queue, cmd.get());
 
        // submit and wait end
        result.readResultContentsTo(&results);
index 87a6f53..7350fb9 100644 (file)
@@ -44,6 +44,7 @@
 #include "vktTestCaseUtil.hpp"
 #include "vktTestGroupUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include <set>
 
@@ -301,10 +302,6 @@ protected:
        de::MovePtr<tcu::TextureLevel>          readImage                                                       (vk::VkImage                            image,
                                                                                                                                                         const ImageParms&                      imageParms,
                                                                                                                                                         const deUint32                         mipLevel = 0u);
-       void                                                            submitCommandsAndWait                           (const DeviceInterface&         vk,
-                                                                                                                                                       const VkDevice                          device,
-                                                                                                                                                       const VkQueue                           queue,
-                                                                                                                                                       const VkCommandBuffer&          cmdBuffer);
 
 private:
        void                                                            uploadImageAspect                                       (const tcu::ConstPixelBufferAccess&     src,
@@ -780,26 +777,6 @@ void CopiesAndBlittingTestInstance::readImageAspect (vk::VkImage                                   image,
        tcu::copy(dst, tcu::ConstPixelBufferAccess(dst.getFormat(), dst.getSize(), bufferAlloc->getHostPtr()));
 }
 
-void CopiesAndBlittingTestInstance::submitCommandsAndWait (const DeviceInterface& vk, const VkDevice device, const VkQueue queue, const VkCommandBuffer& cmdBuffer)
-{
-       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;
-               &cmdBuffer,                                             // const VkCommandBuffer*       pCommandBuffers;
-               0u,                                                             // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*           pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.resetFences(device, 1, &m_fence.get()));
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *m_fence));
-       VK_CHECK(vk.waitForFences(device, 1, &m_fence.get(), true, ~(0ull) /* infinity */));
-}
-
 de::MovePtr<tcu::TextureLevel> CopiesAndBlittingTestInstance::readImage        (vk::VkImage            image,
                                                                                                                                                 const ImageParms&      parms,
                                                                                                                                                 const deUint32         mipLevel)
index 135ee42..454a29c 100644 (file)
@@ -29,6 +29,7 @@
 #include "deUniquePtr.hpp"
 #include "vkImageUtil.hpp"
 #include "vkMemUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktTestCase.hpp"
 #include "vktTestCaseUtil.hpp"
 #include "vkQueryUtil.hpp"
@@ -75,7 +76,6 @@ protected:
 
        Move<VkCommandPool>                             m_cmdPool;
        Move<VkCommandBuffer>                   m_cmdBuffer;
-       Move<VkFence>                                   m_fence;
        de::MovePtr<tcu::TextureLevel>  m_destinationTextureLevel;
        de::MovePtr<tcu::TextureLevel>  m_expectedTextureLevel;
 
@@ -118,9 +118,6 @@ protected:
        // Create command buffer
        m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
-
        testParams.bufferAllocator->createTestBuffer(m_params.dstSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT, context, memAlloc, m_destination, MemoryRequirement::HostVisible, m_destinationBufferAlloc);
 }
 
@@ -165,22 +162,7 @@ tcu::TestStatus                                            FillBufferTestInstance::iterate         (void)
        vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &dstBufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
 
-       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());
 
        // Read buffer data
        de::MovePtr<tcu::TextureLevel>  resultLevel     (new tcu::TextureLevel(m_destinationTextureLevel->getAccess().getFormat(), dstLevelWidth, 1));
@@ -330,22 +312,7 @@ tcu::TestStatus                                            UpdateBufferTestInstance::iterate       (void)
        vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &dstBufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
 
-       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());
 
        // Read buffer data
        de::MovePtr<tcu::TextureLevel>  resultLevel     (new tcu::TextureLevel(m_destinationTextureLevel->getAccess().getFormat(), dstLevelWidth, 1));
index 7dd59a9..1ee582d 100644 (file)
@@ -30,6 +30,7 @@
 #include "vkImageUtil.hpp"
 #include "vkMemUtil.hpp"
 #include "vkPrograms.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktTestCase.hpp"
 #include "vkTypeUtil.cpp"
 
@@ -58,10 +59,6 @@ public:
        deUint32                                                getMemoryTypeIndex                              (VkMemoryPropertyFlags propertyFlag, VkPhysicalDeviceMemoryProperties pMemoryProperties);
        Move<VkCommandPool>                             createCommandPool                               () const;
        Move<VkCommandBuffer>                   allocatePrimaryCommandBuffer    (VkCommandPool commandPool) const;
-       void                                                    submitCommandsAndWait                   (const DeviceInterface& vkd,
-                                                                                                                                        const VkDevice                 device,
-                                                                                                                                        const VkQueue                  queue,
-                                                                                                                                        const VkCommandBuffer& cmdBuffer);
        bool                                                    isDeviceMemoryCommitmentOk              (const VkMemoryRequirements memoryRequirements);
 
 private:
@@ -646,27 +643,6 @@ tcu::TestStatus MemoryCommitmentAllocateOnlyTestInstance::iterate(void)
        return tcu::TestStatus::pass("Pass");
 }
 
-void MemoryCommitmentTestInstance::submitCommandsAndWait (const DeviceInterface& vkd, const VkDevice device, const VkQueue queue, const VkCommandBuffer& cmdBuffer)
-{
-       Move<VkFence> fence = createFence(vkd, device);
-
-       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;
-               &cmdBuffer,                                                             // const VkCommandBuffer*       pCommandBuffers;
-               0u,                                                                             // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores;
-       };
-
-       VK_CHECK(vkd.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vkd.waitForFences(device, 1, &fence.get(), true, ~(0ull) /* infinity */));
-}
-
 deUint32 MemoryCommitmentTestInstance::getMemoryTypeIndex(VkMemoryPropertyFlags propertyFlag, VkPhysicalDeviceMemoryProperties pMemoryProperties)
 {
        for (deUint32 memoryTypeIndex = 0u; memoryTypeIndex < VK_MAX_MEMORY_TYPES; ++memoryTypeIndex)
index b6510a1..26035c8 100644 (file)
@@ -39,6 +39,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "tcuTexture.hpp"
 #include "tcuTextureUtil.hpp"
@@ -855,24 +856,7 @@ void ImageClearingTestInstance::endCommandBuffer (void) const
 
 void ImageClearingTestInstance::submitCommandBuffer (void) const
 {
-       const Unique<VkFence>                                   fence                                   (createFence(m_vkd, m_device));
-
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                                  // VkStructureType                sType;
-               DE_NULL,                                                                                                // const void*                    pNext;
-               0u,                                                                                                             // deUint32                       waitSemaphoreCount;
-               DE_NULL,                                                                                                // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                                                                // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                                                             // deUint32                       commandBufferCount;
-               &(*m_commandBuffer),                                                                    // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                                                             // deUint32                       signalSemaphoreCount;
-               DE_NULL                                                                                                 // const VkSemaphore*             pSignalSemaphores;
-       };
-
-       VK_CHECK(m_vkd.queueSubmit(m_queue, 1, &submitInfo, *fence));
-
-       VK_CHECK(m_vkd.waitForFences(m_device, 1, &fence.get(), VK_TRUE, ~0ull));
+       submitCommandsAndWait(m_vkd, m_device, m_queue, m_commandBuffer.get());
 }
 
 void ImageClearingTestInstance::pipelineImageBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout) const
index a6d9f5f..e9fbb27 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkPrograms.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuFormatUtil.hpp"
@@ -873,30 +874,7 @@ tcu::TestStatus renderTriangleTest (Context& context)
        }
 
        // Submit & wait for completion
-       {
-               const VkFenceCreateInfo fenceParams     =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // sType
-                       DE_NULL,                                                                // pNext
-                       0u,                                                                             // flags
-               };
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // sType
-                       DE_NULL,                                                                // pNext
-                       0u,                                                                             // waitSemaphoreCount
-                       DE_NULL,                                                                // pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,                                                                             // commandBufferCount
-                       &cmdBuf.get(),                                                  // pCommandBuffers
-                       0u,                                                                             // signalSemaphoreCount
-                       DE_NULL,                                                                // pSignalSemaphores
-               };
-               const Unique<VkFence>   fence           (createFence(vk, vkDevice, &fenceParams));
-
-               VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(vkDevice, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuf.get());
 
        // Read results, render reference, compare
        {
@@ -1490,30 +1468,7 @@ tcu::TestStatus renderTriangleUnusedResolveAttachmentTest (Context& context)
        }
 
        // Submit & wait for completion
-       {
-               const VkFenceCreateInfo fenceParams     =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // sType
-                       DE_NULL,                                                                // pNext
-                       0u,                                                                             // flags
-               };
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // sType
-                       DE_NULL,                                                                // pNext
-                       0u,                                                                             // waitSemaphoreCount
-                       DE_NULL,                                                                // pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,                                                                             // commandBufferCount
-                       &cmdBuf.get(),                                                  // pCommandBuffers
-                       0u,                                                                             // signalSemaphoreCount
-                       DE_NULL,                                                                // pSignalSemaphores
-               };
-               const Unique<VkFence>   fence           (createFence(vk, vkDevice, &fenceParams));
-
-               VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(vkDevice, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuf.get());
 
        // Read results, render reference, compare
        {
index d2109e1..fc863ae 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuVector.hpp"
 #include "tcuVectorUtil.hpp"
@@ -751,8 +752,6 @@ void SingleTargetRenderInstance::readRenderTarget (tcu::TextureLevel& dst)
        const de::MovePtr<vk::Allocation>               bufferMemory                            = allocateAndBindObjectMemory(m_vki, m_device, m_allocator, *buffer, vk::MemoryRequirement::HostVisible);
 
        const vk::Unique<vk::VkCommandBuffer>   cmd                                                     (vk::allocateCommandBuffer(m_vki, m_device, *m_cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-       const vk::Unique<vk::VkFence>                   cmdCompleteFence                        (vk::createFence(m_vki, m_device));
-       const deUint64                                                  infiniteTimeout                         = ~(deUint64)0u;
 
        // copy content to buffer
        VK_CHECK(m_vki.beginCommandBuffer(*cmd, &cmdBufBeginInfo));
@@ -767,24 +766,7 @@ void SingleTargetRenderInstance::readRenderTarget (tcu::TextureLevel& dst)
                                                         0, (const vk::VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(m_vki.endCommandBuffer(*cmd));
 
-       // wait for transfer to complete
-       {
-               const vk::VkSubmitInfo  submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const vk::VkSemaphore*)0,
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmd.get(),
-                       0u,
-                       (const vk::VkSemaphore*)0,
-               };
-
-               VK_CHECK(m_vki.queueSubmit(m_queue, 1, &submitInfo, *cmdCompleteFence));
-       }
-       VK_CHECK(m_vki.waitForFences(m_device, 1, &cmdCompleteFence.get(), 0u, infiniteTimeout)); // \note: timeout is failure
+       submitCommandsAndWait(m_vki, m_device, m_queue, cmd.get());
 
        dst.setStorage(m_targetFormat, m_targetSize.x(), m_targetSize.y());
 
@@ -837,8 +819,6 @@ tcu::TestStatus SingleTargetRenderInstance::iterate (void)
                };
 
                const vk::Unique<vk::VkCommandBuffer>   cmd                                     (vk::allocateCommandBuffer(m_vki, m_device, *m_cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-               const vk::Unique<vk::VkFence>                   fence                           (vk::createFence(m_vki, m_device));
-               const deUint64                                                  infiniteTimeout         = ~(deUint64)0u;
 
                VK_CHECK(m_vki.beginCommandBuffer(*cmd, &cmdBufBeginInfo));
                m_vki.cmdPipelineBarrier(*cmd, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, (vk::VkDependencyFlags)0,
@@ -847,25 +827,8 @@ tcu::TestStatus SingleTargetRenderInstance::iterate (void)
                                                                 1, &imageBarrier);
                VK_CHECK(m_vki.endCommandBuffer(*cmd));
 
-               {
-                       const vk::VkSubmitInfo  submitInfo      =
-                       {
-                               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                               DE_NULL,
-                               0u,
-                               (const vk::VkSemaphore*)0,
-                               (const vk::VkPipelineStageFlags*)DE_NULL,
-                               1u,
-                               &cmd.get(),
-                               0u,
-                               (const vk::VkSemaphore*)0,
-                       };
+               submitCommandsAndWait(m_vki, m_device, m_queue, cmd.get());
 
-                       VK_CHECK(m_vki.queueSubmit(m_queue, 1u, &submitInfo, *fence));
-               }
-               VK_CHECK(m_vki.waitForFences(m_device, 1u, &fence.get(), VK_TRUE, infiniteTimeout));
-
-               // and then render to
                renderToTarget();
        }
 
@@ -1184,7 +1147,6 @@ void SingleCmdRenderInstance::renderToTarget (void)
        const vk::Unique<vk::VkCommandBuffer>                           mainCmd                                         (vk::allocateCommandBuffer(m_vki, m_device, *m_cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
        const vk::Unique<vk::VkCommandBuffer>                           passCmd                                         ((m_isPrimaryCmdBuf) ? (vk::Move<vk::VkCommandBuffer>()) : (vk::allocateCommandBuffer(m_vki, m_device, *m_cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_SECONDARY)));
        const vk::Unique<vk::VkFence>                                           fence                                           (vk::createFence(m_vki, m_device));
-       const deUint64                                                                          infiniteTimeout                         = ~(deUint64)0u;
        const vk::VkSubpassContents                                                     passContents                            = (m_isPrimaryCmdBuf) ? (vk::VK_SUBPASS_CONTENTS_INLINE) : (vk::VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS);
 
        VK_CHECK(m_vki.beginCommandBuffer(*mainCmd, &mainCmdBufBeginInfo));
@@ -1209,22 +1171,7 @@ void SingleCmdRenderInstance::renderToTarget (void)
        VK_CHECK(m_vki.endCommandBuffer(*mainCmd));
 
        // submit and wait for them to finish before exiting scope. (Killing in-flight objects is a no-no).
-       {
-               const vk::VkSubmitInfo  submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const vk::VkSemaphore*)0,
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &mainCmd.get(),
-                       0u,
-                       (const vk::VkSemaphore*)0,
-               };
-               VK_CHECK(m_vki.queueSubmit(m_queue, 1, &submitInfo, *fence));
-       }
-       VK_CHECK(m_vki.waitForFences(m_device, 1, &fence.get(), 0u, infiniteTimeout)); // \note: timeout is failure
+       submitCommandsAndWait(m_vki, m_device, m_queue, mainCmd.get());
 }
 
 enum DescriptorSetCount
@@ -2409,13 +2356,6 @@ void ComputeCommand::submitAndWait (deUint32 queueFamilyIndex, vk::VkQueue queue
        };
        const vk::Unique<vk::VkCommandPool>                             cmdPool                         (vk::createCommandPool(m_vki, m_device, &cmdPoolCreateInfo));
 
-       const vk::VkFenceCreateInfo                                             fenceCreateInfo         =
-       {
-               vk::VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
-               DE_NULL,
-               0u,                     // flags
-       };
-
        const vk::VkCommandBufferAllocateInfo                   cmdBufCreateInfo        =
        {
                vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
@@ -2432,9 +2372,7 @@ void ComputeCommand::submitAndWait (deUint32 queueFamilyIndex, vk::VkQueue queue
                (const vk::VkCommandBufferInheritanceInfo*)DE_NULL,
        };
 
-       const vk::Unique<vk::VkFence>                                   cmdCompleteFence        (vk::createFence(m_vki, m_device, &fenceCreateInfo));
        const vk::Unique<vk::VkCommandBuffer>                   cmd                                     (vk::allocateCommandBuffer(m_vki, m_device, &cmdBufCreateInfo));
-       const deUint64                                                                  infiniteTimeout         = ~(deUint64)0u;
 
        VK_CHECK(m_vki.beginCommandBuffer(*cmd, &cmdBufBeginInfo));
 
@@ -2492,23 +2430,7 @@ void ComputeCommand::submitAndWait (deUint32 queueFamilyIndex, vk::VkQueue queue
                                                         0, (const vk::VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(m_vki.endCommandBuffer(*cmd));
 
-       // run
-       {
-               const vk::VkSubmitInfo  submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const vk::VkSemaphore*)0,
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmd.get(),
-                       0u,
-                       (const vk::VkSemaphore*)0,
-               };
-               VK_CHECK(m_vki.queueSubmit(queue, 1, &submitInfo, *cmdCompleteFence));
-       }
-       VK_CHECK(m_vki.waitForFences(m_device, 1, &cmdCompleteFence.get(), 0u, infiniteTimeout)); // \note: timeout is failure
+       submitCommandsAndWait(m_vki, m_device, queue, cmd.get());
 }
 
 //cmdPushDescriptorSet variant
@@ -2530,9 +2452,7 @@ void ComputeCommand::submitAndWait (deUint32 queueFamilyIndex, vk::VkQueue queue
                (const vk::VkCommandBufferInheritanceInfo*)DE_NULL,
        };
 
-       const vk::Unique<vk::VkFence>                                   cmdCompleteFence        (vk::createFence(m_vki, m_device));
        const vk::Unique<vk::VkCommandBuffer>                   cmd                                     (vk::allocateCommandBuffer(m_vki, m_device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-       const deUint64                                                                  infiniteTimeout         = ~(deUint64)0u;
 
        VK_CHECK(m_vki.beginCommandBuffer(*cmd, &cmdBufBeginInfo));
 
@@ -2561,23 +2481,7 @@ void ComputeCommand::submitAndWait (deUint32 queueFamilyIndex, vk::VkQueue queue
                                                         0, (const vk::VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(m_vki.endCommandBuffer(*cmd));
 
-       // run
-       {
-               const vk::VkSubmitInfo  submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const vk::VkSemaphore*)0,
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmd.get(),
-                       0u,
-                       (const vk::VkSemaphore*)0,
-               };
-               VK_CHECK(m_vki.queueSubmit(queue, 1, &submitInfo, *cmdCompleteFence));
-       }
-       VK_CHECK(m_vki.waitForFences(m_device, 1, &cmdCompleteFence.get(), 0u, infiniteTimeout)); // \note: timeout is failure
+       submitCommandsAndWait(m_vki, m_device, queue, cmd.get());
 }
 
 class BufferComputeInstance : public vkt::TestInstance
@@ -4228,8 +4132,6 @@ void ImageInstanceImages::uploadImage (const vk::DeviceInterface&         vki,
        };
 
        const vk::Unique<vk::VkCommandBuffer>   cmd                                                     (vk::allocateCommandBuffer(vki, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-       const vk::Unique<vk::VkFence>                   cmdCompleteFence                        (vk::createFence(vki, device));
-       const deUint64                                                  infiniteTimeout                         = ~(deUint64)0u;
        std::vector<vk::VkBufferImageCopy>              copySlices;
 
        // copy data to buffer
@@ -4250,22 +4152,7 @@ void ImageInstanceImages::uploadImage (const vk::DeviceInterface&                vki,
        VK_CHECK(vki.endCommandBuffer(*cmd));
 
        // submit and wait for command buffer to complete before killing it
-       {
-               const vk::VkSubmitInfo  submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const vk::VkSemaphore*)0,
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmd.get(),
-                       0u,
-                       (const vk::VkSemaphore*)0,
-               };
-               VK_CHECK(vki.queueSubmit(queue, 1, &submitInfo, *cmdCompleteFence));
-       }
-       VK_CHECK(vki.waitForFences(device, 1, &cmdCompleteFence.get(), 0u, infiniteTimeout)); // \note: timeout is failure
+       submitCommandsAndWait(vki, device, queue, cmd.get());
 }
 
 class ImageFetchInstanceImages : private ImageInstanceImages
index 1523140..1ed9143 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkDeviceUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkBuilderUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuFormatUtil.hpp"
index d08c58e..a080114 100644 (file)
@@ -287,43 +287,5 @@ void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandB
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer,
-                                                       const bool                              useDeviceGroups,
-                                                       const deUint32                  deviceMask)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       VkDeviceGroupSubmitInfo deviceGroupSubmitInfo   =
-       {
-               VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR, //      VkStructureType         sType;
-               DE_NULL,                                                                                //      const void*                     pNext;
-               0u,                                                                                             //      uint32_t                        waitSemaphoreCount;
-               DE_NULL,                                                                                //      const uint32_t*         pWaitSemaphoreDeviceIndices;
-               1u,                                                                                             //      uint32_t                        commandBufferCount;
-               &deviceMask,                                                                    //      const uint32_t*         pCommandBufferDeviceMasks;
-               0u,                                                                                             //      uint32_t                        signalSemaphoreCount;
-               DE_NULL,                                                                                //      const uint32_t*         pSignalSemaphoreDeviceIndices;
-       };
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                                          // VkStructureType                              sType;
-               useDeviceGroups ? &deviceGroupSubmitInfo : DE_NULL,     // const void*                                  pNext;
-               0u,                                                                                                     // deUint32                                             waitSemaphoreCount;
-               DE_NULL,                                                                                        // const VkSemaphore*                   pWaitSemaphores;
-               (const VkPipelineStageFlags*)DE_NULL,                           // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                                                                     // deUint32                                             commandBufferCount;
-               &commandBuffer,                                                                         // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                                                                     // deUint32                                             signalSemaphoreCount;
-               DE_NULL,                                                                                        // const VkSemaphore*                   pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 } // compute
 } // vkt
index 8d78451..b03f17c 100644 (file)
@@ -145,13 +145,6 @@ void                                                       beginCommandBuffer                              (const vk::DeviceInterface&                                     vk,
 void                                                   endCommandBuffer                                (const vk::DeviceInterface&                                     vk,
                                                                                                                                 const vk::VkCommandBuffer                                      cmdBuffer);
 
-void                                                   submitCommandsAndWait                   (const vk::DeviceInterface&                                     vk,
-                                                                                                                                const vk::VkDevice                                                     device,
-                                                                                                                                const vk::VkQueue                                                      queue,
-                                                                                                                                const vk::VkCommandBuffer                                      cmdBuffer,
-                                                                                                                                const bool                                                                     useDeviceGroups = false,
-                                                                                                                                const deUint32                                                         deviceMask = 1);
-
 inline vk::VkExtent3D makeExtent3D (const tcu::IVec3& vec)
 {
        return vk::makeExtent3D(vec.x(), vec.y(), vec.z());
index 026340f..9ca6784 100755 (executable)
@@ -35,6 +35,7 @@
 #include "vkRefUtil.hpp"
 #include "vkStrUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktTestCase.hpp"
 #include "vktTestCaseUtil.hpp"
 #include "vktTestGroupUtil.hpp"
@@ -151,7 +152,7 @@ private:
                        deUint32                                        getMemoryIndex                          (deUint32 memoryTypeBits, deUint32 memoryPropertyFlag);
                        void                                            getDeviceLayers                         (vector<string>& enabledLayers);
                        bool                                            isPeerFetchAllowed                      (deUint32 memoryTypeIndex, deUint32 firstdeviceID, deUint32 seconddeviceID);
-                       void                                            SubmitBufferAndWaitForIdle      (const DeviceDriver& vk, VkCommandBuffer cmdBuf, VkDeviceGroupSubmitInfo);
+                       void                                            SubmitBufferAndWaitForIdle      (const DeviceDriver& vk, VkCommandBuffer cmdBuf, deUint32 deviceMask);
        virtual tcu::TestStatus                         iterate                                         (void);
 
                        Move<VkDevice>                          m_deviceGroup;
@@ -351,30 +352,9 @@ void DeviceGroupTestInstance::init (void)
        m_deviceGroupQueue = getDeviceQueue(*deviceDriver, *m_deviceGroup, queueFamilyIndex, queueIndex);
 }
 
-void DeviceGroupTestInstance::SubmitBufferAndWaitForIdle(const DeviceDriver& vk, VkCommandBuffer cmdBuf, VkDeviceGroupSubmitInfo deviceGroupSubmitInfo)
+void DeviceGroupTestInstance::SubmitBufferAndWaitForIdle(const DeviceDriver& vk, VkCommandBuffer cmdBuf, deUint32 deviceMask)
 {
-       const VkFenceCreateInfo fenceParams =
-       {
-               VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // sType
-               DE_NULL,                                                                // pNext
-               0u,                                                                             // flags
-       };
-       const VkSubmitInfo              submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // sType
-               &deviceGroupSubmitInfo,                                 // pNext
-               0u,                                                                             // waitSemaphoreCount
-               DE_NULL,                                                                // pWaitSemaphores
-               (const VkPipelineStageFlags*)DE_NULL,   // pWaitDstStageMask
-               1u,                                                                             // commandBufferCount
-               &cmdBuf,                                                                // pCommandBuffers
-               0u,                                                                             // signalSemaphoreCount
-               DE_NULL,                                                                // pSignalSemaphores
-       };
-       const Unique<VkFence>   fence(createFence(vk, *m_deviceGroup, &fenceParams));
-
-       VK_CHECK(vk.queueSubmit(m_deviceGroupQueue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(*m_deviceGroup, 1u, &fence.get(), DE_TRUE, ~0ull));
+       submitCommandsAndWait(vk, *m_deviceGroup, m_deviceGroupQueue, cmdBuf, true, deviceMask);
        VK_CHECK(vk.deviceWaitIdle(*m_deviceGroup));
 }
 
@@ -496,18 +476,6 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                        0u,                                                                                             // memoryTypeIndex
                };
 
-               VkDeviceGroupSubmitInfo         deviceGroupSubmitInfo =
-               {
-                       VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO,             // sType
-                       DE_NULL,                                                                                // pNext
-                       0u,                                                                                             // waitSemaphoreCount
-                       DE_NULL,                                                                                // pWaitSemaphoreDeviceIndices
-                       0u,                                                                                             // commandBufferCount
-                       DE_NULL,                                                                                // pCommandBufferDeviceMasks
-                       0u,                                                                                             // signalSemaphoreCount
-                       DE_NULL,                                                                                // pSignalSemaphoreDeviceIndices
-               };
-
                // create vertex buffers
                {
                        const VkBufferCreateInfo        stagingVertexBufferParams =
@@ -1716,9 +1684,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                // Submit & wait for completion
                {
                        const deUint32 deviceMask = (1 << firstDeviceID) | (1 << secondDeviceID);
-                       deviceGroupSubmitInfo.commandBufferCount = 1;
-                       deviceGroupSubmitInfo.pCommandBufferDeviceMasks = &deviceMask;
-                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceGroupSubmitInfo);
+                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceMask);
                }
 
                // Copy image from secondDeviceID in case of AFR and SFR(only if Peer memory as copy source is not allowed)
@@ -1799,8 +1765,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                                        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
                                        const deUint32 deviceMask = 1 << firstDeviceID;
-                                       deviceGroupSubmitInfo.pCommandBufferDeviceMasks = &deviceMask;
-                                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceGroupSubmitInfo);
+                                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceMask);
                                }
 
                                // Copy Image from secondDeviceID to firstDeviceID
@@ -1840,8 +1805,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                                        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
                                        const deUint32 deviceMask = 1 << secondDeviceID;
-                                       deviceGroupSubmitInfo.pCommandBufferDeviceMasks = &deviceMask;
-                                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceGroupSubmitInfo);
+                                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceMask);
                                }
 
                                // Change layout back on firstDeviceID
@@ -1872,8 +1836,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                                        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
                                        const deUint32 deviceMask = 1 << firstDeviceID;
-                                       deviceGroupSubmitInfo.pCommandBufferDeviceMasks = &deviceMask;
-                                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceGroupSubmitInfo);
+                                       SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceMask);
                                }
                        }
                }
@@ -1941,8 +1904,7 @@ tcu::TestStatus DeviceGroupTestInstance::iterate (void)
                        // Submit & wait for completion
                        {
                                const deUint32 deviceMask = 1 << firstDeviceID;
-                               deviceGroupSubmitInfo.pCommandBufferDeviceMasks = &deviceMask;
-                               SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceGroupSubmitInfo);
+                               SubmitBufferAndWaitForIdle(vk, cmdBuffer.get(), deviceMask);
                        }
 
                        // Read results and check against reference image
index 2f7e899..c114c2b 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "vktDrawBaseClass.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktTestGroupUtil.hpp"
 
 #include "deDefs.h"
@@ -657,6 +658,7 @@ tcu::TestStatus DrawTestInstance<DrawParams>::iterate (void)
 {
        tcu::TestLog                    &log                            = m_context.getTestContext().getLog();
        const vk::VkQueue               queue                           = m_context.getUniversalQueue();
+       const vk::VkDevice              device                          = m_context.getDevice();
 
        beginRenderPass();
 
@@ -669,19 +671,7 @@ tcu::TestStatus DrawTestInstance<DrawParams>::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo        submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,                      // VkStructureType                      sType;
-               DE_NULL,                                                                        // const void*                          pNext;
-               0,                                                                                      // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                        // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                                      // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                                      // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::TextureLevel refImage (vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -697,8 +687,6 @@ tcu::TestStatus DrawTestInstance<DrawParams>::iterate (void)
        }
        generateRefImage(refImage.getAccess(), vertices, colors);
 
-       VK_CHECK(m_vk.queueWaitIdle(queue));
-
        const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
        const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
                vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
@@ -797,19 +785,7 @@ tcu::TestStatus DrawTestInstance<DrawIndexedParams>::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo        submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,                      // VkStructureType                      sType;
-               DE_NULL,                                                                        // const void*                          pNext;
-               0,                                                                                      // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                        // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                                      // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                                      // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
+       submitCommandsAndWait(m_vk, vkDevice, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::TextureLevel       refImage        (vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -826,8 +802,6 @@ tcu::TestStatus DrawTestInstance<DrawIndexedParams>::iterate (void)
        }
        generateRefImage(refImage.getAccess(), vertices, colors);
 
-       VK_CHECK(m_vk.queueWaitIdle(queue));
-
        const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
        const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
                vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
@@ -938,19 +912,7 @@ tcu::TestStatus DrawTestInstance<DrawIndirectParams>::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo        submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,                      // VkStructureType                      sType;
-               DE_NULL,                                                                        // const void*                          pNext;
-               0,                                                                                      // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                        // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                                      // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                                      // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
+       submitCommandsAndWait(m_vk, vkDevice, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::TextureLevel refImage (vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -972,8 +934,6 @@ tcu::TestStatus DrawTestInstance<DrawIndirectParams>::iterate (void)
                generateRefImage(refImage.getAccess(), vertices, colors);
        }
 
-       VK_CHECK(m_vk.queueWaitIdle(queue));
-
        const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
        const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
                vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
@@ -1132,19 +1092,7 @@ tcu::TestStatus DrawTestInstance<DrawIndexedIndirectParams>::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo        submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,                      // VkStructureType                      sType;
-               DE_NULL,                                                                        // const void*                          pNext;
-               0,                                                                                      // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                        // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                                      // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                                      // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
+       submitCommandsAndWait(m_vk, vkDevice, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::TextureLevel refImage (vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -1164,8 +1112,6 @@ tcu::TestStatus DrawTestInstance<DrawIndexedIndirectParams>::iterate (void)
                generateRefImage(refImage.getAccess(), vertices, colors);
        }
 
-       VK_CHECK(m_vk.queueWaitIdle(queue));
-
        const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
        const tcu::ConstPixelBufferAccess renderedFrame = m_colorTargetImage->readSurface(queue, m_context.getDefaultAllocator(),
                vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
index 34fdd82..23fba57 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "vktDrawBaseClass.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktTestGroupUtil.hpp"
 
 #include "deDefs.h"
@@ -330,21 +331,7 @@ tcu::TestStatus DrawTestInstance::iterate (void)
                        vk.cmdEndRenderPass(*cmdBuffer);
                        vk.endCommandBuffer(*cmdBuffer);
 
-                       VkSubmitInfo    submitInfo =
-                       {
-                               VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType;
-                               DE_NULL,                                                                // const void*                          pNext;
-                               0,                                                                              // deUint32                                     waitSemaphoreCount;
-                               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-                               (const VkPipelineStageFlags*)DE_NULL,
-                               1,                                                                              // deUint32                                     commandBufferCount;
-                               &cmdBuffer.get(),                                               // const VkCommandBuffer*       pCommandBuffers;
-                               0,                                                                              // deUint32                                     signalSemaphoreCount;
-                               DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores;
-                       };
-
-                       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-                       VK_CHECK(vk.queueWaitIdle(queue));
+                       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
                        frames[frameIdx] = colorTargetImages[frameIdx]->readSurface(queue, m_context.getDefaultAllocator(), VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, VK_IMAGE_ASPECT_COLOR_BIT);
                }
index 0d1fae9..19aa0d0 100644 (file)
@@ -30,6 +30,7 @@
 #include "vkRefUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktDrawCreateInfoUtil.hpp"
 #include "vktDrawBufferObjectUtil.hpp"
 
@@ -350,22 +351,7 @@ void Image::readUsingBuffer (vk::VkQueue                           queue,
                m_vk.cmdCopyImageToBuffer(*copyCmdBuffer, object(), layout, stagingResource->object(), 1, &region);
                VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &copyCmdBuffer.get(),                           // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
-               // TODO: make this less intrusive
-               VK_CHECK(m_vk.queueWaitIdle(queue));
+               submitCommandsAndWait(m_vk, m_device, queue, copyCmdBuffer.get());
        }
 
        // Validate the results
@@ -455,22 +441,7 @@ de::SharedPtr<Image> Image::copyToLinearImage (vk::VkQueue                                 queue,
                m_vk.cmdCopyImage(*copyCmdBuffer, object(), layout, stagingResource->object(), vk::VK_IMAGE_LAYOUT_GENERAL, 1, &region);
                VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &copyCmdBuffer.get(),                           // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
-               // TODO: make this less intrusive
-               VK_CHECK(m_vk.queueWaitIdle(queue));
+               submitCommandsAndWait(m_vk, m_device, queue, copyCmdBuffer.get());
 
                // Validate the results
                const vk::Allocation& imgAllocation = stagingResource->getBoundMemory();
@@ -632,22 +603,7 @@ void Image::upload (vk::VkQueue                                    queue,
                                                                vk::VK_IMAGE_LAYOUT_GENERAL, object(), layout, 1, &region);
                VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &copyCmdBuffer.get(),                           // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
-               // TODO: make this less intrusive
-               VK_CHECK(m_vk.queueWaitIdle(queue));
+               submitCommandsAndWait(m_vk, m_device, queue, copyCmdBuffer.get());
        }
 }
 
@@ -742,22 +698,7 @@ void Image::uploadUsingBuffer (vk::VkQueue                                 queue,
                        object(), layout, 1, &region);
                VK_CHECK(m_vk.endCommandBuffer(*copyCmdBuffer));
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &copyCmdBuffer.get(),                           // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
-               // TODO: make this less intrusive
-               VK_CHECK(m_vk.queueWaitIdle(queue));
+               submitCommandsAndWait(m_vk, m_device, queue, copyCmdBuffer.get());
        }
 }
 
index bc48596..e59e8fd 100644 (file)
@@ -36,6 +36,7 @@
 #include "tcuRGBA.hpp"
 
 #include "vkDefs.hpp"
+#include "vkCmdUtil.hpp"
 
 enum
 {
@@ -133,8 +134,9 @@ DrawIndexed::DrawIndexed (Context &context, TestSpec testSpec)
 
 tcu::TestStatus DrawIndexed::iterate (void)
 {
-       tcu::TestLog &log                       = m_context.getTestContext().getLog();
-       const vk::VkQueue queue         = m_context.getUniversalQueue();
+       tcu::TestLog&           log             = m_context.getTestContext().getLog();
+       const vk::VkQueue       queue   = m_context.getUniversalQueue();
+       const vk::VkDevice      device  = m_context.getDevice();
 
        beginRenderPass();
 
@@ -168,22 +170,7 @@ tcu::TestStatus DrawIndexed::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                              // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                              // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                              // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -234,8 +221,9 @@ DrawInstancedIndexed::DrawInstancedIndexed (Context &context, TestSpec testSpec)
 
 tcu::TestStatus DrawInstancedIndexed::iterate (void)
 {
-       tcu::TestLog &log               = m_context.getTestContext().getLog();
-       const vk::VkQueue queue = m_context.getUniversalQueue();
+       tcu::TestLog&           log             = m_context.getTestContext().getLog();
+       const vk::VkQueue       queue   = m_context.getUniversalQueue();
+       const vk::VkDevice      device  = m_context.getDevice();
 
        beginRenderPass();
 
@@ -290,21 +278,7 @@ tcu::TestStatus DrawInstancedIndexed::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                              // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                              // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                              // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        VK_CHECK(m_vk.queueWaitIdle(queue));
index cb89897..521dbc2 100644 (file)
@@ -36,6 +36,7 @@
 #include "tcuRGBA.hpp"
 
 #include "vkDefs.hpp"
+#include "vkCmdUtil.hpp"
 
 namespace vkt
 {
@@ -216,8 +217,9 @@ void IndirectDraw::addCommand<vk::VkDrawIndexedIndirectCommand>(const vk::VkDraw
 
 tcu::TestStatus IndirectDraw::iterate (void)
 {
-       tcu::TestLog &log = m_context.getTestContext().getLog();
-       const vk::VkQueue queue = m_context.getUniversalQueue();
+       tcu::TestLog&           log             = m_context.getTestContext().getLog();
+       const vk::VkQueue       queue   = m_context.getUniversalQueue();
+       const vk::VkDevice      device  = m_context.getDevice();
 
        if (m_drawType == DRAW_TYPE_SEQUENTIAL)
        {
@@ -407,21 +409,7 @@ tcu::TestStatus IndirectDraw::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                              // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                              // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                              // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -479,8 +467,9 @@ IndirectDrawInstanced<FirstInstanceSupport>::IndirectDrawInstanced (Context &con
 template<class FirstInstanceSupport>
 tcu::TestStatus IndirectDrawInstanced<FirstInstanceSupport>::iterate (void)
 {
-       tcu::TestLog &log = m_context.getTestContext().getLog();
-       const vk::VkQueue queue = m_context.getUniversalQueue();
+       tcu::TestLog&           log             = m_context.getTestContext().getLog();
+       const vk::VkQueue       queue   = m_context.getUniversalQueue();
+       const vk::VkDevice      device  = m_context.getDevice();
 
        if (m_drawType == DRAW_TYPE_SEQUENTIAL)
        {
@@ -672,21 +661,7 @@ tcu::TestStatus IndirectDrawInstanced<FirstInstanceSupport>::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                              // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                              // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                              // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        VK_CHECK(m_vk.queueWaitIdle(queue));
index 13e215a..b502fcf 100644 (file)
@@ -31,6 +31,7 @@
 #include "tcuTextureUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkPrograms.hpp"
+#include "vkCmdUtil.hpp"
 #include "vktDrawBufferObjectUtil.hpp"
 #include "vktDrawCreateInfoUtil.hpp"
 #include "vktDrawImageObjectUtil.hpp"
@@ -434,6 +435,7 @@ InstancedDrawInstance::InstancedDrawInstance(Context &context, TestParams params
 tcu::TestStatus InstancedDrawInstance::iterate()
 {
        const vk::VkQueue               queue                                   = m_context.getUniversalQueue();
+       const vk::VkDevice              device                                  = m_context.getDevice();
        static const deUint32   instanceCounts[]                = { 0, 1, 2, 4, 20 };
        static const deUint32   firstInstanceIndices[]  = { 0, 1, 3, 4, 20 };
 
@@ -562,21 +564,7 @@ tcu::TestStatus InstancedDrawInstance::iterate()
                        m_vk.cmdEndRenderPass(*m_cmdBuffer);
                        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-                       vk::VkSubmitInfo submitInfo =
-                       {
-                               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,                      // VkStructureType                              sType;
-                               DE_NULL,                                                                        // const void*                                  pNext;
-                               0,                                                                                      // deUint32                                             waitSemaphoreCount;
-                               DE_NULL,                                                                        // const VkSemaphore*                   pWaitSemaphores;
-                               (const vk::VkPipelineStageFlags*)DE_NULL,       // const VkPipelineStageFlags*  pWaitDstStageMask;
-                               1,                                                                                      // deUint32                                             commandBufferCount;
-                               &m_cmdBuffer.get(),                                                     // const VkCommandBuffer*               pCommandBuffers;
-                               0,                                                                                      // deUint32                                             signalSemaphoreCount;
-                               DE_NULL                                                                         // const VkSemaphore*                   pSignalSemaphores;
-                       };
-                       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
+                       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                        // Reference rendering
                        std::vector<tcu::Vec4>  vetrices;
index f0bdbba..faaaa68 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkPrograms.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuVector.hpp"
 #include "tcuTextureUtil.hpp"
@@ -298,24 +299,7 @@ tcu::ConstPixelBufferAccess InvertedDepthRangesTestInstance::draw (const VkViewp
        vk.endCommandBuffer(*cmdBuffer);
 
        // Submit
-       {
-               const Unique<VkFence>   fence           (createFence(vk, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                          // VkStructureType                sType;
-                       DE_NULL,                                                                        // const void*                    pNext;
-                       0,                                                                                      // uint32_t                       waitSemaphoreCount;
-                       DE_NULL,                                                                        // const VkSemaphore*             pWaitSemaphores;
-                       (const VkPipelineStageFlags*)DE_NULL,           // const VkPipelineStageFlags*    pWaitDstStageMask;
-                       1,                                                                                      // uint32_t                       commandBufferCount;
-                       &cmdBuffer.get(),                                                       // const VkCommandBuffer*         pCommandBuffers;
-                       0,                                                                                      // uint32_t                       signalSemaphoreCount;
-                       DE_NULL                                                                         // const VkSemaphore*             pSignalSemaphores;
-               };
-
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        // Get result
        {
index 187b514..6de1fe4 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuVector.hpp"
 #include "tcuTextureUtil.hpp"
@@ -299,24 +300,7 @@ tcu::ConstPixelBufferAccess NegativeViewportHeightTestInstance::draw (const VkVi
        vk.endCommandBuffer(*cmdBuffer);
 
        // Submit
-       {
-               const Unique<VkFence>   fence           (createFence(vk, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                          // VkStructureType                sType;
-                       DE_NULL,                                                                        // const void*                    pNext;
-                       0,                                                                                      // uint32_t                       waitSemaphoreCount;
-                       DE_NULL,                                                                        // const VkSemaphore*             pWaitSemaphores;
-                       (const VkPipelineStageFlags*)DE_NULL,           // const VkPipelineStageFlags*    pWaitDstStageMask;
-                       1,                                                                                      // uint32_t                       commandBufferCount;
-                       &cmdBuffer.get(),                                                       // const VkCommandBuffer*         pCommandBuffers;
-                       0,                                                                                      // uint32_t                       signalSemaphoreCount;
-                       DE_NULL                                                                         // const VkSemaphore*             pSignalSemaphores;
-               };
-
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        // Get result
        {
index 2c4a46d..2228309 100644 (file)
@@ -28,6 +28,7 @@
 #include "vktDrawBaseClass.hpp"
 
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuImageCompare.hpp"
@@ -326,20 +327,9 @@ tcu::TestStatus DrawTest::iterate (void)
        // Submit
        {
                const vk::VkQueue               queue           = m_context.getUniversalQueue();
-               const vk::VkSubmitInfo  submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,                      // VkStructureType                      sType;
-                       DE_NULL,                                                                        // const void*                          pNext;
-                       0,                                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-               VK_CHECK(m_vk.queueWaitIdle(queue));
+               const vk::VkDevice              device          = m_context.getDevice();
+
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
        }
 
        // Validate
index 816e589..b18aefb 100644 (file)
@@ -36,6 +36,7 @@
 #include "tcuRGBA.hpp"
 
 #include "vkDefs.hpp"
+#include "vkCmdUtil.hpp"
 
 namespace vkt
 {
@@ -108,13 +109,14 @@ SimpleDraw::SimpleDraw (Context &context, TestSpec testSpec)
 
 tcu::TestStatus SimpleDraw::iterate (void)
 {
-       tcu::TestLog &log                                                       = m_context.getTestContext().getLog();
-       const vk::VkQueue queue                                         = m_context.getUniversalQueue();
+       tcu::TestLog&                   log                                     = m_context.getTestContext().getLog();
+       const vk::VkQueue               queue                           = m_context.getUniversalQueue();
+       const vk::VkDevice              device                          = m_context.getDevice();
 
        beginRenderPass();
 
-       const vk::VkDeviceSize vertexBufferOffset       = 0;
-       const vk::VkBuffer vertexBuffer                         = m_vertexBuffer->object();
+       const vk::VkDeviceSize  vertexBufferOffset      = 0;
+       const vk::VkBuffer              vertexBuffer            = m_vertexBuffer->object();
 
        m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
        m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
@@ -147,21 +149,7 @@ tcu::TestStatus SimpleDraw::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                              // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                              // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                              // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
@@ -212,14 +200,14 @@ SimpleDrawInstanced::SimpleDrawInstanced (Context &context, TestSpec testSpec)
 
 tcu::TestStatus SimpleDrawInstanced::iterate (void)
 {
-       tcu::TestLog &log               = m_context.getTestContext().getLog();
-
-       const vk::VkQueue queue = m_context.getUniversalQueue();
+       tcu::TestLog&           log                                             = m_context.getTestContext().getLog();
+       const vk::VkQueue       queue                                   = m_context.getUniversalQueue();
+       const vk::VkDevice      device                                  = m_context.getDevice();
 
        beginRenderPass();
 
-       const vk::VkDeviceSize vertexBufferOffset = 0;
-       const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
+       const vk::VkDeviceSize  vertexBufferOffset      = 0;
+       const vk::VkBuffer              vertexBuffer            = m_vertexBuffer->object();
 
        m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
 
@@ -253,21 +241,7 @@ tcu::TestStatus SimpleDrawInstanced::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                              // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                              // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                              // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        VK_CHECK(m_vk.queueWaitIdle(queue));
index 278308d..677e25b 100644 (file)
@@ -28,6 +28,7 @@
 #include "vktDynamicStateTestCaseUtil.hpp"
 
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuImageCompare.hpp"
 #include "tcuTextureUtil.hpp"
@@ -86,8 +87,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                const vk::VkClearColorValue clearColor = { { 1.0f, 1.0f, 1.0f, 1.0f } };
                beginRenderPassWithClearColor(clearColor);
@@ -109,20 +111,7 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-               VK_CHECK(m_vk.queueWaitIdle(queue));
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                //validation
                {
index b13f366..ed3df6c 100644 (file)
@@ -38,6 +38,7 @@
 #include "vkRefUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "vktDrawCreateInfoUtil.hpp"
 #include "vktDrawImageObjectUtil.hpp"
@@ -445,8 +446,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -470,24 +472,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                        referenceFrame.allocLevel(0);
 
@@ -741,20 +729,7 @@ tcu::TestStatus DepthBoundsTestInstance::iterate (void)
        m_vk.cmdEndRenderPass(*m_cmdBuffer);
        m_vk.endCommandBuffer(*m_cmdBuffer);
 
-       vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                      // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                      // deUint32                                     commandBufferCount;
-               &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                      // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-       VK_CHECK(m_vk.queueWaitIdle(queue));
+       submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
        // Validation
        {
@@ -857,8 +832,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -882,24 +858,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                        referenceFrame.allocLevel(0);
 
@@ -1027,8 +989,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -1052,24 +1015,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                        referenceFrame.allocLevel(0);
 
index c60f453..f8222c8 100644 (file)
@@ -40,6 +40,7 @@
 #include "tcuRGBA.hpp"
 
 #include "vkDefs.hpp"
+#include "vkCmdUtil.hpp"
 
 namespace vkt
 {
@@ -69,8 +70,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog& log               = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -100,23 +102,9 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                //validation
-               VK_CHECK(m_vk.queueWaitIdle(queue));
-
                tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                referenceFrame.allocLevel(0);
 
@@ -174,8 +162,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log               = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog            &log    = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -210,23 +199,9 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                //validation
-               VK_CHECK(m_vk.queueWaitIdle(queue));
-
                tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                referenceFrame.allocLevel(0);
 
@@ -325,8 +300,9 @@ public:
 
        virtual tcu::TestStatus iterate(void)
        {
-               tcu::TestLog &log                               = m_context.getTestContext().getLog();
-               const vk::VkQueue queue                 = m_context.getUniversalQueue();
+               tcu::TestLog&           log                     = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue           = m_context.getUniversalQueue();
+               const vk::VkDevice      device          = m_context.getDevice();
 
                beginRenderPass();
 
@@ -360,23 +336,9 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                //validation
-               VK_CHECK(m_vk.queueWaitIdle(queue));
-
                tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                referenceFrame.allocLevel(0);
 
index 37f8994..b45dca4 100644 (file)
@@ -28,6 +28,7 @@
 #include "vktDynamicStateTestCaseUtil.hpp"
 
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
@@ -404,8 +405,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log               = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -430,19 +432,7 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
@@ -511,8 +501,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -536,24 +527,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                        referenceFrame.allocLevel(0);
 
@@ -617,8 +594,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log               = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -642,24 +620,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                        referenceFrame.allocLevel(0);
 
index 2188b88..5d75bea 100644 (file)
@@ -28,6 +28,7 @@
 #include "vktDynamicStateTestCaseUtil.hpp"
 
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
@@ -75,8 +76,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log                       = m_context.getTestContext().getLog();
-               const vk::VkQueue queue         = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -94,24 +96,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame = buildReferenceFrame();
 
                        const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
@@ -130,10 +118,10 @@ public:
        }
 };
 
-class ViewportParamTestInstane : public ViewportStateBaseCase
+class ViewportParamTestInstance : public ViewportStateBaseCase
 {
 public:
-       ViewportParamTestInstane (Context& context, ShaderMap shaders)
+       ViewportParamTestInstance (Context& context, ShaderMap shaders)
                : ViewportStateBaseCase (context, shaders[glu::SHADERTYPE_VERTEX], shaders[glu::SHADERTYPE_FRAGMENT])
        {
                ViewportStateBaseCase::initialize();
@@ -283,8 +271,9 @@ public:
 
        virtual tcu::TestStatus iterate (void)
        {
-               tcu::TestLog &log = m_context.getTestContext().getLog();
-               const vk::VkQueue queue = m_context.getUniversalQueue();
+               tcu::TestLog&           log             = m_context.getTestContext().getLog();
+               const vk::VkQueue       queue   = m_context.getUniversalQueue();
+               const vk::VkDevice      device  = m_context.getDevice();
 
                beginRenderPass();
 
@@ -326,24 +315,10 @@ public:
                m_vk.cmdEndRenderPass(*m_cmdBuffer);
                m_vk.endCommandBuffer(*m_cmdBuffer);
 
-               vk::VkSubmitInfo submitInfo =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-                       DE_NULL,                                                        // const void*                          pNext;
-                       0,                                                                      // deUint32                                     waitSemaphoreCount;
-                       DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1,                                                                      // deUint32                                     commandBufferCount;
-                       &m_cmdBuffer.get(),                                     // const VkCommandBuffer*       pCommandBuffers;
-                       0,                                                                      // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-               };
-               m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
+               submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
 
                // validation
                {
-                       VK_CHECK(m_vk.queueWaitIdle(queue));
-
                        tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
                        referenceFrame.allocLevel(0);
 
@@ -399,7 +374,7 @@ void DynamicStateVPTests::init (void)
        shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/dynamic_state/VertexFetch.vert";
        shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/dynamic_state/VertexFetch.frag";
 
-       addChild(new InstanceFactory<ViewportParamTestInstane>(m_testCtx, "viewport", "Set viewport which is twice bigger than screen size", shaderPaths));
+       addChild(new InstanceFactory<ViewportParamTestInstance>(m_testCtx, "viewport", "Set viewport which is twice bigger than screen size", shaderPaths));
        addChild(new InstanceFactory<ScissorParamTestInstance>(m_testCtx, "scissor", "Perform a scissor test on 1/4 bottom-left part of the surface", shaderPaths));
 
        shaderPaths[glu::SHADERTYPE_GEOMETRY] = "vulkan/dynamic_state/ViewportArray.geom";
index 200e35b..c7d7212 100644 (file)
@@ -25,6 +25,7 @@
 #include "vkTypeUtil.hpp"
 #include "vkPrograms.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include <vector>
 
 namespace vkt
@@ -206,29 +207,6 @@ void beginCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer comman
        VK_CHECK(vk.beginCommandBuffer(commandBuffer, &info));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                sType;
-               DE_NULL,                                                        // const void*                    pNext;
-               0u,                                                                     // uint32_t                       waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                     // uint32_t                       commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                     // uint32_t                       signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 Move<VkFramebuffer> makeFramebuffer (const DeviceInterface&            vk,
                                                                         const VkDevice                         device,
                                                                         const VkRenderPass                     renderPass,
index f8b6cef..3236266 100644 (file)
@@ -47,7 +47,6 @@ vk::VkImageMemoryBarrier              makeImageMemoryBarrier  (const vk::VkAccessFlags srcAcc
 de::MovePtr<vk::Allocation>            bindImage                               (const vk::DeviceInterface& vk, const vk::VkDevice device, vk::Allocator& allocator, const vk::VkImage image, const vk::MemoryRequirement requirement);
 de::MovePtr<vk::Allocation>            bindBuffer                              (const vk::DeviceInterface& vk, const vk::VkDevice device, vk::Allocator& allocator, const vk::VkBuffer buffer, const vk::MemoryRequirement requirement);
 void                                                   beginCommandBuffer              (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
-void                                                   submitCommandsAndWait   (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
 
 inline vk::Move<vk::VkBuffer> makeBuffer (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkBufferCreateInfo& createInfo)
 {
index ed4ba8f..f67baf6 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vkMemUtil.hpp"
 #include "tcuTextureUtil.hpp"
 
@@ -235,21 +236,7 @@ void uploadImage (Context&                                                         context,
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                              sType;
-               DE_NULL,                                                // const void*                                  pNext;
-               0u,                                                             // deUint32                                             waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                             // deUint32                                             commandBufferCount;
-               &cmdBuffer.get(),                               // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                             // deUint32                                             signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*                   pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull) /* infinity */));
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 }
 
 class GeometryOutputCountTestInstance : public GeometryExpanderRenderTestInstance
index 750040c..3745da9 100644 (file)
@@ -33,6 +33,7 @@
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
index 980014f..d438278 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkBuilderUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deStringUtil.hpp"
 #include "deUniquePtr.hpp"
index 15d2304..559138e 100644 (file)
@@ -673,29 +673,6 @@ void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandB
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                sType;
-               DE_NULL,                                                        // const void*                    pNext;
-               0u,                                                                     // uint32_t                       waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                     // uint32_t                       commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                     // uint32_t                       signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 bool compareWithFileImage (Context& context, const tcu::ConstPixelBufferAccess& resultImage, std::string testName)
 {
        tcu::TextureLevel referenceImage;
index 469c0c5..9e972f2 100644 (file)
@@ -184,7 +184,6 @@ void                                                        beginRenderPass                         (const vk::DeviceInterface& vk, const vk::VkComman
 void                                                   endRenderPass                           (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
 void                                                   beginCommandBuffer                      (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
 void                                                   endCommandBuffer                        (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
-void                                                   submitCommandsAndWait           (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
 
 bool                                                   compareWithFileImage            (Context& context, const tcu::ConstPixelBufferAccess& resultImage, std::string name);
 
index c90e9e5..7c746da 100644 (file)
@@ -34,6 +34,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuTexture.hpp"
index a555649..07eac74 100644 (file)
@@ -38,6 +38,7 @@
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuTexture.hpp"
index 568eddd..7bd4052 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
index 864f1e6..2430d45 100644 (file)
@@ -29,6 +29,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
index 400a42d..12a0946 100644 (file)
@@ -38,6 +38,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deDefs.hpp"
 #include "deStringUtil.hpp"
index 7fa880a..7dbb85b 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkMemUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
index 43159ae..93ed887 100644 (file)
@@ -830,30 +830,6 @@ void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandB
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       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,   // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                                             // deUint32                                             commandBufferCount;
-               &commandBuffer,                                                 // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                                             // deUint32                                             signalSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*                   pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 tcu::UVec3 getCompressedImageResolutionInBlocks (const vk::VkFormat format, const tcu::UVec3& size)
 {
        deUint32        blockWidth      = getBlockWidth(format);
index 6bf1a89..a7b18e6 100644 (file)
@@ -192,11 +192,6 @@ void                                                               beginCommandBuffer                              (const vk::DeviceInterface&                                     vk,
 void                                                           endCommandBuffer                                (const vk::DeviceInterface&                                     vk,
                                                                                                                                         const vk::VkCommandBuffer                                      cmdBuffer);
 
-void                                                           submitCommandsAndWait                   (const vk::DeviceInterface&                                     vk,
-                                                                                                                                        const vk::VkDevice                                                     device,
-                                                                                                                                        const vk::VkQueue                                                      queue,
-                                                                                                                                        const vk::VkCommandBuffer                                      cmdBuffer);
-
 inline vk::VkDeviceSize getImageSizeBytes (const tcu::IVec3& imageSize, const vk::VkFormat format)
 {
        return tcu::getPixelSize(vk::mapVkFormat(format)) * imageSize.x() * imageSize.y() * imageSize.z();
index db8f17c..781e9d1 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuTexture.hpp"
index 4078201..9beea39 100644 (file)
@@ -35,6 +35,7 @@
 #include "deSharedPtr.hpp"
 #include "vktTestCase.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include <algorithm>
 
@@ -393,23 +394,6 @@ const VkCommandBufferBeginInfo                     makeCommandBufferInfo                           ()
        return cmdBufferBeginInfo;
 }
 
-const VkSubmitInfo                                             makeSubmitInfo                                          (const VkCommandBuffer& commandBuffer)
-{
-       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,                                                           // const VkPipelineStageFlags* flags;
-               1u,                                                                                                                                     // deUint32                             commandBufferCount;
-               &commandBuffer,                                                                                                         // const VkCommandBuffer* pCommandBuffers;
-               0u,                                                                                                                                     // deUint32                             signalSemaphoreCount;
-               DE_NULL                                                                                                                         // const VkSemaphore*   pSignalSemaphores;
-       };
-       return submitInfo;
-}
-
 Move<VkCommandBuffer>                                  createCommandBuffer                                     (const DeviceInterface& vk,
                                                                                                                                                         VkDevice                               device,
                                                                                                                                                         VkCommandPool                  commandPool)
@@ -654,11 +638,7 @@ void                                                                       fillUpResource<VkBuffer>                        (Move<VkBuffer>&                source,
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &dstBufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo                                      submitInfo                                                      = makeSubmitInfo(*cmdBuffer);
-       Move<VkFence>                                           fence                                                           = createFence(vk, vkDevice);
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &*fence, DE_TRUE, ~(0ull)));
+       submitCommandsAndWait(vk, vkDevice, queue, *cmdBuffer);
 }
 
 template <>
@@ -700,11 +680,7 @@ void                                                                       fillUpResource<VkImage>                         (Move<VkBuffer>&                source,
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &dstImageBarrier);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo                                      submitInfo                                                      = makeSubmitInfo(*cmdBuffer);
-       Move<VkFence>                                           fence                                                           = createFence(vk, vkDevice);
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &*fence, DE_TRUE, ~(0ull)));
+       submitCommandsAndWait(vk, vkDevice, queue, *cmdBuffer);
 }
 
 template <typename TTarget>
@@ -761,11 +737,7 @@ void                                                                       readUpResource                                          (Move<VkImage>&                 source,
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &dstBufferBarrier, 1, &postImageBarrier);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo                                      submitInfo                                                      = makeSubmitInfo(*cmdBuffer);
-       Move<VkFence>                                           fence                                                           = createFence(vk, vkDevice);
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &*fence, DE_TRUE, ~(0ull)));
+       submitCommandsAndWait(vk, vkDevice, queue, *cmdBuffer);
 }
 
 void                                                                   createBuffer                                            (Move<VkBuffer>&                buffer,
index 4df2bba..7f52c6f 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkMemUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkPrograms.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuMaybe.hpp"
 #include "tcuTextureUtil.hpp"
@@ -658,30 +659,6 @@ vk::Move<vk::VkDeviceMemory> bindImageMemory (const vk::InstanceInterface& vki,
        TCU_FAIL("Failed to allocate memory for image");
 }
 
-void queueRun (const vk::DeviceInterface&      vkd,
-                          vk::VkQueue                                  queue,
-                          vk::VkCommandBuffer                  commandBuffer)
-{
-       const vk::VkSubmitInfo  submitInfo      =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-               DE_NULL,
-
-               0,
-               DE_NULL,
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-
-               1,
-               &commandBuffer,
-
-               0,
-               DE_NULL
-       };
-
-       VK_CHECK(vkd.queueSubmit(queue, 1, &submitInfo, 0));
-       VK_CHECK(vkd.queueWaitIdle(queue));
-}
-
 void* mapMemory (const vk::DeviceInterface&    vkd,
                                 vk::VkDevice                           device,
                                 vk::VkDeviceMemory                     memory,
@@ -2350,7 +2327,7 @@ void BufferCopyToBuffer::verify (VerifyContext& context, size_t commandIndex)
        vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_HOST_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 1, &barrier, 0, (const vk::VkImageMemoryBarrier*)DE_NULL);
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-       queueRun(vkd, queue, *commandBuffer);
+       submitCommandsAndWait(vkd, device, queue, *commandBuffer);
 
        {
                void* const     ptr             = mapMemory(vkd, device, *m_memory, m_bufferSize);
@@ -2567,7 +2544,7 @@ void BufferCopyToImage::prepare (PrepareContext& context)
                vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, 1, &barrier);
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
        }
 }
 
@@ -2678,7 +2655,7 @@ void BufferCopyToImage::verify (VerifyContext& context, size_t commandIndex)
        }
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-       queueRun(vkd, queue, *commandBuffer);
+       submitCommandsAndWait(vkd, device, queue, *commandBuffer);
 
        {
                void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_imageWidth * m_imageHeight);
@@ -2871,7 +2848,7 @@ void BufferCopyFromImage::prepare (PrepareContext& context)
                vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
        }
 }
 
@@ -3015,7 +2992,7 @@ void ImageCopyToBuffer::verify (VerifyContext& context, size_t commandIndex)
        vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_HOST_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 1, &barrier, 0, (const vk::VkImageMemoryBarrier*)DE_NULL);
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-       queueRun(vkd, queue, *commandBuffer);
+       submitCommandsAndWait(vkd, device, queue, *commandBuffer);
 
        reference.setUndefined(0, (size_t)m_imageMemorySize);
        {
@@ -3306,7 +3283,7 @@ void ImageCopyFromImage::prepare (PrepareContext& context)
                vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
        }
 }
 
@@ -3470,7 +3447,7 @@ void ImageCopyToImage::prepare (PrepareContext& context)
                vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, 1, &barrier);
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
        }
 }
 
@@ -3585,7 +3562,7 @@ void ImageCopyToImage::verify (VerifyContext& context, size_t commandIndex)
        }
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-       queueRun(vkd, queue, *commandBuffer);
+       submitCommandsAndWait(vkd, device, queue, *commandBuffer);
 
        {
                void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_imageWidth * m_imageHeight);
@@ -3788,7 +3765,7 @@ void ImageBlitFromImage::prepare (PrepareContext& context)
                vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
        }
 }
 
@@ -4004,7 +3981,7 @@ void ImageBlitToImage::prepare (PrepareContext& context)
                vkd.cmdPipelineBarrier(*commandBuffer, vk::VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, (vk::VkDependencyFlags)0, 0, (const vk::VkMemoryBarrier*)DE_NULL, 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, 1, &barrier);
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
        }
 }
 
@@ -4129,7 +4106,7 @@ void ImageBlitToImage::verify (VerifyContext& context, size_t commandIndex)
        }
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-       queueRun(vkd, queue, *commandBuffer);
+       submitCommandsAndWait(vkd, device, queue, *commandBuffer);
 
        {
                void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_dstImageWidth * m_dstImageHeight);
@@ -4590,7 +4567,7 @@ void SubmitRenderPass::verify (VerifyContext& context, size_t commandIndex)
                }
 
                VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
-               queueRun(vkd, queue, *commandBuffer);
+               submitCommandsAndWait(vkd, device, queue, *commandBuffer);
 
                {
                        void* const     ptr             = mapMemory(vkd, device, *memory, 4 * m_targetWidth * m_targetHeight);
index 40f7406..96c4a91 100644 (file)
@@ -33,6 +33,7 @@
 #include "vkPlatform.hpp"
 #include "vkMemUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuResource.hpp"
index e12be59..44bc672 100644 (file)
@@ -541,34 +541,5 @@ void imageBarrier (const DeviceInterface&                  vk,
                1u, &barrier);
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const VkFenceCreateInfo fenceInfo       =
-       {
-               VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType;
-               DE_NULL,                                                                // const void*                  pNext;
-               (VkFenceCreateFlags)0,                                  // VkFenceCreateFlags   flags;
-       };
-       const Unique<VkFence>   fence           (createFence(vk, device, &fenceInfo));
-
-       const VkSubmitInfo              submitInfo      =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                              sType;
-               DE_NULL,                                                // const void*                                  pNext;
-               0u,                                                             // uint32_t                                             waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                             // uint32_t                                             commandBufferCount;
-               &commandBuffer,                                 // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                             // uint32_t                                             signalSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 } // MultiView
 } // vkt
index e5903b7..411affa 100644 (file)
@@ -47,7 +47,6 @@ vk::Move<vk::VkRenderPass>                    makeRenderPassWithDepth                 (const vk::DeviceInterfac
 void                                                           beginCommandBuffer                              (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
 void                                                           beginSecondaryCommandBuffer             (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const deUint32 subpass, const vk::VkFramebuffer framebuffer);
 void                                                           imageBarrier                                    (const vk::DeviceInterface& vk, const vk::VkCommandBuffer cmdBuffer, const vk::VkImage image, const vk::VkImageSubresourceRange subresourceRange, const vk::VkImageLayout oldLayout, const vk::VkImageLayout newLayout, const vk::VkAccessFlags srcAccessMask, const vk::VkAccessFlags dstAccessMask, const vk::VkPipelineStageFlags srcStageMask = vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, const vk::VkPipelineStageFlags dstStageMask = vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
-void                                                           submitCommandsAndWait                   (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
 
 } // MultiView
 } // vkt
index d7091c0..7293254 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "tcuPlatform.hpp"
 #include "tcuTextureUtil.hpp"
@@ -150,8 +151,6 @@ private:
 
        Move<VkCommandPool>                                     m_cmdPool;
        Move<VkCommandBuffer>                           m_cmdBuffer;
-
-       Move<VkFence>                                           m_fence;
 };
 
 
@@ -754,9 +753,6 @@ BlendTestInstance::BlendTestInstance (Context&                                                                      context,
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 BlendTestInstance::~BlendTestInstance (void)
@@ -768,22 +764,8 @@ tcu::TestStatus BlendTestInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        return verifyImage();
 }
index 2ea6851..faf1056 100644 (file)
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deUniquePtr.hpp"
 #include "deMemory.h"
-#include "vkTypeUtil.hpp"
 
 #include <sstream>
 #include <vector>
@@ -536,7 +537,6 @@ protected:
 
        Move<VkCommandPool>     m_cmdPool;
        Move<VkCommandBuffer>   m_cmdBuffer;
-       Move<VkFence>           m_fence;
        Move<VkPipelineCache>   m_cache;
 };
 
@@ -555,9 +555,6 @@ CacheTestInstance::CacheTestInstance (Context&                 context,
        // Create command buffer
        m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
-
        // Create the Pipeline Cache
        {
                const VkPipelineCacheCreateInfo pipelineCacheCreateInfo =
@@ -585,23 +582,7 @@ tcu::TestStatus CacheTestInstance::iterate (void)
 
        prepareCommandBuffer();
 
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &m_fence.get()));
-
-       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,               // const VkPipelineStageFlags* pWaitDstStageMask;
-               1u,                                                 // deUint32                    commandBufferCount;
-               &m_cmdBuffer.get(),                                 // const VkCommandBuffer*      pCommandBuffers;
-               0u,                                                 // deUint32                    signalSemaphoreCount;
-               DE_NULL,                                            // const VkSemaphore*          pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *m_fence));
-
-       VK_CHECK(vk.waitForFences(vkDevice, 1u, &m_fence.get(), true, ~(0ull) /* infinity*/));
+       submitCommandsAndWait(vk, vkDevice, queue, m_cmdBuffer.get());
 
        return verifyTestResult();
 }
index a87668e..1850993 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
@@ -186,8 +187,6 @@ private:
 
        Move<VkCommandPool>                                     m_cmdPool;
        Move<VkCommandBuffer>                           m_cmdBuffer;
-
-       Move<VkFence>                                           m_fence;
 };
 
 const float DepthTest::quadDepths[QUAD_COUNT] =
@@ -824,9 +823,6 @@ DepthTestInstance::DepthTestInstance (Context&                              context,
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 DepthTestInstance::~DepthTestInstance (void)
@@ -838,22 +834,8 @@ tcu::TestStatus DepthTestInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        return verifyImage();
 }
index 59836d4..f5935d6 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkPrograms.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
index 01f6277..fe1d12f 100644 (file)
@@ -30,6 +30,7 @@
 #include "vkPrograms.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuTexLookupVerifier.hpp"
 #include "tcuTextureUtil.hpp"
 #include "tcuTestLog.hpp"
@@ -880,9 +881,6 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                                      context,
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 ImageSamplingInstance::~ImageSamplingInstance (void)
@@ -894,22 +892,8 @@ tcu::TestStatus ImageSamplingInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       const VkSubmitInfo                      submitInfo      =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                      sType;
-               DE_NULL,                                                // const void*                          pNext;
-               0u,                                                             // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*           pWaitSemaphores;
-               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());
 
        return verifyImage();
 }
index 364de2d..86d4fe8 100644 (file)
@@ -123,8 +123,6 @@ private:
 
        vk::Move<vk::VkCommandPool>                                     m_cmdPool;
        vk::Move<vk::VkCommandBuffer>                           m_cmdBuffer;
-
-       vk::Move<vk::VkFence>                                           m_fence;
 };
 
 } // pipeline
index ba0d82d..7da1b03 100644 (file)
@@ -27,6 +27,7 @@
 #include "vkMemUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuTextureUtil.hpp"
 #include "tcuAstcUtil.hpp"
 #include "deRandom.hpp"
@@ -322,21 +323,7 @@ de::MovePtr<tcu::TextureLevel> readColorAttachment (const vk::DeviceInterface&     v
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &bufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                      sType;
-               DE_NULL,                                                // const void*                          pNext;
-               0u,                                                             // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*           pWaitSemaphores;
-               DE_NULL,
-               1u,                                                             // deUint32                                     commandBufferCount;
-               &cmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers;
-               0u,                                                             // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*           pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1, &fence.get(), 0, ~(0ull) /* infinity */));
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        // Read buffer data
        invalidateMappedMemoryRange(vk, device, bufferAlloc->getMemory(), bufferAlloc->getOffset(), VK_WHOLE_SIZE);
@@ -403,7 +390,6 @@ void uploadTestTextureInternal (const DeviceInterface&                      vk,
        de::MovePtr<Allocation>                 bufferAlloc;
        Move<VkCommandPool>                             cmdPool;
        Move<VkCommandBuffer>                   cmdBuffer;
-       Move<VkFence>                                   fence;
        const VkImageAspectFlags                imageAspectFlags        = getImageAspectFlags(format);
        deUint32                                                stencilOffset           = 0u;
 
@@ -442,9 +428,6 @@ void uploadTestTextureInternal (const DeviceInterface&                      vk,
        cmdPool         = createCommandPool(vk, device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
        cmdBuffer       = allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-       // Create fence
-       fence = createFence(vk, device);
-
        // Barriers for copying buffer to image
        const VkBufferMemoryBarrier preBufferBarrier =
        {
@@ -538,21 +521,7 @@ void uploadTestTextureInternal (const DeviceInterface&                     vk,
 
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                      sType;
-               DE_NULL,                                                // const void*                          pNext;
-               0u,                                                             // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*           pWaitSemaphores;
-               DE_NULL,
-               1u,                                                             // deUint32                                     commandBufferCount;
-               &cmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers;
-               0u,                                                             // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*           pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull) /* infinity */));
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 }
 
 bool checkSparseImageFormatSupport (const VkPhysicalDevice             physicalDevice,
index 44080d2..1a85ff8 100644 (file)
@@ -34,6 +34,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deMath.h"
 #include "deMemory.h"
@@ -177,8 +178,6 @@ private:
 
        Move<VkCommandPool>                                     m_cmdPool;
        Move<VkCommandBuffer>                           m_cmdBuffer;
-
-       Move<VkFence>                                           m_fence;
 };
 
 
@@ -1413,9 +1412,6 @@ InputAssemblyInstance::InputAssemblyInstance (Context&                                                    context,
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 InputAssemblyInstance::~InputAssemblyInstance (void)
@@ -1427,22 +1423,8 @@ tcu::TestStatus InputAssemblyInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        return verifyImage();
 }
index 6248e57..846293e 100644 (file)
@@ -232,29 +232,6 @@ void beginCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer comman
        VK_CHECK(vk.beginCommandBuffer(commandBuffer, &info));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                sType;
-               DE_NULL,                                                        // const void*                    pNext;
-               0u,                                                                     // uint32_t                       waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                     // uint32_t                       commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                     // uint32_t                       signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 Move<VkFramebuffer> makeFramebuffer (const DeviceInterface&            vk,
                                                                         const VkDevice                         device,
                                                                         const VkRenderPass                     renderPass,
index 1f615bd..d19dcb1 100644 (file)
@@ -91,7 +91,6 @@ de::MovePtr<vk::Allocation>           bindBuffer                              (const vk::DeviceInterface& vk, const
 de::MovePtr<vk::Allocation>            bindImageDedicated              (const vk::InstanceInterface& vki, const vk::DeviceInterface& vkd, const vk::VkPhysicalDevice physDevice, const vk::VkDevice device, const vk::VkImage image, const vk::MemoryRequirement requirement);
 de::MovePtr<vk::Allocation>            bindBufferDedicated             (const vk::InstanceInterface& vki, const vk::DeviceInterface& vkd, const vk::VkPhysicalDevice physDevice, const vk::VkDevice device, const vk::VkBuffer buffer, const vk::MemoryRequirement requirement);
 void                                                   beginCommandBuffer              (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
-void                                                   submitCommandsAndWait   (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
 
 } // pipeline
 } // vkt
index fe30e8f..e1811ce 100644 (file)
@@ -25,6 +25,7 @@
 #include "vktPipelineMakeUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuTestLog.hpp"
 #include <vector>
 
index 324b286..37c38c1 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkPrograms.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuTestLog.hpp"
index 145692e..96465df 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkMemUtil.hpp"
 #include "vkPrograms.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "tcuImageCompare.hpp"
@@ -362,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;
@@ -2790,9 +2789,6 @@ void MultisampleRenderer::initialize (Context&                                                                    context,
 
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 MultisampleRenderer::~MultisampleRenderer (void)
@@ -2805,22 +2801,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)
        {
index 50b6974..018839b 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkRefUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deMemory.h"
 #include "deRandom.hpp"
@@ -188,8 +189,6 @@ private:
 
        Move<VkCommandPool>                                                             m_cmdPool;
        Move<VkCommandBuffer>                                                   m_cmdBuffer;
-
-       Move<VkFence>                                                                   m_fence;
 };
 
 PushConstantGraphicsTest::PushConstantGraphicsTest (tcu::TestContext&                  testContext,
@@ -1195,9 +1194,6 @@ PushConstantGraphicsTestInstance::PushConstantGraphicsTestInstance (Context&
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 PushConstantGraphicsTestInstance::~PushConstantGraphicsTestInstance (void)
@@ -1209,22 +1205,8 @@ tcu::TestStatus PushConstantGraphicsTestInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        return verifyImage();
 }
@@ -1345,8 +1327,6 @@ private:
 
        Move<VkCommandPool>                             m_cmdPool;
        Move<VkCommandBuffer>                   m_cmdBuffer;
-
-       Move<VkFence>                                   m_fence;
 };
 
 PushConstantComputeTest::PushConstantComputeTest (tcu::TestContext&                    testContext,
@@ -1518,9 +1498,6 @@ PushConstantComputeTestInstance::PushConstantComputeTestInstance (Context&                                        c
 
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 PushConstantComputeTestInstance::~PushConstantComputeTestInstance (void)
@@ -1532,22 +1509,8 @@ tcu::TestStatus PushConstantComputeTestInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        invalidateMappedMemoryRange(vk, vkDevice, m_outBufferAlloc->getMemory(), m_outBufferAlloc->getOffset(), (size_t)(sizeof(tcu::Vec4) * 8));
 
index df53928..7a7077d 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkPrograms.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
index 0cc4483..ace72e8 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
index 2d46ad7..8f8a042 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deMemory.h"
 #include "deRandom.hpp"
@@ -166,8 +167,6 @@ private:
 
        Move<VkCommandPool>                                     m_cmdPool;
        Move<VkCommandBuffer>                           m_cmdBuffer;
-
-       Move<VkFence>                                           m_fence;
 };
 
 const VkStencilOp stencilOps[] =
@@ -862,9 +861,6 @@ StencilTestInstance::StencilTestInstance (Context&                                  context,
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 StencilTestInstance::~StencilTestInstance (void)
@@ -876,22 +872,8 @@ tcu::TestStatus StencilTestInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        return verifyImage();
 }
index 0c685d8..f5d9a67 100644 (file)
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
 #include "deMemory.h"
-#include "vkTypeUtil.hpp"
 
 #include <sstream>
 #include <vector>
@@ -670,7 +671,6 @@ protected:
 
        Move<VkCommandPool>     m_cmdPool;
        Move<VkCommandBuffer>   m_cmdBuffer;
-       Move<VkFence>           m_fence;
        Move<VkQueryPool>       m_queryPool;
        deUint64*               m_timestampValues;
 };
@@ -727,18 +727,6 @@ TimestampTestInstance::TimestampTestInstance(Context&                context,
        // Create command buffer
        m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, *m_cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-       // Create fence
-       {
-               const VkFenceCreateInfo fenceParams =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,        // VkStructureType      sType;
-                       DE_NULL,                                    // const void*          pNext;
-                       0u,                                         // VkFenceCreateFlags   flags;
-               };
-
-               m_fence = createFence(vk, vkDevice, &fenceParams);
-       }
-
        // alloc timestamp values
        m_timestampValues = new deUint64[m_stages.size()];
 }
@@ -785,23 +773,7 @@ tcu::TestStatus TimestampTestInstance::iterate(void)
 
        configCommandBuffer();
 
-       VK_CHECK(vk.resetFences(vkDevice, 1u, &m_fence.get()));
-
-       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.queueSubmit(queue, 1u, &submitInfo, *m_fence));
-
-       VK_CHECK(vk.waitForFences(vkDevice, 1u, &m_fence.get(), true, ~(0ull) /* infinity*/));
+       submitCommandsAndWait(vk, vkDevice, queue, m_cmdBuffer.get());
 
        // Generate the timestamp mask
        deUint64                    timestampMask;
index c4d252b..bc30234 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuFloat.hpp"
 #include "tcuImageCompare.hpp"
 #include "deFloat16.h"
@@ -240,8 +241,6 @@ private:
 
        Move<VkCommandPool>                                             m_cmdPool;
        Move<VkCommandBuffer>                                   m_cmdBuffer;
-
-       Move<VkFence>                                                   m_fence;
 };
 
 const VertexInputTest::GlslTypeDescription VertexInputTest::s_glslTypeDescriptions[GLSL_TYPE_COUNT] =
@@ -1256,9 +1255,6 @@ VertexInputInstance::VertexInputInstance (Context&                                                                                                context,
                vk.cmdEndRenderPass(*m_cmdBuffer);
                VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
        }
-
-       // Create fence
-       m_fence = createFence(vk, vkDevice);
 }
 
 VertexInputInstance::~VertexInputInstance (void)
@@ -1454,22 +1450,8 @@ tcu::TestStatus VertexInputInstance::iterate (void)
        const DeviceInterface&          vk                      = m_context.getDeviceInterface();
        const VkDevice                          vkDevice        = m_context.getDevice();
        const VkQueue                           queue           = m_context.getUniversalQueue();
-       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());
 
        return verifyImage();
 }
index 384e8ba..0f5800a 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkPrograms.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuResource.hpp"
@@ -414,22 +415,7 @@ tcu::TestStatus    BasicOcclusionQueryTestInstance::iterate (void)
 
        vk.endCommandBuffer(*cmdBuffer);
 
-       // Submit command buffer
-       const vk::VkSubmitInfo submitInfo =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,      // VkStructureType                      sType;
-               DE_NULL,                                                        // const void*                          pNext;
-               0,                                                                      // deUint32                                     waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*           pWaitSemaphores;
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1,                                                                      // deUint32                                     commandBufferCount;
-               &cmdBuffer.get(),                                       // const VkCommandBuffer*       pCommandBuffers;
-               0,                                                                      // deUint32                                     signalSemaphoreCount;
-               DE_NULL                                                         // const VkSemaphore*           pSignalSemaphores;
-       };
-       vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
-
-       VK_CHECK(vk.queueWaitIdle(queue));
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        deUint64 queryResults[NUM_QUERIES_IN_POOL] = { 0 };
        size_t queryResultsSize         = sizeof(queryResults);
index d9a00a9..e5fef46 100644 (file)
@@ -30,6 +30,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkPrograms.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deMath.h"
 
@@ -146,35 +147,6 @@ void beginSecondaryCommandBuffer (const DeviceInterface&                           vk,
        VK_CHECK(vk.beginCommandBuffer(commandBuffer, &info));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const VkFenceCreateInfo fenceInfo       =
-       {
-               VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType;
-               DE_NULL,                                                                // const void*                  pNext;
-               (VkFenceCreateFlags)0,                                  // VkFenceCreateFlags   flags;
-       };
-       const Unique<VkFence>   fence           (createFence(vk, device, &fenceInfo));
-
-       const VkSubmitInfo              submitInfo      =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                              sType;
-               DE_NULL,                                                // const void*                                  pNext;
-               0u,                                                             // uint32_t                                             waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                             // uint32_t                                             commandBufferCount;
-               &commandBuffer,                                 // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                             // uint32_t                                             signalSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 Move<VkQueryPool> makeQueryPool (const DeviceInterface& vk, const VkDevice device, VkQueryPipelineStatisticFlags statisticFlags)
 {
        const VkQueryPoolCreateInfo queryPoolCreateInfo =
index 0a2f912..6cb3991 100644 (file)
@@ -43,6 +43,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include <vector>
 
@@ -191,8 +192,6 @@ protected:
        Move<VkShaderModule>                                                    m_vertexShaderModule;
        Move<VkShaderModule>                                                    m_fragmentShaderModule;
 
-       Move<VkFence>                                                                   m_fence;
-
        Move<VkBuffer>                                                                  m_resultBuffer;
        de::MovePtr<Allocation>                                                 m_resultBufferMemory;
        const VkDeviceSize                                                              m_resultBufferSize;
@@ -535,9 +534,6 @@ BaseRenderingTestInstance::BaseRenderingTestInstance (Context& context, VkSample
                m_fragmentShaderModule  = createShaderModule(vkd, vkDevice, m_context.getBinaryCollection().get("fragment_shader"), 0);
        }
 
-       // Fence
-       m_fence = createFence(vkd, vkDevice);
-
        // Result Buffer
        {
                const VkBufferCreateInfo                                bufferCreateInfo                =
@@ -902,24 +898,7 @@ void BaseRenderingTestInstance::drawPrimitives (tcu::Surface& result, const std:
        }
 
        // Submit
-       {
-               const VkSubmitInfo                                      submitInfo                              =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                              sType;
-                       DE_NULL,                                                                // const void*                                  pNext;
-                       0u,                                                                             // deUint32                                             waitSemaphoreCount;
-                       DE_NULL,                                                                // const VkSemaphore*                   pWaitSemaphores;
-                       DE_NULL,                                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-                       1u,                                                                             // deUint32                                             commandBufferCount;
-                       &commandBuffer.get(),                                   // const VkCommandBuffer*               pCommandBuffers;
-                       0u,                                                                             // deUint32                                             signalSemaphoreCount;
-                       DE_NULL,                                                                // const VkSemaphore*                   pSignalSemaphores;
-               };
-
-               VK_CHECK(vkd.resetFences(vkDevice, 1, &m_fence.get()));
-               VK_CHECK(vkd.queueSubmit(queue, 1, &submitInfo, *m_fence));
-               VK_CHECK(vkd.waitForFences(vkDevice, 1, &m_fence.get(), true, ~(0ull) /* infinity */));
-       }
+       submitCommandsAndWait(vkd, vkDevice, queue, commandBuffer.get());
 
        invalidateMappedMemoryRange(vkd, vkDevice, m_resultBufferMemory->getMemory(), m_resultBufferMemory->getOffset(), m_resultBufferSize);
        tcu::copy(result.getAccess(), tcu::ConstPixelBufferAccess(m_textureFormat, tcu::IVec3(m_renderSize, m_renderSize, 1), m_resultBufferMemory->getHostPtr()));
index acedf15..73fd0f0 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuFloat.hpp"
 #include "tcuImageCompare.hpp"
@@ -1093,27 +1094,7 @@ void MultisampleRenderPassTestInstance::submit (void)
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
 
-       {
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-
-                       0u,
-                       DE_NULL,
-                       DE_NULL,
-
-                       1u,
-                       &*commandBuffer,
-
-                       0u,
-                       DE_NULL
-               };
-
-               VK_CHECK(vkd.queueSubmit(m_context.getUniversalQueue(), 1u, &submitInfo, (VkFence)0u));
-
-               VK_CHECK(vkd.queueWaitIdle(m_context.getUniversalQueue()));
-       }
+       submitCommandsAndWait(vkd, device, m_context.getUniversalQueue(), *commandBuffer);
 }
 
 void MultisampleRenderPassTestInstance::verify (void)
index 23ba014..ed9690f 100644 (file)
@@ -36,6 +36,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuFloat.hpp"
 #include "tcuImageCompare.hpp"
@@ -1594,27 +1595,7 @@ tcu::TestStatus MultisampleRenderPassTestInstance::iterate (void)
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
 
-       {
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-
-                       0u,
-                       DE_NULL,
-                       DE_NULL,
-
-                       1u,
-                       &*commandBuffer,
-
-                       0u,
-                       DE_NULL
-               };
-
-               VK_CHECK(vkd.queueSubmit(m_context.getUniversalQueue(), 1u, &submitInfo, (VkFence)0u));
-
-               VK_CHECK(vkd.queueWaitIdle(m_context.getUniversalQueue()));
-       }
+       submitCommandsAndWait(vkd, device, m_context.getUniversalQueue(), *commandBuffer);
 
        {
                const tcu::TextureFormat                format                  (mapVkFormat(m_dstFormat));
index 24269dd..0122ed7 100644 (file)
@@ -34,6 +34,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuImageCompare.hpp"
 #include "tcuResultCollector.hpp"
@@ -1125,27 +1126,7 @@ tcu::TestStatus SampleReadTestInstance::iterate (void)
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
 
-       {
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-
-                       0u,
-                       DE_NULL,
-                       DE_NULL,
-
-                       1u,
-                       &*commandBuffer,
-
-                       0u,
-                       DE_NULL
-               };
-
-               VK_CHECK(vkd.queueSubmit(m_context.getUniversalQueue(), 1u, &submitInfo, (VkFence)0u));
-
-               VK_CHECK(vkd.queueWaitIdle(m_context.getUniversalQueue()));
-       }
+       submitCommandsAndWait(vkd, device, m_context.getUniversalQueue(), *commandBuffer);
 
        {
                const tcu::TextureFormat                        format          (mapVkFormat(VK_FORMAT_R32_UINT));
index 2a36026..ddda963 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuImageCompare.hpp"
 #include "tcuResultCollector.hpp"
@@ -629,26 +630,7 @@ tcu::TestStatus SparseRenderTargetTestInstance::iterate (void)
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
 
-       {
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-
-                       0u,
-                       DE_NULL,
-                       DE_NULL,
-
-                       1u,
-                       &*commandBuffer,
-
-                       0u,
-                       DE_NULL
-               };
-
-               VK_CHECK(vkd.queueSubmit(m_context.getUniversalQueue(), 1u, &submitInfo, (VkFence)0u));
-               VK_CHECK(vkd.queueWaitIdle(m_context.getUniversalQueue()));
-       }
+       submitCommandsAndWait(vkd, m_context.getDevice(), m_context.getUniversalQueue(), *commandBuffer);
 
        {
                const tcu::TextureFormat                        format                  (mapVkFormat(m_format));
index 503023b..3ba17d3 100644 (file)
@@ -30,6 +30,7 @@
 #include "vkMemUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkQueryUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTexture.hpp"
 #include "tcuTestLog.hpp"
@@ -662,24 +663,7 @@ TestImage::TestImage (Context& context, TextureType texType, tcu::TextureFormat
                                                           &postCopyBarrier);
                VK_CHECK(vkd.endCommandBuffer(*cmdBuf));
 
-               {
-                       const Unique<VkFence>   fence           (createFence(vkd, device));
-                       const VkSubmitInfo              submitInfo      =
-                       {
-                               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                               DE_NULL,
-                               0u,
-                               (const VkSemaphore*)DE_NULL,
-                               (const VkPipelineStageFlags*)DE_NULL,
-                               1u,
-                               &cmdBuf.get(),
-                               0u,
-                               (const VkSemaphore*)DE_NULL,
-                       };
-
-                       VK_CHECK(vkd.queueSubmit(context.getUniversalQueue(), 1u, &submitInfo, *fence));
-                       VK_CHECK(vkd.waitForFences(device, 1u, &fence.get(), VK_TRUE, ~0ull));
-               }
+               submitCommandsAndWait(vkd, device, context.getUniversalQueue(), cmdBuf.get());
        }
 }
 
index b0f316e..7eac9ed 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkTypeUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkBuilderUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "gluShaderUtil.hpp"
 
@@ -766,8 +767,6 @@ void FragmentOutExecutor::execute (int numValues, const void* const* inputs, voi
        Move<VkCommandPool>                                                                     cmdPool;
        Move<VkCommandBuffer>                                                           cmdBuffer;
 
-       Move<VkFence>                                                                           fence;
-
        Unique<VkDescriptorSetLayout>                                           emptyDescriptorSetLayout        (createEmptyDescriptorSetLayout(vk, vkDevice));
        Unique<VkDescriptorPool>                                                        dummyDescriptorPool                     (createDummyDescriptorPool(vk, vkDevice));
        Unique<VkDescriptorSet>                                                         emptyDescriptorSet                      (allocateSingleDescriptorSet(vk, vkDevice, *dummyDescriptorPool, *emptyDescriptorSetLayout));
@@ -1255,29 +1254,8 @@ void FragmentOutExecutor::execute (int numValues, const void* const* inputs, voi
                VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
        }
 
-       // Create fence
-       fence = createFence(vk, vkDevice);
-
        // Execute Draw
-       {
-
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // sType
-                       DE_NULL,                                                                // pNext
-                       0u,                                                                             // waitSemaphoreCount
-                       DE_NULL,                                                                // pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,                                                                             // commandBufferCount
-                       &cmdBuffer.get(),                                               // pCommandBuffers
-                       0u,                                                                             // signalSemaphoreCount
-                       DE_NULL                                                                 // pSignalSemaphores
-               };
-
-               VK_CHECK(vk.resetFences(vkDevice, 1, &fence.get()));
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), DE_TRUE, ~(0ull) /* infinity*/));
-       }
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuffer.get());
 
        // Read back result and output
        {
@@ -1345,26 +1323,11 @@ void FragmentOutExecutor::execute (int numValues, const void* const* inputs, voi
 
                                        Move<VkCommandBuffer> copyCmdBuffer = allocateCommandBuffer(vk, vkDevice, *copyCmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-                                       const VkSubmitInfo submitInfo =
-                                       {
-                                               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                                               DE_NULL,
-                                               0u,
-                                               (const VkSemaphore*)DE_NULL,
-                                               (const VkPipelineStageFlags*)DE_NULL,
-                                               1u,
-                                               &copyCmdBuffer.get(),
-                                               0u,
-                                               (const VkSemaphore*)DE_NULL,
-                                       };
-
                                        VK_CHECK(vk.beginCommandBuffer(*copyCmdBuffer, &cmdBufferBeginInfo));
                                        vk.cmdCopyImageToBuffer(*copyCmdBuffer, colorImages[outLocation + locNdx].get()->get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *readImageBuffer, 1u, &copyParams);
                                        VK_CHECK(vk.endCommandBuffer(*copyCmdBuffer));
 
-                                       VK_CHECK(vk.resetFences(vkDevice, 1, &fence.get()));
-                                       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-                                       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity */));
+                                       submitCommandsAndWait(vk, vkDevice, queue, copyCmdBuffer.get());
                                }
 
                                const VkMappedMemoryRange range =
@@ -1920,7 +1883,6 @@ void ComputeShaderExecutor::execute (int numValues, const void* const* inputs, v
        Move<VkDescriptorSetLayout>             descriptorSetLayout;
        Move<VkDescriptorSet>                   descriptorSet;
        const deUint32                                  numDescriptorSets               = (m_extraResourcesLayout != 0) ? 2u : 1u;
-       Move<VkFence>                                   fence;
 
        DE_ASSERT((m_extraResourcesLayout != 0) == (extraResources != 0));
 
@@ -2015,9 +1977,6 @@ void ComputeShaderExecutor::execute (int numValues, const void* const* inputs, v
                computePipeline = createComputePipeline(vk, vkDevice, DE_NULL, &computePipelineParams);
        }
 
-       // Create fence
-       fence = createFence(vk, vkDevice);
-
        const int                       maxValuesPerInvocation  = m_context.getDeviceProperties().limits.maxComputeWorkGroupSize[0];
        int                                     curOffset                               = 0;
        const deUint32          inputStride                             = getInputStride();
@@ -2072,25 +2031,7 @@ void ComputeShaderExecutor::execute (int numValues, const void* const* inputs, v
                curOffset += numToExec;
 
                // Execute
-               {
-                       VK_CHECK(vk.resetFences(vkDevice, 1, &fence.get()));
-
-                       const VkSubmitInfo submitInfo =
-                       {
-                               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                               DE_NULL,
-                               0u,
-                               (const VkSemaphore*)DE_NULL,
-                               (const VkPipelineStageFlags*)DE_NULL,
-                               1u,
-                               &cmdBuffer.get(),
-                               0u,
-                               (const VkSemaphore*)DE_NULL,
-                       };
-
-                       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-                       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity*/));
-               }
+               submitCommandsAndWait(vk, vkDevice, queue, cmdBuffer.get());
        }
 
        // Read back data
@@ -2165,8 +2106,6 @@ void TessellationExecutor::renderTess (deUint32 numValues, deUint32 vertexCount,
        Move<VkCommandPool>                                     cmdPool;
        Move<VkCommandBuffer>                           cmdBuffer;
 
-       Move<VkFence>                                           fence;
-
        Move<VkDescriptorPool>                          descriptorPool;
        Move<VkDescriptorSetLayout>                     descriptorSetLayout;
        Move<VkDescriptorSet>                           descriptorSet;
@@ -2620,27 +2559,8 @@ void TessellationExecutor::renderTess (deUint32 numValues, deUint32 vertexCount,
                VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
        }
 
-       // Create fence
-       fence = createFence(vk, vkDevice);
-
        // Execute Draw
-       {
-               VK_CHECK(vk.resetFences(vkDevice, 1, &fence.get()));
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)0,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmdBuffer.get(),
-                       0u,
-                       (const VkSemaphore*)0,
-               };
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity*/));
-       }
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuffer.get());
 }
 
 // TessControlExecutor
index 410594c..439cf14 100644 (file)
@@ -44,6 +44,7 @@
 #include "vkRefUtil.hpp"
 #include "vkStrUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include <vector>
 #include <string>
@@ -965,7 +966,6 @@ void ShaderRenderCaseInstance::uploadImage (const tcu::TextureFormat&                       texForma
        de::MovePtr<Allocation>                 bufferAlloc;
        Move<VkCommandPool>                             cmdPool;
        Move<VkCommandBuffer>                   cmdBuffer;
-       Move<VkFence>                                   fence;
        std::vector<VkBufferImageCopy>  copyRegions;
        std::vector<deUint32>                   offsetMultiples;
 
@@ -1007,9 +1007,6 @@ void ShaderRenderCaseInstance::uploadImage (const tcu::TextureFormat&                     texForma
        cmdPool = createCommandPool(vk, vkDevice, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
        cmdBuffer = allocateCommandBuffer(vk, vkDevice, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-       // Create fence
-       fence = createFence(vk, vkDevice);
-
        // Barriers for copying buffer to image
        const VkBufferMemoryBarrier preBufferBarrier =
        {
@@ -1124,21 +1121,7 @@ void ShaderRenderCaseInstance::uploadImage (const tcu::TextureFormat&                    texForma
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                              sType;
-               DE_NULL,                                                // const void*                                  pNext;
-               0u,                                                             // deUint32                                             waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                             // deUint32                                             commandBufferCount;
-               &cmdBuffer.get(),                               // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                             // deUint32                                             signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*                   pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity */));
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuffer.get());
 }
 
 void ShaderRenderCaseInstance::clearImage (const tcu::Sampler&                                 refSampler,
@@ -1155,7 +1138,6 @@ void ShaderRenderCaseInstance::clearImage (const tcu::Sampler&                                    refSampler,
        const VkImageAspectFlags                aspectMask                              = isShadowSampler ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
        Move<VkCommandPool>                             cmdPool;
        Move<VkCommandBuffer>                   cmdBuffer;
-       Move<VkFence>                                   fence;
 
        VkClearValue                                    clearValue;
        deMemset(&clearValue, 0, sizeof(clearValue));
@@ -1165,9 +1147,6 @@ void ShaderRenderCaseInstance::clearImage (const tcu::Sampler&                                    refSampler,
        cmdPool         = createCommandPool(vk, vkDevice, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
        cmdBuffer       = allocateCommandBuffer(vk, vkDevice, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
 
-       // Create fence
-       fence = createFence(vk, vkDevice);
-
        const VkImageMemoryBarrier preImageBarrier =
        {
                VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
@@ -1240,21 +1219,7 @@ void ShaderRenderCaseInstance::clearImage (const tcu::Sampler&                                   refSampler,
        vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                              sType;
-               DE_NULL,                                                // const void*                                  pNext;
-               0u,                                                             // deUint32                                             waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                             // deUint32                                             commandBufferCount;
-               &cmdBuffer.get(),                               // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                             // deUint32                                             signalSemaphoreCount;
-               DE_NULL                                                 // const VkSemaphore*                   pSignalSemaphores;
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity */));
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuffer.get());
 }
 
 VkExtent3D mipLevelExtents (const VkExtent3D& baseExtents, const deUint32 mipLevel)
@@ -2233,7 +2198,6 @@ void ShaderRenderCaseInstance::render (deUint32                           numVertices,
        vk::Move<vk::VkDescriptorSet>                                           descriptorSet;
        vk::Move<vk::VkCommandPool>                                                     cmdPool;
        vk::Move<vk::VkCommandBuffer>                                           cmdBuffer;
-       vk::Move<vk::VkFence>                                                           fence;
 
        // Create color image
        {
@@ -2845,27 +2809,8 @@ void ShaderRenderCaseInstance::render (deUint32                          numVertices,
                VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
        }
 
-       // Create fence
-       fence = createFence(vk, vkDevice);
-
        // Execute Draw
-       {
-               const VkSubmitInfo      submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmdBuffer.get(),
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity*/));
-       }
+       submitCommandsAndWait(vk, vkDevice, queue, cmdBuffer.get());
 
        // Read back the result
        {
@@ -2912,18 +2857,6 @@ void ShaderRenderCaseInstance::render (deUint32                          numVertices,
                        { 0u, 0u, 0u },                                                         // VkOffset3D                   imageOffset;
                        { m_renderSize.x(), m_renderSize.y(), 1u }      // VkExtent3D                   imageExtent;
                };
-               const VkSubmitInfo                                                              submitInfo                                      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &resultCmdBuffer.get(),
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
 
                VK_CHECK(vk.beginCommandBuffer(*resultCmdBuffer, &cmdBufferBeginInfo));
 
@@ -2966,9 +2899,7 @@ void ShaderRenderCaseInstance::render (deUint32                           numVertices,
 
                VK_CHECK(vk.endCommandBuffer(*resultCmdBuffer));
 
-               VK_CHECK(vk.resetFences(vkDevice, 1, &fence.get()));
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), true, ~(0ull) /* infinity */));
+               submitCommandsAndWait(vk, vkDevice, queue, resultCmdBuffer.get());
 
                invalidateMappedMemoryRange(vk, vkDevice, readImageBufferMemory->getMemory(), readImageBufferMemory->getOffset(), imageSizeBytes);
 
index a42e0ee..2fd3395 100644 (file)
@@ -38,6 +38,7 @@
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkMemUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deMath.h"
 #include "deRandom.hpp"
@@ -357,7 +358,6 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
        MovePtr<Allocation>                             depthInitAllocation;
        Move<VkCommandPool>                             cmdPool;
        Move<VkCommandBuffer>                   transferCmdBuffer;
-       Move<VkFence>                                   fence;
        Move<VkSampler>                                 depthSampler;
 
        // Create Buffer/Image for validation
@@ -615,18 +615,6 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
                transferCmdBuffer = allocateCommandBuffer(vk, device, &cmdBufferAllocInfo);
        }
 
-       // Fence for data transfer
-       {
-               const VkFenceCreateInfo fenceCreateInfo =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType
-                       DE_NULL,                                                                // const void*                  pNext
-                       (VkFenceCreateFlags)0                                   // VkFenceCreateFlags   flags
-               };
-
-               fence = createFence(vk, device, &fenceCreateInfo);
-       }
-
        // Initialize Marker Buffer
        {
                VkImageAspectFlags      depthImageAspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
@@ -705,22 +693,7 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
 
                VK_CHECK(vk.endCommandBuffer(*transferCmdBuffer));
 
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType
-                       DE_NULL,                                                                // const void*                          pNext
-                       0u,                                                                             // uint32_t                                     waitSemaphoreCount
-                       DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // const VkPipelineStageFlags*  pWaitDstStageMask
-                       1u,                                                                             // uint32_t                                     commandBufferCount
-                       &transferCmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers
-                       0u,                                                                             // uint32_t                                     signalSemaphoreCount
-                       DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores
-               };
-
-               VK_CHECK(vk.resetFences(device, 1, &fence.get()));
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull)));
+               submitCommandsAndWait(vk, device, queue, transferCmdBuffer.get());
        }
 
 
@@ -873,22 +846,7 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
                                DE_LENGTH_OF_ARRAY(imageBarrier), imageBarrier);
                VK_CHECK(vk.endCommandBuffer(*transferCmdBuffer));
 
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType
-                       DE_NULL,                                                                // const void*                          pNext
-                       0u,                                                                             // uint32_t                                     waitSemaphoreCount
-                       DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // const VkPipelineStageFlags*  pWaitDstStageMask
-                       1u,                                                                             // uint32_t                                     commandBufferCount
-                       &transferCmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers
-                       0u,                                                                             // uint32_t                                     signalSemaphoreCount
-                       DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores
-               };
-
-               VK_CHECK(vk.resetFences(device, 1, &fence.get()));
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull)));
+               submitCommandsAndWait(vk, device, queue, transferCmdBuffer.get());
        }
 
        // Resolve Depth Buffer
@@ -1039,22 +997,7 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
                                0, (const VkImageMemoryBarrier*)DE_NULL);
                VK_CHECK(vk.endCommandBuffer(*transferCmdBuffer));
 
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType
-                       DE_NULL,                                                                // const void*                          pNext
-                       0u,                                                                             // uint32_t                                     waitSemaphoreCount
-                       DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // const VkPipelineStageFlags*  pWaitDstStageMask
-                       1u,                                                                             // uint32_t                                     commandBufferCount
-                       &transferCmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers
-                       0u,                                                                             // uint32_t                                     signalSemaphoreCount
-                       DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores
-               };
-
-               VK_CHECK(vk.resetFences(device, 1, &fence.get()));
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull)));
+               submitCommandsAndWait(vk, device, queue, transferCmdBuffer.get());
        }
 
        // Verify depth buffer
@@ -1135,22 +1078,7 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
                                0, (const VkImageMemoryBarrier*)DE_NULL);
                VK_CHECK(vk.endCommandBuffer(*transferCmdBuffer));
 
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType
-                       DE_NULL,                                                                // const void*                          pNext
-                       0u,                                                                             // uint32_t                                     waitSemaphoreCount
-                       DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // const VkPipelineStageFlags*  pWaitDstStageMask
-                       1u,                                                                             // uint32_t                                     commandBufferCount
-                       &transferCmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers
-                       0u,                                                                             // uint32_t                                     signalSemaphoreCount
-                       DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores
-               };
-
-               VK_CHECK(vk.resetFences(device, 1, &fence.get()));
-               VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull)));
+               submitCommandsAndWait(vk, device, queue, transferCmdBuffer.get());
 
                invalidateMappedMemoryRange(vk, device, validationAlloc->getMemory(), validationAlloc->getOffset(), VK_WHOLE_SIZE);
                invalidateMappedMemoryRange(vk, device, markerBufferAllocation->getMemory(), markerBufferAllocation->getOffset(), VK_WHOLE_SIZE);
@@ -1287,7 +1215,6 @@ TestStatus BuiltinFragCoordMsaaCaseInstance::iterate (void)
        MovePtr<Allocation>                             sampleLocationBufferAllocation;
        Move<VkCommandPool>                             cmdPool;
        Move<VkCommandBuffer>                   transferCmdBuffer;
-       Move<VkFence>                                   fence;
 
        // Coordinate result image
        {
@@ -1410,18 +1337,6 @@ TestStatus BuiltinFragCoordMsaaCaseInstance::iterate (void)
                transferCmdBuffer = allocateCommandBuffer(vk, device, &cmdBufferAllocInfo);
        }
 
-       // Fence for data transfer
-       {
-               const VkFenceCreateInfo fenceCreateInfo =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType
-                       DE_NULL,                                                                // const void*                  pNext
-                       (VkFenceCreateFlags)0                                   // VkFenceCreateFlags   flags
-               };
-
-               fence = createFence(vk, device, &fenceCreateInfo);
-       }
-
        // Transition the output image to LAYOUT_GENERAL
        {
                const VkImageMemoryBarrier barrier =
@@ -1461,22 +1376,7 @@ TestStatus BuiltinFragCoordMsaaCaseInstance::iterate (void)
 
                VK_CHECK(vk.endCommandBuffer(*transferCmdBuffer));
 
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType
-                       DE_NULL,                                                                // const void*                          pNext
-                       0u,                                                                             // uint32_t                                     waitSemaphoreCount
-                       DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // const VkPipelineStageFlags*  pWaitDstStageMask
-                       1u,                                                                             // uint32_t                                     commandBufferCount
-                       &transferCmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers
-                       0u,                                                                             // uint32_t                                     signalSemaphoreCount
-                       DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores
-               };
-
-               vk.resetFences(device, 1, &fence.get());
-               vk.queueSubmit(queue, 1, &submitInfo, *fence);
-               vk.waitForFences(device, 1, &fence.get(), true, ~(0ull));
+               submitCommandsAndWait(vk, device, queue, transferCmdBuffer.get());
        }
 
        // Perform draw
@@ -1590,22 +1490,7 @@ TestStatus BuiltinFragCoordMsaaCaseInstance::iterate (void)
                                0, (const VkImageMemoryBarrier*)DE_NULL);
                VK_CHECK(vk.endCommandBuffer(*transferCmdBuffer));
 
-               const VkSubmitInfo submitInfo =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                      sType
-                       DE_NULL,                                                                // const void*                          pNext
-                       0u,                                                                             // uint32_t                                     waitSemaphoreCount
-                       DE_NULL,                                                                // const VkSemaphore*           pWaitSemaphores
-                       (const VkPipelineStageFlags*)DE_NULL,   // const VkPipelineStageFlags*  pWaitDstStageMask
-                       1u,                                                                             // uint32_t                                     commandBufferCount
-                       &transferCmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers
-                       0u,                                                                             // uint32_t                                     signalSemaphoreCount
-                       DE_NULL                                                                 // const VkSemaphore*           pSignalSemaphores
-               };
-
-               vk.resetFences(device, 1, &fence.get());
-               vk.queueSubmit(queue, 1, &submitInfo, *fence);
-               vk.waitForFences(device, 1, &fence.get(), true, ~(0ull));
+               submitCommandsAndWait(vk, device, queue, transferCmdBuffer.get());
 
                invalidateMappedMemoryRange(vk, device, sampleLocationBufferAllocation->getMemory(), sampleLocationBufferAllocation->getOffset(), VK_WHOLE_SIZE);
        }
index 182ef08..17b69f2 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkRefUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 namespace
 {
@@ -219,31 +220,7 @@ void copyBufferToImage (const DeviceInterface& vkdi, const VkDevice& device, con
 
        VK_CHECK(vkdi.endCommandBuffer(cmdBuffer));
 
-       {
-               const VkFenceCreateInfo fenceParams     =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    //      VkStructureType         sType;
-                       DE_NULL,                                                                //      const void*                     pNext;
-                       0u,                                                                             //      VkFenceCreateFlags      flags;
-               };
-
-               const Unique<VkFence>   fence           (createFence(vkdi, device, &fenceParams));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                              sType;
-                       DE_NULL,                                                                // const void*                                  pNext;
-                       0u,                                                                             // deUint32                                             waitSemaphoreCount;
-                       DE_NULL,                                                                // const VkSemaphore*                   pWaitSemaphores;
-                       DE_NULL,                                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-                       1u,                                                                             // deUint32                                             commandBufferCount;
-                       &cmdBuffer,                                                             // const VkCommandBuffer*               pCommandBuffers;
-                       0u,                                                                             // deUint32                                             signalSemaphoreCount;
-                       DE_NULL                                                                 // const VkSemaphore*                   pSignalSemaphores;
-               };
-
-               VK_CHECK(vkdi.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkdi.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkdi, device, queue, cmdBuffer);
 }
 
 void setMemory (const DeviceInterface& vkdi, const VkDevice& device, Allocation* destAlloc, size_t numBytes, const void* data, bool coherent = false)
@@ -817,25 +794,7 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
        vkdi.cmdDispatch(*cmdBuffer, numWorkGroups.x(), numWorkGroups.y(), numWorkGroups.z());
        VK_CHECK(vkdi.endCommandBuffer(*cmdBuffer));
 
-       // Create fence and run.
-
-       const Unique<VkFence>                   cmdCompleteFence        (createFence(vkdi, device));
-       const deUint64                                  infiniteTimeout         = ~(deUint64)0u;
-       const VkSubmitInfo                              submitInfo                      =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-               DE_NULL,
-               0u,
-               (const VkSemaphore*)DE_NULL,
-               (const VkPipelineStageFlags*)DE_NULL,
-               1u,
-               &cmdBuffer.get(),
-               0u,
-               (const VkSemaphore*)DE_NULL,
-       };
-
-       VK_CHECK(vkdi.queueSubmit(queue, 1, &submitInfo, *cmdCompleteFence));
-       VK_CHECK(vkdi.waitForFences(device, 1, &cmdCompleteFence.get(), 0u, infiniteTimeout)); // \note: timeout is failure
+       submitCommandsAndWait(vkdi, device, queue, *cmdBuffer);
 
        // Invalidate output memory ranges before checking on host.
        for (size_t outputNdx = 0; outputNdx < m_shaderSpec.outputs.size(); ++outputNdx)
index 5b3155e..4d5a89b 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkStrUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 
@@ -243,35 +244,6 @@ void beginCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer comman
        VK_CHECK(vk.beginCommandBuffer(commandBuffer, &info));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const VkFenceCreateInfo fenceInfo       =
-       {
-               VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType;
-               DE_NULL,                                                                // const void*                  pNext;
-               (VkFenceCreateFlags)0,                                  // VkFenceCreateFlags   flags;
-       };
-       const Unique<VkFence>   fence           (createFence(vk, device, &fenceInfo));
-
-       const VkSubmitInfo              submitInfo      =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,  // VkStructureType                              sType;
-               DE_NULL,                                                // const void*                                  pNext;
-               0u,                                                             // uint32_t                                             waitSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                             // uint32_t                                             commandBufferCount;
-               &commandBuffer,                                 // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                             // uint32_t                                             signalSemaphoreCount;
-               DE_NULL,                                                // const VkSemaphore*                   pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 void imageBarrier (const DeviceInterface&                      vk,
                                   const VkCommandBuffer                        cmdBuffer,
                                   const VkImage                                        image,
index 348c5c3..a615e01 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deRandom.hpp"
 
@@ -2348,31 +2349,7 @@ void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const
 
        VK_CHECK(vk.endCommandBuffer(cmdBuffer));
 
-       {
-               const VkFenceCreateInfo fenceParams     =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    //      VkStructureType         sType;
-                       DE_NULL,                                                                //      const void*                     pNext;
-                       0u,                                                                             //      VkFenceCreateFlags      flags;
-               };
-
-               const Unique<VkFence>   fence           (createFence(vk, device, &fenceParams));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                              sType;
-                       DE_NULL,                                                                // const void*                                  pNext;
-                       0u,                                                                             // deUint32                                             waitSemaphoreCount;
-                       DE_NULL,                                                                // const VkSemaphore*                   pWaitSemaphores;
-                       DE_NULL,                                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-                       1u,                                                                             // deUint32                                             commandBufferCount;
-                       &cmdBuffer,                                                             // const VkCommandBuffer*               pCommandBuffers;
-                       0u,                                                                             // deUint32                                             signalSemaphoreCount;
-                       DE_NULL                                                                 // const VkSemaphore*                   pSignalSemaphores;
-               };
-
-               VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, device, queue, cmdBuffer);
 }
 
 TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instance)
@@ -3783,30 +3760,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
        }
 
        // Submit & wait for completion
-       {
-               const VkFenceCreateInfo fenceParams     =
-               {
-                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    //      VkStructureType         sType;
-                       DE_NULL,                                                                //      const void*                     pNext;
-                       0u,                                                                             //      VkFenceCreateFlags      flags;
-               };
-               const Unique<VkFence>   fence           (createFence(vk, device, &fenceParams));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &cmdBuf.get(),
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, device, queue, cmdBuf.get());
 
        const void* imagePtr    = readImageBufferMemory->getHostPtr();
        const tcu::ConstPixelBufferAccess pixelBuffer(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8),
index 44063e0..d18edc7 100644 (file)
@@ -44,6 +44,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 namespace vkt
 {
@@ -2223,23 +2224,7 @@ tcu::TestStatus SSBOLayoutCaseInstance::iterate (void)
 
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
-       vk::Move<vk::VkFence> fence (createFence(vk, device));
-
-       const vk::VkSubmitInfo  submitInfo  =
-       {
-               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-               DE_NULL,
-               0u,
-               (const vk::VkSemaphore*)DE_NULL,
-               (const vk::VkPipelineStageFlags*)DE_NULL,
-               1u,
-               &cmdBuffer.get(),
-               0u,
-               (const vk::VkSemaphore*)DE_NULL,
-       };
-
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        // Read back ac_numPassed data
        bool counterOk;
index edae7a6..18ccbcc 100644 (file)
@@ -41,6 +41,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkMemUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 namespace vkt
 {
@@ -914,22 +915,7 @@ tcu::TestStatus ssboUnsizedArrayLengthTest (Context& context, UnsizedArrayCasePa
 
        VK_CHECK(vk.endCommandBuffer(*cmdBuf));
 
-       const VkSubmitInfo                                              submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-               DE_NULL,
-               0,                                                                                                              // waitSemaphoreCount
-               DE_NULL,                                                                                                // pWaitSemaphores
-               DE_NULL,                                                                                                // pWaitDstStageMask
-               1,                                                                                                              // commandBufferCount
-               &cmdBuf.get(),                                                                                  // pCommandBuffers
-               0,                                                                                                              // signalSemaphoreCount
-               DE_NULL,                                                                                                // pSignalSemaphores
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, (vk::VkFence)0));
-
-       // Force all work to have completed
-       VK_CHECK(vk.deviceWaitIdle(device));
+       submitCommandsAndWait(vk, device, queue, cmdBuf.get());
 
        // Read back output buffer contents
        VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1, &range));
index 151068c..429a0bc 100644 (file)
@@ -282,29 +282,6 @@ void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandB
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                sType;
-               DE_NULL,                                                        // const void*                    pNext;
-               0u,                                                                     // uint32_t                       waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                     // uint32_t                       commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                     // uint32_t                       signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 void beginRenderPass (const DeviceInterface&   vk,
                                          const VkCommandBuffer         commandBuffer,
                                          const VkRenderPass            renderPass,
index 1db42f6..fc0ac08 100644 (file)
@@ -239,7 +239,6 @@ vk::VkImageMemoryBarrier            makeImageMemoryBarrier                                          (const vk::VkAccessFlags s
 
 void                                                   beginCommandBuffer                                                      (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
 void                                                   endCommandBuffer                                                        (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
-void                                                   submitCommandsAndWait                                           (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
 void                                                   beginRenderPass                                                         (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const vk::VkFramebuffer framebuffer, const vk::VkRect2D& renderArea, const tcu::Vec4& clearColor);
 void                                                   beginRenderPassWithRasterizationDisabled        (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const vk::VkFramebuffer framebuffer);
 void                                                   endRenderPass                                                           (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
index b495048..426f582 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkStrUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
index 471b602..268c352 100644 (file)
@@ -34,6 +34,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
index a5a1326..8fa7c34 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkStrUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
index 38f398a..9a0ec72 100644 (file)
@@ -38,6 +38,7 @@
 #include "vkImageUtil.hpp"
 #include "vkBuilderUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
index b22234a..06e6a21 100644 (file)
@@ -261,29 +261,6 @@ void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandB
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const Unique<VkFence> fence(createFence(vk, device));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                sType;
-               DE_NULL,                                                        // const void*                    pNext;
-               0u,                                                                     // uint32_t                       waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                     // uint32_t                       commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                     // uint32_t                       signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 void beginRenderPass (const DeviceInterface&   vk,
                                          const VkCommandBuffer         commandBuffer,
                                          const VkRenderPass            renderPass,
index 066f3fb..c7411ff 100644 (file)
@@ -225,7 +225,6 @@ vk::VkImageMemoryBarrier            makeImageMemoryBarrier                                          (const vk::VkAccessFlags s
 
 void                                                   beginCommandBuffer                                                      (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
 void                                                   endCommandBuffer                                                        (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
-void                                                   submitCommandsAndWait                                           (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
 void                                                   beginRenderPass                                                         (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const vk::VkFramebuffer framebuffer, const vk::VkRect2D& renderArea, const tcu::Vec4& clearColor);
 void                                                   beginRenderPassWithRasterizationDisabled        (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer, const vk::VkRenderPass renderPass, const vk::VkFramebuffer framebuffer);
 void                                                   endRenderPass                                                           (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
index 4462237..a60389f 100644 (file)
@@ -38,6 +38,7 @@
 #include "vkTypeUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkMemUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTexLookupVerifier.hpp"
 #include "tcuTestLog.hpp"
@@ -485,21 +486,7 @@ void initializeImage(Context& ctx, VkImage im, const ConstPixelBufferAccess* pba
 
        VK_CHECK(vkd.endCommandBuffer(copyBuffer.get()));
 
-       const VkSubmitInfo copySubmitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,
-               DE_NULL,
-               0,
-               DE_NULL,
-               DE_NULL,
-               1,
-               &(copyBuffer.get()),
-               0,
-               DE_NULL
-       };
-
-       VK_CHECK(vkd.queueSubmit(ctx.getUniversalQueue(), 1, &copySubmitInfo, 0));
-       VK_CHECK(vkd.queueWaitIdle(ctx.getUniversalQueue()));
+       submitCommandsAndWait(vkd, dev, ctx.getUniversalQueue(), copyBuffer.get());
 }
 
 struct TestCaseData
index 53591bb..e99f1be 100644 (file)
@@ -37,6 +37,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include <map>
 #include <string>
 #include <vector>
@@ -762,9 +763,6 @@ TextureRenderer::TextureRenderer (Context& context, VkSampleCountFlagBits sample
                m_descriptorPool = descriptorPoolBuilder.build(vkd, vkDevice, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 2u);
        }
 
-       // Fence
-       m_fence = createFence(vkd, vkDevice);
-
        // Result Buffer
        {
                const VkBufferCreateInfo                                bufferCreateInfo                =
@@ -843,22 +841,7 @@ void TextureRenderer::clearImage(VkImage image)
 
        VK_CHECK(vkd.endCommandBuffer(*commandBuffer));
 
-       const VkSubmitInfo                                      submitInfo                              =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                              sType;
-               DE_NULL,                                                                // const void*                                  pNext;
-               0u,                                                                             // deUint32                                             waitSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*                   pWaitSemaphores;
-               DE_NULL,                                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-               1u,                                                                             // deUint32                                             commandBufferCount;
-               &commandBuffer.get(),                                   // const VkCommandBuffer*               pCommandBuffers;
-               0u,                                                                             // deUint32                                             signalSemaphoreCount;
-               DE_NULL,                                                                // const VkSemaphore*                   pSignalSemaphores;
-       };
-
-       VK_CHECK(vkd.resetFences(vkDevice, 1, &m_fence.get()));
-       VK_CHECK(vkd.queueSubmit(queue, 1, &submitInfo, *m_fence));
-       VK_CHECK(vkd.waitForFences(vkDevice, 1, &m_fence.get(), true, ~(0ull) /* infinity */));
+       submitCommandsAndWait(vkd, vkDevice, queue, commandBuffer.get());
 }
 
 void TextureRenderer::add2DTexture (const TestTexture2DSp& texture, TextureBinding::ImageBackingMode backingMode)
@@ -1614,24 +1597,7 @@ void TextureRenderer::renderQuad (tcu::Surface&                                                                  result,
        }
 
        // Submit
-       {
-               const VkSubmitInfo                                      submitInfo                              =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,                  // VkStructureType                              sType;
-                       DE_NULL,                                                                // const void*                                  pNext;
-                       0u,                                                                             // deUint32                                             waitSemaphoreCount;
-                       DE_NULL,                                                                // const VkSemaphore*                   pWaitSemaphores;
-                       DE_NULL,                                                                // const VkPipelineStageFlags*  pWaitDstStageMask;
-                       1u,                                                                             // deUint32                                             commandBufferCount;
-                       &commandBuffer.get(),                                   // const VkCommandBuffer*               pCommandBuffers;
-                       0u,                                                                             // deUint32                                             signalSemaphoreCount;
-                       DE_NULL,                                                                // const VkSemaphore*                   pSignalSemaphores;
-               };
-
-               VK_CHECK(vkd.resetFences(vkDevice, 1, &m_fence.get()));
-               VK_CHECK(vkd.queueSubmit(queue, 1, &submitInfo, *m_fence));
-               VK_CHECK(vkd.waitForFences(vkDevice, 1, &m_fence.get(), true, ~(0ull) /* infinity */));
-       }
+       submitCommandsAndWait(vkd, vkDevice, queue, commandBuffer.get());
 
        invalidateMappedMemoryRange(vkd, vkDevice, m_resultBufferMemory->getMemory(), m_resultBufferMemory->getOffset(), VK_WHOLE_SIZE);
 
index 1cb3127..642fae2 100644 (file)
@@ -245,8 +245,6 @@ protected:
        static const vk::VkDeviceSize           s_vertexIndexBufferSize;
        static const deUint16                           s_vertexIndices[6];
 
-       vk::Move<vk::VkFence>                           m_fence;
-
        vk::Move<vk::VkBuffer>                          m_resultBuffer;
        de::MovePtr<vk::Allocation>                     m_resultBufferMemory;
        const vk::VkDeviceSize                          m_resultBufferSize;
index 3551132..00baa35 100644 (file)
@@ -42,6 +42,7 @@
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
 #include "vkBuilderUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include <map>
 #include <set>
@@ -1838,25 +1839,7 @@ tcu::TestStatus UniformBlockCaseInstance::iterate (void)
        VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
 
        // Submit the command buffer
-       {
-               const Unique<vk::VkFence> fence(vk::createFence(vk, device));
-
-               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;
-                       &cmdBuffer.get(),                               // const VkCommandBuffer*       pCommandBuffers;
-                       0u,                                                             // deUint32                                     signalSemaphoreCount;
-                       DE_NULL                                                 // const VkSemaphore*           pSignalSemaphores;
-               };
-
-               VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
 
        // Read back the results
        tcu::Surface surface(RENDER_WIDTH, RENDER_HEIGHT);
index 9855542..97b05ed 100644 (file)
@@ -27,6 +27,7 @@
 #include "vkBufferWithMemory.hpp"
 #include "vkImageWithMemory.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 #include "rrRenderer.hpp"
 #include "rrRenderState.hpp"
 #include "rrPrimitiveTypes.hpp"
@@ -269,35 +270,6 @@ void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandB
        VK_CHECK(vk.endCommandBuffer(commandBuffer));
 }
 
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const VkFenceCreateInfo fenceInfo =
-       {
-               VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType;
-               DE_NULL,                                                                // const void*                  pNext;
-               (VkFenceCreateFlags)0,                                  // VkFenceCreateFlags   flags;
-       };
-       const Unique<VkFence> fence(createFence(vk, device, &fenceInfo));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                                      sType;
-               DE_NULL,                                                        // const void*                                          pNext;
-               0u,                                                                     // uint32_t                                                     waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*                           pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*          pWaitDstStageMask;
-               1u,                                                                     // uint32_t                                                     commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*                       pCommandBuffers;
-               0u,                                                                     // uint32_t                                                     signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*                           pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
 std::string getPrimitiveTopologyShortName (const VkPrimitiveTopology topology)
 {
        std::string name(getPrimitiveTopologyName(topology));
index 8003685..c4ac322 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkBuilderUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "gluShaderLibrary.hpp"
 #include "gluShaderUtil.hpp"
@@ -1752,24 +1753,7 @@ TestStatus ShaderCaseInstance::iterate (void)
        if (!m_spec.values.uniforms.empty())
                writeValuesToMem(m_context, *m_uniformMem, m_uniformLayout, m_spec.values.uniforms, m_subCaseNdx);
 
-       {
-               const vk::VkSubmitInfo          submitInfo      =
-               {
-                       vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,                                                                                     // waitSemaphoreCount
-                       (const vk::VkSemaphore*)0,                                      // pWaitSemaphores
-                       (const vk::VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &m_cmdBuffer.get(),
-                       0u,                                                                                     // signalSemaphoreCount
-                       (const vk::VkSemaphore*)0,                                      // pSignalSemaphores
-               };
-               const Unique<vk::VkFence>       fence           (vk::createFence(vkd, device));
-
-               VK_CHECK(vkd.queueSubmit        (queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkd.waitForFences      (device, 1u, &fence.get(), DE_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkd, device, queue, m_cmdBuffer.get());
 
        // Result was checked in fragment shader
        if (m_spec.outputType == glu::sl::OUTPUT_RESULT)
index 20b3fce..fdc5fa4 100644 (file)
@@ -30,6 +30,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuSeedBuilder.hpp"
 #include "tcuTestLog.hpp"
@@ -841,24 +842,7 @@ tcu::TestStatus imageCopyTest (Context& context, const TestConfig config)
 
                                VK_CHECK(vkd.endCommandBuffer(*cmdBuffer));
 
-                               {
-                                       const vk::Unique<vk::VkFence>   fence           (createFence(vkd, device));
-                                       const vk::VkSubmitInfo                  submitInfo      =
-                                       {
-                                               vk::VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                                               DE_NULL,
-                                               0u,
-                                               (const vk::VkSemaphore*)DE_NULL,
-                                               (const vk::VkPipelineStageFlags*)DE_NULL,
-                                               1u,
-                                               &*cmdBuffer,
-                                               0u,
-                                               (const vk::VkSemaphore*)DE_NULL,
-                                       };
-
-                                       VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, *fence));
-                                       VK_CHECK(vkd.waitForFences(device, 1u, &*fence, VK_TRUE, ~0ull));
-                               }
+                               submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
                        }
 
                        if (config.dst.tiling == vk::VK_IMAGE_TILING_OPTIMAL)
index b154198..6c01b92 100644 (file)
@@ -26,6 +26,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "deMath.h"
@@ -424,24 +425,7 @@ void uploadImage (const DeviceInterface&           vkd,
 
        VK_CHECK(vkd.endCommandBuffer(*cmdBuffer));
 
-       {
-               const Unique<VkFence>   fence           (createFence(vkd, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &*cmdBuffer,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkd.waitForFences(device, 1u, &*fence, VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
 }
 
 void fillImageMemory (const vk::DeviceInterface&                                                       vkd,
@@ -531,24 +515,7 @@ void fillImageMemory (const vk::DeviceInterface&                                                   vkd,
 
        VK_CHECK(vkd.endCommandBuffer(*cmdBuffer));
 
-       {
-               const Unique<VkFence>   fence           (createFence(vkd, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &*cmdBuffer,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkd.waitForFences(device, 1u, &*fence, VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
 }
 
 void downloadImage (const DeviceInterface&     vkd,
@@ -667,24 +634,7 @@ void downloadImage (const DeviceInterface& vkd,
 
        VK_CHECK(vkd.endCommandBuffer(*cmdBuffer));
 
-       {
-               const Unique<VkFence>   fence           (createFence(vkd, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &*cmdBuffer,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkd.waitForFences(device, 1u, &*fence, VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
 
        readStagingBuffers(imageData, vkd, device, stagingMemory);
 }
@@ -744,24 +694,7 @@ void readImageMemory (const vk::DeviceInterface&                                                   vkd,
 
        VK_CHECK(vkd.endCommandBuffer(*cmdBuffer));
 
-       {
-               const Unique<VkFence>   fence           (createFence(vkd, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &*cmdBuffer,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkd.waitForFences(device, 1u, &*fence, VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
 
        for (deUint32 planeNdx = 0; planeNdx < formatDesc.numPlanes; ++planeNdx)
        {
index 0ac0aa1..9ace3e7 100644 (file)
@@ -34,6 +34,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkMemUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuVectorUtil.hpp"
@@ -351,24 +352,7 @@ void executeImageBarrier (const DeviceInterface&           vkd,
 
        VK_CHECK(vkd.endCommandBuffer(*cmdBuffer));
 
-       {
-               const Unique<VkFence>   fence           (createFence(vkd, device));
-               const VkSubmitInfo              submitInfo      =
-               {
-                       VK_STRUCTURE_TYPE_SUBMIT_INFO,
-                       DE_NULL,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-                       (const VkPipelineStageFlags*)DE_NULL,
-                       1u,
-                       &*cmdBuffer,
-                       0u,
-                       (const VkSemaphore*)DE_NULL,
-               };
-
-               VK_CHECK(vkd.queueSubmit(queue, 1u, &submitInfo, *fence));
-               VK_CHECK(vkd.waitForFences(device, 1u, &*fence, VK_TRUE, ~0ull));
-       }
+       submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
 }
 
 struct TestParameters