1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[queries]] 6e5c31af7Sopenharmony_ci= Queries 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ci_Queries_ provide a mechanism to return information about the processing of 9e5c31af7Sopenharmony_cia sequence of Vulkan commands. 10e5c31af7Sopenharmony_ciQuery operations are asynchronous, and as such, their results are not 11e5c31af7Sopenharmony_cireturned immediately. 12e5c31af7Sopenharmony_ciInstead, their results, and their availability status are stored in a 13e5c31af7Sopenharmony_ci<<queries-pools, Query Pool>>. 14e5c31af7Sopenharmony_ciThe state of these queries can: be read back on the host, or copied to a 15e5c31af7Sopenharmony_cibuffer object on the device. 16e5c31af7Sopenharmony_ci 17e5c31af7Sopenharmony_ciThe supported query types are <<queries-occlusion,Occlusion Queries>>, 18e5c31af7Sopenharmony_ci<<queries-pipestats,Pipeline Statistics Queries>>, 19e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 20e5c31af7Sopenharmony_ci<<queries-result-status-only, Result Status Queries>>, 21e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 22e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 23e5c31af7Sopenharmony_ci<<queries-video-encode-feedback, Video Encode Feedback Queries>> 24e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 25e5c31af7Sopenharmony_ciand <<queries-timestamps, Timestamp Queries>>. 26e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 27e5c31af7Sopenharmony_ci<<queries-performance, Performance Queries>> are supported if the associated 28e5c31af7Sopenharmony_ciextension is available. 29e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 30e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 31e5c31af7Sopenharmony_ci<<queries-transform-feedback, Transform Feedback Queries>> are supported if 32e5c31af7Sopenharmony_cithe associated extension is available. 33e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 34e5c31af7Sopenharmony_ciifdef::VK_INTEL_performance_query[] 35e5c31af7Sopenharmony_ci<<queries-performance-intel>> are supported if the associated extension is 36e5c31af7Sopenharmony_ciavailable. 37e5c31af7Sopenharmony_ciendif::VK_INTEL_performance_query[] 38e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 39e5c31af7Sopenharmony_ci<<queries-mesh-shader, Mesh Shader Queries>> are supported if the associated 40e5c31af7Sopenharmony_ciextension is available. 41e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 42e5c31af7Sopenharmony_ci 43e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 44e5c31af7Sopenharmony_ciSeveral additional queries with specific purposes associated with ray 45e5c31af7Sopenharmony_citracing are available if the corresponding extensions are supported, as 46e5c31af7Sopenharmony_cidescribed for elink:VkQueryType. 47e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 48e5c31af7Sopenharmony_ci 49e5c31af7Sopenharmony_ci 50e5c31af7Sopenharmony_ci[[queries-pools]] 51e5c31af7Sopenharmony_ci== Query Pools 52e5c31af7Sopenharmony_ci 53e5c31af7Sopenharmony_ci[open,refpage='VkQueryPool',desc='Opaque handle to a query pool object',type='handles'] 54e5c31af7Sopenharmony_ci-- 55e5c31af7Sopenharmony_ciQueries are managed using _query pool_ objects. 56e5c31af7Sopenharmony_ciEach query pool is a collection of a specific number of queries of a 57e5c31af7Sopenharmony_ciparticular type. 58e5c31af7Sopenharmony_ci 59e5c31af7Sopenharmony_ciQuery pools are represented by sname:VkQueryPool handles: 60e5c31af7Sopenharmony_ci 61e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkQueryPool.adoc[] 62e5c31af7Sopenharmony_ci-- 63e5c31af7Sopenharmony_ci 64e5c31af7Sopenharmony_ci[open,refpage='vkCreateQueryPool',desc='Create a new query pool object',type='protos'] 65e5c31af7Sopenharmony_ci-- 66e5c31af7Sopenharmony_ci:refpage: vkCreateQueryPool 67e5c31af7Sopenharmony_ci:objectnameplural: query pools 68e5c31af7Sopenharmony_ci:objectnamecamelcase: queryPool 69e5c31af7Sopenharmony_ci:objectcount: 1 70e5c31af7Sopenharmony_ci 71e5c31af7Sopenharmony_ciTo create a query pool, call: 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateQueryPool.adoc[] 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_ci * pname:device is the logical device that creates the query pool. 76e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkQueryPoolCreateInfo 77e5c31af7Sopenharmony_ci structure containing the number and type of queries to be managed by the 78e5c31af7Sopenharmony_ci pool. 79e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 80e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 81e5c31af7Sopenharmony_ci * pname:pQueryPool is a pointer to a slink:VkQueryPool handle in which the 82e5c31af7Sopenharmony_ci resulting query pool object is returned. 83e5c31af7Sopenharmony_ci 84e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 85e5c31af7Sopenharmony_ci 86e5c31af7Sopenharmony_ciifdef::VKSC_VERSION_1_0[] 87e5c31af7Sopenharmony_ci.Valid Usage 88e5c31af7Sopenharmony_ci**** 89e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/memory_reservation_request_count_common.adoc[] 90e5c31af7Sopenharmony_ci**** 91e5c31af7Sopenharmony_ciendif::VKSC_VERSION_1_0[] 92e5c31af7Sopenharmony_ci 93e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateQueryPool.adoc[] 94e5c31af7Sopenharmony_ci-- 95e5c31af7Sopenharmony_ci 96e5c31af7Sopenharmony_ci[open,refpage='VkQueryPoolCreateInfo',desc='Structure specifying parameters of a newly created query pool',type='structs'] 97e5c31af7Sopenharmony_ci-- 98e5c31af7Sopenharmony_ciThe sname:VkQueryPoolCreateInfo structure is defined as: 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkQueryPoolCreateInfo.adoc[] 101e5c31af7Sopenharmony_ci 102e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 103e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 104e5c31af7Sopenharmony_ci structure. 105e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 106e5c31af7Sopenharmony_ci * pname:queryType is a elink:VkQueryType value specifying the type of 107e5c31af7Sopenharmony_ci queries managed by the pool. 108e5c31af7Sopenharmony_ci * pname:queryCount is the number of queries managed by the pool. 109e5c31af7Sopenharmony_ci * pname:pipelineStatistics is a bitmask of 110e5c31af7Sopenharmony_ci elink:VkQueryPipelineStatisticFlagBits specifying which counters will be 111e5c31af7Sopenharmony_ci returned in queries on the new pool, as described below in 112e5c31af7Sopenharmony_ci <<queries-pipestats>>. 113e5c31af7Sopenharmony_ci 114e5c31af7Sopenharmony_cipname:pipelineStatistics is ignored if pname:queryType is not 115e5c31af7Sopenharmony_ciename:VK_QUERY_TYPE_PIPELINE_STATISTICS. 116e5c31af7Sopenharmony_ci 117e5c31af7Sopenharmony_ci.Valid Usage 118e5c31af7Sopenharmony_ci**** 119e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-00791]] 120e5c31af7Sopenharmony_ci If the <<features-pipelineStatisticsQuery, 121e5c31af7Sopenharmony_ci pname:pipelineStatisticsQuery>> feature is not enabled, pname:queryType 122e5c31af7Sopenharmony_ci must: not be ename:VK_QUERY_TYPE_PIPELINE_STATISTICS 123e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 124e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-meshShaderQueries-07068]] 125e5c31af7Sopenharmony_ci If the <<features-meshShaderQueries, pname:meshShaderQueries>> feature 126e5c31af7Sopenharmony_ci is not enabled, pname:queryType must: not be 127e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT 128e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-meshShaderQueries-07069]] 129e5c31af7Sopenharmony_ci If the <<features-meshShaderQueries, pname:meshShaderQueries>> feature 130e5c31af7Sopenharmony_ci is not enabled, and pname:queryType is 131e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PIPELINE_STATISTICS, pname:pipelineStatistics must: 132e5c31af7Sopenharmony_ci not contain 133e5c31af7Sopenharmony_ci ename:VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT or 134e5c31af7Sopenharmony_ci ename:VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT 135e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 136e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-00792]] 137e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_PIPELINE_STATISTICS, 138e5c31af7Sopenharmony_ci pname:pipelineStatistics must: be a valid combination of 139e5c31af7Sopenharmony_ci elink:VkQueryPipelineStatisticFlagBits values 140e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 141e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-03222]] 142e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, the 143e5c31af7Sopenharmony_ci pname:pNext chain must: include a 144e5c31af7Sopenharmony_ci slink:VkQueryPoolPerformanceCreateInfoKHR structure 145e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 146e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryCount-02763]] 147e5c31af7Sopenharmony_ci pname:queryCount must: be greater than 0 148e5c31af7Sopenharmony_ciifdef::VKSC_VERSION_1_0[] 149e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-05046]] 150e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_OCCLUSION then 151e5c31af7Sopenharmony_ci pname:queryCount must: be less than or equal to the maximum of all 152e5c31af7Sopenharmony_ci slink:VkDeviceObjectReservationCreateInfo::pname:maxOcclusionQueriesPerPool 153e5c31af7Sopenharmony_ci values specified when pname:device was created 154e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-05047]] 155e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_PIPELINE_STATISTICS then 156e5c31af7Sopenharmony_ci pname:queryCount must: be less than or equal to the maximum of all 157e5c31af7Sopenharmony_ci slink:VkDeviceObjectReservationCreateInfo::pname:maxPipelineStatisticsQueriesPerPool 158e5c31af7Sopenharmony_ci values specified when pname:device was created 159e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-05048]] 160e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_TIMESTAMP then 161e5c31af7Sopenharmony_ci pname:queryCount must: be less than or equal to the maximum of all 162e5c31af7Sopenharmony_ci slink:VkDeviceObjectReservationCreateInfo::pname:maxTimestampQueriesPerPool 163e5c31af7Sopenharmony_ci values specified when pname:device was created 164e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 165e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-05049]] 166e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR then 167e5c31af7Sopenharmony_ci pname:queryCount must: be less than or equal to the maximum of all 168e5c31af7Sopenharmony_ci slink:VkPerformanceQueryReservationInfoKHR::pname:maxPerformanceQueriesPerPool 169e5c31af7Sopenharmony_ci values specified when pname:device was created 170e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 171e5c31af7Sopenharmony_ciendif::VKSC_VERSION_1_0[] 172e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 173e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-07133]] 174e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR, 175e5c31af7Sopenharmony_ci then the pname:pNext chain must: include a slink:VkVideoProfileInfoKHR 176e5c31af7Sopenharmony_ci structure with pname:videoCodecOperation specifying an encode operation 177e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-07906]] 178e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR, 179e5c31af7Sopenharmony_ci then the pname:pNext chain must: include a 180e5c31af7Sopenharmony_ci slink:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR structure 181e5c31af7Sopenharmony_ci * [[VUID-VkQueryPoolCreateInfo-queryType-07907]] 182e5c31af7Sopenharmony_ci If pname:queryType is ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR, and 183e5c31af7Sopenharmony_ci the pname:pNext chain includes a slink:VkVideoProfileInfoKHR structure 184e5c31af7Sopenharmony_ci and a slink:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR structure, then 185e5c31af7Sopenharmony_ci slink:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR::pname:encodeFeedbackFlags 186e5c31af7Sopenharmony_ci must: not contain any bits that are not set in 187e5c31af7Sopenharmony_ci slink:VkVideoEncodeCapabilitiesKHR::pname:supportedEncodeFeedbackFlags, 188e5c31af7Sopenharmony_ci as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the 189e5c31af7Sopenharmony_ci <<video-profiles,video profile>> described by 190e5c31af7Sopenharmony_ci slink:VkVideoProfileInfoKHR and its pname:pNext chain 191e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 192e5c31af7Sopenharmony_ci**** 193e5c31af7Sopenharmony_ci 194e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkQueryPoolCreateInfo.adoc[] 195e5c31af7Sopenharmony_ci-- 196e5c31af7Sopenharmony_ci 197e5c31af7Sopenharmony_ci[open,refpage='VkQueryPoolCreateFlags',desc='Reserved for future use',type='flags'] 198e5c31af7Sopenharmony_ci-- 199e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkQueryPoolCreateFlags.adoc[] 200e5c31af7Sopenharmony_ci 201e5c31af7Sopenharmony_citname:VkQueryPoolCreateFlags is a bitmask type for setting a mask, but is 202e5c31af7Sopenharmony_cicurrently reserved for future use. 203e5c31af7Sopenharmony_ci-- 204e5c31af7Sopenharmony_ci 205e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 206e5c31af7Sopenharmony_ciinclude::{chapters}/VK_KHR_performance_query/querycreateinfo.adoc[] 207e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ciifdef::VKSC_VERSION_1_0[] 210e5c31af7Sopenharmony_ciifdef::hidden[] 211e5c31af7Sopenharmony_ci// tag::scremoved[] 212e5c31af7Sopenharmony_ci * fname:vkDestroyQueryPool <<SCID-4>> 213e5c31af7Sopenharmony_ci// end::scremoved[] 214e5c31af7Sopenharmony_ciendif::hidden[] 215e5c31af7Sopenharmony_ci 216e5c31af7Sopenharmony_ciQuery pools cannot: be destroyed <<SCID-4>>. 217e5c31af7Sopenharmony_ciIf 218e5c31af7Sopenharmony_cislink:VkPhysicalDeviceVulkanSC10Properties::<<limits-deviceDestroyFreesMemory,pname:deviceDestroyFreesMemory>> 219e5c31af7Sopenharmony_ciis ename:VK_TRUE, the memory is returned to the system when the device is 220e5c31af7Sopenharmony_cidestroyed. 221e5c31af7Sopenharmony_ci 222e5c31af7Sopenharmony_ciendif::VKSC_VERSION_1_0[] 223e5c31af7Sopenharmony_ciifndef::VKSC_VERSION_1_0[] 224e5c31af7Sopenharmony_ci 225e5c31af7Sopenharmony_ci[open,refpage='vkDestroyQueryPool',desc='Destroy a query pool object',type='protos'] 226e5c31af7Sopenharmony_ci-- 227e5c31af7Sopenharmony_ciTo destroy a query pool, call: 228e5c31af7Sopenharmony_ci 229e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroyQueryPool.adoc[] 230e5c31af7Sopenharmony_ci 231e5c31af7Sopenharmony_ci * pname:device is the logical device that destroys the query pool. 232e5c31af7Sopenharmony_ci * pname:queryPool is the query pool to destroy. 233e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 234e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 235e5c31af7Sopenharmony_ci 236e5c31af7Sopenharmony_ci.Valid Usage 237e5c31af7Sopenharmony_ci**** 238e5c31af7Sopenharmony_ci * [[VUID-vkDestroyQueryPool-queryPool-00793]] 239e5c31af7Sopenharmony_ci All submitted commands that refer to pname:queryPool must: have 240e5c31af7Sopenharmony_ci completed execution 241e5c31af7Sopenharmony_ci * [[VUID-vkDestroyQueryPool-queryPool-00794]] 242e5c31af7Sopenharmony_ci If sname:VkAllocationCallbacks were provided when pname:queryPool was 243e5c31af7Sopenharmony_ci created, a compatible set of callbacks must: be provided here 244e5c31af7Sopenharmony_ci * [[VUID-vkDestroyQueryPool-queryPool-00795]] 245e5c31af7Sopenharmony_ci If no sname:VkAllocationCallbacks were provided when pname:queryPool was 246e5c31af7Sopenharmony_ci created, pname:pAllocator must: be `NULL` 247e5c31af7Sopenharmony_ci**** 248e5c31af7Sopenharmony_ci 249e5c31af7Sopenharmony_ci[NOTE] 250e5c31af7Sopenharmony_ci.Note 251e5c31af7Sopenharmony_ci==== 252e5c31af7Sopenharmony_ciApplications can: verify that pname:queryPool can: be destroyed by checking 253e5c31af7Sopenharmony_cithat fname:vkGetQueryPoolResults() without the 254e5c31af7Sopenharmony_ciename:VK_QUERY_RESULT_PARTIAL_BIT flag returns ename:VK_SUCCESS for all 255e5c31af7Sopenharmony_ciqueries that are used in command buffers submitted for execution. 256e5c31af7Sopenharmony_ci==== 257e5c31af7Sopenharmony_ci 258e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroyQueryPool.adoc[] 259e5c31af7Sopenharmony_ci-- 260e5c31af7Sopenharmony_ci 261e5c31af7Sopenharmony_ciendif::VKSC_VERSION_1_0[] 262e5c31af7Sopenharmony_ci 263e5c31af7Sopenharmony_ci[open,refpage='VkQueryType',desc='Specify the type of queries managed by a query pool',type='enums'] 264e5c31af7Sopenharmony_ci-- 265e5c31af7Sopenharmony_ciPossible values of slink:VkQueryPoolCreateInfo::pname:queryType, specifying 266e5c31af7Sopenharmony_cithe type of queries managed by the pool, are: 267e5c31af7Sopenharmony_ci 268e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkQueryType.adoc[] 269e5c31af7Sopenharmony_ci 270e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_OCCLUSION specifies an <<queries-occlusion, 271e5c31af7Sopenharmony_ci occlusion query>>. 272e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_PIPELINE_STATISTICS specifies a <<queries-pipestats, 273e5c31af7Sopenharmony_ci pipeline statistics query>>. 274e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_TIMESTAMP specifies a <<queries-timestamps, 275e5c31af7Sopenharmony_ci timestamp query>>. 276e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 277e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR specifies a 278e5c31af7Sopenharmony_ci <<queries-performance, performance query>>. 279e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 280e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 281e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT specifies a 282e5c31af7Sopenharmony_ci <<queries-transform-feedback, transform feedback query>>. 283e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 284e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 285e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT specifies a 286e5c31af7Sopenharmony_ci <<queries-primitives-generated, primitives generated query>>. 287e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 288e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 289e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR specifies 290e5c31af7Sopenharmony_ci a <<acceleration-structure-copying, acceleration structure size query>> 291e5c31af7Sopenharmony_ci for use with flink:vkCmdWriteAccelerationStructuresPropertiesKHR or 292e5c31af7Sopenharmony_ci flink:vkWriteAccelerationStructuresPropertiesKHR. 293e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR 294e5c31af7Sopenharmony_ci specifies a <<acceleration-structure-copying, serialization acceleration 295e5c31af7Sopenharmony_ci structure size query>>. 296e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 297e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_maintenance1[] 298e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR specifies an 299e5c31af7Sopenharmony_ci <<acceleration-structure-copying, acceleration structure size query>> 300e5c31af7Sopenharmony_ci for use with flink:vkCmdWriteAccelerationStructuresPropertiesKHR or 301e5c31af7Sopenharmony_ci flink:vkWriteAccelerationStructuresPropertiesKHR. 302e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR 303e5c31af7Sopenharmony_ci specifies a <<serialized-as-header, serialization acceleration structure 304e5c31af7Sopenharmony_ci pointer count query>>. 305e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_maintenance1[] 306e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 307e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV specifies 308e5c31af7Sopenharmony_ci an <<acceleration-structure-copying, acceleration structure size query>> 309e5c31af7Sopenharmony_ci for use with flink:vkCmdWriteAccelerationStructuresPropertiesNV. 310e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 311e5c31af7Sopenharmony_ciifdef::VK_INTEL_performance_query[] 312e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL specifies a 313e5c31af7Sopenharmony_ci <<queries-performance-intel, Intel performance query>>. 314e5c31af7Sopenharmony_ciendif::VK_INTEL_performance_query[] 315e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 316e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR specifies a 317e5c31af7Sopenharmony_ci <<queries-result-status-only, result status query>>. 318e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 319e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 320e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR specifies a 321e5c31af7Sopenharmony_ci <<queries-video-encode-feedback, video encode feedback query>>. 322e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 323e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 324e5c31af7Sopenharmony_ci * ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT specifies a 325e5c31af7Sopenharmony_ci <<queries-mesh-shader, generated mesh primitives query>>. 326e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 327e5c31af7Sopenharmony_ci-- 328e5c31af7Sopenharmony_ci 329e5c31af7Sopenharmony_ci 330e5c31af7Sopenharmony_ci[[queries-operation]] 331e5c31af7Sopenharmony_ci== Query Operation 332e5c31af7Sopenharmony_ci 333e5c31af7Sopenharmony_ciThe operation of queries is controlled by the commands 334e5c31af7Sopenharmony_ciflink:vkCmdBeginQuery, flink:vkCmdEndQuery, 335e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 336e5c31af7Sopenharmony_ciflink:vkCmdBeginQueryIndexedEXT, flink:vkCmdEndQueryIndexedEXT, 337e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 338e5c31af7Sopenharmony_ciflink:vkCmdResetQueryPool, flink:vkCmdCopyQueryPoolResults, 339e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 340e5c31af7Sopenharmony_ciflink:vkCmdWriteTimestamp2, 341e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_synchronization2[] 342e5c31af7Sopenharmony_ciand flink:vkCmdWriteTimestamp. 343e5c31af7Sopenharmony_ci 344e5c31af7Sopenharmony_ciIn order for a sname:VkCommandBuffer to record query management commands, 345e5c31af7Sopenharmony_cithe queue family for which its sname:VkCommandPool was created must: support 346e5c31af7Sopenharmony_cithe appropriate type of operations (graphics, compute) suitable for the 347e5c31af7Sopenharmony_ciquery type of a given query pool. 348e5c31af7Sopenharmony_ci 349e5c31af7Sopenharmony_ciEach query in a query pool has a status that is either _unavailable_ or 350e5c31af7Sopenharmony_ci_available_, and also has state to store the numerical results of a query 351e5c31af7Sopenharmony_cioperation of the type requested when the query pool was created. 352e5c31af7Sopenharmony_ciResetting a query via flink:vkCmdResetQueryPool 353e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_host_query_reset[] 354e5c31af7Sopenharmony_cior flink:vkResetQueryPool 355e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_host_query_reset[] 356e5c31af7Sopenharmony_cisets the status to unavailable and makes the numerical results undefined:. 357e5c31af7Sopenharmony_ciA query is made available by the operation of flink:vkCmdEndQuery, 358e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 359e5c31af7Sopenharmony_ciflink:vkCmdEndQueryIndexedEXT, 360e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 361e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 362e5c31af7Sopenharmony_ciflink:vkCmdWriteTimestamp2, 363e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_synchronization2[] 364e5c31af7Sopenharmony_cior flink:vkCmdWriteTimestamp. 365e5c31af7Sopenharmony_ciBoth the availability status and numerical results can: be retrieved by 366e5c31af7Sopenharmony_cicalling either flink:vkGetQueryPoolResults or 367e5c31af7Sopenharmony_ciflink:vkCmdCopyQueryPoolResults. 368e5c31af7Sopenharmony_ci 369e5c31af7Sopenharmony_ciAfter query pool creation, each query is in an uninitialized state and must: 370e5c31af7Sopenharmony_cibe reset before it is used. 371e5c31af7Sopenharmony_ciQueries must: also be reset between uses. 372e5c31af7Sopenharmony_ci 373e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 374e5c31af7Sopenharmony_ci 375e5c31af7Sopenharmony_ciIf a logical device includes multiple physical devices, then each command 376e5c31af7Sopenharmony_cithat writes a query must: execute on a single physical device, and any call 377e5c31af7Sopenharmony_cito flink:vkCmdBeginQuery must: execute the corresponding flink:vkCmdEndQuery 378e5c31af7Sopenharmony_cicommand on the same physical device. 379e5c31af7Sopenharmony_ci 380e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 381e5c31af7Sopenharmony_ci 382e5c31af7Sopenharmony_ci[open,refpage='vkCmdResetQueryPool',desc='Reset queries in a query pool',type='protos'] 383e5c31af7Sopenharmony_ci-- 384e5c31af7Sopenharmony_ci:refpage: vkCmdResetQueryPool 385e5c31af7Sopenharmony_ci 386e5c31af7Sopenharmony_ciTo reset a range of queries in a query pool on a queue, call: 387e5c31af7Sopenharmony_ci 388e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdResetQueryPool.adoc[] 389e5c31af7Sopenharmony_ci 390e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which this command will 391e5c31af7Sopenharmony_ci be recorded. 392e5c31af7Sopenharmony_ci * pname:queryPool is the handle of the query pool managing the queries 393e5c31af7Sopenharmony_ci being reset. 394e5c31af7Sopenharmony_ci * pname:firstQuery is the initial query index to reset. 395e5c31af7Sopenharmony_ci * pname:queryCount is the number of queries to reset. 396e5c31af7Sopenharmony_ci 397e5c31af7Sopenharmony_ciWhen executed on a queue, this command sets the status of query indices 398e5c31af7Sopenharmony_ci[eq]#[pname:firstQuery, pname:firstQuery {plus} pname:queryCount - 1]# to 399e5c31af7Sopenharmony_ciunavailable. 400e5c31af7Sopenharmony_ci 401e5c31af7Sopenharmony_ciThis command defines an execution dependency between other query commands 402e5c31af7Sopenharmony_cithat reference the same query. 403e5c31af7Sopenharmony_ci 404e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 405e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 406e5c31af7Sopenharmony_ciindicated by pname:firstQuery and pname:queryCount that occur earlier in 407e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 408e5c31af7Sopenharmony_ci 409e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 410e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 411e5c31af7Sopenharmony_ciindicated by pname:firstQuery and pname:queryCount that occur later in 412e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 413e5c31af7Sopenharmony_ci 414e5c31af7Sopenharmony_ciThe operation of this command happens after the first scope and happens 415e5c31af7Sopenharmony_cibefore the second scope. 416e5c31af7Sopenharmony_ci 417e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 418e5c31af7Sopenharmony_ciIf the pname:queryType used to create pname:queryPool was 419e5c31af7Sopenharmony_ciename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, this command sets the status of 420e5c31af7Sopenharmony_ciquery indices [eq]#[pname:firstQuery, pname:firstQuery {plus} 421e5c31af7Sopenharmony_cipname:queryCount - 1]# to unavailable for each pass of pname:queryPool, as 422e5c31af7Sopenharmony_ciindicated by a call to 423e5c31af7Sopenharmony_ciflink:vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR. 424e5c31af7Sopenharmony_ci 425e5c31af7Sopenharmony_ci[NOTE] 426e5c31af7Sopenharmony_ci.Note 427e5c31af7Sopenharmony_ci==== 428e5c31af7Sopenharmony_ciBecause fname:vkCmdResetQueryPool resets all the passes of the indicated 429e5c31af7Sopenharmony_ciqueries, applications must not record a fname:vkCmdResetQueryPool command 430e5c31af7Sopenharmony_cifor a pname:queryPool created with ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR 431e5c31af7Sopenharmony_ciin a command buffer that needs to be submitted multiple times as indicated 432e5c31af7Sopenharmony_ciby a call to flink:vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR. 433e5c31af7Sopenharmony_ciOtherwise applications will never be able to complete the recorded queries. 434e5c31af7Sopenharmony_ci==== 435e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 436e5c31af7Sopenharmony_ci 437e5c31af7Sopenharmony_ci 438e5c31af7Sopenharmony_ci.Valid Usage 439e5c31af7Sopenharmony_ci**** 440e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_pool_count_common.adoc[] 441e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetQueryPool-None-02841]] 442e5c31af7Sopenharmony_ci All queries used by the command must: not be active 443e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 444e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetQueryPool-firstQuery-02862]] 445e5c31af7Sopenharmony_ci If pname:queryPool was created with 446e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, this command must: not be 447e5c31af7Sopenharmony_ci recorded in a command buffer that, either directly or through secondary 448e5c31af7Sopenharmony_ci command buffers, also contains begin commands for a query from the set 449e5c31af7Sopenharmony_ci of queries [eq]#[pname:firstQuery, pname:firstQuery {plus} 450e5c31af7Sopenharmony_ci pname:queryCount - 1]# 451e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 452e5c31af7Sopenharmony_ci**** 453e5c31af7Sopenharmony_ci 454e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdResetQueryPool.adoc[] 455e5c31af7Sopenharmony_ci-- 456e5c31af7Sopenharmony_ci 457e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_host_query_reset[] 458e5c31af7Sopenharmony_ci[open,refpage='vkResetQueryPool',desc='Reset queries in a query pool',type='protos',alias='vkResetQueryPoolEXT'] 459e5c31af7Sopenharmony_ci-- 460e5c31af7Sopenharmony_ci:refpage: vkResetQueryPool 461e5c31af7Sopenharmony_ci 462e5c31af7Sopenharmony_ciTo reset a range of queries in a query pool on the host, call: 463e5c31af7Sopenharmony_ci 464e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 465e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkResetQueryPool.adoc[] 466e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 467e5c31af7Sopenharmony_ci 468e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2+VK_EXT_host_query_reset[or the equivalent command] 469e5c31af7Sopenharmony_ci 470e5c31af7Sopenharmony_ciifdef::VK_EXT_host_query_reset[] 471e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkResetQueryPoolEXT.adoc[] 472e5c31af7Sopenharmony_ciendif::VK_EXT_host_query_reset[] 473e5c31af7Sopenharmony_ci 474e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the query pool. 475e5c31af7Sopenharmony_ci * pname:queryPool is the handle of the query pool managing the queries 476e5c31af7Sopenharmony_ci being reset. 477e5c31af7Sopenharmony_ci * pname:firstQuery is the initial query index to reset. 478e5c31af7Sopenharmony_ci * pname:queryCount is the number of queries to reset. 479e5c31af7Sopenharmony_ci 480e5c31af7Sopenharmony_ciThis command sets the status of query indices [eq]#[pname:firstQuery, 481e5c31af7Sopenharmony_cipname:firstQuery {plus} pname:queryCount - 1]# to unavailable. 482e5c31af7Sopenharmony_ci 483e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 484e5c31af7Sopenharmony_ciIf pname:queryPool is ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR this command 485e5c31af7Sopenharmony_cisets the status of query indices [eq]#[pname:firstQuery, pname:firstQuery 486e5c31af7Sopenharmony_ci{plus} pname:queryCount - 1]# to unavailable for each pass. 487e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 488e5c31af7Sopenharmony_ci 489e5c31af7Sopenharmony_ci.Valid Usage 490e5c31af7Sopenharmony_ci**** 491e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_pool_count_common.adoc[] 492e5c31af7Sopenharmony_ci * [[VUID-vkResetQueryPool-None-02665]] 493e5c31af7Sopenharmony_ci The <<features-hostQueryReset, pname:hostQueryReset>> feature must: be 494e5c31af7Sopenharmony_ci enabled 495e5c31af7Sopenharmony_ci * [[VUID-vkResetQueryPool-firstQuery-02741]] 496e5c31af7Sopenharmony_ci Submitted commands that refer to the range specified by pname:firstQuery 497e5c31af7Sopenharmony_ci and pname:queryCount in pname:queryPool must: have completed execution 498e5c31af7Sopenharmony_ci * [[VUID-vkResetQueryPool-firstQuery-02742]] 499e5c31af7Sopenharmony_ci The range of queries specified by pname:firstQuery and pname:queryCount 500e5c31af7Sopenharmony_ci in pname:queryPool must: not be in use by calls to 501e5c31af7Sopenharmony_ci flink:vkGetQueryPoolResults or fname:vkResetQueryPool in other threads 502e5c31af7Sopenharmony_ci**** 503e5c31af7Sopenharmony_ci 504e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkResetQueryPool.adoc[] 505e5c31af7Sopenharmony_ci-- 506e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_host_query_reset[] 507e5c31af7Sopenharmony_ci 508e5c31af7Sopenharmony_ciOnce queries are reset and ready for use, query commands can: be issued to a 509e5c31af7Sopenharmony_cicommand buffer. 510e5c31af7Sopenharmony_ciOcclusion queries and pipeline statistics queries count events - drawn 511e5c31af7Sopenharmony_cisamples and pipeline stage invocations, respectively - resulting from 512e5c31af7Sopenharmony_cicommands that are recorded between a flink:vkCmdBeginQuery command and a 513e5c31af7Sopenharmony_ciflink:vkCmdEndQuery command within a specified command buffer, effectively 514e5c31af7Sopenharmony_ciscoping a set of drawing and/or dispatching commands. 515e5c31af7Sopenharmony_ciTimestamp queries write timestamps to a query pool. 516e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 517e5c31af7Sopenharmony_ciPerformance queries record performance counters to a query pool. 518e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 519e5c31af7Sopenharmony_ci 520e5c31af7Sopenharmony_ciA query must: begin and end in the same command buffer, although if it is a 521e5c31af7Sopenharmony_ciprimary command buffer, and the <<features-inheritedQueries, 522e5c31af7Sopenharmony_cipname:inheritedQueries>> feature is enabled, it can: execute secondary 523e5c31af7Sopenharmony_cicommand buffers during the query operation. 524e5c31af7Sopenharmony_ciFor a secondary command buffer to be executed while a query is active, it 525e5c31af7Sopenharmony_cimust: set the pname:occlusionQueryEnable, pname:queryFlags, and/or 526e5c31af7Sopenharmony_cipname:pipelineStatistics members of slink:VkCommandBufferInheritanceInfo to 527e5c31af7Sopenharmony_ciconservative values, as described in the <<commandbuffers-recording, Command 528e5c31af7Sopenharmony_ciBuffer Recording>> section. 529e5c31af7Sopenharmony_ciA query must: either begin and end inside the same subpass of a render pass 530e5c31af7Sopenharmony_ciinstance, or must: both begin and end outside of a render pass instance 531e5c31af7Sopenharmony_ci(i.e. contain entire render pass instances). 532e5c31af7Sopenharmony_ci 533e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 534e5c31af7Sopenharmony_ci 535e5c31af7Sopenharmony_ciIf queries are used while executing a render pass instance that has 536e5c31af7Sopenharmony_cimultiview enabled, the query uses [eq]#N# consecutive query indices in the 537e5c31af7Sopenharmony_ciquery pool (starting at pname:query) where [eq]#N# is the number of bits set 538e5c31af7Sopenharmony_ciin the view mask in the subpass the query is used in. 539e5c31af7Sopenharmony_ciHow the numerical results of the query are distributed among the queries is 540e5c31af7Sopenharmony_ciimplementation-dependent. 541e5c31af7Sopenharmony_ciFor example, some implementations may: write each view's results to a 542e5c31af7Sopenharmony_cidistinct query, while other implementations may: write the total result to 543e5c31af7Sopenharmony_cithe first query and write zero to the other queries. 544e5c31af7Sopenharmony_ciHowever, the sum of the results in all the queries must: accurately reflect 545e5c31af7Sopenharmony_cithe total result of the query summed over all views. 546e5c31af7Sopenharmony_ciApplications can: sum the results from all the queries to compute the total 547e5c31af7Sopenharmony_ciresult. 548e5c31af7Sopenharmony_ci 549e5c31af7Sopenharmony_ciQueries used with multiview rendering must: not span subpasses, i.e. they 550e5c31af7Sopenharmony_cimust: begin and end in the same subpass. 551e5c31af7Sopenharmony_ci 552e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 553e5c31af7Sopenharmony_ci 554e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 555e5c31af7Sopenharmony_ciA query must: either begin and end inside the same video coding scope, or 556e5c31af7Sopenharmony_cimust: both begin and end outside of a video coding scope and must: not 557e5c31af7Sopenharmony_cicontain entire video coding scopes. 558e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 559e5c31af7Sopenharmony_ci 560e5c31af7Sopenharmony_ci[open,refpage='vkCmdBeginQuery',desc='Begin a query',type='protos',xrefs='vkCmdEndQuery vkCmdBeginQueryIndexedEXT vkCmdEndQueryIndexedEXT'] 561e5c31af7Sopenharmony_ci-- 562e5c31af7Sopenharmony_ci:refpage: vkCmdBeginQuery 563e5c31af7Sopenharmony_ci 564e5c31af7Sopenharmony_ciTo begin a query, call: 565e5c31af7Sopenharmony_ci 566e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBeginQuery.adoc[] 567e5c31af7Sopenharmony_ci 568e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which this command will 569e5c31af7Sopenharmony_ci be recorded. 570e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that will manage the results of the 571e5c31af7Sopenharmony_ci query. 572e5c31af7Sopenharmony_ci * pname:query is the query index within the query pool that will contain 573e5c31af7Sopenharmony_ci the results. 574e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkQueryControlFlagBits specifying 575e5c31af7Sopenharmony_ci constraints on the types of queries that can: be performed. 576e5c31af7Sopenharmony_ci 577e5c31af7Sopenharmony_ciIf the pname:queryType of the pool is ename:VK_QUERY_TYPE_OCCLUSION and 578e5c31af7Sopenharmony_cipname:flags contains ename:VK_QUERY_CONTROL_PRECISE_BIT, an implementation 579e5c31af7Sopenharmony_cimust: return a result that matches the actual number of samples passed. 580e5c31af7Sopenharmony_ciThis is described in more detail in <<queries-occlusion,Occlusion Queries>>. 581e5c31af7Sopenharmony_ci 582e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 583e5c31af7Sopenharmony_ciCalling fname:vkCmdBeginQuery is equivalent to calling 584e5c31af7Sopenharmony_ciflink:vkCmdBeginQueryIndexedEXT with the pname:index parameter set to zero. 585e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 586e5c31af7Sopenharmony_ci 587e5c31af7Sopenharmony_ci[[queries-operation-active]] 588e5c31af7Sopenharmony_ciAfter beginning a query, that query is considered _active_ within the 589e5c31af7Sopenharmony_cicommand buffer it was called in until that same query is ended. 590e5c31af7Sopenharmony_ciQueries active in a primary command buffer when secondary command buffers 591e5c31af7Sopenharmony_ciare executed are considered active for those secondary command buffers. 592e5c31af7Sopenharmony_ci 593e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 594e5c31af7Sopenharmony_ciFurthermore, if the query is started within a video coding scope, the 595e5c31af7Sopenharmony_cifollowing command buffer states are initialized for the query type: 596e5c31af7Sopenharmony_ci 597e5c31af7Sopenharmony_ci * [[queries-operation-active-query-index]] The _active_query_index_ is set 598e5c31af7Sopenharmony_ci to the value specified by pname:query. 599e5c31af7Sopenharmony_ci * [[queries-operation-last-activatable-query-index]] The _last activatable 600e5c31af7Sopenharmony_ci query index_ is also set to the value specified by pname:query. 601e5c31af7Sopenharmony_ci 602e5c31af7Sopenharmony_ciEach <<video-coding,video coding operation>> stores a result to the query 603e5c31af7Sopenharmony_cicorresponding to the current active query index, followed by incrementing 604e5c31af7Sopenharmony_cithe active query index. 605e5c31af7Sopenharmony_ciIf the active query index gets incremented past the last activatable query 606e5c31af7Sopenharmony_ciindex, issuing any further video coding operations results in undefined: 607e5c31af7Sopenharmony_cibehavior. 608e5c31af7Sopenharmony_ci 609e5c31af7Sopenharmony_ci[NOTE] 610e5c31af7Sopenharmony_ci.Note 611e5c31af7Sopenharmony_ci==== 612e5c31af7Sopenharmony_ciIn practice, this means that currently no more than a single video coding 613e5c31af7Sopenharmony_cioperation must: be issued between a begin and end query pair. 614e5c31af7Sopenharmony_ci==== 615e5c31af7Sopenharmony_ci 616e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 617e5c31af7Sopenharmony_ci 618e5c31af7Sopenharmony_ciThis command defines an execution dependency between other query commands 619e5c31af7Sopenharmony_cithat reference the same query. 620e5c31af7Sopenharmony_ci 621e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 622e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 623e5c31af7Sopenharmony_ciindicated by pname:query that occur earlier in 624e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 625e5c31af7Sopenharmony_ci 626e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 627e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 628e5c31af7Sopenharmony_ciindicated by pname:query that occur later in 629e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 630e5c31af7Sopenharmony_ci 631e5c31af7Sopenharmony_ciThe operation of this command happens after the first scope and happens 632e5c31af7Sopenharmony_cibefore the second scope. 633e5c31af7Sopenharmony_ci 634e5c31af7Sopenharmony_ci.Valid Usage 635e5c31af7Sopenharmony_ci**** 636e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_begin_common.adoc[] 637e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQuery-queryPool-01922]] 638e5c31af7Sopenharmony_ci pname:queryPool must: have been created with a pname:queryType that 639e5c31af7Sopenharmony_ci differs from that of any queries that are 640e5c31af7Sopenharmony_ci <<queries-operation-active,active>> within pname:commandBuffer 641e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 642e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQuery-queryType-07070]] 643e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 644e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT the 645e5c31af7Sopenharmony_ci sname:VkCommandPool that pname:commandBuffer was allocated from must: 646e5c31af7Sopenharmony_ci support graphics operations 647e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 648e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 649e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQuery-queryType-02327]] 650e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 651e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT the 652e5c31af7Sopenharmony_ci sname:VkCommandPool that pname:commandBuffer was allocated from must: 653e5c31af7Sopenharmony_ci support graphics operations 654e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQuery-queryType-02328]] 655e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 656e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT then 657e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:transformFeedbackQueries 658e5c31af7Sopenharmony_ci must: be supported 659e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 660e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 661e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQuery-queryType-06687]] 662e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 663e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT the sname:VkCommandPool 664e5c31af7Sopenharmony_ci that pname:commandBuffer was allocated from must: support graphics 665e5c31af7Sopenharmony_ci operations 666e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQuery-queryType-06688]] 667e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 668e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT then 669e5c31af7Sopenharmony_ci <<features-primitivesGeneratedQuery, pname:primitivesGeneratedQuery>> 670e5c31af7Sopenharmony_ci must: be enabled 671e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 672e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/performance_query_begin_common.adoc[] 673e5c31af7Sopenharmony_ci**** 674e5c31af7Sopenharmony_ci 675e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBeginQuery.adoc[] 676e5c31af7Sopenharmony_ci-- 677e5c31af7Sopenharmony_ci 678e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 679e5c31af7Sopenharmony_ci[open,refpage='vkCmdBeginQueryIndexedEXT',desc='Begin an indexed query',type='protos',xrefs='vkCmdBeginQuery vkCmdEndQuery vkCmdEndQueryIndexedEXT'] 680e5c31af7Sopenharmony_ci-- 681e5c31af7Sopenharmony_ci:refpage: vkCmdBeginQueryIndexedEXT 682e5c31af7Sopenharmony_ci 683e5c31af7Sopenharmony_ciTo begin an indexed query, call: 684e5c31af7Sopenharmony_ci 685e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBeginQueryIndexedEXT.adoc[] 686e5c31af7Sopenharmony_ci 687e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which this command will 688e5c31af7Sopenharmony_ci be recorded. 689e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that will manage the results of the 690e5c31af7Sopenharmony_ci query. 691e5c31af7Sopenharmony_ci * pname:query is the query index within the query pool that will contain 692e5c31af7Sopenharmony_ci the results. 693e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkQueryControlFlagBits specifying 694e5c31af7Sopenharmony_ci constraints on the types of queries that can: be performed. 695e5c31af7Sopenharmony_ci * pname:index is the query type specific index. 696e5c31af7Sopenharmony_ci When the query type is ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT 697e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 698e5c31af7Sopenharmony_ci or ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT, 699e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 700e5c31af7Sopenharmony_ci the index represents the vertex stream. 701e5c31af7Sopenharmony_ci 702e5c31af7Sopenharmony_ciThe fname:vkCmdBeginQueryIndexedEXT command operates the same as the 703e5c31af7Sopenharmony_ciflink:vkCmdBeginQuery command, except that it also accepts a query type 704e5c31af7Sopenharmony_cispecific pname:index parameter. 705e5c31af7Sopenharmony_ci 706e5c31af7Sopenharmony_ciThis command defines an execution dependency between other query commands 707e5c31af7Sopenharmony_cithat reference the same query index. 708e5c31af7Sopenharmony_ci 709e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 710e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 711e5c31af7Sopenharmony_ciindicated by pname:query and pname:index that occur earlier in 712e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 713e5c31af7Sopenharmony_ci 714e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 715e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 716e5c31af7Sopenharmony_ciindicated by pname:query and pname:index that occur later in 717e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 718e5c31af7Sopenharmony_ci 719e5c31af7Sopenharmony_ciThe operation of this command happens after the first scope and happens 720e5c31af7Sopenharmony_cibefore the second scope. 721e5c31af7Sopenharmony_ci 722e5c31af7Sopenharmony_ci.Valid Usage 723e5c31af7Sopenharmony_ci**** 724e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_begin_common.adoc[] 725e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryPool-04753]] 726e5c31af7Sopenharmony_ci If the pname:queryPool was created with the same pname:queryType as that 727e5c31af7Sopenharmony_ci of another <<queries-operation-active,active>> query within 728e5c31af7Sopenharmony_ci pname:commandBuffer, then pname:index must: not match the index used for 729e5c31af7Sopenharmony_ci the active query 730e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-02338]] 731e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 732e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT the 733e5c31af7Sopenharmony_ci sname:VkCommandPool that pname:commandBuffer was allocated from must: 734e5c31af7Sopenharmony_ci support graphics operations 735e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-02339]] 736e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 737e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT the pname:index 738e5c31af7Sopenharmony_ci parameter must: be less than 739e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams 740e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-06692]] 741e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was not 742e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT 743e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 744e5c31af7Sopenharmony_ci and not ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT, 745e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 746e5c31af7Sopenharmony_ci the pname:index must: be zero 747e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 748e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-06689]] 749e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 750e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT the sname:VkCommandPool 751e5c31af7Sopenharmony_ci that pname:commandBuffer was allocated from must: support graphics 752e5c31af7Sopenharmony_ci operations 753e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-06690]] 754e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 755e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT the pname:index parameter 756e5c31af7Sopenharmony_ci must: be less than 757e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams 758e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-06691]] 759e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 760e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT and the 761e5c31af7Sopenharmony_ci <<features-primitivesGeneratedQueryWithNonZeroStreams, 762e5c31af7Sopenharmony_ci pname:primitivesGeneratedQueryWithNonZeroStreams>> feature is not 763e5c31af7Sopenharmony_ci enabled, the pname:index parameter must: be zero 764e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-06693]] 765e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 766e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT then 767e5c31af7Sopenharmony_ci <<features-primitivesGeneratedQuery, pname:primitivesGeneratedQuery>> 768e5c31af7Sopenharmony_ci must: be enabled 769e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 770e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-02341]] 771e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 772e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT then 773e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:transformFeedbackQueries 774e5c31af7Sopenharmony_ci must: be supported 775e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 776e5c31af7Sopenharmony_ci * [[VUID-vkCmdBeginQueryIndexedEXT-queryType-07071]] 777e5c31af7Sopenharmony_ci The pname:queryType used to create pname:queryPool must: not be 778e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT 779e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 780e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/performance_query_begin_common.adoc[] 781e5c31af7Sopenharmony_ci**** 782e5c31af7Sopenharmony_ci 783e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBeginQueryIndexedEXT.adoc[] 784e5c31af7Sopenharmony_ci-- 785e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 786e5c31af7Sopenharmony_ci 787e5c31af7Sopenharmony_ci[open,refpage='VkQueryControlFlagBits',desc='Bitmask specifying constraints on a query',type='enums'] 788e5c31af7Sopenharmony_ci-- 789e5c31af7Sopenharmony_ciBits which can: be set in flink:vkCmdBeginQuery::pname:flags, specifying 790e5c31af7Sopenharmony_ciconstraints on the types of queries that can: be performed, are: 791e5c31af7Sopenharmony_ci 792e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkQueryControlFlagBits.adoc[] 793e5c31af7Sopenharmony_ci 794e5c31af7Sopenharmony_ci * ename:VK_QUERY_CONTROL_PRECISE_BIT specifies the precision of 795e5c31af7Sopenharmony_ci <<queries-occlusion, occlusion queries>>. 796e5c31af7Sopenharmony_ci-- 797e5c31af7Sopenharmony_ci 798e5c31af7Sopenharmony_ci[open,refpage='VkQueryControlFlags',desc='Bitmask of VkQueryControlFlagBits',type='flags'] 799e5c31af7Sopenharmony_ci-- 800e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkQueryControlFlags.adoc[] 801e5c31af7Sopenharmony_ci 802e5c31af7Sopenharmony_citname:VkQueryControlFlags is a bitmask type for setting a mask of zero or 803e5c31af7Sopenharmony_cimore elink:VkQueryControlFlagBits. 804e5c31af7Sopenharmony_ci-- 805e5c31af7Sopenharmony_ci 806e5c31af7Sopenharmony_ci[open,refpage='vkCmdEndQuery',desc='Ends a query',type='protos',xrefs='vkCmdBeginQuery vkCmdBeginQueryIndexedEXT vkCmdEndQueryIndexedEXT'] 807e5c31af7Sopenharmony_ci-- 808e5c31af7Sopenharmony_ci:refpage: vkCmdEndQuery 809e5c31af7Sopenharmony_ci 810e5c31af7Sopenharmony_ciTo end a query after the set of desired drawing or dispatching commands is 811e5c31af7Sopenharmony_ciexecuted, call: 812e5c31af7Sopenharmony_ci 813e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdEndQuery.adoc[] 814e5c31af7Sopenharmony_ci 815e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which this command will 816e5c31af7Sopenharmony_ci be recorded. 817e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that is managing the results of the 818e5c31af7Sopenharmony_ci query. 819e5c31af7Sopenharmony_ci * pname:query is the query index within the query pool where the result is 820e5c31af7Sopenharmony_ci stored. 821e5c31af7Sopenharmony_ci 822e5c31af7Sopenharmony_ciThe command completes the query in pname:queryPool identified by 823e5c31af7Sopenharmony_cipname:query, and marks it as available. 824e5c31af7Sopenharmony_ci 825e5c31af7Sopenharmony_ciThis command defines an execution dependency between other query commands 826e5c31af7Sopenharmony_cithat reference the same query. 827e5c31af7Sopenharmony_ci 828e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 829e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 830e5c31af7Sopenharmony_ciindicated by pname:query that occur earlier in 831e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 832e5c31af7Sopenharmony_ci 833e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 834e5c31af7Sopenharmony_ciincludes only the operation of this command. 835e5c31af7Sopenharmony_ci 836e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 837e5c31af7Sopenharmony_ciCalling fname:vkCmdEndQuery is equivalent to calling 838e5c31af7Sopenharmony_ciflink:vkCmdEndQueryIndexedEXT with the pname:index parameter set to zero. 839e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 840e5c31af7Sopenharmony_ci 841e5c31af7Sopenharmony_ci 842e5c31af7Sopenharmony_ci.Valid Usage 843e5c31af7Sopenharmony_ci**** 844e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQuery-None-01923]] 845e5c31af7Sopenharmony_ci All queries used by the command must: be 846e5c31af7Sopenharmony_ci <<queries-operation-active,active>> 847e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQuery-query-00810]] 848e5c31af7Sopenharmony_ci pname:query must: be less than the number of queries in pname:queryPool 849e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 850e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQuery-commandBuffer-01886]] 851e5c31af7Sopenharmony_ci pname:commandBuffer must: not be a protected command buffer 852e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 853e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 854e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQuery-query-00812]] 855e5c31af7Sopenharmony_ci If fname:vkCmdEndQuery is called within a render pass instance, the sum 856e5c31af7Sopenharmony_ci of pname:query and the number of bits set in the current subpass's view 857e5c31af7Sopenharmony_ci mask must: be less than or equal to the number of queries in 858e5c31af7Sopenharmony_ci pname:queryPool 859e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 860e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 861e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQuery-queryPool-03227]] 862e5c31af7Sopenharmony_ci If pname:queryPool was created with a pname:queryType of 863e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR and one or more of the 864e5c31af7Sopenharmony_ci counters used to create pname:queryPool was 865e5c31af7Sopenharmony_ci ename:VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR, the 866e5c31af7Sopenharmony_ci flink:vkCmdEndQuery must: be the last recorded command in 867e5c31af7Sopenharmony_ci pname:commandBuffer 868e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQuery-queryPool-03228]] 869e5c31af7Sopenharmony_ci If pname:queryPool was created with a pname:queryType of 870e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR and one or more of the 871e5c31af7Sopenharmony_ci counters used to create pname:queryPool was 872e5c31af7Sopenharmony_ci ename:VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR, the 873e5c31af7Sopenharmony_ci flink:vkCmdEndQuery must: not be recorded within a render pass instance 874e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 875e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_end_common.adoc[] 876e5c31af7Sopenharmony_ci**** 877e5c31af7Sopenharmony_ci 878e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdEndQuery.adoc[] 879e5c31af7Sopenharmony_ci-- 880e5c31af7Sopenharmony_ci 881e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 882e5c31af7Sopenharmony_ci[open,refpage='vkCmdEndQueryIndexedEXT',desc='Ends a query',type='protos',xrefs='vkCmdBeginQuery vkCmdEndQuery vkCmdBeginQueryIndexedEXT'] 883e5c31af7Sopenharmony_ci-- 884e5c31af7Sopenharmony_ci:refpage: vkCmdEndQueryIndexedEXT 885e5c31af7Sopenharmony_ci 886e5c31af7Sopenharmony_ciTo end an indexed query after the set of desired drawing or dispatching 887e5c31af7Sopenharmony_cicommands is recorded, call: 888e5c31af7Sopenharmony_ci 889e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdEndQueryIndexedEXT.adoc[] 890e5c31af7Sopenharmony_ci 891e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which this command will 892e5c31af7Sopenharmony_ci be recorded. 893e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that is managing the results of the 894e5c31af7Sopenharmony_ci query. 895e5c31af7Sopenharmony_ci * pname:query is the query index within the query pool where the result is 896e5c31af7Sopenharmony_ci stored. 897e5c31af7Sopenharmony_ci * pname:index is the query type specific index. 898e5c31af7Sopenharmony_ci 899e5c31af7Sopenharmony_ciThe command completes the query in pname:queryPool identified by pname:query 900e5c31af7Sopenharmony_ciand pname:index, and marks it as available. 901e5c31af7Sopenharmony_ci 902e5c31af7Sopenharmony_ciThe fname:vkCmdEndQueryIndexedEXT command operates the same as the 903e5c31af7Sopenharmony_ciflink:vkCmdEndQuery command, except that it also accepts a query type 904e5c31af7Sopenharmony_cispecific pname:index parameter. 905e5c31af7Sopenharmony_ci 906e5c31af7Sopenharmony_ciThis command defines an execution dependency between other query commands 907e5c31af7Sopenharmony_cithat reference the same query index. 908e5c31af7Sopenharmony_ci 909e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 910e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 911e5c31af7Sopenharmony_ciindicated by pname:query that occur earlier in 912e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 913e5c31af7Sopenharmony_ci 914e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 915e5c31af7Sopenharmony_ciincludes only the operation of this command. 916e5c31af7Sopenharmony_ci 917e5c31af7Sopenharmony_ci.Valid Usage 918e5c31af7Sopenharmony_ci**** 919e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-None-02342]] 920e5c31af7Sopenharmony_ci All queries used by the command must: be 921e5c31af7Sopenharmony_ci <<queries-operation-active,active>> 922e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-query-02343]] 923e5c31af7Sopenharmony_ci pname:query must: be less than the number of queries in pname:queryPool 924e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 925e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-commandBuffer-02344]] 926e5c31af7Sopenharmony_ci pname:commandBuffer must: not be a protected command buffer 927e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 928e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 929e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-query-02345]] 930e5c31af7Sopenharmony_ci If fname:vkCmdEndQueryIndexedEXT is called within a render pass 931e5c31af7Sopenharmony_ci instance, the sum of pname:query and the number of bits set in the 932e5c31af7Sopenharmony_ci current subpass's view mask must: be less than or equal to the number of 933e5c31af7Sopenharmony_ci queries in pname:queryPool 934e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 935e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-queryType-06694]] 936e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 937e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT 938e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 939e5c31af7Sopenharmony_ci or ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT, 940e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 941e5c31af7Sopenharmony_ci the pname:index parameter must: be less than 942e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams 943e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-queryType-06695]] 944e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was not 945e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT 946e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 947e5c31af7Sopenharmony_ci and not ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT, 948e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 949e5c31af7Sopenharmony_ci the pname:index must: be zero 950e5c31af7Sopenharmony_ci * [[VUID-vkCmdEndQueryIndexedEXT-queryType-06696]] 951e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 952e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT 953e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 954e5c31af7Sopenharmony_ci or ename:VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT, 955e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 956e5c31af7Sopenharmony_ci pname:index must: equal the pname:index used to begin the query 957e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_end_common.adoc[] 958e5c31af7Sopenharmony_ci**** 959e5c31af7Sopenharmony_ci 960e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdEndQueryIndexedEXT.adoc[] 961e5c31af7Sopenharmony_ci-- 962e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 963e5c31af7Sopenharmony_ci 964e5c31af7Sopenharmony_ci[[queries-operation-memorylayout]] 965e5c31af7Sopenharmony_ciAn application can: retrieve results either by requesting they be written 966e5c31af7Sopenharmony_ciinto application-provided memory, or by requesting they be copied into a 967e5c31af7Sopenharmony_cisname:VkBuffer. 968e5c31af7Sopenharmony_ciIn either case, the layout in memory is defined as follows: 969e5c31af7Sopenharmony_ci 970e5c31af7Sopenharmony_ci * The first query's result is written starting at the first byte requested 971e5c31af7Sopenharmony_ci by the command, and each subsequent query's result begins pname:stride 972e5c31af7Sopenharmony_ci bytes later. 973e5c31af7Sopenharmony_ci * Occlusion queries, pipeline statistics queries, 974e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 975e5c31af7Sopenharmony_ci transform feedback queries, 976e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 977e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 978e5c31af7Sopenharmony_ci primitives generated queries, 979e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 980e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 981e5c31af7Sopenharmony_ci mesh shader queries, 982e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 983e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 984e5c31af7Sopenharmony_ci video encode feedback queries, 985e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 986e5c31af7Sopenharmony_ci and timestamp queries store results in a tightly packed array of 987e5c31af7Sopenharmony_ci unsigned integers, either 32- or 64-bits as requested by the command, 988e5c31af7Sopenharmony_ci storing the numerical results and, if requested, the availability 989e5c31af7Sopenharmony_ci status. 990e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 991e5c31af7Sopenharmony_ci * Performance queries store results in a tightly packed array whose type 992e5c31af7Sopenharmony_ci is determined by the pname:unit member of the corresponding 993e5c31af7Sopenharmony_ci slink:VkPerformanceCounterKHR. 994e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 995e5c31af7Sopenharmony_ci * If ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is used, the final 996e5c31af7Sopenharmony_ci element of each query's result is an integer indicating whether the 997e5c31af7Sopenharmony_ci query's result is available, with any non-zero value indicating that it 998e5c31af7Sopenharmony_ci is available. 999e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 1000e5c31af7Sopenharmony_ci * If ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR is used, the final element 1001e5c31af7Sopenharmony_ci of each query's result is an integer value indicating that status of the 1002e5c31af7Sopenharmony_ci query result. 1003e5c31af7Sopenharmony_ci Positive values indicate success, negative values indicate failure, and 1004e5c31af7Sopenharmony_ci 0 indicates that the result is not yet available. 1005e5c31af7Sopenharmony_ci Specific error codes are encoded in the elink:VkQueryResultStatusKHR 1006e5c31af7Sopenharmony_ci enumeration. 1007e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 1008e5c31af7Sopenharmony_ci * Occlusion queries write one integer value - the number of samples 1009e5c31af7Sopenharmony_ci passed. 1010e5c31af7Sopenharmony_ci Pipeline statistics queries write one integer value for each bit that is 1011e5c31af7Sopenharmony_ci enabled in the pname:pipelineStatistics when the pool is created, and 1012e5c31af7Sopenharmony_ci the statistics values are written in bit order starting from the least 1013e5c31af7Sopenharmony_ci significant bit. 1014e5c31af7Sopenharmony_ci Timestamp queries write one integer value. 1015e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1016e5c31af7Sopenharmony_ci Performance queries write one slink:VkPerformanceCounterResultKHR value 1017e5c31af7Sopenharmony_ci for each slink:VkPerformanceCounterKHR in the query. 1018e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1019e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 1020e5c31af7Sopenharmony_ci Transform feedback queries write two integers; the first integer is the 1021e5c31af7Sopenharmony_ci number of primitives successfully written to the corresponding transform 1022e5c31af7Sopenharmony_ci feedback buffer and the second is the number of primitives output to the 1023e5c31af7Sopenharmony_ci vertex stream, regardless of whether they were successfully captured or 1024e5c31af7Sopenharmony_ci not. 1025e5c31af7Sopenharmony_ci In other words, if the transform feedback buffer was sized too small for 1026e5c31af7Sopenharmony_ci the number of primitives output by the vertex stream, the first integer 1027e5c31af7Sopenharmony_ci represents the number of primitives actually written and the second is 1028e5c31af7Sopenharmony_ci the number that would have been written if all the transform feedback 1029e5c31af7Sopenharmony_ci buffers associated with that vertex stream were large enough. 1030e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 1031e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 1032e5c31af7Sopenharmony_ci Primitives generated queries write the number of primitives output to 1033e5c31af7Sopenharmony_ci the vertex stream, regardless of whether transform feedback is active or 1034e5c31af7Sopenharmony_ci not, or whether they were successfully captured by transform feedback or 1035e5c31af7Sopenharmony_ci not. 1036e5c31af7Sopenharmony_ci This is identical to the second integer of the transform feedback 1037e5c31af7Sopenharmony_ci queries if transform feedback is active. 1038e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 1039e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 1040e5c31af7Sopenharmony_ci Mesh shader queries write a single integer. 1041e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 1042e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 1043e5c31af7Sopenharmony_ci Video encode feedback queries write one or more integer values for each 1044e5c31af7Sopenharmony_ci bit that is enabled in 1045e5c31af7Sopenharmony_ci slink:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR::pname:encodeFeedbackFlags 1046e5c31af7Sopenharmony_ci when the pool is created, and the feedback values are written in bit 1047e5c31af7Sopenharmony_ci order starting from the least significant bit, as described 1048e5c31af7Sopenharmony_ci <<queries-video-encode-feedback,here>>. 1049e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 1050e5c31af7Sopenharmony_ci * If more than one query is retrieved and pname:stride is not at least as 1051e5c31af7Sopenharmony_ci large as the size of the array of values corresponding to a single 1052e5c31af7Sopenharmony_ci query, the values written to memory are undefined:. 1053e5c31af7Sopenharmony_ci 1054e5c31af7Sopenharmony_ci[open,refpage='vkGetQueryPoolResults',desc='Copy results of queries in a query pool to a host memory region',type='protos'] 1055e5c31af7Sopenharmony_ci-- 1056e5c31af7Sopenharmony_ci:refpage: vkGetQueryPoolResults 1057e5c31af7Sopenharmony_ci 1058e5c31af7Sopenharmony_ciTo retrieve status and results for a set of queries, call: 1059e5c31af7Sopenharmony_ci 1060e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetQueryPoolResults.adoc[] 1061e5c31af7Sopenharmony_ci 1062e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the query pool. 1063e5c31af7Sopenharmony_ci * pname:queryPool is the query pool managing the queries containing the 1064e5c31af7Sopenharmony_ci desired results. 1065e5c31af7Sopenharmony_ci * pname:firstQuery is the initial query index. 1066e5c31af7Sopenharmony_ci * pname:queryCount is the number of queries to read. 1067e5c31af7Sopenharmony_ci * pname:dataSize is the size in bytes of the buffer pointed to by 1068e5c31af7Sopenharmony_ci pname:pData. 1069e5c31af7Sopenharmony_ci * pname:pData is a pointer to a user-allocated buffer where the results 1070e5c31af7Sopenharmony_ci will be written 1071e5c31af7Sopenharmony_ci * pname:stride is the stride in bytes between results for individual 1072e5c31af7Sopenharmony_ci queries within pname:pData. 1073e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkQueryResultFlagBits specifying how 1074e5c31af7Sopenharmony_ci and when results are returned. 1075e5c31af7Sopenharmony_ci 1076e5c31af7Sopenharmony_ciAny results written for a query are written according to 1077e5c31af7Sopenharmony_ci<<queries-operation-memorylayout,a layout dependent on the query type>>. 1078e5c31af7Sopenharmony_ci 1079e5c31af7Sopenharmony_ciIf no bits are set in pname:flags, and all requested queries are in the 1080e5c31af7Sopenharmony_ciavailable state, results are written as an array of 32-bit unsigned integer 1081e5c31af7Sopenharmony_civalues. 1082e5c31af7Sopenharmony_ciBehavior when not all queries are available is described 1083e5c31af7Sopenharmony_ci<<queries-wait-bit-not-set, below>>. 1084e5c31af7Sopenharmony_ci 1085e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is set, results for all 1086e5c31af7Sopenharmony_ciqueries in pname:queryPool identified by pname:firstQuery and 1087e5c31af7Sopenharmony_cipname:queryCount are copied to pname:pData, along with an extra availability 1088e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1089e5c31af7Sopenharmony_civalue written directly after the results of each query and interpreted as an 1090e5c31af7Sopenharmony_ciunsigned integer. 1091e5c31af7Sopenharmony_ciA value of zero indicates that the results are not yet available, otherwise 1092e5c31af7Sopenharmony_cithe query is complete and results are available. 1093e5c31af7Sopenharmony_ciThe size of the availability 1094e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1095e5c31af7Sopenharmony_civalues is 64 bits if ename:VK_QUERY_RESULT_64_BIT is set in pname:flags. 1096e5c31af7Sopenharmony_ciOtherwise, it is 32 bits. 1097e5c31af7Sopenharmony_ci 1098e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 1099e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR is set, results for all queries 1100e5c31af7Sopenharmony_ciin pname:queryPool identified by pname:firstQuery and pname:queryCount are 1101e5c31af7Sopenharmony_cicopied to pname:pData, along with an extra status value written directly 1102e5c31af7Sopenharmony_ciafter the results of each query and interpreted as a signed integer. 1103e5c31af7Sopenharmony_ciA value of zero indicates that the results are not yet available. 1104e5c31af7Sopenharmony_ciPositive values indicate that the operations within the query completed 1105e5c31af7Sopenharmony_cisuccessfully, and the query results are valid. 1106e5c31af7Sopenharmony_ciNegative values indicate that the operations within the query completed 1107e5c31af7Sopenharmony_ciunsuccessfully. 1108e5c31af7Sopenharmony_ci 1109e5c31af7Sopenharmony_cielink:VkQueryResultStatusKHR defines specific meaning for values returned 1110e5c31af7Sopenharmony_cihere, though implementations are free to return other values. 1111e5c31af7Sopenharmony_ci 1112e5c31af7Sopenharmony_ciIf the status value written is negative, indicating that the operations 1113e5c31af7Sopenharmony_ciwithin the query completed unsuccessfully, then all other results written by 1114e5c31af7Sopenharmony_cithis command are undefined: unless otherwise specified for any of the 1115e5c31af7Sopenharmony_ciresults of the used query type. 1116e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 1117e5c31af7Sopenharmony_ci 1118e5c31af7Sopenharmony_ci[NOTE] 1119e5c31af7Sopenharmony_ci.Note 1120e5c31af7Sopenharmony_ci==== 1121e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT 1122e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR] 1123e5c31af7Sopenharmony_ciis set, the layout of data in the buffer is a __(result,availability)__ 1124e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or __(result,status)__] 1125e5c31af7Sopenharmony_cipair for each query returned, and pname:stride is the stride between each 1126e5c31af7Sopenharmony_cipair. 1127e5c31af7Sopenharmony_ci==== 1128e5c31af7Sopenharmony_ci 1129e5c31af7Sopenharmony_ciResults for any available query written by this command are final and 1130e5c31af7Sopenharmony_cirepresent the final result of the query. 1131e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_PARTIAL_BIT is set, then for any query that is 1132e5c31af7Sopenharmony_ciunavailable, an intermediate result between zero and the final result value 1133e5c31af7Sopenharmony_ciis written for that query. 1134e5c31af7Sopenharmony_ciOtherwise, any result written by this command is undefined:. 1135e5c31af7Sopenharmony_ci 1136e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_64_BIT is set, results and, if returned, 1137e5c31af7Sopenharmony_ciavailability 1138e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1139e5c31af7Sopenharmony_civalues for all queries are written as an array of 64-bit values. 1140e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1141e5c31af7Sopenharmony_ciIf the pname:queryPool was created with 1142e5c31af7Sopenharmony_ciename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, results for each query are 1143e5c31af7Sopenharmony_ciwritten as an array of the type indicated by 1144e5c31af7Sopenharmony_cislink:VkPerformanceCounterKHR::pname:storage for the counter being queried. 1145e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1146e5c31af7Sopenharmony_ciOtherwise, results and availability 1147e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1148e5c31af7Sopenharmony_civalues are written as an array of 32-bit values. 1149e5c31af7Sopenharmony_ciIf an unsigned integer query's value overflows the result type, the value 1150e5c31af7Sopenharmony_cimay: either wrap or saturate. 1151e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1152e5c31af7Sopenharmony_ciIf a signed integer query's value overflows the result type, the value is 1153e5c31af7Sopenharmony_ciundefined:. 1154e5c31af7Sopenharmony_ciIf a floating point query's value is not representable as the result type, 1155e5c31af7Sopenharmony_cithe value is undefined:. 1156e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1157e5c31af7Sopenharmony_ci 1158e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WAIT_BIT is set, this command defines an execution 1159e5c31af7Sopenharmony_cidependency with any earlier commands that writes one of the identified 1160e5c31af7Sopenharmony_ciqueries. 1161e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 1162e5c31af7Sopenharmony_ciincludes all instances of flink:vkCmdEndQuery, 1163e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 1164e5c31af7Sopenharmony_ciflink:vkCmdEndQueryIndexedEXT, 1165e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 1166e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 1167e5c31af7Sopenharmony_ciflink:vkCmdWriteTimestamp2, 1168e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_synchronization2[] 1169e5c31af7Sopenharmony_ciand flink:vkCmdWriteTimestamp that reference any query in pname:queryPool 1170e5c31af7Sopenharmony_ciindicated by pname:firstQuery and pname:queryCount. 1171e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 1172e5c31af7Sopenharmony_ciincludes the host operations of this command. 1173e5c31af7Sopenharmony_ci 1174e5c31af7Sopenharmony_ci[[queries-wait-bit-not-set]] 1175e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WAIT_BIT is not set, fname:vkGetQueryPoolResults 1176e5c31af7Sopenharmony_cimay: return ename:VK_NOT_READY if there are queries in the unavailable 1177e5c31af7Sopenharmony_cistate. 1178e5c31af7Sopenharmony_ci 1179e5c31af7Sopenharmony_ci[NOTE] 1180e5c31af7Sopenharmony_ci.Note 1181e5c31af7Sopenharmony_ci==== 1182e5c31af7Sopenharmony_ciApplications must: take care to ensure that use of the 1183e5c31af7Sopenharmony_ciename:VK_QUERY_RESULT_WAIT_BIT bit has the desired effect. 1184e5c31af7Sopenharmony_ci 1185e5c31af7Sopenharmony_ciFor example, if a query has been used previously and a command buffer 1186e5c31af7Sopenharmony_cirecords the commands fname:vkCmdResetQueryPool, fname:vkCmdBeginQuery, and 1187e5c31af7Sopenharmony_cifname:vkCmdEndQuery for that query, then the query will remain in the 1188e5c31af7Sopenharmony_ciavailable state until 1189e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_host_query_reset[] 1190e5c31af7Sopenharmony_cifname:vkResetQueryPool is called or 1191e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_host_query_reset[] 1192e5c31af7Sopenharmony_cithe fname:vkCmdResetQueryPool command executes on a queue. 1193e5c31af7Sopenharmony_ciApplications can: use fences or events to ensure that a query has already 1194e5c31af7Sopenharmony_cibeen reset before checking for its results or availability status. 1195e5c31af7Sopenharmony_ciOtherwise, a stale value could be returned from a previous use of the query. 1196e5c31af7Sopenharmony_ci 1197e5c31af7Sopenharmony_ciThe above also applies when ename:VK_QUERY_RESULT_WAIT_BIT is used in 1198e5c31af7Sopenharmony_cicombination with ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT. 1199e5c31af7Sopenharmony_ciIn this case, the returned availability status may: reflect the result of a 1200e5c31af7Sopenharmony_ciprevious use of the query unless 1201e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_host_query_reset[] 1202e5c31af7Sopenharmony_cifname:vkResetQueryPool is called or 1203e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_host_query_reset[] 1204e5c31af7Sopenharmony_cithe fname:vkCmdResetQueryPool command has been executed since the last use 1205e5c31af7Sopenharmony_ciof the query. 1206e5c31af7Sopenharmony_ci 1207e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 1208e5c31af7Sopenharmony_ciA similar situation can arise with the 1209e5c31af7Sopenharmony_ciename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR flag. 1210e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 1211e5c31af7Sopenharmony_ci==== 1212e5c31af7Sopenharmony_ci 1213e5c31af7Sopenharmony_ci[NOTE] 1214e5c31af7Sopenharmony_ci.Note 1215e5c31af7Sopenharmony_ci==== 1216e5c31af7Sopenharmony_ciApplications can: double-buffer query pool usage, with a pool per frame, and 1217e5c31af7Sopenharmony_cireset queries at the end of the frame in which they are read. 1218e5c31af7Sopenharmony_ci==== 1219e5c31af7Sopenharmony_ci 1220e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 1221e5c31af7Sopenharmony_ci 1222e5c31af7Sopenharmony_ci.Valid Usage 1223e5c31af7Sopenharmony_ci**** 1224e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_pool_count_common.adoc[] 1225e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_results_common.adoc[] 1226e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-None-09401]] 1227e5c31af7Sopenharmony_ci All queries used by the command must: not be uninitialized 1228e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-flags-02828]] 1229e5c31af7Sopenharmony_ci If ename:VK_QUERY_RESULT_64_BIT is not set in pname:flags 1230e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1231e5c31af7Sopenharmony_ci and the pname:queryType used to create pname:queryPool was not 1232e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, 1233e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1234e5c31af7Sopenharmony_ci then pname:pData and pname:stride must: be multiples of `4` 1235e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-flags-00815]] 1236e5c31af7Sopenharmony_ci If ename:VK_QUERY_RESULT_64_BIT is set in pname:flags then pname:pData 1237e5c31af7Sopenharmony_ci and pname:stride must: be multiples of `8` 1238e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-stride-08993]] 1239e5c31af7Sopenharmony_ci If ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is set, pname:stride 1240e5c31af7Sopenharmony_ci must: be large enough to contain the unsigned integer representing 1241e5c31af7Sopenharmony_ci availability 1242e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1243e5c31af7Sopenharmony_ci in addition to the query result. 1244e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1245e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-queryType-03229]] 1246e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 1247e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, then pname:pData and 1248e5c31af7Sopenharmony_ci pname:stride must: be multiples of the size of 1249e5c31af7Sopenharmony_ci slink:VkPerformanceCounterResultKHR 1250e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-queryType-04519]] 1251e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 1252e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, then pname:stride must: be 1253e5c31af7Sopenharmony_ci large enough to contain the 1254e5c31af7Sopenharmony_ci slink:VkQueryPoolPerformanceCreateInfoKHR::pname:counterIndexCount used 1255e5c31af7Sopenharmony_ci to create pname:queryPool times the size of 1256e5c31af7Sopenharmony_ci slink:VkPerformanceCounterResultKHR 1257e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1258e5c31af7Sopenharmony_ci * [[VUID-vkGetQueryPoolResults-dataSize-00817]] 1259e5c31af7Sopenharmony_ci pname:dataSize must: be large enough to contain the result of each 1260e5c31af7Sopenharmony_ci query, as described <<queries-operation-memorylayout,here>> 1261e5c31af7Sopenharmony_ci**** 1262e5c31af7Sopenharmony_ci 1263e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetQueryPoolResults.adoc[] 1264e5c31af7Sopenharmony_ci-- 1265e5c31af7Sopenharmony_ci 1266e5c31af7Sopenharmony_ci[open,refpage='VkQueryResultFlagBits',desc='Bitmask specifying how and when query results are returned',type='enums'] 1267e5c31af7Sopenharmony_ci-- 1268e5c31af7Sopenharmony_ciBits which can: be set in flink:vkGetQueryPoolResults::pname:flags and 1269e5c31af7Sopenharmony_ciflink:vkCmdCopyQueryPoolResults::pname:flags, specifying how and when 1270e5c31af7Sopenharmony_ciresults are returned, are: 1271e5c31af7Sopenharmony_ci 1272e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkQueryResultFlagBits.adoc[] 1273e5c31af7Sopenharmony_ci 1274e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_64_BIT specifies the results will be written as an 1275e5c31af7Sopenharmony_ci array of 64-bit unsigned integer values. 1276e5c31af7Sopenharmony_ci If this bit is not set, the results will be written as an array of 1277e5c31af7Sopenharmony_ci 32-bit unsigned integer values. 1278e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_WAIT_BIT specifies that Vulkan will wait for each 1279e5c31af7Sopenharmony_ci query's status to become available before retrieving its results. 1280e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT specifies that the 1281e5c31af7Sopenharmony_ci availability status accompanies the results. 1282e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_PARTIAL_BIT specifies that returning partial 1283e5c31af7Sopenharmony_ci results is acceptable. 1284e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 1285e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR specifies that the last value 1286e5c31af7Sopenharmony_ci returned in the query is a elink:VkQueryResultStatusKHR value. 1287e5c31af7Sopenharmony_ci See <<queries-result-status-only, result status query>> for information 1288e5c31af7Sopenharmony_ci on how an application can determine whether the use of this flag bit is 1289e5c31af7Sopenharmony_ci supported. 1290e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 1291e5c31af7Sopenharmony_ci-- 1292e5c31af7Sopenharmony_ci 1293e5c31af7Sopenharmony_ci[open,refpage='VkQueryResultFlags',desc='Bitmask of VkQueryResultFlagBits',type='flags'] 1294e5c31af7Sopenharmony_ci-- 1295e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkQueryResultFlags.adoc[] 1296e5c31af7Sopenharmony_ci 1297e5c31af7Sopenharmony_citname:VkQueryResultFlags is a bitmask type for setting a mask of zero or 1298e5c31af7Sopenharmony_cimore elink:VkQueryResultFlagBits. 1299e5c31af7Sopenharmony_ci-- 1300e5c31af7Sopenharmony_ci 1301e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 1302e5c31af7Sopenharmony_ci[open,refpage='VkQueryResultStatusKHR',desc='Specific status codes for operations',type='enums'] 1303e5c31af7Sopenharmony_ci-- 1304e5c31af7Sopenharmony_ci[[query-result-status-codes]] 1305e5c31af7Sopenharmony_ciSpecific status codes that can: be returned from a query are: 1306e5c31af7Sopenharmony_ci 1307e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkQueryResultStatusKHR.adoc[] 1308e5c31af7Sopenharmony_ci 1309e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_STATUS_NOT_READY_KHR indicates that the query 1310e5c31af7Sopenharmony_ci result is not yet available. 1311e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_STATUS_ERROR_KHR indicates that operations did not 1312e5c31af7Sopenharmony_ci complete successfully. 1313e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_STATUS_COMPLETE_KHR indicates that operations 1314e5c31af7Sopenharmony_ci completed successfully and the query result is available. 1315e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 1316e5c31af7Sopenharmony_ci * ename:VK_QUERY_RESULT_STATUS_INSUFFICIENT_BITSTREAM_BUFFER_RANGE_KHR 1317e5c31af7Sopenharmony_ci indicates that a video encode operation did not complete successfully 1318e5c31af7Sopenharmony_ci due to the destination video bitstream buffer range not being 1319e5c31af7Sopenharmony_ci sufficiently large to fit the encoded bitstream data. 1320e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 1321e5c31af7Sopenharmony_ci-- 1322e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 1323e5c31af7Sopenharmony_ci 1324e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyQueryPoolResults',desc='Copy the results of queries in a query pool to a buffer object',type='protos'] 1325e5c31af7Sopenharmony_ci-- 1326e5c31af7Sopenharmony_ci:refpage: vkCmdCopyQueryPoolResults 1327e5c31af7Sopenharmony_ci 1328e5c31af7Sopenharmony_ciTo copy query statuses and numerical results directly to buffer memory, 1329e5c31af7Sopenharmony_cicall: 1330e5c31af7Sopenharmony_ci 1331e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyQueryPoolResults.adoc[] 1332e5c31af7Sopenharmony_ci 1333e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which this command will 1334e5c31af7Sopenharmony_ci be recorded. 1335e5c31af7Sopenharmony_ci * pname:queryPool is the query pool managing the queries containing the 1336e5c31af7Sopenharmony_ci desired results. 1337e5c31af7Sopenharmony_ci * pname:firstQuery is the initial query index. 1338e5c31af7Sopenharmony_ci * pname:queryCount is the number of queries. 1339e5c31af7Sopenharmony_ci pname:firstQuery and pname:queryCount together define a range of 1340e5c31af7Sopenharmony_ci queries. 1341e5c31af7Sopenharmony_ci * pname:dstBuffer is a slink:VkBuffer object that will receive the results 1342e5c31af7Sopenharmony_ci of the copy command. 1343e5c31af7Sopenharmony_ci * pname:dstOffset is an offset into pname:dstBuffer. 1344e5c31af7Sopenharmony_ci * pname:stride is the stride in bytes between results for individual 1345e5c31af7Sopenharmony_ci queries within pname:dstBuffer. 1346e5c31af7Sopenharmony_ci The required size of the backing memory for pname:dstBuffer is 1347e5c31af7Sopenharmony_ci determined as described above for flink:vkGetQueryPoolResults. 1348e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkQueryResultFlagBits specifying how 1349e5c31af7Sopenharmony_ci and when results are returned. 1350e5c31af7Sopenharmony_ci 1351e5c31af7Sopenharmony_ciAny results written for a query are written according to 1352e5c31af7Sopenharmony_ci<<queries-operation-memorylayout,a layout dependent on the query type>>. 1353e5c31af7Sopenharmony_ci 1354e5c31af7Sopenharmony_ciResults for any query in pname:queryPool identified by pname:firstQuery and 1355e5c31af7Sopenharmony_cipname:queryCount that is available are copied to pname:dstBuffer. 1356e5c31af7Sopenharmony_ci 1357e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is set, results for all 1358e5c31af7Sopenharmony_ciqueries in pname:queryPool identified by pname:firstQuery and 1359e5c31af7Sopenharmony_cipname:queryCount are copied to pname:dstBuffer, along with an extra 1360e5c31af7Sopenharmony_ciavailability value written directly after the results of each query and 1361e5c31af7Sopenharmony_ciinterpreted as an unsigned integer. 1362e5c31af7Sopenharmony_ciA value of zero indicates that the results are not yet available, otherwise 1363e5c31af7Sopenharmony_cithe query is complete and results are available. 1364e5c31af7Sopenharmony_ci 1365e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 1366e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR is set, results for all queries 1367e5c31af7Sopenharmony_ciin pname:queryPool identified by pname:firstQuery and pname:queryCount are 1368e5c31af7Sopenharmony_cicopied to pname:dstBuffer, along with an extra status value written directly 1369e5c31af7Sopenharmony_ciafter the results of each query and interpreted as a signed integer. 1370e5c31af7Sopenharmony_ciA value of zero indicates that the results are not yet available. 1371e5c31af7Sopenharmony_ciPositive values indicate that the operations within the query completed 1372e5c31af7Sopenharmony_cisuccessfully, and the query results are valid. 1373e5c31af7Sopenharmony_ciNegative values indicate that the operations within the query completed 1374e5c31af7Sopenharmony_ciunsuccessfully. 1375e5c31af7Sopenharmony_ci 1376e5c31af7Sopenharmony_cielink:VkQueryResultStatusKHR defines specific meaning for values returned 1377e5c31af7Sopenharmony_cihere, though implementations are free to return other values. 1378e5c31af7Sopenharmony_ci 1379e5c31af7Sopenharmony_ciIf the status value written is negative, indicating that the operations 1380e5c31af7Sopenharmony_ciwithin the query completed unsuccessfully, then all other results written by 1381e5c31af7Sopenharmony_cithis command are undefined: unless otherwise specified for any of the 1382e5c31af7Sopenharmony_ciresults of the used query type. 1383e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 1384e5c31af7Sopenharmony_ci 1385e5c31af7Sopenharmony_ciResults for any available query written by this command are final and 1386e5c31af7Sopenharmony_cirepresent the final result of the query. 1387e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_PARTIAL_BIT is set, then for any query that is 1388e5c31af7Sopenharmony_ciunavailable, an intermediate result between zero and the final result value 1389e5c31af7Sopenharmony_ciis written for that query. 1390e5c31af7Sopenharmony_ciOtherwise, any result written by this command is undefined:. 1391e5c31af7Sopenharmony_ci 1392e5c31af7Sopenharmony_ciIf ename:VK_QUERY_RESULT_64_BIT is set, results and availability 1393e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1394e5c31af7Sopenharmony_civalues for all queries are written as an array of 64-bit values. 1395e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1396e5c31af7Sopenharmony_ciIf the pname:queryPool was created with 1397e5c31af7Sopenharmony_ciename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, results for each query are 1398e5c31af7Sopenharmony_ciwritten as an array of the type indicated by 1399e5c31af7Sopenharmony_cislink:VkPerformanceCounterKHR::pname:storage for the counter being queried. 1400e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1401e5c31af7Sopenharmony_ciOtherwise, results and availability 1402e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[or status] 1403e5c31af7Sopenharmony_civalues are written as an array of 32-bit values. 1404e5c31af7Sopenharmony_ciIf an unsigned integer query's value overflows the result type, the value 1405e5c31af7Sopenharmony_cimay: either wrap or saturate. 1406e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1407e5c31af7Sopenharmony_ciIf a signed integer query's value overflows the result type, the value is 1408e5c31af7Sopenharmony_ciundefined:. 1409e5c31af7Sopenharmony_ciIf a floating point query's value is not representable as the result type, 1410e5c31af7Sopenharmony_cithe value is undefined:. 1411e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1412e5c31af7Sopenharmony_ci 1413e5c31af7Sopenharmony_ciThis command defines an execution dependency between other query commands 1414e5c31af7Sopenharmony_cithat reference the same query. 1415e5c31af7Sopenharmony_ci 1416e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 1417e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 1418e5c31af7Sopenharmony_ciindicated by pname:query that occur earlier in 1419e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 1420e5c31af7Sopenharmony_ciIf pname:flags does not include ename:VK_QUERY_RESULT_WAIT_BIT, 1421e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 1422e5c31af7Sopenharmony_ciflink:vkCmdEndQueryIndexedEXT, 1423e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 1424e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 1425e5c31af7Sopenharmony_ciflink:vkCmdWriteTimestamp2, 1426e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_synchronization2[] 1427e5c31af7Sopenharmony_ciflink:vkCmdEndQuery, and flink:vkCmdWriteTimestamp are excluded from this 1428e5c31af7Sopenharmony_ciscope. 1429e5c31af7Sopenharmony_ci 1430e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 1431e5c31af7Sopenharmony_ciincludes all commands which reference the queries in pname:queryPool 1432e5c31af7Sopenharmony_ciindicated by pname:query that occur later in 1433e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 1434e5c31af7Sopenharmony_ci 1435e5c31af7Sopenharmony_ciThe operation of this command happens after the first scope and happens 1436e5c31af7Sopenharmony_cibefore the second scope. 1437e5c31af7Sopenharmony_ci 1438e5c31af7Sopenharmony_cifname:vkCmdCopyQueryPoolResults is considered to be a transfer operation, 1439e5c31af7Sopenharmony_ciand its writes to buffer memory must: be synchronized using 1440e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_TRANSFER_BIT and ename:VK_ACCESS_TRANSFER_WRITE_BIT 1441e5c31af7Sopenharmony_cibefore using the results. 1442e5c31af7Sopenharmony_ci 1443e5c31af7Sopenharmony_ci.Valid Usage 1444e5c31af7Sopenharmony_ci**** 1445e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_pool_count_common.adoc[] 1446e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/query_results_common.adoc[] 1447e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-None-09402]] 1448e5c31af7Sopenharmony_ci All queries used by the command must: not be uninitialized when the 1449e5c31af7Sopenharmony_ci command is executed 1450e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-dstOffset-00819]] 1451e5c31af7Sopenharmony_ci pname:dstOffset must: be less than the size of pname:dstBuffer 1452e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-flags-00822]] 1453e5c31af7Sopenharmony_ci If ename:VK_QUERY_RESULT_64_BIT is not set in pname:flags then 1454e5c31af7Sopenharmony_ci pname:dstOffset and pname:stride must: be multiples of `4` 1455e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-flags-00823]] 1456e5c31af7Sopenharmony_ci If ename:VK_QUERY_RESULT_64_BIT is set in pname:flags then 1457e5c31af7Sopenharmony_ci pname:dstOffset and pname:stride must: be multiples of `8` 1458e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-dstBuffer-00824]] 1459e5c31af7Sopenharmony_ci pname:dstBuffer must: have enough storage, from pname:dstOffset, to 1460e5c31af7Sopenharmony_ci contain the result of each query, as described 1461e5c31af7Sopenharmony_ci <<queries-operation-memorylayout,here>> 1462e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-dstBuffer-00825]] 1463e5c31af7Sopenharmony_ci pname:dstBuffer must: have been created with 1464e5c31af7Sopenharmony_ci ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag 1465e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-dstBuffer-00826]] 1466e5c31af7Sopenharmony_ci If pname:dstBuffer is non-sparse then it must: be bound completely and 1467e5c31af7Sopenharmony_ci contiguously to a single sname:VkDeviceMemory object 1468e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 1469e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-queryType-03232]] 1470e5c31af7Sopenharmony_ci If the pname:queryType used to create pname:queryPool was 1471e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR, 1472e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePerformanceQueryPropertiesKHR::pname:allowCommandBufferQueryCopies 1473e5c31af7Sopenharmony_ci must: be ename:VK_TRUE 1474e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 1475e5c31af7Sopenharmony_ciifdef::VK_INTEL_performance_query[] 1476e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-queryType-02734]] 1477e5c31af7Sopenharmony_ci flink:vkCmdCopyQueryPoolResults must: not be called if the 1478e5c31af7Sopenharmony_ci pname:queryType used to create pname:queryPool was 1479e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL 1480e5c31af7Sopenharmony_ciendif::VK_INTEL_performance_query[] 1481e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-None-07429]] 1482e5c31af7Sopenharmony_ci All queries used by the command must: not be active 1483e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyQueryPoolResults-None-08752]] 1484e5c31af7Sopenharmony_ci All queries used by the command must: have been made _available_ by 1485e5c31af7Sopenharmony_ci prior executed commands 1486e5c31af7Sopenharmony_ci**** 1487e5c31af7Sopenharmony_ci 1488e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyQueryPoolResults.adoc[] 1489e5c31af7Sopenharmony_ci-- 1490e5c31af7Sopenharmony_ci 1491e5c31af7Sopenharmony_ci[[queries-operation-undefined]] 1492e5c31af7Sopenharmony_ciRendering operations such as clears, MSAA resolves, attachment load/store 1493e5c31af7Sopenharmony_cioperations, and blits may: count towards the results of queries. 1494e5c31af7Sopenharmony_ciThis behavior is implementation-dependent and may: vary depending on the 1495e5c31af7Sopenharmony_cipath used within an implementation. 1496e5c31af7Sopenharmony_ciFor example, some implementations have several types of clears, some of 1497e5c31af7Sopenharmony_ciwhich may: include vertices and some not. 1498e5c31af7Sopenharmony_ci 1499e5c31af7Sopenharmony_ci 1500e5c31af7Sopenharmony_ci[[queries-occlusion]] 1501e5c31af7Sopenharmony_ci== Occlusion Queries 1502e5c31af7Sopenharmony_ci 1503e5c31af7Sopenharmony_ciOcclusion queries track the number of samples that pass the per-fragment 1504e5c31af7Sopenharmony_citests for a set of drawing commands. 1505e5c31af7Sopenharmony_ciAs such, occlusion queries are only available on queue families supporting 1506e5c31af7Sopenharmony_cigraphics operations. 1507e5c31af7Sopenharmony_ciThe application can: then use these results to inform future rendering 1508e5c31af7Sopenharmony_cidecisions. 1509e5c31af7Sopenharmony_ciAn occlusion query is begun and ended by calling fname:vkCmdBeginQuery and 1510e5c31af7Sopenharmony_cifname:vkCmdEndQuery, respectively. 1511e5c31af7Sopenharmony_ciWhen an occlusion query begins, the count of passing samples always starts 1512e5c31af7Sopenharmony_ciat zero. 1513e5c31af7Sopenharmony_ciFor each drawing command, the count is incremented as described in 1514e5c31af7Sopenharmony_ci<<fragops-samplecount,Sample Counting>>. 1515e5c31af7Sopenharmony_ciIf pname:flags does not contain ename:VK_QUERY_CONTROL_PRECISE_BIT an 1516e5c31af7Sopenharmony_ciimplementation may: generate any non-zero result value for the query if the 1517e5c31af7Sopenharmony_cicount of passing samples is non-zero. 1518e5c31af7Sopenharmony_ci 1519e5c31af7Sopenharmony_ci[NOTE] 1520e5c31af7Sopenharmony_ci.Note 1521e5c31af7Sopenharmony_ci==== 1522e5c31af7Sopenharmony_ciNot setting ename:VK_QUERY_CONTROL_PRECISE_BIT mode may: be more efficient 1523e5c31af7Sopenharmony_cion some implementations, and should: be used where it is sufficient to know 1524e5c31af7Sopenharmony_cia boolean result on whether any samples passed the per-fragment tests. 1525e5c31af7Sopenharmony_ciIn this case, some implementations may: only return zero or one, indifferent 1526e5c31af7Sopenharmony_cito the actual number of samples passing the per-fragment tests. 1527e5c31af7Sopenharmony_ci 1528e5c31af7Sopenharmony_ciSetting ename:VK_QUERY_CONTROL_PRECISE_BIT does not guarantee that different 1529e5c31af7Sopenharmony_ciimplementations return the same number of samples in an occlusion query. 1530e5c31af7Sopenharmony_ciSome implementations may kill fragments in the 1531e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization, pre-rasterization shader 1532e5c31af7Sopenharmony_cistage>>, and these killed fragments do not contribute to the final result of 1533e5c31af7Sopenharmony_cithe query. 1534e5c31af7Sopenharmony_ciIt is possible that some implementations generate a zero result value for 1535e5c31af7Sopenharmony_cithe query, while others generate a non-zero value. 1536e5c31af7Sopenharmony_ci==== 1537e5c31af7Sopenharmony_ci 1538e5c31af7Sopenharmony_ciWhen an occlusion query finishes, the result for that query is marked as 1539e5c31af7Sopenharmony_ciavailable. 1540e5c31af7Sopenharmony_ciThe application can: then either copy the result to a buffer (via 1541e5c31af7Sopenharmony_cifname:vkCmdCopyQueryPoolResults) or request it be put into host memory (via 1542e5c31af7Sopenharmony_cifname:vkGetQueryPoolResults). 1543e5c31af7Sopenharmony_ci 1544e5c31af7Sopenharmony_ci[NOTE] 1545e5c31af7Sopenharmony_ci.Note 1546e5c31af7Sopenharmony_ci==== 1547e5c31af7Sopenharmony_ciIf occluding geometry is not drawn first, samples can: pass the depth test, 1548e5c31af7Sopenharmony_cibut still not be visible in a final image. 1549e5c31af7Sopenharmony_ci==== 1550e5c31af7Sopenharmony_ci 1551e5c31af7Sopenharmony_ci 1552e5c31af7Sopenharmony_ci[[queries-pipestats]] 1553e5c31af7Sopenharmony_ci== Pipeline Statistics Queries 1554e5c31af7Sopenharmony_ci 1555e5c31af7Sopenharmony_ciPipeline statistics queries allow the application to sample a specified set 1556e5c31af7Sopenharmony_ciof sname:VkPipeline counters. 1557e5c31af7Sopenharmony_ciThese counters are accumulated by Vulkan for a set of either drawing or 1558e5c31af7Sopenharmony_cidispatching commands while a pipeline statistics query is active. 1559e5c31af7Sopenharmony_ciAs such, pipeline statistics queries are available on queue families 1560e5c31af7Sopenharmony_cisupporting either graphics or compute operations. 1561e5c31af7Sopenharmony_ciThe availability of pipeline statistics queries is indicated by the 1562e5c31af7Sopenharmony_cipname:pipelineStatisticsQuery member of the sname:VkPhysicalDeviceFeatures 1563e5c31af7Sopenharmony_ciobject (see fname:vkGetPhysicalDeviceFeatures and fname:vkCreateDevice for 1564e5c31af7Sopenharmony_cidetecting and requesting this query type on a sname:VkDevice). 1565e5c31af7Sopenharmony_ci 1566e5c31af7Sopenharmony_ciA pipeline statistics query is begun and ended by calling 1567e5c31af7Sopenharmony_cifname:vkCmdBeginQuery and fname:vkCmdEndQuery, respectively. 1568e5c31af7Sopenharmony_ciWhen a pipeline statistics query begins, all statistics counters are set to 1569e5c31af7Sopenharmony_cizero. 1570e5c31af7Sopenharmony_ciWhile the query is active, the pipeline type determines which set of 1571e5c31af7Sopenharmony_cistatistics are available, but these must: be configured on the query pool 1572e5c31af7Sopenharmony_ciwhen it is created. 1573e5c31af7Sopenharmony_ciIf a statistic counter is issued on a command buffer that does not support 1574e5c31af7Sopenharmony_cithe corresponding operation, the value of that counter is undefined: after 1575e5c31af7Sopenharmony_cithe query has been made available. 1576e5c31af7Sopenharmony_ciAt least one statistic counter relevant to the operations supported on the 1577e5c31af7Sopenharmony_cirecording command buffer must: be enabled. 1578e5c31af7Sopenharmony_ci 1579e5c31af7Sopenharmony_ci[open,refpage='VkQueryPipelineStatisticFlagBits',desc='Bitmask specifying queried pipeline statistics',type='enums'] 1580e5c31af7Sopenharmony_ci-- 1581e5c31af7Sopenharmony_ciBits which can: be set in 1582e5c31af7Sopenharmony_cislink:VkQueryPoolCreateInfo::pname:pipelineStatistics for query pools and in 1583e5c31af7Sopenharmony_cislink:VkCommandBufferInheritanceInfo::pname:pipelineStatistics for secondary 1584e5c31af7Sopenharmony_cicommand buffers, individually enabling pipeline statistics counters, are: 1585e5c31af7Sopenharmony_ci 1586e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkQueryPipelineStatisticFlagBits.adoc[] 1587e5c31af7Sopenharmony_ci 1588e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT specifies 1589e5c31af7Sopenharmony_ci that queries managed by the pool will count the number of vertices 1590e5c31af7Sopenharmony_ci processed by the <<drawing,input assembly>> stage. 1591e5c31af7Sopenharmony_ci Vertices corresponding to incomplete primitives may: contribute to the 1592e5c31af7Sopenharmony_ci count. 1593e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT 1594e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1595e5c31af7Sopenharmony_ci primitives processed by the <<drawing,input assembly>> stage. 1596e5c31af7Sopenharmony_ci If primitive restart is enabled, restarting the primitive topology has 1597e5c31af7Sopenharmony_ci no effect on the count. 1598e5c31af7Sopenharmony_ci Incomplete primitives may: be counted. 1599e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT 1600e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1601e5c31af7Sopenharmony_ci vertex shader invocations. 1602e5c31af7Sopenharmony_ci This counter's value is incremented each time a vertex shader is 1603e5c31af7Sopenharmony_ci <<shaders-vertex-execution,invoked>>. 1604e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT 1605e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1606e5c31af7Sopenharmony_ci geometry shader invocations. 1607e5c31af7Sopenharmony_ci This counter's value is incremented each time a geometry shader is 1608e5c31af7Sopenharmony_ci <<shaders-geometry-execution,invoked>>. 1609e5c31af7Sopenharmony_ci In the case of <<geometry-invocations,instanced geometry shaders>>, the 1610e5c31af7Sopenharmony_ci geometry shader invocations count is incremented for each separate 1611e5c31af7Sopenharmony_ci instanced invocation. 1612e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT 1613e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1614e5c31af7Sopenharmony_ci primitives generated by geometry shader invocations. 1615e5c31af7Sopenharmony_ci The counter's value is incremented each time the geometry shader emits a 1616e5c31af7Sopenharmony_ci primitive. 1617e5c31af7Sopenharmony_ci Restarting primitive topology using the SPIR-V instructions 1618e5c31af7Sopenharmony_ci code:OpEndPrimitive or code:OpEndStreamPrimitive has no effect on the 1619e5c31af7Sopenharmony_ci geometry shader output primitives count. 1620e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT specifies 1621e5c31af7Sopenharmony_ci that queries managed by the pool will count the number of primitives 1622e5c31af7Sopenharmony_ci processed by the <<vertexpostproc-clipping,Primitive Clipping>> stage of 1623e5c31af7Sopenharmony_ci the pipeline. 1624e5c31af7Sopenharmony_ci The counter's value is incremented each time a primitive reaches the 1625e5c31af7Sopenharmony_ci primitive clipping stage. 1626e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT specifies that 1627e5c31af7Sopenharmony_ci queries managed by the pool will count the number of primitives output 1628e5c31af7Sopenharmony_ci by the <<vertexpostproc-clipping,Primitive Clipping>> stage of the 1629e5c31af7Sopenharmony_ci pipeline. 1630e5c31af7Sopenharmony_ci The counter's value is incremented each time a primitive passes the 1631e5c31af7Sopenharmony_ci primitive clipping stage. 1632e5c31af7Sopenharmony_ci The actual number of primitives output by the primitive clipping stage 1633e5c31af7Sopenharmony_ci for a particular input primitive is implementation-dependent but must: 1634e5c31af7Sopenharmony_ci satisfy the following conditions: 1635e5c31af7Sopenharmony_ci ** If at least one vertex of the input primitive lies inside the clipping 1636e5c31af7Sopenharmony_ci volume, the counter is incremented by one or more. 1637e5c31af7Sopenharmony_ci ** Otherwise, the counter is incremented by zero or more. 1638e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT 1639e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1640e5c31af7Sopenharmony_ci fragment shader invocations. 1641e5c31af7Sopenharmony_ci The counter's value is incremented each time the fragment shader is 1642e5c31af7Sopenharmony_ci <<fragops-shader,invoked>>. 1643e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT 1644e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1645e5c31af7Sopenharmony_ci patches processed by the tessellation control shader. 1646e5c31af7Sopenharmony_ci The counter's value is incremented once for each patch for which a 1647e5c31af7Sopenharmony_ci tessellation control shader is 1648e5c31af7Sopenharmony_ci <<shaders-tessellation-control-execution,invoked>>. 1649e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT 1650e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1651e5c31af7Sopenharmony_ci invocations of the tessellation evaluation shader. 1652e5c31af7Sopenharmony_ci The counter's value is incremented each time the tessellation evaluation 1653e5c31af7Sopenharmony_ci shader is <<shaders-tessellation-evaluation-execution,invoked>>. 1654e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT 1655e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of 1656e5c31af7Sopenharmony_ci compute shader invocations. 1657e5c31af7Sopenharmony_ci The counter's value is incremented every time the compute shader is 1658e5c31af7Sopenharmony_ci invoked. 1659e5c31af7Sopenharmony_ci Implementations may: skip the execution of certain compute shader 1660e5c31af7Sopenharmony_ci invocations or execute additional compute shader invocations for 1661e5c31af7Sopenharmony_ci implementation-dependent reasons as long as the results of rendering 1662e5c31af7Sopenharmony_ci otherwise remain unchanged. 1663e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 1664e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT 1665e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of task 1666e5c31af7Sopenharmony_ci shader invocations. 1667e5c31af7Sopenharmony_ci The counter's value is incremented every time the task shader is 1668e5c31af7Sopenharmony_ci invoked. 1669e5c31af7Sopenharmony_ci * ename:VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT 1670e5c31af7Sopenharmony_ci specifies that queries managed by the pool will count the number of mesh 1671e5c31af7Sopenharmony_ci shader invocations. 1672e5c31af7Sopenharmony_ci The counter's value is incremented every time the mesh shader is 1673e5c31af7Sopenharmony_ci invoked. 1674e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 1675e5c31af7Sopenharmony_ci 1676e5c31af7Sopenharmony_ciThese values are intended to measure relative statistics on one 1677e5c31af7Sopenharmony_ciimplementation. 1678e5c31af7Sopenharmony_ciVarious device architectures will count these values differently. 1679e5c31af7Sopenharmony_ciAny or all counters may: be affected by the issues described in 1680e5c31af7Sopenharmony_ci<<queries-operation-undefined,Query Operation>>. 1681e5c31af7Sopenharmony_ci 1682e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader,VK_NV_mesh_shader[] 1683e5c31af7Sopenharmony_ciThis counting difference is especially true if the pipeline contains mesh or 1684e5c31af7Sopenharmony_citask shaders, which may affect several of the counters in unexpected ways. 1685e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader,VK_NV_mesh_shader[] 1686e5c31af7Sopenharmony_ci 1687e5c31af7Sopenharmony_ci[NOTE] 1688e5c31af7Sopenharmony_ci.Note 1689e5c31af7Sopenharmony_ci==== 1690e5c31af7Sopenharmony_ciFor example, tile-based rendering devices may: need to replay the scene 1691e5c31af7Sopenharmony_cimultiple times, affecting some of the counts. 1692e5c31af7Sopenharmony_ci==== 1693e5c31af7Sopenharmony_ci 1694e5c31af7Sopenharmony_ciIf a pipeline has pname:rasterizerDiscardEnable enabled, implementations 1695e5c31af7Sopenharmony_cimay: discard primitives after the final 1696e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 1697e5c31af7Sopenharmony_cistage>>. 1698e5c31af7Sopenharmony_ciAs a result, if pname:rasterizerDiscardEnable is enabled, the clipping input 1699e5c31af7Sopenharmony_ciand output primitives counters may: not be incremented. 1700e5c31af7Sopenharmony_ci 1701e5c31af7Sopenharmony_ciWhen a pipeline statistics query finishes, the result for that query is 1702e5c31af7Sopenharmony_cimarked as available. 1703e5c31af7Sopenharmony_ciThe application can: copy the result to a buffer (via 1704e5c31af7Sopenharmony_cifname:vkCmdCopyQueryPoolResults), or request it be put into host memory (via 1705e5c31af7Sopenharmony_cifname:vkGetQueryPoolResults). 1706e5c31af7Sopenharmony_ci-- 1707e5c31af7Sopenharmony_ci 1708e5c31af7Sopenharmony_ci[open,refpage='VkQueryPipelineStatisticFlags',desc='Bitmask of VkQueryPipelineStatisticFlagBits',type='flags'] 1709e5c31af7Sopenharmony_ci-- 1710e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkQueryPipelineStatisticFlags.adoc[] 1711e5c31af7Sopenharmony_ci 1712e5c31af7Sopenharmony_citname:VkQueryPipelineStatisticFlags is a bitmask type for setting a mask of 1713e5c31af7Sopenharmony_cizero or more elink:VkQueryPipelineStatisticFlagBits. 1714e5c31af7Sopenharmony_ci-- 1715e5c31af7Sopenharmony_ci 1716e5c31af7Sopenharmony_ci 1717e5c31af7Sopenharmony_ci[[queries-timestamps]] 1718e5c31af7Sopenharmony_ci== Timestamp Queries 1719e5c31af7Sopenharmony_ci 1720e5c31af7Sopenharmony_ci_Timestamps_ provide applications with a mechanism for timing the execution 1721e5c31af7Sopenharmony_ciof commands. 1722e5c31af7Sopenharmony_ciA timestamp is an integer value generated by the sname:VkPhysicalDevice. 1723e5c31af7Sopenharmony_ciUnlike other queries, timestamps do not operate over a range, and so do not 1724e5c31af7Sopenharmony_ciuse flink:vkCmdBeginQuery or flink:vkCmdEndQuery. 1725e5c31af7Sopenharmony_ciThe mechanism is built around a set of commands that allow the application 1726e5c31af7Sopenharmony_cito tell the sname:VkPhysicalDevice to write timestamp values to a 1727e5c31af7Sopenharmony_ci<<queries-pools,query pool>> and then either read timestamp values on the 1728e5c31af7Sopenharmony_cihost (using flink:vkGetQueryPoolResults) or copy timestamp values to a 1729e5c31af7Sopenharmony_cisname:VkBuffer (using flink:vkCmdCopyQueryPoolResults). 1730e5c31af7Sopenharmony_ciThe application can: then compute differences between timestamps to 1731e5c31af7Sopenharmony_cidetermine execution time. 1732e5c31af7Sopenharmony_ci 1733e5c31af7Sopenharmony_ciThe number of valid bits in a timestamp value is determined by the 1734e5c31af7Sopenharmony_cisname:VkQueueFamilyProperties::pname:timestampValidBits property of the 1735e5c31af7Sopenharmony_ciqueue on which the timestamp is written. 1736e5c31af7Sopenharmony_ciTimestamps are supported on any queue which reports a non-zero value for 1737e5c31af7Sopenharmony_cipname:timestampValidBits via flink:vkGetPhysicalDeviceQueueFamilyProperties. 1738e5c31af7Sopenharmony_ciIf the <<limits-timestampComputeAndGraphics, 1739e5c31af7Sopenharmony_cipname:timestampComputeAndGraphics>> limit is ename:VK_TRUE, timestamps are 1740e5c31af7Sopenharmony_cisupported by every queue family that supports either graphics or compute 1741e5c31af7Sopenharmony_cioperations (see slink:VkQueueFamilyProperties). 1742e5c31af7Sopenharmony_ci 1743e5c31af7Sopenharmony_ciThe number of nanoseconds it takes for a timestamp value to be incremented 1744e5c31af7Sopenharmony_ciby 1 can: be obtained from 1745e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:timestampPeriod after a call to 1746e5c31af7Sopenharmony_cifname:vkGetPhysicalDeviceProperties. 1747e5c31af7Sopenharmony_ci 1748e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 1749e5c31af7Sopenharmony_ci[open,refpage='vkCmdWriteTimestamp2',desc='Write a device timestamp into a query object',type='protos',alias='vkCmdWriteTimestamp2KHR'] 1750e5c31af7Sopenharmony_ci-- 1751e5c31af7Sopenharmony_ci:refpage: vkCmdWriteTimestamp2 1752e5c31af7Sopenharmony_ci 1753e5c31af7Sopenharmony_ciTo request a timestamp and write the value to memory, call: 1754e5c31af7Sopenharmony_ci 1755e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 1756e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWriteTimestamp2.adoc[] 1757e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 1758e5c31af7Sopenharmony_ci 1759e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3+VK_KHR_synchronization2[or the equivalent command] 1760e5c31af7Sopenharmony_ci 1761e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1762e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWriteTimestamp2KHR.adoc[] 1763e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1764e5c31af7Sopenharmony_ci 1765e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1766e5c31af7Sopenharmony_ci recorded. 1767e5c31af7Sopenharmony_ci * pname:stage specifies a stage of the pipeline. 1768e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that will manage the timestamp. 1769e5c31af7Sopenharmony_ci * pname:query is the query within the query pool that will contain the 1770e5c31af7Sopenharmony_ci timestamp. 1771e5c31af7Sopenharmony_ci 1772e5c31af7Sopenharmony_ciWhen fname:vkCmdWriteTimestamp2 is submitted to a queue, it defines an 1773e5c31af7Sopenharmony_ciexecution dependency on commands that were submitted before it, and writes a 1774e5c31af7Sopenharmony_citimestamp to a query pool. 1775e5c31af7Sopenharmony_ci 1776e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 1777e5c31af7Sopenharmony_ciincludes all commands that occur earlier in 1778e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 1779e5c31af7Sopenharmony_ciThe synchronization scope is limited to operations on the pipeline stage 1780e5c31af7Sopenharmony_cispecified by pname:stage. 1781e5c31af7Sopenharmony_ci 1782e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 1783e5c31af7Sopenharmony_ciincludes only the timestamp write operation. 1784e5c31af7Sopenharmony_ci 1785e5c31af7Sopenharmony_ci[NOTE] 1786e5c31af7Sopenharmony_ci.Note 1787e5c31af7Sopenharmony_ci==== 1788e5c31af7Sopenharmony_ciImplementations may write the timestamp at any stage that is 1789e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-order, logically later>> than pname:stage. 1790e5c31af7Sopenharmony_ci==== 1791e5c31af7Sopenharmony_ci 1792e5c31af7Sopenharmony_ciAny timestamp write that <<synchronization-dependencies-execution, 1793e5c31af7Sopenharmony_cihappens-after>> another timestamp write in the same submission must: not 1794e5c31af7Sopenharmony_cihave a lower value unless its value overflows the maximum supported integer 1795e5c31af7Sopenharmony_cibit width of the query. 1796e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1797e5c31af7Sopenharmony_ciIf 1798e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps[`apiext:VK_KHR_calibrated_timestamps`] 1799e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps+VK_EXT_calibrated_timestamps[or] 1800e5c31af7Sopenharmony_ciifdef::VK_EXT_calibrated_timestamps[`apiext:VK_EXT_calibrated_timestamps`] 1801e5c31af7Sopenharmony_ciis enabled, this extends to timestamp writes across all submissions on the 1802e5c31af7Sopenharmony_cisame logical device: any timestamp write that 1803e5c31af7Sopenharmony_ci<<synchronization-dependencies-execution, happens-after>> another must: not 1804e5c31af7Sopenharmony_cihave a lower value unless its value overflows the maximum supported integer 1805e5c31af7Sopenharmony_cibit width of the query. 1806e5c31af7Sopenharmony_ciTimestamps written by this command must: be in the 1807e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps[ename:VK_TIME_DOMAIN_DEVICE_KHR] 1808e5c31af7Sopenharmony_ciifndef::VK_KHR_calibrated_timestamps[ename:VK_TIME_DOMAIN_DEVICE_EXT] 1809e5c31af7Sopenharmony_ci<<VkTimeDomainKHR, time domain>>. 1810e5c31af7Sopenharmony_ciendif::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1811e5c31af7Sopenharmony_ciIf an overflow occurs, the timestamp value must: wrap back to zero. 1812e5c31af7Sopenharmony_ci 1813e5c31af7Sopenharmony_ci[NOTE] 1814e5c31af7Sopenharmony_ci.Note 1815e5c31af7Sopenharmony_ci==== 1816e5c31af7Sopenharmony_ciComparisons between timestamps should be done between timestamps where they 1817e5c31af7Sopenharmony_ciare guaranteed to not decrease. 1818e5c31af7Sopenharmony_ciFor example, subtracting an older timestamp from a newer one to determine 1819e5c31af7Sopenharmony_cithe execution time of a sequence of commands is only a reliable measurement 1820e5c31af7Sopenharmony_ciif the two timestamp writes were performed in the same 1821e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1822e5c31af7Sopenharmony_cisubmission, or if the writes were performed on the same logical device and 1823e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps[`apiext:VK_KHR_calibrated_timestamps`] 1824e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps+VK_EXT_calibrated_timestamps[or] 1825e5c31af7Sopenharmony_ciifdef::VK_EXT_calibrated_timestamps[`apiext:VK_EXT_calibrated_timestamps`] 1826e5c31af7Sopenharmony_ciis enabled. 1827e5c31af7Sopenharmony_ciendif::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1828e5c31af7Sopenharmony_ciifndef::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1829e5c31af7Sopenharmony_cisubmission. 1830e5c31af7Sopenharmony_ciendif::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1831e5c31af7Sopenharmony_ci==== 1832e5c31af7Sopenharmony_ci 1833e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1834e5c31af7Sopenharmony_ci 1835e5c31af7Sopenharmony_ciIf fname:vkCmdWriteTimestamp2 is called while executing a render pass 1836e5c31af7Sopenharmony_ciinstance that has multiview enabled, the timestamp uses [eq]#N# consecutive 1837e5c31af7Sopenharmony_ciquery indices in the query pool (starting at pname:query) where [eq]#N# is 1838e5c31af7Sopenharmony_cithe number of bits set in the view mask of the subpass the command is 1839e5c31af7Sopenharmony_ciexecuted in. 1840e5c31af7Sopenharmony_ciThe resulting query values are determined by an implementation-dependent 1841e5c31af7Sopenharmony_cichoice of one of the following behaviors: 1842e5c31af7Sopenharmony_ci 1843e5c31af7Sopenharmony_ci * The first query is a timestamp value and (if more than one bit is set in 1844e5c31af7Sopenharmony_ci the view mask) zero is written to the remaining queries. 1845e5c31af7Sopenharmony_ci If two timestamps are written in the same subpass, the sum of the 1846e5c31af7Sopenharmony_ci execution time of all views between those commands is the difference 1847e5c31af7Sopenharmony_ci between the first query written by each command. 1848e5c31af7Sopenharmony_ci * All [eq]#N# queries are timestamp values. 1849e5c31af7Sopenharmony_ci If two timestamps are written in the same subpass, the sum of the 1850e5c31af7Sopenharmony_ci execution time of all views between those commands is the sum of the 1851e5c31af7Sopenharmony_ci difference between corresponding queries written by each command. 1852e5c31af7Sopenharmony_ci The difference between corresponding queries may: be the execution time 1853e5c31af7Sopenharmony_ci of a single view. 1854e5c31af7Sopenharmony_ci 1855e5c31af7Sopenharmony_ciIn either case, the application can: sum the differences between all [eq]#N# 1856e5c31af7Sopenharmony_ciqueries to determine the total execution time. 1857e5c31af7Sopenharmony_ci 1858e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 1859e5c31af7Sopenharmony_ci 1860e5c31af7Sopenharmony_ci.Valid Usage 1861e5c31af7Sopenharmony_ci**** 1862e5c31af7Sopenharmony_ci:stageMaskName: stage 1863e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.adoc[] 1864e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-synchronization2-03858]] 1865e5c31af7Sopenharmony_ci The <<features-synchronization2, pname:synchronization2>> feature must: 1866e5c31af7Sopenharmony_ci be enabled 1867e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-stage-03859]] 1868e5c31af7Sopenharmony_ci pname:stage must: only include a single pipeline stage 1869e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-stage-03860]] 1870e5c31af7Sopenharmony_ci pname:stage must: only include stages valid for the queue family that 1871e5c31af7Sopenharmony_ci was used to create the command pool that pname:commandBuffer was 1872e5c31af7Sopenharmony_ci allocated from 1873e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-queryPool-03861]] 1874e5c31af7Sopenharmony_ci pname:queryPool must: have been created with a pname:queryType of 1875e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TIMESTAMP 1876e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-timestampValidBits-03863]] 1877e5c31af7Sopenharmony_ci The command pool's queue family must: support a non-zero 1878e5c31af7Sopenharmony_ci pname:timestampValidBits 1879e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-query-04903]] 1880e5c31af7Sopenharmony_ci pname:query must: be less than the number of queries in pname:queryPool 1881e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-None-03864]] 1882e5c31af7Sopenharmony_ci All queries used by the command must: be _unavailable_ 1883e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1884e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp2-query-03865]] 1885e5c31af7Sopenharmony_ci If fname:vkCmdWriteTimestamp2 is called within a render pass instance, 1886e5c31af7Sopenharmony_ci the sum of pname:query and the number of bits set in the current 1887e5c31af7Sopenharmony_ci subpass's view mask must: be less than or equal to the number of queries 1888e5c31af7Sopenharmony_ci in pname:queryPool 1889e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 1890e5c31af7Sopenharmony_ci**** 1891e5c31af7Sopenharmony_ci 1892e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdWriteTimestamp2.adoc[] 1893e5c31af7Sopenharmony_ci-- 1894e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_synchronization2[] 1895e5c31af7Sopenharmony_ci 1896e5c31af7Sopenharmony_ci[open,refpage='vkCmdWriteTimestamp',desc='Write a device timestamp into a query object',type='protos'] 1897e5c31af7Sopenharmony_ci-- 1898e5c31af7Sopenharmony_ci:refpage: vkCmdWriteTimestamp 1899e5c31af7Sopenharmony_ci 1900e5c31af7Sopenharmony_ciTo request a timestamp and write the value to memory, call: 1901e5c31af7Sopenharmony_ci 1902e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWriteTimestamp.adoc[] 1903e5c31af7Sopenharmony_ci 1904e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1905e5c31af7Sopenharmony_ci recorded. 1906e5c31af7Sopenharmony_ci * pname:pipelineStage is a elink:VkPipelineStageFlagBits value, specifying 1907e5c31af7Sopenharmony_ci a stage of the pipeline. 1908e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that will manage the timestamp. 1909e5c31af7Sopenharmony_ci * pname:query is the query within the query pool that will contain the 1910e5c31af7Sopenharmony_ci timestamp. 1911e5c31af7Sopenharmony_ci 1912e5c31af7Sopenharmony_ciWhen fname:vkCmdWriteTimestamp is submitted to a queue, it defines an 1913e5c31af7Sopenharmony_ciexecution dependency on commands that were submitted before it, and writes a 1914e5c31af7Sopenharmony_citimestamp to a query pool. 1915e5c31af7Sopenharmony_ci 1916e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 1917e5c31af7Sopenharmony_ciincludes all commands that occur earlier in 1918e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 1919e5c31af7Sopenharmony_ciThe synchronization scope is limited to operations on the pipeline stage 1920e5c31af7Sopenharmony_cispecified by pname:pipelineStage. 1921e5c31af7Sopenharmony_ci 1922e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 1923e5c31af7Sopenharmony_ciincludes only the timestamp write operation. 1924e5c31af7Sopenharmony_ci 1925e5c31af7Sopenharmony_ci[NOTE] 1926e5c31af7Sopenharmony_ci.Note 1927e5c31af7Sopenharmony_ci==== 1928e5c31af7Sopenharmony_ciImplementations may write the timestamp at any stage that is 1929e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-order, logically later>> than pname:stage. 1930e5c31af7Sopenharmony_ci==== 1931e5c31af7Sopenharmony_ci 1932e5c31af7Sopenharmony_ciAny timestamp write that <<synchronization-dependencies-execution, 1933e5c31af7Sopenharmony_cihappens-after>> another timestamp write in the same submission must: not 1934e5c31af7Sopenharmony_cihave a lower value unless its value overflows the maximum supported integer 1935e5c31af7Sopenharmony_cibit width of the query. 1936e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1937e5c31af7Sopenharmony_ciIf 1938e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps[`apiext:VK_KHR_calibrated_timestamps`] 1939e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps+VK_EXT_calibrated_timestamps[or] 1940e5c31af7Sopenharmony_ciifdef::VK_EXT_calibrated_timestamps[`apiext:VK_EXT_calibrated_timestamps`] 1941e5c31af7Sopenharmony_ciis enabled, this extends to timestamp writes across all submissions on the 1942e5c31af7Sopenharmony_cisame logical device: any timestamp write that 1943e5c31af7Sopenharmony_ci<<synchronization-dependencies-execution, happens-after>> another must: not 1944e5c31af7Sopenharmony_cihave a lower value unless its value overflows the maximum supported integer 1945e5c31af7Sopenharmony_cibit width of the query. 1946e5c31af7Sopenharmony_ciTimestamps written by this command must: be in the 1947e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps[ename:VK_TIME_DOMAIN_DEVICE_KHR] 1948e5c31af7Sopenharmony_ciifndef::VK_KHR_calibrated_timestamps[ename:VK_TIME_DOMAIN_DEVICE_EXT] 1949e5c31af7Sopenharmony_ci<<VkTimeDomainKHR, time domain>>. 1950e5c31af7Sopenharmony_ciendif::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1951e5c31af7Sopenharmony_ciIf an overflow occurs, the timestamp value must: wrap back to zero. 1952e5c31af7Sopenharmony_ci 1953e5c31af7Sopenharmony_ci[NOTE] 1954e5c31af7Sopenharmony_ci.Note 1955e5c31af7Sopenharmony_ci==== 1956e5c31af7Sopenharmony_ciComparisons between timestamps should be done between timestamps where they 1957e5c31af7Sopenharmony_ciare guaranteed to not decrease. 1958e5c31af7Sopenharmony_ciFor example, subtracting an older timestamp from a newer one to determine 1959e5c31af7Sopenharmony_cithe execution time of a sequence of commands is only a reliable measurement 1960e5c31af7Sopenharmony_ciif the two timestamp writes were performed in the same 1961e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1962e5c31af7Sopenharmony_cisubmission, or if the writes were performed on the same logical device and 1963e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps[`apiext:VK_KHR_calibrated_timestamps`] 1964e5c31af7Sopenharmony_ciifdef::VK_KHR_calibrated_timestamps+VK_EXT_calibrated_timestamps[or] 1965e5c31af7Sopenharmony_ciifdef::VK_EXT_calibrated_timestamps[`apiext:VK_EXT_calibrated_timestamps`] 1966e5c31af7Sopenharmony_ciis enabled. 1967e5c31af7Sopenharmony_ciendif::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1968e5c31af7Sopenharmony_ciifndef::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1969e5c31af7Sopenharmony_cisubmission. 1970e5c31af7Sopenharmony_ciendif::VK_KHR_calibrated_timestamps,VK_EXT_calibrated_timestamps[] 1971e5c31af7Sopenharmony_ci==== 1972e5c31af7Sopenharmony_ci 1973e5c31af7Sopenharmony_ci 1974e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1975e5c31af7Sopenharmony_ci 1976e5c31af7Sopenharmony_ciIf fname:vkCmdWriteTimestamp is called while executing a render pass 1977e5c31af7Sopenharmony_ciinstance that has multiview enabled, the timestamp uses [eq]#N# consecutive 1978e5c31af7Sopenharmony_ciquery indices in the query pool (starting at pname:query) where [eq]#N# is 1979e5c31af7Sopenharmony_cithe number of bits set in the view mask of the subpass the command is 1980e5c31af7Sopenharmony_ciexecuted in. 1981e5c31af7Sopenharmony_ciThe resulting query values are determined by an implementation-dependent 1982e5c31af7Sopenharmony_cichoice of one of the following behaviors: 1983e5c31af7Sopenharmony_ci 1984e5c31af7Sopenharmony_ci * The first query is a timestamp value and (if more than one bit is set in 1985e5c31af7Sopenharmony_ci the view mask) zero is written to the remaining queries. 1986e5c31af7Sopenharmony_ci If two timestamps are written in the same subpass, the sum of the 1987e5c31af7Sopenharmony_ci execution time of all views between those commands is the difference 1988e5c31af7Sopenharmony_ci between the first query written by each command. 1989e5c31af7Sopenharmony_ci * All [eq]#N# queries are timestamp values. 1990e5c31af7Sopenharmony_ci If two timestamps are written in the same subpass, the sum of the 1991e5c31af7Sopenharmony_ci execution time of all views between those commands is the sum of the 1992e5c31af7Sopenharmony_ci difference between corresponding queries written by each command. 1993e5c31af7Sopenharmony_ci The difference between corresponding queries may: be the execution time 1994e5c31af7Sopenharmony_ci of a single view. 1995e5c31af7Sopenharmony_ci 1996e5c31af7Sopenharmony_ciIn either case, the application can: sum the differences between all [eq]#N# 1997e5c31af7Sopenharmony_ciqueries to determine the total execution time. 1998e5c31af7Sopenharmony_ci 1999e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 2000e5c31af7Sopenharmony_ci 2001e5c31af7Sopenharmony_ci.Valid Usage 2002e5c31af7Sopenharmony_ci**** 2003e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/pipeline_stage_common.adoc[] 2004e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp-queryPool-01416]] 2005e5c31af7Sopenharmony_ci pname:queryPool must: have been created with a pname:queryType of 2006e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_TIMESTAMP 2007e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp-timestampValidBits-00829]] 2008e5c31af7Sopenharmony_ci The command pool's queue family must: support a non-zero 2009e5c31af7Sopenharmony_ci pname:timestampValidBits 2010e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp-query-04904]] 2011e5c31af7Sopenharmony_ci pname:query must: be less than the number of queries in pname:queryPool 2012e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp-None-00830]] 2013e5c31af7Sopenharmony_ci All queries used by the command must: be _unavailable_ 2014e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 2015e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteTimestamp-query-00831]] 2016e5c31af7Sopenharmony_ci If fname:vkCmdWriteTimestamp is called within a render pass instance, 2017e5c31af7Sopenharmony_ci the sum of pname:query and the number of bits set in the current 2018e5c31af7Sopenharmony_ci subpass's view mask must: be less than or equal to the number of queries 2019e5c31af7Sopenharmony_ci in pname:queryPool 2020e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 2021e5c31af7Sopenharmony_ci**** 2022e5c31af7Sopenharmony_ci 2023e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdWriteTimestamp.adoc[] 2024e5c31af7Sopenharmony_ci-- 2025e5c31af7Sopenharmony_ci 2026e5c31af7Sopenharmony_ciifdef::VK_KHR_performance_query[] 2027e5c31af7Sopenharmony_ciinclude::{chapters}/VK_KHR_performance_query/queriesperformance.adoc[] 2028e5c31af7Sopenharmony_ciendif::VK_KHR_performance_query[] 2029e5c31af7Sopenharmony_ci 2030e5c31af7Sopenharmony_ci 2031e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 2032e5c31af7Sopenharmony_ci[[queries-transform-feedback]] 2033e5c31af7Sopenharmony_ci== Transform Feedback Queries 2034e5c31af7Sopenharmony_ci 2035e5c31af7Sopenharmony_ciTransform feedback queries track the number of primitives attempted to be 2036e5c31af7Sopenharmony_ciwritten and actually written, by the vertex stream being captured, to a 2037e5c31af7Sopenharmony_citransform feedback buffer. 2038e5c31af7Sopenharmony_ciThis query is updated during drawing commands while transform feedback is 2039e5c31af7Sopenharmony_ciactive. 2040e5c31af7Sopenharmony_ciThe number of primitives actually written will be less than the number 2041e5c31af7Sopenharmony_ciattempted to be written if the bound transform feedback buffer size was too 2042e5c31af7Sopenharmony_cismall for the number of primitives actually drawn. 2043e5c31af7Sopenharmony_ciPrimitives are not written beyond the bound range of the transform feedback 2044e5c31af7Sopenharmony_cibuffer. 2045e5c31af7Sopenharmony_ciA transform feedback query is begun and ended by calling 2046e5c31af7Sopenharmony_cifname:vkCmdBeginQuery and fname:vkCmdEndQuery, respectively to query for 2047e5c31af7Sopenharmony_civertex stream zero. 2048e5c31af7Sopenharmony_cifname:vkCmdBeginQueryIndexedEXT and fname:vkCmdEndQueryIndexedEXT can: be 2049e5c31af7Sopenharmony_ciused to begin and end transform feedback queries for any supported vertex 2050e5c31af7Sopenharmony_cistream. 2051e5c31af7Sopenharmony_ciWhen a transform feedback query begins, the count of primitives written and 2052e5c31af7Sopenharmony_ciprimitives needed starts from zero. 2053e5c31af7Sopenharmony_ciFor each drawing command, the count is incremented as vertex attribute 2054e5c31af7Sopenharmony_cioutputs are captured to the transform feedback buffers while transform 2055e5c31af7Sopenharmony_cifeedback is active. 2056e5c31af7Sopenharmony_ci 2057e5c31af7Sopenharmony_ciWhen a transform feedback query finishes, the result for that query is 2058e5c31af7Sopenharmony_cimarked as available. 2059e5c31af7Sopenharmony_ciThe application can: then either copy the result to a buffer (via 2060e5c31af7Sopenharmony_cifname:vkCmdCopyQueryPoolResults) or request it be put into host memory (via 2061e5c31af7Sopenharmony_cifname:vkGetQueryPoolResults). 2062e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 2063e5c31af7Sopenharmony_ci 2064e5c31af7Sopenharmony_ci 2065e5c31af7Sopenharmony_ciifdef::VK_EXT_primitives_generated_query[] 2066e5c31af7Sopenharmony_ci[[queries-primitives-generated]] 2067e5c31af7Sopenharmony_ci== Primitives Generated Queries 2068e5c31af7Sopenharmony_ci 2069e5c31af7Sopenharmony_ciWhen a generated primitive query for a vertex stream is active, the 2070e5c31af7Sopenharmony_ciprimitives-generated count is incremented every time a primitive emitted to 2071e5c31af7Sopenharmony_cithat stream reaches the transform feedback stage, whether or not transform 2072e5c31af7Sopenharmony_cifeedback is active. 2073e5c31af7Sopenharmony_ciA primitives generated query is begun and ended by calling 2074e5c31af7Sopenharmony_cifname:vkCmdBeginQuery and fname:vkCmdEndQuery, respectively to query for 2075e5c31af7Sopenharmony_civertex stream zero. 2076e5c31af7Sopenharmony_cifname:vkCmdBeginQueryIndexedEXT and fname:vkCmdEndQueryIndexedEXT can: be 2077e5c31af7Sopenharmony_ciused to begin and end primitives generated queries for any supported vertex 2078e5c31af7Sopenharmony_cistream. 2079e5c31af7Sopenharmony_ciWhen a primitives generated query begins, the count of primitives generated 2080e5c31af7Sopenharmony_cistarts from zero. 2081e5c31af7Sopenharmony_ci 2082e5c31af7Sopenharmony_ciWhen a primitives generated query finishes, the result for that query is 2083e5c31af7Sopenharmony_cimarked as available. 2084e5c31af7Sopenharmony_ciThe application can: then either copy the result to a buffer (via 2085e5c31af7Sopenharmony_cifname:vkCmdCopyQueryPoolResults) or request it be put into host memory (via 2086e5c31af7Sopenharmony_cifname:vkGetQueryPoolResults). 2087e5c31af7Sopenharmony_ci 2088e5c31af7Sopenharmony_ci[NOTE] 2089e5c31af7Sopenharmony_ci.Note 2090e5c31af7Sopenharmony_ci==== 2091e5c31af7Sopenharmony_ciThe result of this query is typically identical to 2092e5c31af7Sopenharmony_ciename:VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT, but the 2093e5c31af7Sopenharmony_ciprimitives generated query is deterministic, i.e. it must be identical to 2094e5c31af7Sopenharmony_cithe number of primitives processed. 2095e5c31af7Sopenharmony_ciename:VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT may vary for 2096e5c31af7Sopenharmony_ciimplementation-dependent reasons, e.g. the same primitive may be processed 2097e5c31af7Sopenharmony_cimultiple times for purposes of clipping. 2098e5c31af7Sopenharmony_ci==== 2099e5c31af7Sopenharmony_ciendif::VK_EXT_primitives_generated_query[] 2100e5c31af7Sopenharmony_ci 2101e5c31af7Sopenharmony_ci 2102e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 2103e5c31af7Sopenharmony_ci[[queries-mesh-shader]] 2104e5c31af7Sopenharmony_ci== Mesh Shader Queries 2105e5c31af7Sopenharmony_ci 2106e5c31af7Sopenharmony_ciWhen a generated mesh primitives query is active, the 2107e5c31af7Sopenharmony_cimesh-primitives-generated count is incremented every time a primitive 2108e5c31af7Sopenharmony_ciemitted from the mesh shader stage reaches the fragment shader stage. 2109e5c31af7Sopenharmony_ciWhen a generated mesh primitives query begins, the mesh-primitives-generated 2110e5c31af7Sopenharmony_cicount starts from zero. 2111e5c31af7Sopenharmony_ci 2112e5c31af7Sopenharmony_ciMesh and task shader pipeline statistics queries function the same way that 2113e5c31af7Sopenharmony_ciinvocation queries work for other shader stages, counting the number of 2114e5c31af7Sopenharmony_citimes the respective shader stage has been run. 2115e5c31af7Sopenharmony_ciWhen the statistics query begins, the invocation counters start from zero. 2116e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 2117e5c31af7Sopenharmony_ci 2118e5c31af7Sopenharmony_ciifdef::VK_INTEL_performance_query[] 2119e5c31af7Sopenharmony_ciinclude::{chapters}/VK_INTEL_performance_query/queries.adoc[] 2120e5c31af7Sopenharmony_ciendif::VK_INTEL_performance_query[] 2121e5c31af7Sopenharmony_ci 2122e5c31af7Sopenharmony_ci 2123e5c31af7Sopenharmony_ciifdef::VK_KHR_video_queue[] 2124e5c31af7Sopenharmony_ci[[queries-result-status-only]] 2125e5c31af7Sopenharmony_ci== Result Status Queries 2126e5c31af7Sopenharmony_ci 2127e5c31af7Sopenharmony_ciResult status queries serve a single purpose: allowing the application to 2128e5c31af7Sopenharmony_cidetermine whether a set of operations have completed successfully or not, as 2129e5c31af7Sopenharmony_ciindicated by the elink:VkQueryResultStatusKHR value written when retrieving 2130e5c31af7Sopenharmony_cithe result of a query using the ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR 2131e5c31af7Sopenharmony_ciflag. 2132e5c31af7Sopenharmony_ci 2133e5c31af7Sopenharmony_ciUnlike other query types, result status queries do not track or maintain any 2134e5c31af7Sopenharmony_ciother data beyond the completion status, thus no other data is written when 2135e5c31af7Sopenharmony_ciretrieving their results. 2136e5c31af7Sopenharmony_ci 2137e5c31af7Sopenharmony_ciSupport for result status queries is indicated by 2138e5c31af7Sopenharmony_cislink:VkQueueFamilyQueryResultStatusPropertiesKHR::pname:queryResultStatusSupport 2139e5c31af7Sopenharmony_ci, as returned by flink:vkGetPhysicalDeviceQueueFamilyProperties2 for the 2140e5c31af7Sopenharmony_ciqueue family in question. 2141e5c31af7Sopenharmony_ciendif::VK_KHR_video_queue[] 2142e5c31af7Sopenharmony_ci 2143e5c31af7Sopenharmony_ci 2144e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 2145e5c31af7Sopenharmony_ci[[queries-video-encode-feedback]] 2146e5c31af7Sopenharmony_ci== Video Encode Feedback Queries 2147e5c31af7Sopenharmony_ci 2148e5c31af7Sopenharmony_ciVideo encode feedback queries allow the application to capture feedback 2149e5c31af7Sopenharmony_civalues generated by video encode operations. 2150e5c31af7Sopenharmony_ciAs such, video encode feedback queries are available on queue families 2151e5c31af7Sopenharmony_cisupporting video encode operations. 2152e5c31af7Sopenharmony_ciThe availability of individual video encode feedback values is indicated by 2153e5c31af7Sopenharmony_cithe bits of 2154e5c31af7Sopenharmony_cislink:VkVideoEncodeCapabilitiesKHR::pname:supportedEncodeFeedbackFlags, as 2155e5c31af7Sopenharmony_cireturned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the 2156e5c31af7Sopenharmony_ci<<video-profiles,video profile>> the queries are intended to be used with. 2157e5c31af7Sopenharmony_ci 2158e5c31af7Sopenharmony_ciThe set of enabled video encode feedback values must: be configured on the 2159e5c31af7Sopenharmony_ciquery pool when it is created using the pname:encodeFeedbackFlags member of 2160e5c31af7Sopenharmony_cithe slink:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR included in the 2161e5c31af7Sopenharmony_cipname:pNext chain of slink:VkQueryPoolCreateInfo. 2162e5c31af7Sopenharmony_ci 2163e5c31af7Sopenharmony_ci[open,refpage='VkQueryPoolVideoEncodeFeedbackCreateInfoKHR',desc='Structure specifying enabled video encode feedback values',type='structs'] 2164e5c31af7Sopenharmony_ci-- 2165e5c31af7Sopenharmony_ciThe sname:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR structure is defined 2166e5c31af7Sopenharmony_cias: 2167e5c31af7Sopenharmony_ci 2168e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkQueryPoolVideoEncodeFeedbackCreateInfoKHR.adoc[] 2169e5c31af7Sopenharmony_ci 2170e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2171e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2172e5c31af7Sopenharmony_ci structure. 2173e5c31af7Sopenharmony_ci * pname:encodeFeedbackFlags is a bitmask of 2174e5c31af7Sopenharmony_ci elink:VkVideoEncodeFeedbackFlagBitsKHR values specifying the set of 2175e5c31af7Sopenharmony_ci enabled video encode feedback values captured by queries of the new 2176e5c31af7Sopenharmony_ci pool. 2177e5c31af7Sopenharmony_ci 2178e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkQueryPoolVideoEncodeFeedbackCreateInfoKHR.adoc[] 2179e5c31af7Sopenharmony_ci-- 2180e5c31af7Sopenharmony_ci 2181e5c31af7Sopenharmony_ci[open,refpage='VkVideoEncodeFeedbackFlagBitsKHR',desc='Bits specifying queried video encode feedback values',type='enums'] 2182e5c31af7Sopenharmony_ci-- 2183e5c31af7Sopenharmony_ciBits which can: be set in 2184e5c31af7Sopenharmony_cislink:VkQueryPoolVideoEncodeFeedbackCreateInfoKHR::pname:encodeFeedbackFlags 2185e5c31af7Sopenharmony_cifor video encode feedback query pools are: 2186e5c31af7Sopenharmony_ci 2187e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkVideoEncodeFeedbackFlagBitsKHR.adoc[] 2188e5c31af7Sopenharmony_ci 2189e5c31af7Sopenharmony_ci * ename:VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR specifies 2190e5c31af7Sopenharmony_ci that queries managed by the pool will capture the byte offset of the 2191e5c31af7Sopenharmony_ci bitstream data written by the video encode operation to the bitstream 2192e5c31af7Sopenharmony_ci buffer specified in slink:VkVideoEncodeInfoKHR::pname:dstBuffer relative 2193e5c31af7Sopenharmony_ci to the offset specified in 2194e5c31af7Sopenharmony_ci slink:VkVideoEncodeInfoKHR::pname:dstBufferOffset. 2195e5c31af7Sopenharmony_ci For the first video encode operation issued by any 2196e5c31af7Sopenharmony_ci <<video-encode-commands,video encode command>>, this value will always 2197e5c31af7Sopenharmony_ci be zero, meaning that bitstream data is always written to the buffer 2198e5c31af7Sopenharmony_ci specified in slink:VkVideoEncodeInfoKHR::pname:dstBuffer starting from 2199e5c31af7Sopenharmony_ci the offset specified in 2200e5c31af7Sopenharmony_ci slink:VkVideoEncodeInfoKHR::pname:dstBufferOffset. 2201e5c31af7Sopenharmony_ci * ename:VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR specifies 2202e5c31af7Sopenharmony_ci that queries managed by the pool will capture the number of bytes 2203e5c31af7Sopenharmony_ci written by the video encode operation to the bitstream buffer specified 2204e5c31af7Sopenharmony_ci in slink:VkVideoEncodeInfoKHR::pname:dstBuffer. 2205e5c31af7Sopenharmony_ci * ename:VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR specifies 2206e5c31af7Sopenharmony_ci that queries managed by the pool will capture a boolean value indicating 2207e5c31af7Sopenharmony_ci that the data written to the bitstream buffer specified in 2208e5c31af7Sopenharmony_ci slink:VkVideoEncodeInfoKHR::pname:dstBuffer contains 2209e5c31af7Sopenharmony_ci <<encode-overrides,overridden parameters>>. 2210e5c31af7Sopenharmony_ci 2211e5c31af7Sopenharmony_ciWhen retrieving the results of video encode feedback queries, the values 2212e5c31af7Sopenharmony_cicorresponding to each enabled video encode feedback are written in the order 2213e5c31af7Sopenharmony_ciof the bits defined above, followed by an optional value indicating 2214e5c31af7Sopenharmony_ciavailability or result status if ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT 2215e5c31af7Sopenharmony_cior ename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR is specified, respectively. 2216e5c31af7Sopenharmony_ci 2217e5c31af7Sopenharmony_ciIf the result status of a video encode feedback query is negative, then the 2218e5c31af7Sopenharmony_ciresults of all enabled video encode feedback values will be undefined:. 2219e5c31af7Sopenharmony_ci 2220e5c31af7Sopenharmony_ci[NOTE] 2221e5c31af7Sopenharmony_ci.Note 2222e5c31af7Sopenharmony_ci==== 2223e5c31af7Sopenharmony_ciThus it is recommended that applications always specify 2224e5c31af7Sopenharmony_ciename:VK_QUERY_RESULT_WITH_STATUS_BIT_KHR when retrieving the results of 2225e5c31af7Sopenharmony_civideo encode feedback queries and ignore such undefined: video encode 2226e5c31af7Sopenharmony_cifeedback values for any <<encode-unsuccessful,unsuccessfully>> completed 2227e5c31af7Sopenharmony_civideo encode operations. 2228e5c31af7Sopenharmony_ci==== 2229e5c31af7Sopenharmony_ci-- 2230e5c31af7Sopenharmony_ci 2231e5c31af7Sopenharmony_ci[open,refpage='VkVideoEncodeFeedbackFlagsKHR',desc='Bitmask of VkVideoEncodeFeedbackFlagBitsKHR',type='flags'] 2232e5c31af7Sopenharmony_ci-- 2233e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkVideoEncodeFeedbackFlagsKHR.adoc[] 2234e5c31af7Sopenharmony_ci 2235e5c31af7Sopenharmony_citname:VkVideoEncodeFeedbackFlagsKHR is a bitmask type for setting a mask of 2236e5c31af7Sopenharmony_cizero or more elink:VkVideoEncodeFeedbackFlagBitsKHR. 2237e5c31af7Sopenharmony_ci-- 2238e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 2239