Missing coverage for vkCmdCopyQueryPoolResults
authorJuha Heiskanen <juha.heiskanen@siru.fi>
Fri, 12 Nov 2021 13:09:02 +0000 (15:09 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 3 Dec 2021 01:10:33 +0000 (01:10 +0000)
Cover stride 0 and query count 1 for vkCmdCopyQueryPoolResult.

Components: Vulkan

VK-GL-CTS Issue: 3286

New tests: dEQP-VK.query_pool.occlusion_query.*stride_0_*

Change-Id: I033acd4927f3de45ce7584c610c73e33ac9c7a16

android/cts/master/vk-master-2021-03-01/query-pool.txt
android/cts/master/vk-master/query-pool.txt
external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp
external/vulkancts/mustpass/master/vk-default/query-pool.txt

index 46479df..1c320ba 100644 (file)
@@ -57,6 +57,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_without_availa
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_20_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_52_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4096_without_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_0_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_16_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_24_without_availability_dstoffset
@@ -64,18 +65,21 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_without_availa
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_40_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_104_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8192_without_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_0_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_8_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_12_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_20_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_52_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4096_with_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_0_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_16_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_24_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_40_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_104_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8192_with_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_0_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_reset_results_size_32_stride_8_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_reset_results_size_32_stride_12_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_reset_results_size_32_stride_16_with_availability_dstoffset
index 96dccad..fe03d6c 100644 (file)
@@ -255,6 +255,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_without_availa
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_20_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_52_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4096_without_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_0_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_8_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_12_without_availability
@@ -269,6 +270,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_without_availa
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_40_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_104_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8192_without_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_0_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_16_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_24_without_availability
@@ -282,6 +284,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_with_availabil
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_20_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_52_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4096_with_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_0_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_8_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_12_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_with_availability
@@ -294,6 +297,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_with_availabil
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_40_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_104_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8192_with_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_0_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_16_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_24_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_with_availability
index 705adc0..27b0bad 100644 (file)
@@ -559,8 +559,11 @@ OcclusionQueryTestInstance::OcclusionQueryTestInstance (vkt::Context &context, c
 
        if (m_testVector.queryResultsMode == RESULTS_MODE_COPY || m_testVector.queryResultsMode == RESULTS_MODE_COPY_RESET)
        {
-               deUint32 numQueriesinPool = NUM_QUERIES_IN_POOL + (m_testVector.queryResultsDstOffset ? 1 : 0);
-               const vk::VkDeviceSize  resultsBufferSize                       = m_testVector.queryResultsStride * numQueriesinPool;
+               deUint32                                numQueriesinPool                        = NUM_QUERIES_IN_POOL + (m_testVector.queryResultsDstOffset ? 1 : 0);
+               const vk::VkDeviceSize  elementSize                                     = m_testVector.queryResultSize == RESULT_SIZE_32_BIT ? sizeof(deUint32) : sizeof(deUint64);
+               const vk::VkDeviceSize  resultsBufferSize                       = m_testVector.queryResultsStride == 0
+                                                                                                                       ? (elementSize + elementSize * m_testVector.queryResultsAvailability) * numQueriesinPool
+                                                                                                                       : m_testVector.queryResultsStride * numQueriesinPool;
                                                                m_queryPoolResultsBuffer        = Buffer::createAndAlloc(vk, device, BufferCreateInfo(resultsBufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DST_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
        }
 
@@ -855,7 +858,22 @@ vk::Move<vk::VkCommandBuffer> OcclusionQueryTestInstance::recordRender (vk::VkCo
                && !hasSeparateCopyCmdBuf())
        {
                vk::VkDeviceSize dstOffset = m_testVector.queryResultsDstOffset ? m_testVector.queryResultsStride : 0u;
-               vk.cmdCopyQueryPoolResults(*cmdBuffer, m_queryPool, 0, NUM_QUERIES_IN_POOL, m_queryPoolResultsBuffer->object(), dstOffset, m_testVector.queryResultsStride, m_queryResultFlags);
+
+               if (m_testVector.queryResultsStride != 0u)
+               {
+                       vk.cmdCopyQueryPoolResults(*cmdBuffer, m_queryPool, 0, NUM_QUERIES_IN_POOL, m_queryPoolResultsBuffer->object(), dstOffset, m_testVector.queryResultsStride, m_queryResultFlags);
+               }
+               else
+               {
+                       const vk::VkDeviceSize  elementSize     = m_testVector.queryResultSize == RESULT_SIZE_32_BIT ? sizeof(deUint32) : sizeof(deUint64);
+                       const vk::VkDeviceSize  strideSize      = elementSize + elementSize * m_testVector.queryResultsAvailability;
+
+                       for (int queryNdx = 0; queryNdx < NUM_QUERIES_IN_POOL; queryNdx++)
+                       {
+                               vk.cmdCopyQueryPoolResults(*cmdBuffer, m_queryPool, queryNdx, 1, m_queryPoolResultsBuffer->object(), strideSize * queryNdx, 0, m_queryResultFlags);
+                       }
+               }
+
                bufferBarrier(vk, *cmdBuffer, m_queryPoolResultsBuffer->object(), vk::VK_ACCESS_TRANSFER_WRITE_BIT, vk::VK_ACCESS_HOST_READ_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_HOST_BIT);
        }
 
@@ -876,9 +894,26 @@ vk::Move<vk::VkCommandBuffer> OcclusionQueryTestInstance::recordCopyResults (vk:
        vk::Move<vk::VkCommandBuffer>   cmdBuffer       (vk::allocateCommandBuffer(vk, device, cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
 
        beginCommandBuffer(vk, *cmdBuffer);
+
        vk::VkDeviceSize dstOffset = m_testVector.queryResultsDstOffset ? m_testVector.queryResultsStride : 0u;
-       vk.cmdCopyQueryPoolResults(*cmdBuffer, m_queryPool, 0, NUM_QUERIES_IN_POOL, m_queryPoolResultsBuffer->object(), dstOffset, m_testVector.queryResultsStride, m_queryResultFlags);
+
+       if (m_testVector.queryResultsStride != 0u)
+       {
+               vk.cmdCopyQueryPoolResults(*cmdBuffer, m_queryPool, 0, NUM_QUERIES_IN_POOL, m_queryPoolResultsBuffer->object(), dstOffset, m_testVector.queryResultsStride, m_queryResultFlags);
+       }
+       else
+       {
+               const vk::VkDeviceSize  elementSize     = m_testVector.queryResultSize == RESULT_SIZE_32_BIT ? sizeof(deUint32) : sizeof(deUint64);
+               const vk::VkDeviceSize  strideSize      = elementSize + elementSize * m_testVector.queryResultsAvailability;
+
+               for (int queryNdx = 0; queryNdx < NUM_QUERIES_IN_POOL; queryNdx++)
+               {
+                       vk.cmdCopyQueryPoolResults(*cmdBuffer, m_queryPool, queryNdx, 1, m_queryPoolResultsBuffer->object(), strideSize * queryNdx, 0, m_queryResultFlags);
+               }
+       }
+
        bufferBarrier(vk, *cmdBuffer, m_queryPoolResultsBuffer->object(), vk::VK_ACCESS_TRANSFER_WRITE_BIT, vk::VK_ACCESS_HOST_READ_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT, vk::VK_PIPELINE_STAGE_HOST_BIT);
+
        endCommandBuffer(vk, *cmdBuffer);
 
        return cmdBuffer;
@@ -886,11 +921,13 @@ vk::Move<vk::VkCommandBuffer> OcclusionQueryTestInstance::recordCopyResults (vk:
 
 void OcclusionQueryTestInstance::captureResults (deUint64* retResults, deUint64* retAvailAbility, bool allowNotReady)
 {
-
        const vk::VkDevice                      device                  = m_context.getDevice();
        const vk::DeviceInterface&      vk                              = m_context.getDeviceInterface();
-       const vk::VkDeviceSize          resultsSize             = m_testVector.queryResultsStride * NUM_QUERIES_IN_POOL;
-       std::vector<deUint8>            resultsBuffer   (static_cast<size_t>(resultsSize));
+       const vk::VkDeviceSize          elementSize             = m_testVector.queryResultSize == RESULT_SIZE_32_BIT ? sizeof(deUint32) : sizeof(deUint64);
+       const vk::VkDeviceSize          resultsSize             = m_testVector.queryResultsStride == 0
+                                                                                               ? elementSize + elementSize * m_testVector.queryResultsAvailability
+                                                                                               : m_testVector.queryResultsStride;
+       std::vector<deUint8>            resultsBuffer   (static_cast<size_t>(resultsSize * NUM_QUERIES_IN_POOL));
 
        if (m_testVector.queryResultsMode == RESULTS_MODE_GET || m_testVector.queryResultsMode == RESULTS_MODE_GET_RESET)
        {
@@ -917,7 +954,8 @@ void OcclusionQueryTestInstance::captureResults (deUint64* retResults, deUint64*
 
        for (int queryNdx = 0; queryNdx < NUM_QUERIES_IN_POOL; queryNdx++)
        {
-               const void* srcPtr = &resultsBuffer[queryNdx * static_cast<size_t>(m_testVector.queryResultsStride)];
+               const void* srcPtr = &resultsBuffer[queryNdx * static_cast<size_t>(resultsSize)];
+
                if (m_testVector.queryResultSize == RESULT_SIZE_32_BIT)
                {
                        const deUint32* srcPtrTyped = static_cast<const deUint32*>(srcPtr);
@@ -946,6 +984,7 @@ void OcclusionQueryTestInstance::captureResults (deUint64* retResults, deUint64*
        if (m_testVector.queryResultsMode == RESULTS_MODE_GET_RESET)
        {
                vk.resetQueryPool(device, m_queryPool, 0, NUM_QUERIES_IN_POOL);
+
                vk::VkResult queryResult = vk.getQueryPoolResults(device, m_queryPool, 0, NUM_QUERIES_IN_POOL, resultsBuffer.size(), &resultsBuffer[0], m_testVector.queryResultsStride, m_queryResultFlags);
 
                if (queryResult != vk::VK_NOT_READY)
@@ -961,7 +1000,7 @@ void OcclusionQueryTestInstance::captureResults (deUint64* retResults, deUint64*
                 */
                for (int queryNdx = 0; queryNdx < NUM_QUERIES_IN_POOL; queryNdx++)
                {
-                       const void* srcPtr = &resultsBuffer[queryNdx * static_cast<size_t>(m_testVector.queryResultsStride)];
+                       const void* srcPtr = &resultsBuffer[queryNdx * static_cast<size_t>(resultsSize)];
                        if (m_testVector.queryResultSize == RESULT_SIZE_32_BIT)
                        {
                                const deUint32* srcPtrTyped = static_cast<const deUint32*>(srcPtr);
@@ -1344,6 +1383,7 @@ void QueryPoolOcclusionTests::init (void)
                                        // \todo [2015-12-18 scygan] Ensure only stride values aligned to resultSize are allowed. Otherwise test should be extended.
                                        const vk::VkDeviceSize strides[]        =
                                        {
+                                               0u,
                                                1 * resultSize,
                                                2 * resultSize,
                                                3 * resultSize,
@@ -1366,9 +1406,24 @@ void QueryPoolOcclusionTests::init (void)
 
                                                        const vk::VkDeviceSize elementSize              = (testVector.queryResultsAvailability ? resultSize * 2 : resultSize);
 
-                                                       if (elementSize > testVector.queryResultsStride)
+                                                       if (elementSize > testVector.queryResultsStride && strides[strideIdx] != 0)
+                                                       {
+                                                               continue;
+                                                       }
+
+                                                       if (strides[strideIdx] == 0)
                                                        {
+                                                               // Due to the nature of the test, the dstOffset is tested automatically when stride size is 0.
+                                                               if (testVector.queryResultsDstOffset)
+                                                               {
                                                                        continue;
+                                                               }
+
+                                                               // We are testing only VkCmdCopyQueryPoolResults with stride 0.
+                                                               if (testVector.queryResultsMode != RESULTS_MODE_COPY)
+                                                               {
+                                                                       continue;
+                                                               }
                                                        }
 
                                                        std::ostringstream testName;
index 96dccad..fe03d6c 100644 (file)
@@ -255,6 +255,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_without_availa
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_20_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_52_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4096_without_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_0_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_8_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_12_without_availability
@@ -269,6 +270,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_without_availa
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_40_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_104_without_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8192_without_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_0_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_16_without_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_24_without_availability
@@ -282,6 +284,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_with_availabil
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_20_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_52_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_4096_with_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_0_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_8_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_12_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_32_stride_16_with_availability
@@ -294,6 +297,7 @@ dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_with_availabil
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_40_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_104_with_availability_dstoffset
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_8192_with_availability_dstoffset
+dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_0_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_16_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_24_with_availability
 dEQP-VK.query_pool.occlusion_query.copy_results_size_64_stride_32_with_availability