To copy query statuses and numerical results directly to buffer memory, call:
void vkCmdCopyQueryPoolResults( VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags);
commandBufferis the command buffer into which this command will be recorded.
queryPoolis the query pool managing the queries containing the desired results.
firstQueryis the initial query index.
queryCountis the number of queries.
queryCounttogether define a range of queries.
VkBufferobject that will receive the results of the copy command.
dstOffsetis an offset into
strideis the stride in bytes between results for individual queries within
dstBuffer. The required size of the backing memory for
dstBufferis determined as described above for vkGetQueryPoolResults.
flagsis a bitmask of VkQueryResultFlagBits specifying how and when results are returned.
vkCmdCopyQueryPoolResults is guaranteed to see the effect of previous
vkCmdResetQueryPool in the same queue, without any additional
Thus, the results will always reflect the most recent use of the query.
flags has the same possible values described above for the
parameter of vkGetQueryPoolResults, but the different style of
execution causes some subtle behavioral differences.
vkCmdCopyQueryPoolResults executes in order with respect to
other query commands, there is less ambiguity about which use of a query is
If no bits are set in
flags, results for all requested queries in the
available state are written as 32-bit unsigned integer values, and nothing
is written for queries in the unavailable state.
VK_QUERY_RESULT_64_BIT is set, the results are written as an array
of 64-bit unsigned integer values as described for
VK_QUERY_RESULT_WAIT_BIT is set, the implementation will wait for
each query’s status to be in the available state before retrieving the
numerical results for that query.
This is guaranteed to reflect the most recent use of the query on the same
queue, assuming that the query is not being simultaneously used by other
If the query does not become available in a finite amount of time (e.g. due
to not issuing a query since the last reset), a
error may occur.
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is set and
VK_QUERY_RESULT_WAIT_BIT is not set, the availability is guaranteed to
reflect the most recent use of the query on the same queue, assuming that
the query is not being simultaneously used by other queues.
vkGetQueryPoolResults, implementations must guarantee that if
they return a non-zero availability value, then the numerical results are
VK_QUERY_RESULT_PARTIAL_BIT is set,
is not set, and the query’s status is unavailable, an intermediate result
value between zero and the final result value is written for that query.
VK_QUERY_RESULT_PARTIAL_BIT must not be used if the pool’s
vkCmdCopyQueryPoolResults is considered to be a transfer operation,
and its writes to buffer memory must be synchronized using
before using the results.
For more information, see the Vulkan Specification at URL
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.
Copyright (c) 2014-2018 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.