From 98b61bd23214c23c49bf4bb13126b91a3ae62c53 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Fri, 12 Nov 2021 15:09:02 +0200 Subject: [PATCH] Missing coverage for vkCmdCopyQueryPoolResults 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 --- .../cts/master/vk-master-2021-03-01/query-pool.txt | 4 ++ android/cts/master/vk-master/query-pool.txt | 4 ++ .../query_pool/vktQueryPoolOcclusionTests.cpp | 75 +++++++++++++++++++--- .../mustpass/master/vk-default/query-pool.txt | 4 ++ 4 files changed, 77 insertions(+), 10 deletions(-) diff --git a/android/cts/master/vk-master-2021-03-01/query-pool.txt b/android/cts/master/vk-master-2021-03-01/query-pool.txt index 46479df..1c320ba 100644 --- a/android/cts/master/vk-master-2021-03-01/query-pool.txt +++ b/android/cts/master/vk-master-2021-03-01/query-pool.txt @@ -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 diff --git a/android/cts/master/vk-master/query-pool.txt b/android/cts/master/vk-master/query-pool.txt index 96dccad..fe03d6c 100644 --- a/android/cts/master/vk-master/query-pool.txt +++ b/android/cts/master/vk-master/query-pool.txt @@ -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 diff --git a/external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp b/external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp index 705adc0..27b0bad 100644 --- a/external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp +++ b/external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp @@ -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 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 OcclusionQueryTestInstance::recordCopyResults (vk: vk::Move 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 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 resultsBuffer (static_cast(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 resultsBuffer (static_cast(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(m_testVector.queryResultsStride)]; + const void* srcPtr = &resultsBuffer[queryNdx * static_cast(resultsSize)]; + if (m_testVector.queryResultSize == RESULT_SIZE_32_BIT) { const deUint32* srcPtrTyped = static_cast(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(m_testVector.queryResultsStride)]; + const void* srcPtr = &resultsBuffer[queryNdx * static_cast(resultsSize)]; if (m_testVector.queryResultSize == RESULT_SIZE_32_BIT) { const deUint32* srcPtrTyped = static_cast(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; diff --git a/external/vulkancts/mustpass/master/vk-default/query-pool.txt b/external/vulkancts/mustpass/master/vk-default/query-pool.txt index 96dccad..fe03d6c 100644 --- a/external/vulkancts/mustpass/master/vk-default/query-pool.txt +++ b/external/vulkancts/mustpass/master/vk-default/query-pool.txt @@ -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 -- 2.7.4