To retrieve status and results for a set of queries, call:
// Provided by VK_VERSION_1_0 VkResult vkGetQueryPoolResults( VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
deviceis the logical device that owns the query pool.
queryPoolis the query pool managing the queries containing the desired results.
firstQueryis the initial query index.
queryCountis the number of queries to read.
dataSizeis the size in bytes of the buffer pointed to by
pDatais a pointer to a user-allocated buffer where the results will be written
strideis the stride in bytes between results for individual queries within
flagsis a bitmask of VkQueryResultFlagBits specifying how and when results are returned.
Any results written for a query are written according to a layout dependent on the query type.
If no bits are set in
flags, and all requested queries are in the
available state, results are written as an array of 32-bit unsigned integer
Behavior when not all queries are available is described
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is set, results for all
queryPool identified by
queryCount are copied to
pData, along with an extra availability
value written directly after the results of each query and interpreted as an
A value of zero indicates that the results are not yet available, otherwise
the query is complete and results are available.
VK_QUERY_RESULT_WITH_STATUS_BIT_KHR is set, results for all queries
queryPool identified by
pData, along with an extra status value written directly
after the results of each query and interpreted as a signed integer.
A value of zero indicates that the results are not yet available.
Positive values indicate that the operations within the query completed
successfully, and the query results are valid.
Negative values indicate that the operations within the query completed
VkQueryResultStatusKHR defines specific meaning for values returned here, though implementations are free to return other values.
Results for any available query written by this command are final and
represent the final result of the query.
VK_QUERY_RESULT_PARTIAL_BIT is set, then for any query that is
unavailable, an intermediate result between zero and the final result value
is written for that query.
Otherwise, any result written by this command is undefined.
VK_QUERY_RESULT_64_BIT is set, results and availability
values for all queries are written as an array of 64-bit values.
queryPool was created with
VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, results for each query are
written as an array of the type indicated by
storage for the counter being queried.
Otherwise, results and availability
values are written as an array of 32-bit values.
If an unsigned integer query’s value overflows the result type, the value
may either wrap or saturate.
If a signed integer query’s value overflows the result type, the value is
If a floating point query’s value is not representable as the result type,
the value is undefined.
VK_QUERY_RESULT_WAIT_BIT is set, this command defines an execution
dependency with any earlier commands that writes one of the identified
The first synchronization scope
includes all instances of vkCmdEndQuery,
and vkCmdWriteTimestamp that reference any query in
The second synchronization scope
includes the host operations of this command.
VK_QUERY_RESULT_WAIT_BIT is not set,
VK_NOT_READY if there are queries in the unavailable
Applications must take care to ensure that use of the
For example, if a query has been used previously and a command buffer
records the commands
The above also applies when
A similar situation can arise with the
Applications can double-buffer query pool usage, with a pool per frame, and reset queries at the end of the frame in which they are read.
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.