1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[synchronization]] 6e5c31af7Sopenharmony_ci= Synchronization and Cache Control 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciSynchronization of access to resources is primarily the responsibility of 9e5c31af7Sopenharmony_cithe application in Vulkan. 10e5c31af7Sopenharmony_ciThe order of execution of commands with respect to the host and other 11e5c31af7Sopenharmony_cicommands on the device has few implicit guarantees, and needs to be 12e5c31af7Sopenharmony_ciexplicitly specified. 13e5c31af7Sopenharmony_ciMemory caches and other optimizations are also explicitly managed, requiring 14e5c31af7Sopenharmony_cithat the flow of data through the system is largely under application 15e5c31af7Sopenharmony_cicontrol. 16e5c31af7Sopenharmony_ci 17e5c31af7Sopenharmony_ciWhilst some implicit guarantees exist between commands, five explicit 18e5c31af7Sopenharmony_cisynchronization mechanisms are exposed by Vulkan: 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_ci<<synchronization-fences,Fences>>:: 21e5c31af7Sopenharmony_ci Fences can: be used to communicate to the host that execution of some 22e5c31af7Sopenharmony_ci task on the device has completed. 23e5c31af7Sopenharmony_ci 24e5c31af7Sopenharmony_ci<<synchronization-semaphores,Semaphores>>:: 25e5c31af7Sopenharmony_ci Semaphores can: be used to control resource access across multiple 26e5c31af7Sopenharmony_ci queues. 27e5c31af7Sopenharmony_ci 28e5c31af7Sopenharmony_ci<<synchronization-events,Events>>:: 29e5c31af7Sopenharmony_ci Events provide a fine-grained synchronization primitive which can: be 30e5c31af7Sopenharmony_ci signaled either within a command buffer or by the host, and can: be 31e5c31af7Sopenharmony_ci waited upon within a command buffer or queried on the host. 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_ci<<synchronization-pipeline-barriers,Pipeline Barriers>>:: 34e5c31af7Sopenharmony_ci Pipeline barriers also provide synchronization control within a command 35e5c31af7Sopenharmony_ci buffer, but at a single point, rather than with separate signal and wait 36e5c31af7Sopenharmony_ci operations. 37e5c31af7Sopenharmony_ci 38e5c31af7Sopenharmony_ci<<renderpass,Render Passes>>:: 39e5c31af7Sopenharmony_ci Render passes provide a useful synchronization framework for most 40e5c31af7Sopenharmony_ci rendering tasks, built upon the concepts in this chapter. 41e5c31af7Sopenharmony_ci Many cases that would otherwise need an application to use other 42e5c31af7Sopenharmony_ci synchronization primitives can: be expressed more efficiently as part of 43e5c31af7Sopenharmony_ci a render pass. 44e5c31af7Sopenharmony_ci 45e5c31af7Sopenharmony_ci 46e5c31af7Sopenharmony_ci[[synchronization-dependencies]] 47e5c31af7Sopenharmony_ci== Execution and Memory Dependencies 48e5c31af7Sopenharmony_ci 49e5c31af7Sopenharmony_ciAn _operation_ is an arbitrary amount of work to be executed on the host, a 50e5c31af7Sopenharmony_cidevice, or an external entity such as a presentation engine. 51e5c31af7Sopenharmony_ciSynchronization commands introduce explicit _execution dependencies_, and 52e5c31af7Sopenharmony_ci_memory dependencies_ between two sets of operations defined by the 53e5c31af7Sopenharmony_cicommand's two _synchronization scopes_. 54e5c31af7Sopenharmony_ci 55e5c31af7Sopenharmony_ci[[synchronization-dependencies-scopes]] 56e5c31af7Sopenharmony_ciThe synchronization scopes define which other operations a synchronization 57e5c31af7Sopenharmony_cicommand is able to create execution dependencies with. 58e5c31af7Sopenharmony_ciAny type of operation that is not in a synchronization command's 59e5c31af7Sopenharmony_cisynchronization scopes will not be included in the resulting dependency. 60e5c31af7Sopenharmony_ciFor example, for many synchronization commands, the synchronization scopes 61e5c31af7Sopenharmony_cican: be limited to just operations executing in specific 62e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages,pipeline stages>>, which allows other 63e5c31af7Sopenharmony_cipipeline stages to be excluded from a dependency. 64e5c31af7Sopenharmony_ciOther scoping options are possible, depending on the particular command. 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ci[[synchronization-dependencies-execution]] 67e5c31af7Sopenharmony_ciAn _execution dependency_ is a guarantee that for two sets of operations, 68e5c31af7Sopenharmony_cithe first set must: _happen-before_ the second set. 69e5c31af7Sopenharmony_ciIf an operation happens-before another operation, then the first operation 70e5c31af7Sopenharmony_cimust: complete before the second operation is initiated. 71e5c31af7Sopenharmony_ciMore precisely: 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ci * Let *A* and *B* be separate sets of operations. 74e5c31af7Sopenharmony_ci * Let *S* be a synchronization command. 75e5c31af7Sopenharmony_ci * Let *A~S~* and *B~S~* be the synchronization scopes of *S*. 76e5c31af7Sopenharmony_ci * Let *A'* be the intersection of sets *A* and *A~S~*. 77e5c31af7Sopenharmony_ci * Let *B'* be the intersection of sets *B* and *B~S~*. 78e5c31af7Sopenharmony_ci * Submitting *A*, *S* and *B* for execution, in that order, will result in 79e5c31af7Sopenharmony_ci execution dependency *E* between *A'* and *B'*. 80e5c31af7Sopenharmony_ci * Execution dependency *E* guarantees that *A'* happens-before *B'*. 81e5c31af7Sopenharmony_ci 82e5c31af7Sopenharmony_ci[[synchronization-dependencies-chains]] 83e5c31af7Sopenharmony_ciAn _execution dependency chain_ is a sequence of execution dependencies that 84e5c31af7Sopenharmony_ciform a happens-before relation between the first dependency's *A'* and the 85e5c31af7Sopenharmony_cifinal dependency's *B'*. 86e5c31af7Sopenharmony_ciFor each consecutive pair of execution dependencies, a chain exists if the 87e5c31af7Sopenharmony_ciintersection of *B~S~* in the first dependency and *A~S~* in the second 88e5c31af7Sopenharmony_cidependency is not an empty set. 89e5c31af7Sopenharmony_ciThe formation of a single execution dependency from an execution dependency 90e5c31af7Sopenharmony_cichain can be described by substituting the following in the description of 91e5c31af7Sopenharmony_ciexecution dependencies: 92e5c31af7Sopenharmony_ci 93e5c31af7Sopenharmony_ci * Let *S* be a set of synchronization commands that generate an execution 94e5c31af7Sopenharmony_ci dependency chain. 95e5c31af7Sopenharmony_ci * Let *A~S~* be the first synchronization scope of the first command in 96e5c31af7Sopenharmony_ci *S*. 97e5c31af7Sopenharmony_ci * Let *B~S~* be the second synchronization scope of the last command in 98e5c31af7Sopenharmony_ci *S*. 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ciExecution dependencies alone are not sufficient to guarantee that values 101e5c31af7Sopenharmony_ciresulting from writes in one set of operations can: be read from another set 102e5c31af7Sopenharmony_ciof operations. 103e5c31af7Sopenharmony_ci 104e5c31af7Sopenharmony_ci[[synchronization-dependencies-available-and-visible]] 105e5c31af7Sopenharmony_ciThree additional types of operations are used to control memory access. 106e5c31af7Sopenharmony_ci_Availability operations_ cause the values generated by specified memory 107e5c31af7Sopenharmony_ciwrite accesses to become _available_ to a memory domain for future access. 108e5c31af7Sopenharmony_ciAny available value remains available until a subsequent write to the same 109e5c31af7Sopenharmony_cimemory location occurs (whether it is made available or not) or the memory 110e5c31af7Sopenharmony_ciis freed. 111e5c31af7Sopenharmony_ci_Memory domain operations_ cause writes that are available to a source 112e5c31af7Sopenharmony_cimemory domain to become available to a destination memory domain (an example 113e5c31af7Sopenharmony_ciof this is making writes available to the host domain available to the 114e5c31af7Sopenharmony_cidevice domain). 115e5c31af7Sopenharmony_ci_Visibility operations_ cause values available to a memory domain to become 116e5c31af7Sopenharmony_ci_visible_ to specified memory accesses. 117e5c31af7Sopenharmony_ci 118e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_vulkan_memory_model[] 119e5c31af7Sopenharmony_ciAvailability, visibility, memory domains, and memory domain operations are 120e5c31af7Sopenharmony_ciformally defined in the <<memory-model-availability-visibility,Availability 121e5c31af7Sopenharmony_ciand Visibility>> section of the <<memory-model,Memory Model>> chapter. 122e5c31af7Sopenharmony_ciWhich API operations perform each of these operations is defined in 123e5c31af7Sopenharmony_ci<<memory-model-vulkan-availability-visibility,Availability, Visibility, and 124e5c31af7Sopenharmony_ciDomain Operations>>. 125e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_vulkan_memory_model[] 126e5c31af7Sopenharmony_ci 127e5c31af7Sopenharmony_ci[[synchronization-dependencies-memory]] 128e5c31af7Sopenharmony_ciA _memory dependency_ is an execution dependency which includes availability 129e5c31af7Sopenharmony_ciand visibility operations such that: 130e5c31af7Sopenharmony_ci 131e5c31af7Sopenharmony_ci * The first set of operations happens-before the availability operation. 132e5c31af7Sopenharmony_ci * The availability operation happens-before the visibility operation. 133e5c31af7Sopenharmony_ci * The visibility operation happens-before the second set of operations. 134e5c31af7Sopenharmony_ci 135e5c31af7Sopenharmony_ciOnce written values are made visible to a particular type of memory access, 136e5c31af7Sopenharmony_cithey can: be read or written by that type of memory access. 137e5c31af7Sopenharmony_ciMost synchronization commands in Vulkan define a memory dependency. 138e5c31af7Sopenharmony_ci 139e5c31af7Sopenharmony_ci[[synchronization-dependencies-access-scopes]] 140e5c31af7Sopenharmony_ciThe specific memory accesses that are made available and visible are defined 141e5c31af7Sopenharmony_ciby the _access scopes_ of a memory dependency. 142e5c31af7Sopenharmony_ciAny type of access that is in a memory dependency's first access scope and 143e5c31af7Sopenharmony_cioccurs in *A'* is made available. 144e5c31af7Sopenharmony_ciAny type of access that is in a memory dependency's second access scope and 145e5c31af7Sopenharmony_cioccurs in *B'* has any available writes made visible to it. 146e5c31af7Sopenharmony_ciAny type of operation that is not in a synchronization command's access 147e5c31af7Sopenharmony_ciscopes will not be included in the resulting dependency. 148e5c31af7Sopenharmony_ci 149e5c31af7Sopenharmony_ciA memory dependency enforces availability and visibility of memory accesses 150e5c31af7Sopenharmony_ciand execution order between two sets of operations. 151e5c31af7Sopenharmony_ciAdding to the description of <<synchronization-dependencies-chains, 152e5c31af7Sopenharmony_ciexecution dependency chains>>: 153e5c31af7Sopenharmony_ci 154e5c31af7Sopenharmony_ci * Let *a* be the set of memory accesses performed by *A'*. 155e5c31af7Sopenharmony_ci * Let *b* be the set of memory accesses performed by *B'*. 156e5c31af7Sopenharmony_ci * Let *a~S~* be the first access scope of the first command in *S*. 157e5c31af7Sopenharmony_ci * Let *b~S~* be the second access scope of the last command in *S*. 158e5c31af7Sopenharmony_ci * Let *a'* be the intersection of sets *a* and *a~S~*. 159e5c31af7Sopenharmony_ci * Let *b'* be the intersection of sets *b* and *b~S~*. 160e5c31af7Sopenharmony_ci * Submitting *A*, *S* and *B* for execution, in that order, will result in 161e5c31af7Sopenharmony_ci a memory dependency *m* between *A'* and *B'*. 162e5c31af7Sopenharmony_ci * Memory dependency *m* guarantees that: 163e5c31af7Sopenharmony_ci ** Memory writes in *a'* are made available. 164e5c31af7Sopenharmony_ci ** Available memory writes, including those from *a'*, are made visible to 165e5c31af7Sopenharmony_ci *b'*. 166e5c31af7Sopenharmony_ci 167e5c31af7Sopenharmony_ci[NOTE] 168e5c31af7Sopenharmony_ci.Note 169e5c31af7Sopenharmony_ci==== 170e5c31af7Sopenharmony_ciExecution and memory dependencies are used to solve data hazards, i.e. to 171e5c31af7Sopenharmony_ciensure that read and write operations occur in a well-defined order. 172e5c31af7Sopenharmony_ciWrite-after-read hazards can be solved with just an execution dependency, 173e5c31af7Sopenharmony_cibut read-after-write and write-after-write hazards need appropriate memory 174e5c31af7Sopenharmony_cidependencies to be included between them. 175e5c31af7Sopenharmony_ciIf an application does not include dependencies to solve these hazards, the 176e5c31af7Sopenharmony_ciresults and execution orders of memory accesses are undefined:. 177e5c31af7Sopenharmony_ci==== 178e5c31af7Sopenharmony_ci 179e5c31af7Sopenharmony_ci 180e5c31af7Sopenharmony_ci[[synchronization-image-layout-transitions]] 181e5c31af7Sopenharmony_ci=== Image Layout Transitions 182e5c31af7Sopenharmony_ci 183e5c31af7Sopenharmony_ciImage subresources can: be transitioned from one <<resources-image-layouts, 184e5c31af7Sopenharmony_cilayout>> to another as part of a <<synchronization-dependencies-memory, 185e5c31af7Sopenharmony_cimemory dependency>> (e.g. by using an 186e5c31af7Sopenharmony_ci<<synchronization-image-memory-barriers,image memory barrier>>). 187e5c31af7Sopenharmony_ciWhen a layout transition is specified in a memory dependency, it 188e5c31af7Sopenharmony_cihappens-after the availability operations in the memory dependency, and 189e5c31af7Sopenharmony_cihappens-before the visibility operations. 190e5c31af7Sopenharmony_ciImage layout transitions may: perform read and write accesses on all memory 191e5c31af7Sopenharmony_cibound to the image subresource range, so applications must: ensure that all 192e5c31af7Sopenharmony_cimemory writes have been made 193e5c31af7Sopenharmony_ci<<synchronization-dependencies-available-and-visible, available>> before a 194e5c31af7Sopenharmony_cilayout transition is executed. 195e5c31af7Sopenharmony_ciAvailable memory is automatically made visible to a layout transition, and 196e5c31af7Sopenharmony_ciwrites performed by a layout transition are automatically made available. 197e5c31af7Sopenharmony_ci 198e5c31af7Sopenharmony_ciLayout transitions always apply to a particular image subresource range, and 199e5c31af7Sopenharmony_cispecify both an old layout and new layout. 200e5c31af7Sopenharmony_ciThe old layout must: either be ename:VK_IMAGE_LAYOUT_UNDEFINED, or match the 201e5c31af7Sopenharmony_cicurrent layout of the image subresource range. 202e5c31af7Sopenharmony_ciIf the old layout matches the current layout of the image subresource range, 203e5c31af7Sopenharmony_cithe transition preserves the contents of that range. 204e5c31af7Sopenharmony_ciIf the old layout is ename:VK_IMAGE_LAYOUT_UNDEFINED, the contents of that 205e5c31af7Sopenharmony_cirange may: be discarded. 206e5c31af7Sopenharmony_ci 207e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 208e5c31af7Sopenharmony_ciAs image layout transitions may: perform read and write accesses on the 209e5c31af7Sopenharmony_cimemory bound to the image, if the image subresource affected by the layout 210e5c31af7Sopenharmony_citransition is bound to peer memory for any device in the current device mask 211e5c31af7Sopenharmony_cithen the memory heap the bound memory comes from must: support the 212e5c31af7Sopenharmony_ciename:VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT and 213e5c31af7Sopenharmony_ciename:VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT capabilities as returned by 214e5c31af7Sopenharmony_ciflink:vkGetDeviceGroupPeerMemoryFeatures. 215e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 216e5c31af7Sopenharmony_ci 217e5c31af7Sopenharmony_ci[NOTE] 218e5c31af7Sopenharmony_ci.Note 219e5c31af7Sopenharmony_ci==== 220e5c31af7Sopenharmony_ciApplications must: ensure that layout transitions happen-after all 221e5c31af7Sopenharmony_cioperations accessing the image with the old layout, and happen-before any 222e5c31af7Sopenharmony_cioperations that will access the image with the new layout. 223e5c31af7Sopenharmony_ciLayout transitions are potentially read/write operations, so not defining 224e5c31af7Sopenharmony_ciappropriate memory dependencies to guarantee this will result in a data 225e5c31af7Sopenharmony_cirace. 226e5c31af7Sopenharmony_ci==== 227e5c31af7Sopenharmony_ci 228e5c31af7Sopenharmony_ciImage layout transitions interact with <<resources-memory-aliasing,memory 229e5c31af7Sopenharmony_cialiasing>>. 230e5c31af7Sopenharmony_ci 231e5c31af7Sopenharmony_ci 232e5c31af7Sopenharmony_ci[[synchronization-image-barrier-layout-transition-order]] 233e5c31af7Sopenharmony_ciLayout transitions that are performed via image memory barriers execute in 234e5c31af7Sopenharmony_citheir entirety in <<synchronization-submission-order, submission order>>, 235e5c31af7Sopenharmony_cirelative to other image layout transitions submitted to the same queue, 236e5c31af7Sopenharmony_ciincluding those performed by <<renderpass, render passes>>. 237e5c31af7Sopenharmony_ciIn effect there is an implicit execution dependency from each such layout 238e5c31af7Sopenharmony_citransition to all layout transitions previously submitted to the same queue. 239e5c31af7Sopenharmony_ci 240e5c31af7Sopenharmony_ciifdef::VK_EXT_sample_locations[] 241e5c31af7Sopenharmony_ci 242e5c31af7Sopenharmony_ciThe image layout of each image subresource of a depth/stencil image created 243e5c31af7Sopenharmony_ciwith ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT is 244e5c31af7Sopenharmony_cidependent on the last sample locations used to render to the image 245e5c31af7Sopenharmony_cisubresource as a depth/stencil attachment, thus when the pname:image member 246e5c31af7Sopenharmony_ciof an <<synchronization-image-memory-barriers, image memory barrier>> is an 247e5c31af7Sopenharmony_ciimage created with this flag the application can: chain a 248e5c31af7Sopenharmony_cislink:VkSampleLocationsInfoEXT structure to the pname:pNext chain of 249e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 250e5c31af7Sopenharmony_cislink:VkImageMemoryBarrier2KHR or 251e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 252e5c31af7Sopenharmony_cislink:VkImageMemoryBarrier to specify the sample locations to use during any 253e5c31af7Sopenharmony_ciimage layout transition. 254e5c31af7Sopenharmony_ci 255e5c31af7Sopenharmony_ciIf the sname:VkSampleLocationsInfoEXT structure does not match the sample 256e5c31af7Sopenharmony_cilocation state last used to render to the image subresource range specified 257e5c31af7Sopenharmony_ciby pname:subresourceRange, or if no sname:VkSampleLocationsInfoEXT structure 258e5c31af7Sopenharmony_ciis present, then the contents of the given image subresource range becomes 259e5c31af7Sopenharmony_ciundefined: as if pname:oldLayout would equal 260e5c31af7Sopenharmony_ciename:VK_IMAGE_LAYOUT_UNDEFINED. 261e5c31af7Sopenharmony_ci 262e5c31af7Sopenharmony_ciendif::VK_EXT_sample_locations[] 263e5c31af7Sopenharmony_ci 264e5c31af7Sopenharmony_ci 265e5c31af7Sopenharmony_ci[[synchronization-pipeline-stages]] 266e5c31af7Sopenharmony_ci=== Pipeline Stages 267e5c31af7Sopenharmony_ci 268e5c31af7Sopenharmony_ciThe work performed by an <<fundamentals-queueoperation-command-types, action 269e5c31af7Sopenharmony_cior synchronization command>> consists of multiple operations, which are 270e5c31af7Sopenharmony_ciperformed as a sequence of logically independent steps known as _pipeline 271e5c31af7Sopenharmony_cistages_. 272e5c31af7Sopenharmony_ciThe exact pipeline stages executed depend on the particular command that is 273e5c31af7Sopenharmony_ciused, and current command buffer state when the command was recorded. 274e5c31af7Sopenharmony_ci<<drawing,Drawing commands>>, <<dispatch,dispatching commands>>, 275e5c31af7Sopenharmony_ci<<copies,copy commands>>, <<clears,clear commands>>, and <<synchronization, 276e5c31af7Sopenharmony_cisynchronization commands>> all execute in different sets of 277e5c31af7Sopenharmony_ci<<VkPipelineStageFlagBits,pipeline stages>>. 278e5c31af7Sopenharmony_ci<<synchronization, Synchronization commands>> do not execute in a defined 279e5c31af7Sopenharmony_cipipeline stage. 280e5c31af7Sopenharmony_ci 281e5c31af7Sopenharmony_ci[NOTE] 282e5c31af7Sopenharmony_ci.Note 283e5c31af7Sopenharmony_ci==== 284e5c31af7Sopenharmony_ciOperations performed by synchronization commands (e.g. 285e5c31af7Sopenharmony_ci<<synchronization-dependencies-available-and-visible, availability and 286e5c31af7Sopenharmony_civisibility operations>>) are not executed by a defined pipeline stage. 287e5c31af7Sopenharmony_ciHowever other commands can still synchronize with them by using the 288e5c31af7Sopenharmony_ci<<synchronization-dependencies-scopes, synchronization scopes>> to create a 289e5c31af7Sopenharmony_ci<<synchronization-dependencies-chains, dependency chain>>. 290e5c31af7Sopenharmony_ci==== 291e5c31af7Sopenharmony_ci 292e5c31af7Sopenharmony_ciExecution of operations across pipeline stages must: adhere to 293e5c31af7Sopenharmony_ci<<synchronization-implicit, implicit ordering guarantees>>, particularly 294e5c31af7Sopenharmony_ciincluding <<synchronization-pipeline-stages-order, pipeline stage order>>. 295e5c31af7Sopenharmony_ciOtherwise, execution across pipeline stages may: overlap or execute out of 296e5c31af7Sopenharmony_ciorder with regards to other stages, unless otherwise enforced by an 297e5c31af7Sopenharmony_ciexecution dependency. 298e5c31af7Sopenharmony_ci 299e5c31af7Sopenharmony_ciSeveral of the synchronization commands include pipeline stage parameters, 300e5c31af7Sopenharmony_cirestricting the <<synchronization-dependencies-scopes, synchronization 301e5c31af7Sopenharmony_ciscopes>> for that command to just those stages. 302e5c31af7Sopenharmony_ciThis allows fine grained control over the exact execution dependencies and 303e5c31af7Sopenharmony_ciaccesses performed by action commands. 304e5c31af7Sopenharmony_ciImplementations should: use these pipeline stages to avoid unnecessary 305e5c31af7Sopenharmony_cistalls or cache flushing. 306e5c31af7Sopenharmony_ci 307e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 308e5c31af7Sopenharmony_ci[open,refpage='VkPipelineStageFlagBits2KHR',desc='Pipeline stage flags for VkPipelineStageFlags2KHR',type='enums'] 309e5c31af7Sopenharmony_ci-- 310e5c31af7Sopenharmony_ciBits which can: be set in a tlink:VkPipelineStageFlags2KHR mask, specifying 311e5c31af7Sopenharmony_cistages of execution, are: 312e5c31af7Sopenharmony_ci 313e5c31af7Sopenharmony_ciifdef::editing-notes[] 314e5c31af7Sopenharmony_ci[NOTE] 315e5c31af7Sopenharmony_ci.editing-note 316e5c31af7Sopenharmony_ci==== 317e5c31af7Sopenharmony_ciThe many places pipeline stage flags are used are not currently listed here. 318e5c31af7Sopenharmony_ci==== 319e5c31af7Sopenharmony_ciendif::editing-notes[] 320e5c31af7Sopenharmony_ci 321e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPipelineStageFlagBits2KHR.txt[] 322e5c31af7Sopenharmony_ci 323e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_NONE_KHR specifies no stages of execution. 324e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR specifies the stage of 325e5c31af7Sopenharmony_ci the pipeline where indirect command parameters are consumed. 326e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 327e5c31af7Sopenharmony_ci This stage also includes reading commands written by 328e5c31af7Sopenharmony_ci flink:vkCmdPreprocessGeneratedCommandsNV. 329e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 330e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 331e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV specifies the task shader 332e5c31af7Sopenharmony_ci stage. 333e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV specifies the mesh shader 334e5c31af7Sopenharmony_ci stage. 335e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 336e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR specifies the stage of the 337e5c31af7Sopenharmony_ci pipeline where index buffers are consumed. 338e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR specifies the 339e5c31af7Sopenharmony_ci stage of the pipeline where vertex buffers are consumed. 340e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR is equivalent to the 341e5c31af7Sopenharmony_ci logical OR of: 342e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR 343e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR 344e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR specifies the vertex 345e5c31af7Sopenharmony_ci shader stage. 346e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR specifies 347e5c31af7Sopenharmony_ci the tessellation control shader stage. 348e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR 349e5c31af7Sopenharmony_ci specifies the tessellation evaluation shader stage. 350e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR specifies the geometry 351e5c31af7Sopenharmony_ci shader stage. 352e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR is 353e5c31af7Sopenharmony_ci equivalent to specifying all supported 354e5c31af7Sopenharmony_ci <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader 355e5c31af7Sopenharmony_ci stages>>: 356e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR 357e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR 358e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR 359e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR 360e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 361e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV 362e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV 363e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 364e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR specifies the fragment 365e5c31af7Sopenharmony_ci shader stage. 366e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR specifies the 367e5c31af7Sopenharmony_ci stage of the pipeline where early fragment tests (depth and stencil 368e5c31af7Sopenharmony_ci tests before fragment shading) are performed. 369e5c31af7Sopenharmony_ci This stage also includes <<renderpass-load-store-ops, subpass load 370e5c31af7Sopenharmony_ci operations>> for framebuffer attachments with a depth/stencil format. 371e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR specifies the 372e5c31af7Sopenharmony_ci stage of the pipeline where late fragment tests (depth and stencil tests 373e5c31af7Sopenharmony_ci after fragment shading) are performed. 374e5c31af7Sopenharmony_ci This stage also includes <<renderpass-load-store-ops, subpass store 375e5c31af7Sopenharmony_ci operations>> for framebuffer attachments with a depth/stencil format. 376e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR specifies the 377e5c31af7Sopenharmony_ci stage of the pipeline after blending where the final color values are 378e5c31af7Sopenharmony_ci output from the pipeline. 379e5c31af7Sopenharmony_ci This stage also includes <<renderpass-load-store-ops, subpass load and 380e5c31af7Sopenharmony_ci store operations>> and multisample resolve operations for framebuffer 381e5c31af7Sopenharmony_ci attachments with a color 382e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 383e5c31af7Sopenharmony_ci or depth/stencil 384e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 385e5c31af7Sopenharmony_ci format. 386e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR specifies the compute 387e5c31af7Sopenharmony_ci shader stage. 388e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR specifies a pseudo-stage 389e5c31af7Sopenharmony_ci indicating execution on the host of reads/writes of device memory. 390e5c31af7Sopenharmony_ci This stage is not invoked by any commands recorded in a command buffer. 391e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_COPY_BIT_KHR specifies the execution of all 392e5c31af7Sopenharmony_ci <<copies,copy commands>>, including flink:vkCmdCopyQueryPoolResults. 393e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_BLIT_BIT_KHR specifies the execution of 394e5c31af7Sopenharmony_ci flink:vkCmdBlitImage. 395e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR specifies the execution of 396e5c31af7Sopenharmony_ci flink:vkCmdResolveImage. 397e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR specifies the execution of 398e5c31af7Sopenharmony_ci <<clears,clear commands>>, with the exception of 399e5c31af7Sopenharmony_ci flink:vkCmdClearAttachments. 400e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR is equivalent to 401e5c31af7Sopenharmony_ci specifying all of: 402e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_COPY_BIT_KHR 403e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_BLIT_BIT_KHR 404e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR 405e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR 406e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline,VK_NV_ray_tracing[] 407e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR specifies the 408e5c31af7Sopenharmony_ci execution of the ray tracing shader stages. 409e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline,VK_NV_ray_tracing[] 410e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 411e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR specifies 412e5c31af7Sopenharmony_ci the execution of <<acceleration-structure, acceleration structure 413e5c31af7Sopenharmony_ci commands>>. 414e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 415e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR specifies the execution 416e5c31af7Sopenharmony_ci of all graphics pipeline stages, and is equivalent to the logical OR of: 417e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR 418e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 419e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV 420e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV 421e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 422e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR 423e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR 424e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR 425e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR 426e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR 427e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR 428e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR 429e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR 430e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR 431e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 432e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT 433e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 434e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 435e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT 436e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 437e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 438e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV 439e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 440e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 441e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT 442e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 443e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_invocation_mask[] 444e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI 445e5c31af7Sopenharmony_ciendif::VK_HUAWEI_invocation_mask[] 446e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR specifies all operations 447e5c31af7Sopenharmony_ci performed by all commands supported on the queue it is used with. 448e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 449e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT specifies the 450e5c31af7Sopenharmony_ci stage of the pipeline where the predicate of conditional rendering is 451e5c31af7Sopenharmony_ci consumed. 452e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 453e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 454e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT specifies the stage 455e5c31af7Sopenharmony_ci of the pipeline where vertex attribute output values are written to the 456e5c31af7Sopenharmony_ci transform feedback buffers. 457e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 458e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 459e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV specifies the stage 460e5c31af7Sopenharmony_ci of the pipeline where device-side generation of commands via 461e5c31af7Sopenharmony_ci flink:vkCmdPreprocessGeneratedCommandsNV is handled. 462e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 463e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 464e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 465e5c31af7Sopenharmony_ci specifies the stage of the pipeline where the 466e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 467e5c31af7Sopenharmony_ci <<primsrast-fragment-shading-rate-attachment, fragment shading rate 468e5c31af7Sopenharmony_ci attachment>> 469e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 470e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate+VK_NV_shading_rate_image[or] 471e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 472e5c31af7Sopenharmony_ci <<primsrast-shading-rate-image, shading rate image>> 473e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 474e5c31af7Sopenharmony_ci is read to determine the fragment shading rate for portions of a 475e5c31af7Sopenharmony_ci rasterized primitive. 476e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 477e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 478e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT specifies the 479e5c31af7Sopenharmony_ci stage of the pipeline where the fragment density map is read to 480e5c31af7Sopenharmony_ci <<fragmentdensitymapops,generate the fragment areas>>. 481e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 482e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_invocation_mask[] 483e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI specifies the stage 484e5c31af7Sopenharmony_ci of the pipeline where the invocation mask image is read by the 485e5c31af7Sopenharmony_ci implementation to optimize the ray dispatch. 486e5c31af7Sopenharmony_ciendif::VK_HUAWEI_invocation_mask[] 487e5c31af7Sopenharmony_ciifdef::VK_KHR_video_decode_queue[] 488e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR specifies the stage of 489e5c31af7Sopenharmony_ci the pipeline where <<video-decode-operations, video decode operation>> 490e5c31af7Sopenharmony_ci are performed. 491e5c31af7Sopenharmony_ciendif::VK_KHR_video_decode_queue[] 492e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 493e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR specifies the stage of 494e5c31af7Sopenharmony_ci the pipeline where <<video-encode-operations, video encode operation>> 495e5c31af7Sopenharmony_ci are performed. 496e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 497e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 498e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI specifies the 499e5c31af7Sopenharmony_ci subpass shading shader stage. 500e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 501e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR is equivalent to 502e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR with 503e5c31af7Sopenharmony_ci tlink:VkAccessFlags2KHR set to `0` when specified in the second 504e5c31af7Sopenharmony_ci synchronization scope, but equivalent to 505e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_NONE_KHR in the first scope. 506e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR is equivalent to 507e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR with 508e5c31af7Sopenharmony_ci tlink:VkAccessFlags2KHR set to `0` when specified in the first 509e5c31af7Sopenharmony_ci synchronization scope, but equivalent to 510e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_NONE_KHR in the second scope. 511e5c31af7Sopenharmony_ci 512e5c31af7Sopenharmony_ci[NOTE] 513e5c31af7Sopenharmony_ci.Note 514e5c31af7Sopenharmony_ci==== 515e5c31af7Sopenharmony_ciThe etext:TOP and etext:BOTTOM pipeline stages are deprecated, and 516e5c31af7Sopenharmony_ciapplications should prefer ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR 517e5c31af7Sopenharmony_ciand ename:VK_PIPELINE_STAGE_2_NONE_KHR. 518e5c31af7Sopenharmony_ci==== 519e5c31af7Sopenharmony_ci 520e5c31af7Sopenharmony_ci[NOTE] 521e5c31af7Sopenharmony_ci.Note 522e5c31af7Sopenharmony_ci==== 523e5c31af7Sopenharmony_ciThe tname:VkPipelineStageFlags2KHR bitmask goes beyond the 31 individual bit 524e5c31af7Sopenharmony_ciflags allowable within a C99 enum, which is how 525e5c31af7Sopenharmony_cielink:VkPipelineStageFlagBits is defined. 526e5c31af7Sopenharmony_ciThe first 31 values are common to both, and are interchangeable. 527e5c31af7Sopenharmony_ci==== 528e5c31af7Sopenharmony_ci-- 529e5c31af7Sopenharmony_ci 530e5c31af7Sopenharmony_ci[open,refpage='VkPipelineStageFlags2KHR',desc='64-bit mask of pipeline stage flags',type='flags'] 531e5c31af7Sopenharmony_ci-- 532e5c31af7Sopenharmony_citname:VkPipelineStageFlags2KHR is a bitmask type for setting a mask of zero 533e5c31af7Sopenharmony_cior more elink:VkPipelineStageFlagBits2KHR flags: 534e5c31af7Sopenharmony_ci 535e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineStageFlags2KHR.txt[] 536e5c31af7Sopenharmony_ci-- 537e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 538e5c31af7Sopenharmony_ci 539e5c31af7Sopenharmony_ci[open,refpage='VkPipelineStageFlagBits',desc='Bitmask specifying pipeline stages',type='enums'] 540e5c31af7Sopenharmony_ci-- 541e5c31af7Sopenharmony_ciBits which can: be set in a tlink:VkPipelineStageFlags mask, specifying 542e5c31af7Sopenharmony_cistages of execution, are: 543e5c31af7Sopenharmony_ci 544e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPipelineStageFlagBits.txt[] 545e5c31af7Sopenharmony_ci 546e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 547e5c31af7Sopenharmony_ciThese values all have the same meaning as the equivalently named values for 548e5c31af7Sopenharmony_citlink:VkPipelineStageFlags2KHR. 549e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 550e5c31af7Sopenharmony_ci 551e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 552e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_NONE_KHR specifies no stages of execution. 553e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 554e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT specifies the stage of the 555e5c31af7Sopenharmony_ci pipeline where stext:VkDrawIndirect* / stext:VkDispatchIndirect* / 556e5c31af7Sopenharmony_ci stext:VkTraceRaysIndirect* data structures are consumed. 557e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 558e5c31af7Sopenharmony_ci This stage also includes reading commands written by 559e5c31af7Sopenharmony_ci flink:vkCmdExecuteGeneratedCommandsNV. 560e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 561e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 562e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV specifies the task shader 563e5c31af7Sopenharmony_ci stage. 564e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV specifies the mesh shader 565e5c31af7Sopenharmony_ci stage. 566e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 567e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT specifies the stage of the 568e5c31af7Sopenharmony_ci pipeline where vertex and index buffers are consumed. 569e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT specifies the vertex shader 570e5c31af7Sopenharmony_ci stage. 571e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT specifies the 572e5c31af7Sopenharmony_ci tessellation control shader stage. 573e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT specifies the 574e5c31af7Sopenharmony_ci tessellation evaluation shader stage. 575e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT specifies the geometry 576e5c31af7Sopenharmony_ci shader stage. 577e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT specifies the fragment 578e5c31af7Sopenharmony_ci shader stage. 579e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT specifies the stage of 580e5c31af7Sopenharmony_ci the pipeline where early fragment tests (depth and stencil tests before 581e5c31af7Sopenharmony_ci fragment shading) are performed. 582e5c31af7Sopenharmony_ci This stage also includes <<renderpass-load-store-ops, subpass load 583e5c31af7Sopenharmony_ci operations>> for framebuffer attachments with a depth/stencil format. 584e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT specifies the stage of 585e5c31af7Sopenharmony_ci the pipeline where late fragment tests (depth and stencil tests after 586e5c31af7Sopenharmony_ci fragment shading) are performed. 587e5c31af7Sopenharmony_ci This stage also includes <<renderpass-load-store-ops, subpass store 588e5c31af7Sopenharmony_ci operations>> for framebuffer attachments with a depth/stencil format. 589e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT specifies the stage 590e5c31af7Sopenharmony_ci of the pipeline after blending where the final color values are output 591e5c31af7Sopenharmony_ci from the pipeline. 592e5c31af7Sopenharmony_ci This stage also includes <<renderpass-load-store-ops, subpass load and 593e5c31af7Sopenharmony_ci store operations>> and multisample resolve operations for framebuffer 594e5c31af7Sopenharmony_ci attachments with a color 595e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 596e5c31af7Sopenharmony_ci or depth/stencil 597e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 598e5c31af7Sopenharmony_ci format. 599e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT specifies the execution of a 600e5c31af7Sopenharmony_ci compute shader. 601e5c31af7Sopenharmony_ci * [[synchronization-pipeline-stages-transfer]] 602e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TRANSFER_BIT specifies the following commands: 603e5c31af7Sopenharmony_ci ** All <<copies,copy commands>>, including flink:vkCmdCopyQueryPoolResults 604e5c31af7Sopenharmony_ciifndef::VK_KHR_copy_commands2[] 605e5c31af7Sopenharmony_ci ** flink:vkCmdBlitImage 606e5c31af7Sopenharmony_ci ** flink:vkCmdResolveImage 607e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[] 608e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[] 609e5c31af7Sopenharmony_ci ** flink:vkCmdBlitImage2KHR and flink:vkCmdBlitImage 610e5c31af7Sopenharmony_ci ** flink:vkCmdResolveImage2KHR and flink:vkCmdResolveImage 611e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[] 612e5c31af7Sopenharmony_ci ** All <<clears,clear commands>>, with the exception of 613e5c31af7Sopenharmony_ci flink:vkCmdClearAttachments 614e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_HOST_BIT specifies a pseudo-stage indicating 615e5c31af7Sopenharmony_ci execution on the host of reads/writes of device memory. 616e5c31af7Sopenharmony_ci This stage is not invoked by any commands recorded in a command buffer. 617e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 618e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR specifies 619e5c31af7Sopenharmony_ci the execution of 620e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 621e5c31af7Sopenharmony_ci flink:vkCmdBuildAccelerationStructureNV, 622e5c31af7Sopenharmony_ci flink:vkCmdCopyAccelerationStructureNV, 623e5c31af7Sopenharmony_ci flink:vkCmdWriteAccelerationStructuresPropertiesNV 624e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 625e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing+VK_KHR_acceleration_structure[,] 626e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 627e5c31af7Sopenharmony_ci flink:vkCmdBuildAccelerationStructuresKHR, 628e5c31af7Sopenharmony_ci flink:vkCmdBuildAccelerationStructuresIndirectKHR, 629e5c31af7Sopenharmony_ci flink:vkCmdCopyAccelerationStructureKHR, 630e5c31af7Sopenharmony_ci flink:vkCmdCopyAccelerationStructureToMemoryKHR, 631e5c31af7Sopenharmony_ci flink:vkCmdCopyMemoryToAccelerationStructureKHR, and 632e5c31af7Sopenharmony_ci flink:vkCmdWriteAccelerationStructuresPropertiesKHR. 633e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 634e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 635e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 636e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR specifies the 637e5c31af7Sopenharmony_ci execution of the ray tracing shader stages, via 638e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[flink:vkCmdTraceRaysNV] 639e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing+VK_KHR_ray_tracing_pipeline[,] 640e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[flink:vkCmdTraceRaysKHR, or flink:vkCmdTraceRaysIndirectKHR] 641e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 642e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT specifies the execution of all 643e5c31af7Sopenharmony_ci graphics pipeline stages, and is equivalent to the logical OR of: 644e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 645e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 646e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV 647e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV 648e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 649e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT 650e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT 651e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT 652e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT 653e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT 654e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT 655e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT 656e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT 657e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 658e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 659e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT 660e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 661e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 662e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT 663e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 664e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 665e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 666e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 667e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 668e5c31af7Sopenharmony_ci ** ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT 669e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 670e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT specifies all operations 671e5c31af7Sopenharmony_ci performed by all commands supported on the queue it is used with. 672e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 673e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT specifies the 674e5c31af7Sopenharmony_ci stage of the pipeline where the predicate of conditional rendering is 675e5c31af7Sopenharmony_ci consumed. 676e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 677e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 678e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT specifies the stage 679e5c31af7Sopenharmony_ci of the pipeline where vertex attribute output values are written to the 680e5c31af7Sopenharmony_ci transform feedback buffers. 681e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 682e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 683e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV specifies the stage of 684e5c31af7Sopenharmony_ci the pipeline where device-side preprocessing for generated commands via 685e5c31af7Sopenharmony_ci flink:vkCmdPreprocessGeneratedCommandsNV is handled. 686e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 687e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 688e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 689e5c31af7Sopenharmony_ci specifies the stage of the pipeline where the 690e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 691e5c31af7Sopenharmony_ci <<primsrast-fragment-shading-rate-attachment, fragment shading rate 692e5c31af7Sopenharmony_ci attachment>> 693e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 694e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate+VK_NV_shading_rate_image[or] 695e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 696e5c31af7Sopenharmony_ci <<primsrast-shading-rate-image, shading rate image>> 697e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 698e5c31af7Sopenharmony_ci is read to determine the fragment shading rate for portions of a 699e5c31af7Sopenharmony_ci rasterized primitive. 700e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 701e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 702e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT specifies the 703e5c31af7Sopenharmony_ci stage of the pipeline where the fragment density map is read to 704e5c31af7Sopenharmony_ci <<fragmentdensitymapops,generate the fragment areas>>. 705e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 706e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT is equivalent to 707e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT with tlink:VkAccessFlags set to 708e5c31af7Sopenharmony_ci `0` when specified in the second synchronization scope, but specifies no 709e5c31af7Sopenharmony_ci stage of execution when specified in the first scope. 710e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT is equivalent to 711e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT with tlink:VkAccessFlags set to 712e5c31af7Sopenharmony_ci `0` when specified in the first synchronization scope, but specifies no 713e5c31af7Sopenharmony_ci stage of execution when specified in the second scope. 714e5c31af7Sopenharmony_ci-- 715e5c31af7Sopenharmony_ci 716e5c31af7Sopenharmony_ci[open,refpage='VkPipelineStageFlags',desc='Bitmask of VkPipelineStageFlagBits',type='flags'] 717e5c31af7Sopenharmony_ci-- 718e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineStageFlags.txt[] 719e5c31af7Sopenharmony_ci 720e5c31af7Sopenharmony_citname:VkPipelineStageFlags is a bitmask type for setting a mask of zero or 721e5c31af7Sopenharmony_cimore elink:VkPipelineStageFlagBits. 722e5c31af7Sopenharmony_ci-- 723e5c31af7Sopenharmony_ci 724e5c31af7Sopenharmony_ci[[synchronization-pipeline-stages-masks]] 725e5c31af7Sopenharmony_ciIf a synchronization command includes a source stage mask, its first 726e5c31af7Sopenharmony_ci<<synchronization-dependencies-scopes, synchronization scope>> only includes 727e5c31af7Sopenharmony_ciexecution of the pipeline stages specified in that mask, and its first 728e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> only includes 729e5c31af7Sopenharmony_cimemory accesses performed by pipeline stages specified in that mask. 730e5c31af7Sopenharmony_ci 731e5c31af7Sopenharmony_ciIf a synchronization command includes a destination stage mask, its second 732e5c31af7Sopenharmony_ci<<synchronization-dependencies-scopes, synchronization scope>> only includes 733e5c31af7Sopenharmony_ciexecution of the pipeline stages specified in that mask, and its second 734e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> only includes 735e5c31af7Sopenharmony_cimemory access performed by pipeline stages specified in that mask. 736e5c31af7Sopenharmony_ci 737e5c31af7Sopenharmony_ci[NOTE] 738e5c31af7Sopenharmony_ci.Note 739e5c31af7Sopenharmony_ci==== 740e5c31af7Sopenharmony_ciIncluding a particular pipeline stage in the first 741e5c31af7Sopenharmony_ci<<synchronization-dependencies-scopes, synchronization scope>> of a command 742e5c31af7Sopenharmony_ciimplicitly includes <<synchronization-pipeline-stages-order, logically 743e5c31af7Sopenharmony_ciearlier>> pipeline stages in the synchronization scope. 744e5c31af7Sopenharmony_ciSimilarly, the second <<synchronization-dependencies-scopes, synchronization 745e5c31af7Sopenharmony_ciscope>> includes <<synchronization-pipeline-stages-order, logically later>> 746e5c31af7Sopenharmony_cipipeline stages. 747e5c31af7Sopenharmony_ci 748e5c31af7Sopenharmony_ciHowever, note that <<synchronization-dependencies-access-scopes, access 749e5c31af7Sopenharmony_ciscopes>> are not affected in this way - only the precise stages specified 750e5c31af7Sopenharmony_ciare considered part of each access scope. 751e5c31af7Sopenharmony_ci==== 752e5c31af7Sopenharmony_ci 753e5c31af7Sopenharmony_ciCertain pipeline stages are only available on queues that support a 754e5c31af7Sopenharmony_ciparticular set of operations. 755e5c31af7Sopenharmony_ciThe following table lists, for each pipeline stage flag, which queue 756e5c31af7Sopenharmony_cicapability flag must: be supported by the queue. 757e5c31af7Sopenharmony_ciWhen multiple flags are enumerated in the second column of the table, it 758e5c31af7Sopenharmony_cimeans that the pipeline stage is supported on the queue if it supports any 759e5c31af7Sopenharmony_ciof the listed capability flags. 760e5c31af7Sopenharmony_ciFor further details on queue capabilities see 761e5c31af7Sopenharmony_ci<<devsandqueues-physical-device-enumeration,Physical Device Enumeration>> 762e5c31af7Sopenharmony_ciand <<devsandqueues-queues,Queues>>. 763e5c31af7Sopenharmony_ci 764e5c31af7Sopenharmony_ci[[synchronization-pipeline-stages-supported]] 765e5c31af7Sopenharmony_ci.Supported pipeline stage flags 766e5c31af7Sopenharmony_ci[cols="60%,40%",options="header"] 767e5c31af7Sopenharmony_ci|==== 768e5c31af7Sopenharmony_ci|Pipeline stage flag | Required queue capability flag 769e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT | None required 770e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT 771e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | ename:VK_QUEUE_GRAPHICS_BIT 772e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | ename:VK_QUEUE_GRAPHICS_BIT 773e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | ename:VK_QUEUE_GRAPHICS_BIT 774e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | ename:VK_QUEUE_GRAPHICS_BIT 775e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | ename:VK_QUEUE_GRAPHICS_BIT 776e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | ename:VK_QUEUE_GRAPHICS_BIT 777e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | ename:VK_QUEUE_GRAPHICS_BIT 778e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | ename:VK_QUEUE_GRAPHICS_BIT 779e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | ename:VK_QUEUE_GRAPHICS_BIT 780e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | ename:VK_QUEUE_COMPUTE_BIT 781e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_TRANSFER_BIT | ename:VK_QUEUE_GRAPHICS_BIT, ename:VK_QUEUE_COMPUTE_BIT or ename:VK_QUEUE_TRANSFER_BIT 782e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | None required 783e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_HOST_BIT | None required 784e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | ename:VK_QUEUE_GRAPHICS_BIT 785e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | None required 786e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 787e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT | ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT 788e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 789e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 790e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT | ename:VK_QUEUE_GRAPHICS_BIT 791e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 792e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 793e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV | ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT 794e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 795e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 796e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR | ename:VK_QUEUE_GRAPHICS_BIT 797e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 798e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 799e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV | ename:VK_QUEUE_GRAPHICS_BIT 800e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV | ename:VK_QUEUE_GRAPHICS_BIT 801e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 802e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 803e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR | ename:VK_QUEUE_COMPUTE_BIT 804e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 805e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 806e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR | ename:VK_QUEUE_COMPUTE_BIT 807e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 808e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 809e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT | ename:VK_QUEUE_GRAPHICS_BIT 810e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 811e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 812e5c31af7Sopenharmony_ci|ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI | ename:VK_QUEUE_GRAPHICS_BIT 813e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 814e5c31af7Sopenharmony_ci|==== 815e5c31af7Sopenharmony_ci 816e5c31af7Sopenharmony_ci[[synchronization-pipeline-stages-order]] 817e5c31af7Sopenharmony_ciPipeline stages that execute as a result of a command logically complete 818e5c31af7Sopenharmony_ciexecution in a specific order, such that completion of a logically later 819e5c31af7Sopenharmony_cipipeline stage must: not happen-before completion of a logically earlier 820e5c31af7Sopenharmony_cistage. 821e5c31af7Sopenharmony_ciThis means that including any stage in the source stage mask for a 822e5c31af7Sopenharmony_ciparticular synchronization command also implies that any logically earlier 823e5c31af7Sopenharmony_cistages are included in *A~S~* for that command. 824e5c31af7Sopenharmony_ci 825e5c31af7Sopenharmony_ciSimilarly, initiation of a logically earlier pipeline stage must: not 826e5c31af7Sopenharmony_cihappen-after initiation of a logically later pipeline stage. 827e5c31af7Sopenharmony_ciIncluding any given stage in the destination stage mask for a particular 828e5c31af7Sopenharmony_cisynchronization command also implies that any logically later stages are 829e5c31af7Sopenharmony_ciincluded in *B~S~* for that command. 830e5c31af7Sopenharmony_ci 831e5c31af7Sopenharmony_ci[NOTE] 832e5c31af7Sopenharmony_ci.Note 833e5c31af7Sopenharmony_ci==== 834e5c31af7Sopenharmony_ciImplementations may: not support synchronization at every pipeline stage for 835e5c31af7Sopenharmony_cievery synchronization operation. 836e5c31af7Sopenharmony_ciIf a pipeline stage that an implementation does not support synchronization 837e5c31af7Sopenharmony_cifor appears in a source stage mask, it may: substitute any logically later 838e5c31af7Sopenharmony_cistage in its place for the first synchronization scope. 839e5c31af7Sopenharmony_ciIf a pipeline stage that an implementation does not support synchronization 840e5c31af7Sopenharmony_cifor appears in a destination stage mask, it may: substitute any logically 841e5c31af7Sopenharmony_ciearlier stage in its place for the second synchronization scope. 842e5c31af7Sopenharmony_ci 843e5c31af7Sopenharmony_ciFor example, if an implementation is unable to signal an event immediately 844e5c31af7Sopenharmony_ciafter vertex shader execution is complete, it may: instead signal the event 845e5c31af7Sopenharmony_ciafter color attachment output has completed. 846e5c31af7Sopenharmony_ci 847e5c31af7Sopenharmony_ciIf an implementation makes such a substitution, it must: not affect the 848e5c31af7Sopenharmony_cisemantics of execution or memory dependencies or image and buffer memory 849e5c31af7Sopenharmony_cibarriers. 850e5c31af7Sopenharmony_ci==== 851e5c31af7Sopenharmony_ci 852e5c31af7Sopenharmony_ci[[synchronization-pipeline-stages-types]][[synchronization-pipeline-graphics]] 853e5c31af7Sopenharmony_ci<<pipelines-graphics, Graphics pipelines>> are executable on queues 854e5c31af7Sopenharmony_cisupporting ename:VK_QUEUE_GRAPHICS_BIT. 855e5c31af7Sopenharmony_ciStages executed by graphics pipelines can: only be specified in commands 856e5c31af7Sopenharmony_cirecorded for queues supporting ename:VK_QUEUE_GRAPHICS_BIT. 857e5c31af7Sopenharmony_ci 858e5c31af7Sopenharmony_ciThe graphics 859e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 860e5c31af7Sopenharmony_ciprimitive 861e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 862e5c31af7Sopenharmony_cipipeline executes the following stages, with the logical ordering of the 863e5c31af7Sopenharmony_cistages matching the order specified here: 864e5c31af7Sopenharmony_ci 865e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 866e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 867e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR 868e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR 869e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 870e5c31af7Sopenharmony_ciifndef::VK_KHR_synchronization2[] 871e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT 872e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 873e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT 874e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT 875e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT 876e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT 877e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 878e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT 879e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 880e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 881e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 882e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 883e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT 884e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT 885e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT 886e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 887e5c31af7Sopenharmony_ci 888e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 889e5c31af7Sopenharmony_ciThe graphics mesh pipeline executes the following stages, with the logical 890e5c31af7Sopenharmony_ciordering of the stages matching the order specified here: 891e5c31af7Sopenharmony_ci 892e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 893e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV 894e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV 895e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 896e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 897e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 898e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT 899e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT 900e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT 901e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 902e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 903e5c31af7Sopenharmony_ci 904e5c31af7Sopenharmony_ciFor the compute pipeline, the following stages occur in this order: 905e5c31af7Sopenharmony_ci 906e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 907e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT 908e5c31af7Sopenharmony_ci 909e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 910e5c31af7Sopenharmony_ciFor the subpass shading pipeline, the following stages occur in this order: 911e5c31af7Sopenharmony_ci 912e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI 913e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 914e5c31af7Sopenharmony_ci 915e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 916e5c31af7Sopenharmony_ciFor graphics pipeline commands executing in a render pass with a fragment 917e5c31af7Sopenharmony_cidensity map attachment, the following pipeline stage where the fragment 918e5c31af7Sopenharmony_cidensity map read happens has no particular order relative to the other 919e5c31af7Sopenharmony_cistages, except that it is logically earlier than 920e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT: 921e5c31af7Sopenharmony_ci 922e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT 923e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT 924e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 925e5c31af7Sopenharmony_ci 926e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 927e5c31af7Sopenharmony_ciThe conditional rendering stage is formally part of both the graphics, and 928e5c31af7Sopenharmony_cithe compute pipeline. 929e5c31af7Sopenharmony_ciThe pipeline stage where the predicate read happens has unspecified order 930e5c31af7Sopenharmony_cirelative to other stages of these pipelines: 931e5c31af7Sopenharmony_ci 932e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT 933e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 934e5c31af7Sopenharmony_ci 935e5c31af7Sopenharmony_ciFor the transfer pipeline, the following stages occur in this order: 936e5c31af7Sopenharmony_ci 937e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_TRANSFER_BIT 938e5c31af7Sopenharmony_ci 939e5c31af7Sopenharmony_ciFor host operations, only one pipeline stage occurs, so no order is 940e5c31af7Sopenharmony_ciguaranteed: 941e5c31af7Sopenharmony_ci 942e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_HOST_BIT 943e5c31af7Sopenharmony_ci 944e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 945e5c31af7Sopenharmony_ciFor the command preprocessing pipeline, the following stages occur in this 946e5c31af7Sopenharmony_ciorder: 947e5c31af7Sopenharmony_ci 948e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV 949e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 950e5c31af7Sopenharmony_ci 951e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 952e5c31af7Sopenharmony_ciFor acceleration structure operations, only one pipeline stage occurs, so no 953e5c31af7Sopenharmony_ciorder is guaranteed: 954e5c31af7Sopenharmony_ci 955e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 956e5c31af7Sopenharmony_ci 957e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 958e5c31af7Sopenharmony_ci 959e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 960e5c31af7Sopenharmony_ciFor the ray tracing pipeline, the following stages occur in this order: 961e5c31af7Sopenharmony_ci 962e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 963e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR 964e5c31af7Sopenharmony_ci 965e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 966e5c31af7Sopenharmony_ci 967e5c31af7Sopenharmony_ci 968e5c31af7Sopenharmony_ci[[synchronization-access-types]] 969e5c31af7Sopenharmony_ci=== Access Types 970e5c31af7Sopenharmony_ci 971e5c31af7Sopenharmony_ciMemory in Vulkan can: be accessed from within shader invocations and via 972e5c31af7Sopenharmony_cisome fixed-function stages of the pipeline. 973e5c31af7Sopenharmony_ciThe _access type_ is a function of the <<descriptorsets, descriptor type>> 974e5c31af7Sopenharmony_ciused, or how a fixed-function stage accesses memory. 975e5c31af7Sopenharmony_ci 976e5c31af7Sopenharmony_ci[[synchronization-access-masks]] 977e5c31af7Sopenharmony_ciSome synchronization commands take sets of access types as parameters to 978e5c31af7Sopenharmony_cidefine the <<synchronization-dependencies-access-scopes, access scopes>> of 979e5c31af7Sopenharmony_cia memory dependency. 980e5c31af7Sopenharmony_ciIf a synchronization command includes a _source access mask_, its first 981e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> only includes 982e5c31af7Sopenharmony_ciaccesses via the access types specified in that mask. 983e5c31af7Sopenharmony_ciSimilarly, if a synchronization command includes a _destination access 984e5c31af7Sopenharmony_cimask_, its second <<synchronization-dependencies-access-scopes, access 985e5c31af7Sopenharmony_ciscope>> only includes accesses via the access types specified in that mask. 986e5c31af7Sopenharmony_ci 987e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 988e5c31af7Sopenharmony_ci[open,refpage='VkAccessFlagBits2KHR',desc='Access flags for VkAccessFlags2KHR',type='enums'] 989e5c31af7Sopenharmony_ci-- 990e5c31af7Sopenharmony_ciBits which can: be set in the pname:srcAccessMask and pname:dstAccessMask 991e5c31af7Sopenharmony_cimembers of slink:VkMemoryBarrier2KHR, slink:VkImageMemoryBarrier2KHR, and 992e5c31af7Sopenharmony_cislink:VkBufferMemoryBarrier2KHR, specifying access behavior, are: 993e5c31af7Sopenharmony_ci 994e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkAccessFlagBits2KHR.txt[] 995e5c31af7Sopenharmony_ci 996e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_NONE_KHR specifies no accesses. 997e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_MEMORY_READ_BIT_KHR specifies all read accesses. 998e5c31af7Sopenharmony_ci It is always valid in any access mask, and is treated as equivalent to 999e5c31af7Sopenharmony_ci setting all etext:READ access flags that are valid where it is used. 1000e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_MEMORY_WRITE_BIT_KHR specifies all write accesses. 1001e5c31af7Sopenharmony_ci It is always valid in any access mask, and is treated as equivalent to 1002e5c31af7Sopenharmony_ci setting all etext:WRITE access flags that are valid where it is used. 1003e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR specifies read access to 1004e5c31af7Sopenharmony_ci command data read from indirect buffers as part of an indirect 1005e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[build,] 1006e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[trace,] 1007e5c31af7Sopenharmony_ci drawing or dispatch command. 1008e5c31af7Sopenharmony_ci Such access occurs in the 1009e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR pipeline stage. 1010e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_INDEX_READ_BIT_KHR specifies read access to an index 1011e5c31af7Sopenharmony_ci buffer as part of an indexed drawing command, bound by 1012e5c31af7Sopenharmony_ci flink:vkCmdBindIndexBuffer. 1013e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR 1014e5c31af7Sopenharmony_ci pipeline stage. 1015e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR specifies read access to 1016e5c31af7Sopenharmony_ci a vertex buffer as part of a drawing command, bound by 1017e5c31af7Sopenharmony_ci flink:vkCmdBindVertexBuffers. 1018e5c31af7Sopenharmony_ci Such access occurs in the 1019e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR pipeline stage. 1020e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_UNIFORM_READ_BIT_KHR specifies read access to a 1021e5c31af7Sopenharmony_ci <<descriptorsets-uniformbuffer, uniform buffer>> in any shader pipeline 1022e5c31af7Sopenharmony_ci stage. 1023e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR specifies read access to 1024e5c31af7Sopenharmony_ci an <<renderpass, input attachment>> within a render pass during 1025e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 1026e5c31af7Sopenharmony_ci subpass shading or 1027e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 1028e5c31af7Sopenharmony_ci fragment shading. 1029e5c31af7Sopenharmony_ci Such access occurs in the 1030e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 1031e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI or 1032e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 1033e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR pipeline stage. 1034e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR specifies read access to a 1035e5c31af7Sopenharmony_ci <<descriptorsets-uniformtexelbuffer, uniform texel buffer>> or 1036e5c31af7Sopenharmony_ci <<descriptorsets-sampledimage, sampled image>> in any shader pipeline 1037e5c31af7Sopenharmony_ci stage. 1038e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR specifies read access to a 1039e5c31af7Sopenharmony_ci <<descriptorsets-storagebuffer, storage buffer>>, 1040e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_buffer_device_address[] 1041e5c31af7Sopenharmony_ci <<descriptorsets-physical-storage-buffer, physical storage buffer>>, 1042e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_buffer_device_address[] 1043e5c31af7Sopenharmony_ci <<descriptorsets-storagetexelbuffer, storage texel buffer>>, or 1044e5c31af7Sopenharmony_ci <<descriptorsets-storageimage, storage image>> in any shader pipeline 1045e5c31af7Sopenharmony_ci stage. 1046e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_SHADER_READ_BIT_KHR 1047e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1048e5c31af7Sopenharmony_ci specifies read access to a <<shader-binding-table, shader binding 1049e5c31af7Sopenharmony_ci table>> in any shader pipeline. 1050e5c31af7Sopenharmony_ci In addition, it 1051e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1052e5c31af7Sopenharmony_ci is equivalent to the logical OR of: 1053e5c31af7Sopenharmony_ci ** ename:VK_ACCESS_2_UNIFORM_READ_BIT_KHR 1054e5c31af7Sopenharmony_ci ** ename:VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR 1055e5c31af7Sopenharmony_ci ** ename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR 1056e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR specifies write access to 1057e5c31af7Sopenharmony_ci a <<descriptorsets-storagebuffer, storage buffer>>, 1058e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_buffer_device_address[] 1059e5c31af7Sopenharmony_ci <<descriptorsets-physical-storage-buffer, physical storage buffer>>, 1060e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_buffer_device_address[] 1061e5c31af7Sopenharmony_ci <<descriptorsets-storagetexelbuffer, storage texel buffer>>, or 1062e5c31af7Sopenharmony_ci <<descriptorsets-storageimage, storage image>> in any shader pipeline 1063e5c31af7Sopenharmony_ci stage. 1064e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_SHADER_WRITE_BIT_KHR is equivalent to 1065e5c31af7Sopenharmony_ci ename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR. 1066e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR specifies read access to 1067e5c31af7Sopenharmony_ci a <<renderpass, color attachment>>, such as via <<framebuffer-blending, 1068e5c31af7Sopenharmony_ci blending>>, <<framebuffer-logicop, logic operations>>, or via certain 1069e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load operations>>. 1070e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[] 1071e5c31af7Sopenharmony_ci It does not include <<framebuffer-blend-advanced, advanced blend 1072e5c31af7Sopenharmony_ci operations>>. 1073e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[] 1074e5c31af7Sopenharmony_ci Such access occurs in the 1075e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR pipeline 1076e5c31af7Sopenharmony_ci stage. 1077e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR specifies write access 1078e5c31af7Sopenharmony_ci to a 1079e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1080e5c31af7Sopenharmony_ci <<renderpass, color or resolve attachment>> 1081e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1082e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1083e5c31af7Sopenharmony_ci <<renderpass, color, resolve, or depth/stencil resolve attachment>> 1084e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1085e5c31af7Sopenharmony_ci during a <<renderpass, render pass>> or via certain 1086e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load and store operations>>. 1087e5c31af7Sopenharmony_ci Such access occurs in the 1088e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR pipeline 1089e5c31af7Sopenharmony_ci stage. 1090e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR specifies read 1091e5c31af7Sopenharmony_ci access to a <<renderpass, depth/stencil attachment>>, via 1092e5c31af7Sopenharmony_ci <<fragops-ds-state, depth or stencil operations>> or via certain 1093e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load operations>>. 1094e5c31af7Sopenharmony_ci Such access occurs in the 1095e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR or 1096e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR pipeline stages. 1097e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR specifies write 1098e5c31af7Sopenharmony_ci access to a <<renderpass, depth/stencil attachment>>, via 1099e5c31af7Sopenharmony_ci <<fragops-ds-state, depth or stencil operations>> or via certain 1100e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load and store operations>>. 1101e5c31af7Sopenharmony_ci Such access occurs in the 1102e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR or 1103e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR pipeline stages. 1104e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_TRANSFER_READ_BIT_KHR specifies read access to an 1105e5c31af7Sopenharmony_ci image or buffer in a <<copies, copy>> operation. 1106e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_COPY_BIT_KHR, 1107e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_BLIT_BIT_KHR, or 1108e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR pipeline stages. 1109e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR specifies write access to an 1110e5c31af7Sopenharmony_ci image or buffer in a <<clears, clear>> or <<copies, copy>> operation. 1111e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_COPY_BIT_KHR, 1112e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_BLIT_BIT_KHR, 1113e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR, or 1114e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR pipeline stages. 1115e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_HOST_READ_BIT_KHR specifies read access by a host 1116e5c31af7Sopenharmony_ci operation. 1117e5c31af7Sopenharmony_ci Accesses of this type are not performed through a resource, but directly 1118e5c31af7Sopenharmony_ci on memory. 1119e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR 1120e5c31af7Sopenharmony_ci pipeline stage. 1121e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_HOST_WRITE_BIT_KHR specifies write access by a host 1122e5c31af7Sopenharmony_ci operation. 1123e5c31af7Sopenharmony_ci Accesses of this type are not performed through a resource, but directly 1124e5c31af7Sopenharmony_ci on memory. 1125e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR 1126e5c31af7Sopenharmony_ci pipeline stage. 1127e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 1128e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_CONDITIONAL_RENDERING_READ_BIT_EXT specifies read 1129e5c31af7Sopenharmony_ci access to a predicate as part of conditional rendering. 1130e5c31af7Sopenharmony_ci Such access occurs in the 1131e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT pipeline stage. 1132e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 1133e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 1134e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT specifies write 1135e5c31af7Sopenharmony_ci access to a transform feedback buffer made when transform feedback is 1136e5c31af7Sopenharmony_ci active. 1137e5c31af7Sopenharmony_ci Such access occurs in the 1138e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT pipeline stage. 1139e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT specifies read 1140e5c31af7Sopenharmony_ci access to a transform feedback counter buffer which is read when 1141e5c31af7Sopenharmony_ci flink:vkCmdBeginTransformFeedbackEXT executes. 1142e5c31af7Sopenharmony_ci Such access occurs in the 1143e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT pipeline stage. 1144e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT specifies 1145e5c31af7Sopenharmony_ci write access to a transform feedback counter buffer which is written 1146e5c31af7Sopenharmony_ci when flink:vkCmdEndTransformFeedbackEXT executes. 1147e5c31af7Sopenharmony_ci Such access occurs in the 1148e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT pipeline stage. 1149e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 1150e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 1151e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_COMMAND_PREPROCESS_READ_BIT_NV specifies reads from 1152e5c31af7Sopenharmony_ci buffer inputs to flink:vkCmdPreprocessGeneratedCommandsNV. 1153e5c31af7Sopenharmony_ci Such access occurs in the 1154e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV pipeline stage. 1155e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_COMMAND_PREPROCESS_WRITE_BIT_NV specifies writes to 1156e5c31af7Sopenharmony_ci the target command buffer preprocess outputs. 1157e5c31af7Sopenharmony_ci Such access occurs in the 1158e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV pipeline stage. 1159e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 1160e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[] 1161e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT specifies 1162e5c31af7Sopenharmony_ci read access to <<renderpass, color attachments>>, including 1163e5c31af7Sopenharmony_ci <<framebuffer-blend-advanced,advanced blend operations>>. 1164e5c31af7Sopenharmony_ci Such access occurs in the 1165e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR pipeline 1166e5c31af7Sopenharmony_ci stage. 1167e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[] 1168e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_invocation_mask[] 1169e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI specifies read access 1170e5c31af7Sopenharmony_ci to a invocation mask image in the 1171e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI pipeline stage. 1172e5c31af7Sopenharmony_ciendif::VK_HUAWEI_invocation_mask[] 1173e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 1174e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR specifies read 1175e5c31af7Sopenharmony_ci access to an acceleration structure as part of a trace, build, or copy 1176e5c31af7Sopenharmony_ci command, or to an <<acceleration-structure-scratch, acceleration 1177e5c31af7Sopenharmony_ci structure scratch buffer>> as part of a build command. 1178e5c31af7Sopenharmony_ci Such access occurs in the 1179e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 1180e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR pipeline stage or 1181e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 1182e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR pipeline 1183e5c31af7Sopenharmony_ci stage. 1184e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR specifies write 1185e5c31af7Sopenharmony_ci access to an acceleration structure or <<acceleration-structure-scratch, 1186e5c31af7Sopenharmony_ci acceleration structure scratch buffer>> as part of a build or copy 1187e5c31af7Sopenharmony_ci command. 1188e5c31af7Sopenharmony_ci Such access occurs in the 1189e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR pipeline 1190e5c31af7Sopenharmony_ci stage. 1191e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 1192e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1193e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT specifies read 1194e5c31af7Sopenharmony_ci access to a <<renderpass-fragmentdensitymapattachment, fragment density 1195e5c31af7Sopenharmony_ci map attachment>> during dynamic <<fragmentdensitymapops, fragment 1196e5c31af7Sopenharmony_ci density map operations>>. 1197e5c31af7Sopenharmony_ci Such access occurs in the 1198e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT pipeline 1199e5c31af7Sopenharmony_ci stage. 1200e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1201e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 1202e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR 1203e5c31af7Sopenharmony_ci specifies read access to a fragment shading rate attachment during 1204e5c31af7Sopenharmony_ci rasterization. 1205e5c31af7Sopenharmony_ci Such access occurs in the 1206e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 1207e5c31af7Sopenharmony_ci pipeline stage. 1208e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 1209e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 1210e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV specifies read access 1211e5c31af7Sopenharmony_ci to a shading rate image during rasterization. 1212e5c31af7Sopenharmony_ci Such access occurs in the 1213e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV pipeline stage. 1214e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 1215e5c31af7Sopenharmony_ci It is equivalent to 1216e5c31af7Sopenharmony_ci ename:VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR. 1217e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 1218e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 1219e5c31af7Sopenharmony_ciifdef::VK_KHR_video_decode_queue[] 1220e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR specifies read access to an 1221e5c31af7Sopenharmony_ci image or buffer resource as part of a <<video-decode-operations, video 1222e5c31af7Sopenharmony_ci decode operation>>. 1223e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR 1224e5c31af7Sopenharmony_ci pipeline stage. 1225e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR specifies write access to 1226e5c31af7Sopenharmony_ci an image or buffer resource as part of a <<video-decode-operations, 1227e5c31af7Sopenharmony_ci video decode operation>>. 1228e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR 1229e5c31af7Sopenharmony_ci pipeline stage. 1230e5c31af7Sopenharmony_ciendif::VK_KHR_video_decode_queue[] 1231e5c31af7Sopenharmony_ciifdef::VK_KHR_video_encode_queue[] 1232e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_VIDEO_ENCODE_READ_BIT_KHR specifies read access to an 1233e5c31af7Sopenharmony_ci image or buffer resource as part of a <<video-encode-operations, video 1234e5c31af7Sopenharmony_ci encode operation>>. 1235e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR 1236e5c31af7Sopenharmony_ci pipeline stage. 1237e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_VIDEO_ENCODE_WRITE_BIT_KHR specifies write access to 1238e5c31af7Sopenharmony_ci an image or buffer resource as part of a <<video-encode-operations, 1239e5c31af7Sopenharmony_ci video encode operation>>. 1240e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR 1241e5c31af7Sopenharmony_ci pipeline stage. 1242e5c31af7Sopenharmony_ciendif::VK_KHR_video_encode_queue[] 1243e5c31af7Sopenharmony_ci 1244e5c31af7Sopenharmony_ci[NOTE] 1245e5c31af7Sopenharmony_ci.Note 1246e5c31af7Sopenharmony_ci==== 1247e5c31af7Sopenharmony_ciIn situations where an application wishes to select all access types for a 1248e5c31af7Sopenharmony_cigiven set of pipeline stages, ename:VK_ACCESS_2_MEMORY_READ_BIT_KHR or 1249e5c31af7Sopenharmony_ciename:VK_ACCESS_2_MEMORY_WRITE_BIT_KHR can be used. 1250e5c31af7Sopenharmony_ciThis is particularly useful when specifying stages that only have a single 1251e5c31af7Sopenharmony_ciaccess type. 1252e5c31af7Sopenharmony_ci==== 1253e5c31af7Sopenharmony_ci 1254e5c31af7Sopenharmony_ci[NOTE] 1255e5c31af7Sopenharmony_ci.Note 1256e5c31af7Sopenharmony_ci==== 1257e5c31af7Sopenharmony_ciThe tname:VkAccessFlags2KHR bitmask goes beyond the 31 individual bit flags 1258e5c31af7Sopenharmony_ciallowable within a C99 enum, which is how elink:VkAccessFlagBits is defined. 1259e5c31af7Sopenharmony_ciThe first 31 values are common to both, and are interchangeable. 1260e5c31af7Sopenharmony_ci==== 1261e5c31af7Sopenharmony_ci-- 1262e5c31af7Sopenharmony_ci 1263e5c31af7Sopenharmony_ci[open,refpage='VkAccessFlags2KHR',desc='64-bit mask of access flags',type='flags'] 1264e5c31af7Sopenharmony_ci-- 1265e5c31af7Sopenharmony_citname:VkAccessFlags2KHR is a bitmask type for setting a mask of zero or more 1266e5c31af7Sopenharmony_cielink:VkAccessFlagBits2KHR: 1267e5c31af7Sopenharmony_ci 1268e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkAccessFlags2KHR.txt[] 1269e5c31af7Sopenharmony_ci-- 1270e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1271e5c31af7Sopenharmony_ci 1272e5c31af7Sopenharmony_ci[open,refpage='VkAccessFlagBits',desc='Bitmask specifying memory access types that will participate in a memory dependency',type='enums'] 1273e5c31af7Sopenharmony_ci-- 1274e5c31af7Sopenharmony_ciBits which can: be set in the pname:srcAccessMask and pname:dstAccessMask 1275e5c31af7Sopenharmony_cimembers of slink:VkSubpassDependency, 1276e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[slink:VkSubpassDependency2,] 1277e5c31af7Sopenharmony_cislink:VkMemoryBarrier, slink:VkBufferMemoryBarrier, and 1278e5c31af7Sopenharmony_cislink:VkImageMemoryBarrier, specifying access behavior, are: 1279e5c31af7Sopenharmony_ci 1280e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkAccessFlagBits.txt[] 1281e5c31af7Sopenharmony_ci 1282e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1283e5c31af7Sopenharmony_ciThese values all have the same meaning as the equivalently named values for 1284e5c31af7Sopenharmony_citlink:VkAccessFlags2KHR. 1285e5c31af7Sopenharmony_ci 1286e5c31af7Sopenharmony_ci * ename:VK_ACCESS_NONE_KHR specifies no accesses. 1287e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1288e5c31af7Sopenharmony_ci * ename:VK_ACCESS_MEMORY_READ_BIT specifies all read accesses. 1289e5c31af7Sopenharmony_ci It is always valid in any access mask, and is treated as equivalent to 1290e5c31af7Sopenharmony_ci setting all etext:READ access flags that are valid where it is used. 1291e5c31af7Sopenharmony_ci * ename:VK_ACCESS_MEMORY_WRITE_BIT specifies all write accesses. 1292e5c31af7Sopenharmony_ci It is always valid in any access mask, and is treated as equivalent to 1293e5c31af7Sopenharmony_ci setting all etext:WRITE access flags that are valid where it is used. 1294e5c31af7Sopenharmony_ci * ename:VK_ACCESS_INDIRECT_COMMAND_READ_BIT specifies read access to 1295e5c31af7Sopenharmony_ci indirect command data read as part of an indirect 1296e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[build,] 1297e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[trace,] 1298e5c31af7Sopenharmony_ci drawing or dispatching command. 1299e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 1300e5c31af7Sopenharmony_ci pipeline stage. 1301e5c31af7Sopenharmony_ci * ename:VK_ACCESS_INDEX_READ_BIT specifies read access to an index buffer 1302e5c31af7Sopenharmony_ci as part of an indexed drawing command, bound by 1303e5c31af7Sopenharmony_ci flink:vkCmdBindIndexBuffer. 1304e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT 1305e5c31af7Sopenharmony_ci pipeline stage. 1306e5c31af7Sopenharmony_ci * ename:VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT specifies read access to a 1307e5c31af7Sopenharmony_ci vertex buffer as part of a drawing command, bound by 1308e5c31af7Sopenharmony_ci flink:vkCmdBindVertexBuffers. 1309e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT 1310e5c31af7Sopenharmony_ci pipeline stage. 1311e5c31af7Sopenharmony_ci * ename:VK_ACCESS_UNIFORM_READ_BIT specifies read access to a 1312e5c31af7Sopenharmony_ci <<descriptorsets-uniformbuffer, uniform buffer>> in any shader pipeline 1313e5c31af7Sopenharmony_ci stage. 1314e5c31af7Sopenharmony_ci * ename:VK_ACCESS_INPUT_ATTACHMENT_READ_BIT specifies read access to an 1315e5c31af7Sopenharmony_ci <<renderpass, input attachment>> within a render pass during 1316e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 1317e5c31af7Sopenharmony_ci subpass shading or 1318e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 1319e5c31af7Sopenharmony_ci fragment shading. 1320e5c31af7Sopenharmony_ci Such access occurs in the 1321e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 1322e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI or 1323e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 1324e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT pipeline stage. 1325e5c31af7Sopenharmony_ci * ename:VK_ACCESS_SHADER_READ_BIT specifies read access to a 1326e5c31af7Sopenharmony_ci <<descriptorsets-uniformbuffer, uniform buffer>>, 1327e5c31af7Sopenharmony_ci <<descriptorsets-uniformtexelbuffer, uniform texel buffer>>, 1328e5c31af7Sopenharmony_ci <<descriptorsets-sampledimage, sampled image>>, 1329e5c31af7Sopenharmony_ci <<descriptorsets-storagebuffer, storage buffer>>, 1330e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1331e5c31af7Sopenharmony_ci <<descriptorsets-physical-storage-buffer, physical storage buffer>>, 1332e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1333e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1334e5c31af7Sopenharmony_ci <<shader-binding-table, shader binding table>>, 1335e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1336e5c31af7Sopenharmony_ci <<descriptorsets-storagetexelbuffer, storage texel buffer>>, or 1337e5c31af7Sopenharmony_ci <<descriptorsets-storageimage, storage image>> in any shader pipeline 1338e5c31af7Sopenharmony_ci stage. 1339e5c31af7Sopenharmony_ci * ename:VK_ACCESS_SHADER_WRITE_BIT specifies write access to a 1340e5c31af7Sopenharmony_ci <<descriptorsets-storagebuffer, storage buffer>>, 1341e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1342e5c31af7Sopenharmony_ci <<descriptorsets-physical-storage-buffer, physical storage buffer>>, 1343e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1344e5c31af7Sopenharmony_ci <<descriptorsets-storagetexelbuffer, storage texel buffer>>, or 1345e5c31af7Sopenharmony_ci <<descriptorsets-storageimage, storage image>> in any shader pipeline 1346e5c31af7Sopenharmony_ci stage. 1347e5c31af7Sopenharmony_ci * ename:VK_ACCESS_COLOR_ATTACHMENT_READ_BIT specifies read access to a 1348e5c31af7Sopenharmony_ci <<renderpass, color attachment>>, such as via <<framebuffer-blending, 1349e5c31af7Sopenharmony_ci blending>>, <<framebuffer-logicop, logic operations>>, or via certain 1350e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load operations>>. 1351e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[] 1352e5c31af7Sopenharmony_ci It does not include <<framebuffer-blend-advanced, advanced blend 1353e5c31af7Sopenharmony_ci operations>>. 1354e5c31af7Sopenharmony_ci Such access occurs in the 1355e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage. 1356e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[] 1357e5c31af7Sopenharmony_ci * ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT specifies write access to a 1358e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1359e5c31af7Sopenharmony_ci <<renderpass, color or resolve attachment>> 1360e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1361e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1362e5c31af7Sopenharmony_ci <<renderpass, color, resolve, or depth/stencil resolve attachment>> 1363e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1364e5c31af7Sopenharmony_ci during a <<renderpass, render pass>> or via certain 1365e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load and store operations>>. 1366e5c31af7Sopenharmony_ci Such access occurs in the 1367e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage. 1368e5c31af7Sopenharmony_ci * ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT specifies read access 1369e5c31af7Sopenharmony_ci to a <<renderpass, depth/stencil attachment>>, via <<fragops-ds-state, 1370e5c31af7Sopenharmony_ci depth or stencil operations>> or via certain 1371e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load operations>>. 1372e5c31af7Sopenharmony_ci Such access occurs in the 1373e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT or 1374e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stages. 1375e5c31af7Sopenharmony_ci * ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT specifies write 1376e5c31af7Sopenharmony_ci access to a <<renderpass, depth/stencil attachment>>, via 1377e5c31af7Sopenharmony_ci <<fragops-ds-state, depth or stencil operations>> or via certain 1378e5c31af7Sopenharmony_ci <<renderpass-load-store-ops, subpass load and store operations>>. 1379e5c31af7Sopenharmony_ci Such access occurs in the 1380e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT or 1381e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stages. 1382e5c31af7Sopenharmony_ci * ename:VK_ACCESS_TRANSFER_READ_BIT specifies read access to an image or 1383e5c31af7Sopenharmony_ci buffer in a <<copies, copy>> operation. 1384e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1385e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR 1386e5c31af7Sopenharmony_ci pipeline stage. 1387e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1388e5c31af7Sopenharmony_ci * ename:VK_ACCESS_TRANSFER_WRITE_BIT specifies write access to an image or 1389e5c31af7Sopenharmony_ci buffer in a <<clears, clear>> or <<copies, copy>> operation. 1390e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1391e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR 1392e5c31af7Sopenharmony_ci pipeline stage. 1393e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1394e5c31af7Sopenharmony_ci * ename:VK_ACCESS_HOST_READ_BIT specifies read access by a host operation. 1395e5c31af7Sopenharmony_ci Accesses of this type are not performed through a resource, but directly 1396e5c31af7Sopenharmony_ci on memory. 1397e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_HOST_BIT pipeline 1398e5c31af7Sopenharmony_ci stage. 1399e5c31af7Sopenharmony_ci * ename:VK_ACCESS_HOST_WRITE_BIT specifies write access by a host 1400e5c31af7Sopenharmony_ci operation. 1401e5c31af7Sopenharmony_ci Accesses of this type are not performed through a resource, but directly 1402e5c31af7Sopenharmony_ci on memory. 1403e5c31af7Sopenharmony_ci Such access occurs in the ename:VK_PIPELINE_STAGE_HOST_BIT pipeline 1404e5c31af7Sopenharmony_ci stage. 1405e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 1406e5c31af7Sopenharmony_ci * ename:VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT specifies read access 1407e5c31af7Sopenharmony_ci to a predicate as part of conditional rendering. 1408e5c31af7Sopenharmony_ci Such access occurs in the 1409e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT pipeline stage. 1410e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 1411e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 1412e5c31af7Sopenharmony_ci * ename:VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT specifies write access 1413e5c31af7Sopenharmony_ci to a transform feedback buffer made when transform feedback is active. 1414e5c31af7Sopenharmony_ci Such access occurs in the 1415e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT pipeline stage. 1416e5c31af7Sopenharmony_ci * ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT specifies read 1417e5c31af7Sopenharmony_ci access to a transform feedback counter buffer which is read when 1418e5c31af7Sopenharmony_ci fname:vkCmdBeginTransformFeedbackEXT executes. 1419e5c31af7Sopenharmony_ci Such access occurs in the 1420e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT pipeline stage. 1421e5c31af7Sopenharmony_ci * ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT specifies write 1422e5c31af7Sopenharmony_ci access to a transform feedback counter buffer which is written when 1423e5c31af7Sopenharmony_ci fname:vkCmdEndTransformFeedbackEXT executes. 1424e5c31af7Sopenharmony_ci Such access occurs in the 1425e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT pipeline stage. 1426e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 1427e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 1428e5c31af7Sopenharmony_ci * ename:VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV specifies reads from 1429e5c31af7Sopenharmony_ci buffer inputs to flink:vkCmdPreprocessGeneratedCommandsNV. 1430e5c31af7Sopenharmony_ci Such access occurs in the 1431e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV pipeline stage. 1432e5c31af7Sopenharmony_ci * ename:VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV specifies writes to the 1433e5c31af7Sopenharmony_ci target command buffer:VkBuffer preprocess outputs in 1434e5c31af7Sopenharmony_ci flink:vkCmdPreprocessGeneratedCommandsNV. 1435e5c31af7Sopenharmony_ci Such access occurs in the 1436e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV pipeline stage. 1437e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 1438e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[] 1439e5c31af7Sopenharmony_ci * ename:VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT specifies read 1440e5c31af7Sopenharmony_ci access to <<renderpass, color attachments>>, including 1441e5c31af7Sopenharmony_ci <<framebuffer-blend-advanced,advanced blend operations>>. 1442e5c31af7Sopenharmony_ci Such access occurs in the 1443e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage. 1444e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[] 1445e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 1446e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_invocation_mask[] 1447e5c31af7Sopenharmony_ci * ename:VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI specifies read access 1448e5c31af7Sopenharmony_ci to a invocation mask image in the 1449e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI pipeline stage. 1450e5c31af7Sopenharmony_ciendif::VK_HUAWEI_invocation_mask[] 1451e5c31af7Sopenharmony_ci * ename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR specifies read 1452e5c31af7Sopenharmony_ci access to an acceleration structure as part of a trace, build, or copy 1453e5c31af7Sopenharmony_ci command, or to an <<acceleration-structure-scratch, acceleration 1454e5c31af7Sopenharmony_ci structure scratch buffer>> as part of a build command. 1455e5c31af7Sopenharmony_ci Such access occurs in the 1456e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 1457e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR pipeline stage or 1458e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 1459e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR pipeline 1460e5c31af7Sopenharmony_ci stage. 1461e5c31af7Sopenharmony_ci * ename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR specifies write 1462e5c31af7Sopenharmony_ci access to an acceleration structure or <<acceleration-structure-scratch, 1463e5c31af7Sopenharmony_ci acceleration structure scratch buffer>> as part of a build or copy 1464e5c31af7Sopenharmony_ci command. 1465e5c31af7Sopenharmony_ci Such access occurs in the 1466e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR pipeline 1467e5c31af7Sopenharmony_ci stage. 1468e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure,VK_NV_ray_tracing[] 1469e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1470e5c31af7Sopenharmony_ci * ename:VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT specifies read access 1471e5c31af7Sopenharmony_ci to a <<renderpass-fragmentdensitymapattachment, fragment density map 1472e5c31af7Sopenharmony_ci attachment>> during dynamic <<fragmentdensitymapops, fragment density 1473e5c31af7Sopenharmony_ci map operations>> Such access occurs in the 1474e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT pipeline stage. 1475e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1476e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 1477e5c31af7Sopenharmony_ci * ename:VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR specifies 1478e5c31af7Sopenharmony_ci read access to a fragment shading rate attachment during rasterization. 1479e5c31af7Sopenharmony_ci Such access occurs in the 1480e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 1481e5c31af7Sopenharmony_ci pipeline stage. 1482e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 1483e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 1484e5c31af7Sopenharmony_ci * ename:VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV specifies read access to 1485e5c31af7Sopenharmony_ci a shading rate image during rasterization. 1486e5c31af7Sopenharmony_ci Such access occurs in the 1487e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV pipeline stage. 1488e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 1489e5c31af7Sopenharmony_ci It is equivalent to 1490e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR. 1491e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 1492e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 1493e5c31af7Sopenharmony_ci 1494e5c31af7Sopenharmony_ciCertain access types are only performed by a subset of pipeline stages. 1495e5c31af7Sopenharmony_ciAny synchronization command that takes both stage masks and access masks 1496e5c31af7Sopenharmony_ciuses both to define the <<synchronization-dependencies-access-scopes, access 1497e5c31af7Sopenharmony_ciscopes>> - only the specified access types performed by the specified stages 1498e5c31af7Sopenharmony_ciare included in the access scope. 1499e5c31af7Sopenharmony_ciAn application must: not specify an access flag in a synchronization command 1500e5c31af7Sopenharmony_ciif it does not include a pipeline stage in the corresponding stage mask that 1501e5c31af7Sopenharmony_ciis able to perform accesses of that type. 1502e5c31af7Sopenharmony_ciThe following table lists, for each access flag, which pipeline stages can: 1503e5c31af7Sopenharmony_ciperform that type of access. 1504e5c31af7Sopenharmony_ci 1505e5c31af7Sopenharmony_ci[[synchronization-access-types-supported]] 1506e5c31af7Sopenharmony_ci.Supported access types 1507e5c31af7Sopenharmony_ci[cols="50,50",options="header"] 1508e5c31af7Sopenharmony_ci|==== 1509e5c31af7Sopenharmony_ci|Access flag | Supported pipeline stages 1510e5c31af7Sopenharmony_ci|ename:VK_ACCESS_INDIRECT_COMMAND_READ_BIT | ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 1511e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1512e5c31af7Sopenharmony_ci, ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1513e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1514e5c31af7Sopenharmony_ci|ename:VK_ACCESS_INDEX_READ_BIT | ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT 1515e5c31af7Sopenharmony_ci|ename:VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT 1516e5c31af7Sopenharmony_ci 1517e5c31af7Sopenharmony_ci|ename:VK_ACCESS_UNIFORM_READ_BIT | 1518e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 1519e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, 1520e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 1521e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1522e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 1523e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1524e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, or ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT 1525e5c31af7Sopenharmony_ci 1526e5c31af7Sopenharmony_ci|ename:VK_ACCESS_SHADER_READ_BIT | 1527e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1528e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, 1529e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1530e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 1531e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, 1532e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 1533e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1534e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 1535e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1536e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, or ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT 1537e5c31af7Sopenharmony_ci 1538e5c31af7Sopenharmony_ci|ename:VK_ACCESS_SHADER_WRITE_BIT | 1539e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 1540e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, 1541e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 1542e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1543e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 1544e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 1545e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, or ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT 1546e5c31af7Sopenharmony_ci 1547e5c31af7Sopenharmony_ci|ename:VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | 1548e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_subpass_shading[] 1549e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI, or 1550e5c31af7Sopenharmony_ciendif::VK_HUAWEI_subpass_shading[] 1551e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT 1552e5c31af7Sopenharmony_ci|ename:VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 1553e5c31af7Sopenharmony_ci|ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 1554e5c31af7Sopenharmony_ci|ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, or ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT 1555e5c31af7Sopenharmony_ci|ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, or ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT 1556e5c31af7Sopenharmony_ci|ename:VK_ACCESS_TRANSFER_READ_BIT | ename:VK_PIPELINE_STAGE_TRANSFER_BIT 1557e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[or ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR] 1558e5c31af7Sopenharmony_ci|ename:VK_ACCESS_TRANSFER_WRITE_BIT | ename:VK_PIPELINE_STAGE_TRANSFER_BIT 1559e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[or ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR] 1560e5c31af7Sopenharmony_ci|ename:VK_ACCESS_HOST_READ_BIT | ename:VK_PIPELINE_STAGE_HOST_BIT 1561e5c31af7Sopenharmony_ci|ename:VK_ACCESS_HOST_WRITE_BIT | ename:VK_PIPELINE_STAGE_HOST_BIT 1562e5c31af7Sopenharmony_ci|ename:VK_ACCESS_MEMORY_READ_BIT | Any 1563e5c31af7Sopenharmony_ci|ename:VK_ACCESS_MEMORY_WRITE_BIT | Any 1564e5c31af7Sopenharmony_ciifdef::VK_EXT_blend_operation_advanced[] 1565e5c31af7Sopenharmony_ci|ename:VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT | ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 1566e5c31af7Sopenharmony_ciendif::VK_EXT_blend_operation_advanced[] 1567e5c31af7Sopenharmony_ciifdef::VK_NV_device_generated_commands[] 1568e5c31af7Sopenharmony_ci|ename:VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV | ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV 1569e5c31af7Sopenharmony_ci|ename:VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV | ename:VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV 1570e5c31af7Sopenharmony_ciendif::VK_NV_device_generated_commands[] 1571e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[] 1572e5c31af7Sopenharmony_ci|ename:VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT | ename:VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT 1573e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[] 1574e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 1575e5c31af7Sopenharmony_ci|ename:VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR | ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 1576e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[] 1577e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_invocation_mask[] 1578e5c31af7Sopenharmony_ci|ename:VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI | ename:VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI 1579e5c31af7Sopenharmony_ciendif::VK_HUAWEI_invocation_mask[] 1580e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 1581e5c31af7Sopenharmony_ci|ename:VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT | ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT 1582e5c31af7Sopenharmony_ci|ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT | ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT 1583e5c31af7Sopenharmony_ci|ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT | ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT, ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT 1584e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 1585e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 1586e5c31af7Sopenharmony_ci|ename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR | 1587e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 1588e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 1589e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, 1590e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 1591e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 1592e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 1593e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 1594e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 1595e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 1596e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline,VK_KHR_ray_query[] 1597e5c31af7Sopenharmony_ci or 1598e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline,VK_KHR_ray_query[] 1599e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1600e5c31af7Sopenharmony_ci|ename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR | ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1601e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 1602e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1603e5c31af7Sopenharmony_ci|ename:VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT | ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT 1604e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1605e5c31af7Sopenharmony_ci|==== 1606e5c31af7Sopenharmony_ci-- 1607e5c31af7Sopenharmony_ci 1608e5c31af7Sopenharmony_ci[open,refpage='VkAccessFlags',desc='Bitmask of VkAccessFlagBits',type='flags'] 1609e5c31af7Sopenharmony_ci-- 1610e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkAccessFlags.txt[] 1611e5c31af7Sopenharmony_ci 1612e5c31af7Sopenharmony_citname:VkAccessFlags is a bitmask type for setting a mask of zero or more 1613e5c31af7Sopenharmony_cielink:VkAccessFlagBits. 1614e5c31af7Sopenharmony_ci-- 1615e5c31af7Sopenharmony_ci 1616e5c31af7Sopenharmony_ci 1617e5c31af7Sopenharmony_ci[[synchronization-host-access-types]] 1618e5c31af7Sopenharmony_ciIf a memory object does not have the 1619e5c31af7Sopenharmony_ciename:VK_MEMORY_PROPERTY_HOST_COHERENT_BIT property, then 1620e5c31af7Sopenharmony_ciflink:vkFlushMappedMemoryRanges must: be called in order to guarantee that 1621e5c31af7Sopenharmony_ciwrites to the memory object from the host are made available to the host 1622e5c31af7Sopenharmony_cidomain, where they can: be further made available to the device domain via a 1623e5c31af7Sopenharmony_cidomain operation. 1624e5c31af7Sopenharmony_ciSimilarly, flink:vkInvalidateMappedMemoryRanges must: be called to guarantee 1625e5c31af7Sopenharmony_cithat writes which are available to the host domain are made visible to host 1626e5c31af7Sopenharmony_cioperations. 1627e5c31af7Sopenharmony_ci 1628e5c31af7Sopenharmony_ciIf the memory object does have the 1629e5c31af7Sopenharmony_ciename:VK_MEMORY_PROPERTY_HOST_COHERENT_BIT property flag, writes to the 1630e5c31af7Sopenharmony_cimemory object from the host are automatically made available to the host 1631e5c31af7Sopenharmony_cidomain. 1632e5c31af7Sopenharmony_ciSimilarly, writes made available to the host domain are automatically made 1633e5c31af7Sopenharmony_civisible to the host. 1634e5c31af7Sopenharmony_ci 1635e5c31af7Sopenharmony_ci[NOTE] 1636e5c31af7Sopenharmony_ci.Note 1637e5c31af7Sopenharmony_ci==== 1638e5c31af7Sopenharmony_ci<<devsandqueues-submission, Queue submission commands>> automatically 1639e5c31af7Sopenharmony_ciperform a <<synchronization-submission-host-writes,domain operation from 1640e5c31af7Sopenharmony_cihost to device>> for all writes performed before the command executes, so in 1641e5c31af7Sopenharmony_cimost cases an explicit memory barrier is not needed for this case. 1642e5c31af7Sopenharmony_ciIn the few circumstances where a submit does not occur between the host 1643e5c31af7Sopenharmony_ciwrite and the device read access, writes can: be made available by using an 1644e5c31af7Sopenharmony_ciexplicit memory barrier. 1645e5c31af7Sopenharmony_ci==== 1646e5c31af7Sopenharmony_ci 1647e5c31af7Sopenharmony_ci 1648e5c31af7Sopenharmony_ci[[synchronization-framebuffer-regions]] 1649e5c31af7Sopenharmony_ci=== Framebuffer Region Dependencies 1650e5c31af7Sopenharmony_ci 1651e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, Pipeline stages>> that operate on, or 1652e5c31af7Sopenharmony_ciwith respect to, the framebuffer are collectively the _framebuffer-space_ 1653e5c31af7Sopenharmony_cipipeline stages. 1654e5c31af7Sopenharmony_ciThese stages are: 1655e5c31af7Sopenharmony_ci 1656e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT 1657e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT 1658e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT 1659e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 1660e5c31af7Sopenharmony_ci 1661e5c31af7Sopenharmony_ciFor these pipeline stages, an execution or memory dependency from the first 1662e5c31af7Sopenharmony_ciset of operations to the second set can: either be a single 1663e5c31af7Sopenharmony_ci_framebuffer-global_ dependency, or split into multiple _framebuffer-local_ 1664e5c31af7Sopenharmony_cidependencies. 1665e5c31af7Sopenharmony_ciA dependency with non-framebuffer-space pipeline stages is neither 1666e5c31af7Sopenharmony_ciframebuffer-global nor framebuffer-local. 1667e5c31af7Sopenharmony_ci 1668e5c31af7Sopenharmony_ciifndef::VK_QCOM_render_pass_shader_resolve[] 1669e5c31af7Sopenharmony_ciA _framebuffer region_ is a set of sample (x, y, layer, sample) coordinates 1670e5c31af7Sopenharmony_cithat is a subset of the entire framebuffer. 1671e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1672e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_shader_resolve[] 1673e5c31af7Sopenharmony_ciA _framebuffer region_ is a subset of the entire framebuffer, and can: 1674e5c31af7Sopenharmony_cieither be: 1675e5c31af7Sopenharmony_ci 1676e5c31af7Sopenharmony_ci * A _sample region_, which is set of sample (x, y, layer, sample) 1677e5c31af7Sopenharmony_ci coordinates that is a subset of the entire framebuffer, or 1678e5c31af7Sopenharmony_ci 1679e5c31af7Sopenharmony_ci * A _fragment region_, which is a set of fragment (x, y, layer) coordinates 1680e5c31af7Sopenharmony_ci that is a subset of the entire framebuffer. 1681e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1682e5c31af7Sopenharmony_ci 1683e5c31af7Sopenharmony_ciBoth <<synchronization-dependencies-scopes, synchronization scopes>> of a 1684e5c31af7Sopenharmony_ciframebuffer-local dependency include only the operations performed within 1685e5c31af7Sopenharmony_cicorresponding framebuffer regions (as defined below). 1686e5c31af7Sopenharmony_ciNo ordering guarantees are made between different framebuffer regions for a 1687e5c31af7Sopenharmony_ciframebuffer-local dependency. 1688e5c31af7Sopenharmony_ci 1689e5c31af7Sopenharmony_ciBoth <<synchronization-dependencies-scopes, synchronization scopes>> of a 1690e5c31af7Sopenharmony_ciframebuffer-global dependency include operations on all framebuffer-regions. 1691e5c31af7Sopenharmony_ci 1692e5c31af7Sopenharmony_ciIf the first synchronization scope includes operations on pixels/fragments 1693e5c31af7Sopenharmony_ciwith N samples and the second synchronization scope includes operations on 1694e5c31af7Sopenharmony_cipixels/fragments with M samples, where N does not equal M, then a 1695e5c31af7Sopenharmony_ciframebuffer region containing all samples at a given (x, y, layer) 1696e5c31af7Sopenharmony_cicoordinate in the first synchronization scope corresponds to a region 1697e5c31af7Sopenharmony_cicontaining all samples at the same coordinate in the second synchronization 1698e5c31af7Sopenharmony_ciscope. 1699e5c31af7Sopenharmony_ciifndef::VK_QCOM_render_pass_shader_resolve[] 1700e5c31af7Sopenharmony_ciIn other words, it is a pixel granularity dependency. 1701e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1702e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_shader_resolve[] 1703e5c31af7Sopenharmony_ciIn other words, the framebuffer region is a fragment region and it is a 1704e5c31af7Sopenharmony_cipixel granularity dependency. 1705e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1706e5c31af7Sopenharmony_ciIf N equals M, 1707e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_shader_resolve[] 1708e5c31af7Sopenharmony_ciand if the sname:VkSubpassDescription::pname:flags does not specify the 1709e5c31af7Sopenharmony_ciename:VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM flag, 1710e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1711e5c31af7Sopenharmony_cithen a framebuffer region containing a single (x, y, layer, sample) 1712e5c31af7Sopenharmony_cicoordinate in the first synchronization scope corresponds to a region 1713e5c31af7Sopenharmony_cicontaining the same sample at the same coordinate in the second 1714e5c31af7Sopenharmony_cisynchronization scope. 1715e5c31af7Sopenharmony_ciifndef::VK_QCOM_render_pass_shader_resolve[] 1716e5c31af7Sopenharmony_ciIn other words, it is a sample granularity dependency. 1717e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1718e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_shader_resolve[] 1719e5c31af7Sopenharmony_ciIn other words, the framebuffer region is a sample region and it is a sample 1720e5c31af7Sopenharmony_cigranularity dependency. 1721e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1722e5c31af7Sopenharmony_ci 1723e5c31af7Sopenharmony_ci[NOTE] 1724e5c31af7Sopenharmony_ci.Note 1725e5c31af7Sopenharmony_ci==== 1726e5c31af7Sopenharmony_ciSince fragment shader invocations are not specified to run in any particular 1727e5c31af7Sopenharmony_cigroupings, the size of a framebuffer region is implementation-dependent, not 1728e5c31af7Sopenharmony_ciknown to the application, and must: be assumed to be no larger than 1729e5c31af7Sopenharmony_cispecified above. 1730e5c31af7Sopenharmony_ci==== 1731e5c31af7Sopenharmony_ci 1732e5c31af7Sopenharmony_ci[NOTE] 1733e5c31af7Sopenharmony_ci.Note 1734e5c31af7Sopenharmony_ci==== 1735e5c31af7Sopenharmony_ciPractically, the pixel vs sample granularity dependency means that if an 1736e5c31af7Sopenharmony_ciinput attachment has a different number of samples than the pipeline's 1737e5c31af7Sopenharmony_cipname:rasterizationSamples, then a fragment can: access any sample in the 1738e5c31af7Sopenharmony_ciinput attachment's pixel even if it only uses framebuffer-local 1739e5c31af7Sopenharmony_cidependencies. 1740e5c31af7Sopenharmony_ciIf the input attachment has the same number of samples, then the fragment 1741e5c31af7Sopenharmony_cican: only access the covered samples in its input code:SampleMask (i.e. the 1742e5c31af7Sopenharmony_cifragment operations happen-after a framebuffer-local dependency for each 1743e5c31af7Sopenharmony_cisample the fragment covers). 1744e5c31af7Sopenharmony_ciTo access samples that are not covered, 1745e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_shader_resolve[] 1746e5c31af7Sopenharmony_cieither the sname:VkSubpassDescription::pname:flags 1747e5c31af7Sopenharmony_ciename:VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM flag is required, or 1748e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_shader_resolve[] 1749e5c31af7Sopenharmony_cia framebuffer-global dependency is required. 1750e5c31af7Sopenharmony_ci==== 1751e5c31af7Sopenharmony_ci 1752e5c31af7Sopenharmony_ciIf a synchronization command includes a pname:dependencyFlags parameter, and 1753e5c31af7Sopenharmony_cispecifies the ename:VK_DEPENDENCY_BY_REGION_BIT flag, then it defines 1754e5c31af7Sopenharmony_ciframebuffer-local dependencies for the framebuffer-space pipeline stages in 1755e5c31af7Sopenharmony_cithat synchronization command, for all framebuffer regions. 1756e5c31af7Sopenharmony_ciIf no pname:dependencyFlags parameter is included, or the 1757e5c31af7Sopenharmony_ciename:VK_DEPENDENCY_BY_REGION_BIT flag is not specified, then a 1758e5c31af7Sopenharmony_ciframebuffer-global dependency is specified for those stages. 1759e5c31af7Sopenharmony_ciThe ename:VK_DEPENDENCY_BY_REGION_BIT flag does not affect the dependencies 1760e5c31af7Sopenharmony_cibetween non-framebuffer-space pipeline stages, nor does it affect the 1761e5c31af7Sopenharmony_cidependencies between framebuffer-space and non-framebuffer-space pipeline 1762e5c31af7Sopenharmony_cistages. 1763e5c31af7Sopenharmony_ci 1764e5c31af7Sopenharmony_ci[NOTE] 1765e5c31af7Sopenharmony_ci.Note 1766e5c31af7Sopenharmony_ci==== 1767e5c31af7Sopenharmony_ciFramebuffer-local dependencies are more efficient for most architectures; 1768e5c31af7Sopenharmony_ciparticularly tile-based architectures - which can keep framebuffer-regions 1769e5c31af7Sopenharmony_cientirely in on-chip registers and thus avoid external bandwidth across such 1770e5c31af7Sopenharmony_cia dependency. 1771e5c31af7Sopenharmony_ciIncluding a framebuffer-global dependency in your rendering will usually 1772e5c31af7Sopenharmony_ciforce all implementations to flush data to memory, or to a higher level 1773e5c31af7Sopenharmony_cicache, breaking any potential locality optimizations. 1774e5c31af7Sopenharmony_ci==== 1775e5c31af7Sopenharmony_ci 1776e5c31af7Sopenharmony_ci 1777e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1778e5c31af7Sopenharmony_ci[[synchronization-view-local-dependencies]] 1779e5c31af7Sopenharmony_ci=== View-Local Dependencies 1780e5c31af7Sopenharmony_ci 1781e5c31af7Sopenharmony_ciIn a render pass instance that has <<renderpass-multiview,multiview>> 1782e5c31af7Sopenharmony_cienabled, dependencies can: be either view-local or view-global. 1783e5c31af7Sopenharmony_ci 1784e5c31af7Sopenharmony_ciA view-local dependency only includes operations from a single 1785e5c31af7Sopenharmony_ci<<renderpass-multiview-view-local,source view>> from the source subpass in 1786e5c31af7Sopenharmony_cithe first synchronization scope, and only includes operations from a single 1787e5c31af7Sopenharmony_ci<<renderpass-multiview-view-local,destination view>> from the destination 1788e5c31af7Sopenharmony_cisubpass in the second synchronization scope. 1789e5c31af7Sopenharmony_ciA view-global dependency includes all views in the view mask of the source 1790e5c31af7Sopenharmony_ciand destination subpasses in the corresponding synchronization scopes. 1791e5c31af7Sopenharmony_ci 1792e5c31af7Sopenharmony_ciIf a synchronization command includes a pname:dependencyFlags parameter and 1793e5c31af7Sopenharmony_cispecifies the ename:VK_DEPENDENCY_VIEW_LOCAL_BIT flag, then it defines 1794e5c31af7Sopenharmony_ciview-local dependencies for that synchronization command, for all views. 1795e5c31af7Sopenharmony_ciIf no pname:dependencyFlags parameter is included or the 1796e5c31af7Sopenharmony_ciename:VK_DEPENDENCY_VIEW_LOCAL_BIT flag is not specified, then a view-global 1797e5c31af7Sopenharmony_cidependency is specified. 1798e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 1799e5c31af7Sopenharmony_ci 1800e5c31af7Sopenharmony_ci 1801e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 1802e5c31af7Sopenharmony_ci[[synchronization-device-local-dependencies]] 1803e5c31af7Sopenharmony_ci=== Device-Local Dependencies 1804e5c31af7Sopenharmony_ci 1805e5c31af7Sopenharmony_ciDependencies can: be either device-local or non-device-local. 1806e5c31af7Sopenharmony_ciA device-local dependency acts as multiple separate dependencies, one for 1807e5c31af7Sopenharmony_cieach physical device that executes the synchronization command, where each 1808e5c31af7Sopenharmony_cidependency only includes operations from that physical device in both 1809e5c31af7Sopenharmony_cisynchronization scopes. 1810e5c31af7Sopenharmony_ciA non-device-local dependency is a single dependency where both 1811e5c31af7Sopenharmony_cisynchronization scopes include operations from all physical devices that 1812e5c31af7Sopenharmony_ciparticipate in the synchronization command. 1813e5c31af7Sopenharmony_ciFor subpass dependencies, all physical devices in the 1814e5c31af7Sopenharmony_cislink:VkDeviceGroupRenderPassBeginInfo::pname:deviceMask participate in the 1815e5c31af7Sopenharmony_cidependency, and for pipeline barriers all physical devices that are set in 1816e5c31af7Sopenharmony_cithe command buffer's current device mask participate in the dependency. 1817e5c31af7Sopenharmony_ci 1818e5c31af7Sopenharmony_ciIf a synchronization command includes a pname:dependencyFlags parameter and 1819e5c31af7Sopenharmony_cispecifies the ename:VK_DEPENDENCY_DEVICE_GROUP_BIT flag, then it defines a 1820e5c31af7Sopenharmony_cinon-device-local dependency for that synchronization command. 1821e5c31af7Sopenharmony_ciIf no pname:dependencyFlags parameter is included or the 1822e5c31af7Sopenharmony_ciename:VK_DEPENDENCY_DEVICE_GROUP_BIT flag is not specified, then it defines 1823e5c31af7Sopenharmony_cidevice-local dependencies for that synchronization command, for all 1824e5c31af7Sopenharmony_ciparticipating physical devices. 1825e5c31af7Sopenharmony_ci 1826e5c31af7Sopenharmony_ciSemaphore and event dependencies are device-local and only execute on the 1827e5c31af7Sopenharmony_cione physical device that performs the dependency. 1828e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 1829e5c31af7Sopenharmony_ci 1830e5c31af7Sopenharmony_ci 1831e5c31af7Sopenharmony_ci[[synchronization-implicit]] 1832e5c31af7Sopenharmony_ci== Implicit Synchronization Guarantees 1833e5c31af7Sopenharmony_ci 1834e5c31af7Sopenharmony_ciA small number of implicit ordering guarantees are provided by Vulkan, 1835e5c31af7Sopenharmony_ciensuring that the order in which commands are submitted is meaningful, and 1836e5c31af7Sopenharmony_ciavoiding unnecessary complexity in common operations. 1837e5c31af7Sopenharmony_ci 1838e5c31af7Sopenharmony_ci[[synchronization-submission-order]] 1839e5c31af7Sopenharmony_ci_Submission order_ is a fundamental ordering in Vulkan, giving meaning to 1840e5c31af7Sopenharmony_cithe order in which <<fundamentals-queueoperation-command-types, action and 1841e5c31af7Sopenharmony_cisynchronization commands>> are recorded and submitted to a single queue. 1842e5c31af7Sopenharmony_ciExplicit and implicit ordering guarantees between commands in Vulkan all 1843e5c31af7Sopenharmony_ciwork on the premise that this ordering is meaningful. 1844e5c31af7Sopenharmony_ciThis order does not itself define any execution or memory dependencies; 1845e5c31af7Sopenharmony_cisynchronization commands and other orderings within the API use this 1846e5c31af7Sopenharmony_ciordering to define their scopes. 1847e5c31af7Sopenharmony_ci 1848e5c31af7Sopenharmony_ciSubmission order for any given set of commands is based on the order in 1849e5c31af7Sopenharmony_ciwhich they were recorded to command buffers and then submitted. 1850e5c31af7Sopenharmony_ciThis order is determined as follows: 1851e5c31af7Sopenharmony_ci 1852e5c31af7Sopenharmony_ci . The initial order is determined by the order in which 1853e5c31af7Sopenharmony_ci flink:vkQueueSubmit 1854e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1855e5c31af7Sopenharmony_ci and flink:vkQueueSubmit2KHR 1856e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1857e5c31af7Sopenharmony_ci commands are executed on the host, for a single queue, from first to 1858e5c31af7Sopenharmony_ci last. 1859e5c31af7Sopenharmony_ci . The order in which slink:VkSubmitInfo structures are specified in the 1860e5c31af7Sopenharmony_ci pname:pSubmits parameter of flink:vkQueueSubmit, 1861e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1862e5c31af7Sopenharmony_ci or in which slink:VkSubmitInfo2KHR structures are specified in the 1863e5c31af7Sopenharmony_ci pname:pSubmits parameter of flink:vkQueueSubmit2KHR, 1864e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1865e5c31af7Sopenharmony_ci from lowest index to highest. 1866e5c31af7Sopenharmony_ci . The order in which command buffers are specified in the 1867e5c31af7Sopenharmony_ci pname:pCommandBuffers member of slink:VkSubmitInfo 1868e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1869e5c31af7Sopenharmony_ci or slink:VkSubmitInfo2KHR 1870e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1871e5c31af7Sopenharmony_ci from lowest index to highest. 1872e5c31af7Sopenharmony_ci . The order in which commands were recorded to a command buffer on the 1873e5c31af7Sopenharmony_ci host, from first to last: 1874e5c31af7Sopenharmony_ci ** For commands recorded outside a render pass, this includes all other 1875e5c31af7Sopenharmony_ci commands recorded outside a render pass, including 1876e5c31af7Sopenharmony_ci flink:vkCmdBeginRenderPass and flink:vkCmdEndRenderPass commands; it 1877e5c31af7Sopenharmony_ci does not directly include commands inside a render pass. 1878e5c31af7Sopenharmony_ci ** For commands recorded inside a render pass, this includes all other 1879e5c31af7Sopenharmony_ci commands recorded inside the same subpass, including the 1880e5c31af7Sopenharmony_ci flink:vkCmdBeginRenderPass and flink:vkCmdEndRenderPass commands that 1881e5c31af7Sopenharmony_ci delimit the same render pass instance; it does not include commands 1882e5c31af7Sopenharmony_ci recorded to other subpasses. 1883e5c31af7Sopenharmony_ci<<fundamentals-queueoperation-command-types, State commands>> do not execute 1884e5c31af7Sopenharmony_ciany operations on the device, instead they set the state of the command 1885e5c31af7Sopenharmony_cibuffer when they execute on the host, in the order that they are recorded. 1886e5c31af7Sopenharmony_ci<<fundamentals-queueoperation-command-types, Action commands>> consume the 1887e5c31af7Sopenharmony_cicurrent state of the command buffer when they are recorded, and will execute 1888e5c31af7Sopenharmony_cistate changes on the device as required to match the recorded state. 1889e5c31af7Sopenharmony_ci 1890e5c31af7Sopenharmony_ci<<queries-order, Query commands>>, <<drawing-primitive-order, the order of 1891e5c31af7Sopenharmony_ciprimitives passing through the graphics pipeline>> and 1892e5c31af7Sopenharmony_ci<<synchronization-image-barrier-layout-transition-order, image layout 1893e5c31af7Sopenharmony_citransitions as part of an image memory barrier>> provide additional 1894e5c31af7Sopenharmony_ciguarantees based on submission order. 1895e5c31af7Sopenharmony_ci 1896e5c31af7Sopenharmony_ciExecution of <<synchronization-pipeline-stages-order, pipeline stages>> 1897e5c31af7Sopenharmony_ciwithin a given command also has a loose ordering, dependent only on a single 1898e5c31af7Sopenharmony_cicommand. 1899e5c31af7Sopenharmony_ci 1900e5c31af7Sopenharmony_ci[[synchronization-signal-operation-order]] 1901e5c31af7Sopenharmony_ci_Signal operation order_ is a fundamental ordering in Vulkan, giving meaning 1902e5c31af7Sopenharmony_cito the order in which semaphore and fence signal operations occur when 1903e5c31af7Sopenharmony_cisubmitted to a single queue. 1904e5c31af7Sopenharmony_ciThe signal operation order for queue operations is determined as follows: 1905e5c31af7Sopenharmony_ci 1906e5c31af7Sopenharmony_ci . The initial order is determined by the order in which 1907e5c31af7Sopenharmony_ci flink:vkQueueSubmit 1908e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1909e5c31af7Sopenharmony_ci and flink:vkQueueSubmit2KHR 1910e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1911e5c31af7Sopenharmony_ci commands are executed on the host, for a single queue, from first to 1912e5c31af7Sopenharmony_ci last. 1913e5c31af7Sopenharmony_ci . The order in which slink:VkSubmitInfo structures are specified in the 1914e5c31af7Sopenharmony_ci pname:pSubmits parameter of flink:vkQueueSubmit, 1915e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1916e5c31af7Sopenharmony_ci or in which slink:VkSubmitInfo2KHR structures are specified in the 1917e5c31af7Sopenharmony_ci pname:pSubmits parameter of flink:vkQueueSubmit2KHR, 1918e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1919e5c31af7Sopenharmony_ci from lowest index to highest. 1920e5c31af7Sopenharmony_ci . The fence signal operation defined by the pname:fence parameter of a 1921e5c31af7Sopenharmony_ci flink:vkQueueSubmit, 1922e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1923e5c31af7Sopenharmony_ci flink:vkQueueSubmit2KHR, 1924e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1925e5c31af7Sopenharmony_ci or flink:vkQueueBindSparse command is ordered after all semaphore signal 1926e5c31af7Sopenharmony_ci operations defined by that command. 1927e5c31af7Sopenharmony_ci 1928e5c31af7Sopenharmony_ciSemaphore signal operations defined by a single slink:VkSubmitInfo, 1929e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1930e5c31af7Sopenharmony_cislink:VkSubmitInfo2KHR, 1931e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1932e5c31af7Sopenharmony_cior slink:VkBindSparseInfo structure are unordered with respect to other 1933e5c31af7Sopenharmony_cisemaphore signal operations defined within the same structure. 1934e5c31af7Sopenharmony_ci 1935e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 1936e5c31af7Sopenharmony_ciThe flink:vkSignalSemaphore command does not execute on a queue but instead 1937e5c31af7Sopenharmony_ciperforms the signal operation from the host. 1938e5c31af7Sopenharmony_ciThe semaphore signal operation defined by executing a 1939e5c31af7Sopenharmony_ciflink:vkSignalSemaphore command happens-after the flink:vkSignalSemaphore 1940e5c31af7Sopenharmony_cicommand is invoked and happens-before the command returns. 1941e5c31af7Sopenharmony_ci 1942e5c31af7Sopenharmony_ci[NOTE] 1943e5c31af7Sopenharmony_ci.Note 1944e5c31af7Sopenharmony_ci==== 1945e5c31af7Sopenharmony_ciWhen signaling timeline semaphores, it is the responsibility of the 1946e5c31af7Sopenharmony_ciapplication to ensure that they are ordered such that the semaphore value is 1947e5c31af7Sopenharmony_cistrictly increasing. 1948e5c31af7Sopenharmony_ciBecause the first synchronization scope for a semaphore signal operation 1949e5c31af7Sopenharmony_cicontains all semaphore signal operations which occur earlier in submission 1950e5c31af7Sopenharmony_ciorder, all semaphore signal operations contained in any given batch are 1951e5c31af7Sopenharmony_ciguaranteed to happen-after all semaphore signal operations contained in any 1952e5c31af7Sopenharmony_ciprevious batches. 1953e5c31af7Sopenharmony_ciHowever, no ordering guarantee is provided between the semaphore signal 1954e5c31af7Sopenharmony_cioperations defined within a single batch. 1955e5c31af7Sopenharmony_ciThis, combined with the requirement that timeline semaphore values strictly 1956e5c31af7Sopenharmony_ciincrease, means that it is invalid to signal the same timeline semaphore 1957e5c31af7Sopenharmony_citwice within a single batch. 1958e5c31af7Sopenharmony_ci 1959e5c31af7Sopenharmony_ciIf an application wishes to ensure that some semaphore signal operation 1960e5c31af7Sopenharmony_cihappens-after some other semaphore signal operation, it can submit a 1961e5c31af7Sopenharmony_ciseparate batch containing only semaphore signal operations, which will 1962e5c31af7Sopenharmony_cihappen-after the semaphore signal operations in any earlier batches. 1963e5c31af7Sopenharmony_ci 1964e5c31af7Sopenharmony_ciWhen signaling a semaphore from the host, the only ordering guarantee is 1965e5c31af7Sopenharmony_cithat the signal operation happens-after when flink:vkSignalSemaphore is 1966e5c31af7Sopenharmony_cicalled and happens-before it returns. 1967e5c31af7Sopenharmony_ciTherefore, it is invalid to call fname:vkSignalSemaphore while there are any 1968e5c31af7Sopenharmony_cioutstanding signal operations on that semaphore from any queue submissions 1969e5c31af7Sopenharmony_ciunless those queue submissions have some dependency which ensures that they 1970e5c31af7Sopenharmony_cihappen-after the host signal operation. 1971e5c31af7Sopenharmony_ciOne example of this would be if the pending signal operation is, itself, 1972e5c31af7Sopenharmony_ciwaiting on the same semaphore at a lower value and the call to 1973e5c31af7Sopenharmony_cifname:vkSignalSemaphore signals that lower value. 1974e5c31af7Sopenharmony_ciFurthermore, if there are two or more processes or threads signaling the 1975e5c31af7Sopenharmony_cisame timeline semaphore from the host, the application must ensure that the 1976e5c31af7Sopenharmony_cifname:vkSignalSemaphore with the lower semaphore value returns before 1977e5c31af7Sopenharmony_cifname:vkSignalSemaphore is called with the higher value. 1978e5c31af7Sopenharmony_ci==== 1979e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 1980e5c31af7Sopenharmony_ci 1981e5c31af7Sopenharmony_ci 1982e5c31af7Sopenharmony_ci[[synchronization-fences]] 1983e5c31af7Sopenharmony_ci== Fences 1984e5c31af7Sopenharmony_ci 1985e5c31af7Sopenharmony_ci[open,refpage='VkFence',desc='Opaque handle to a fence object',type='handles'] 1986e5c31af7Sopenharmony_ci-- 1987e5c31af7Sopenharmony_ciFences are a synchronization primitive that can: be used to insert a 1988e5c31af7Sopenharmony_cidependency from a queue to the host. 1989e5c31af7Sopenharmony_ciFences have two states - signaled and unsignaled. 1990e5c31af7Sopenharmony_ciA fence can: be signaled as part of the execution of a 1991e5c31af7Sopenharmony_ci<<devsandqueues-submission, queue submission>> command. 1992e5c31af7Sopenharmony_ciFences can: be unsignaled on the host with flink:vkResetFences. 1993e5c31af7Sopenharmony_ciFences can: be waited on by the host with the flink:vkWaitForFences command, 1994e5c31af7Sopenharmony_ciand the current state can: be queried with flink:vkGetFenceStatus. 1995e5c31af7Sopenharmony_ci 1996e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_fence[] 1997e5c31af7Sopenharmony_ci[[synchronization-fences-payloads]] 1998e5c31af7Sopenharmony_ciThe internal data of a fence may: include a reference to any resources and 1999e5c31af7Sopenharmony_cipending work associated with signal or unsignal operations performed on that 2000e5c31af7Sopenharmony_cifence object, collectively referred to as the fence's _payload_. 2001e5c31af7Sopenharmony_ciMechanisms to import and export that internal data to and from fences are 2002e5c31af7Sopenharmony_ciprovided <<VkExportFenceCreateInfo, below>>. 2003e5c31af7Sopenharmony_ciThese mechanisms indirectly enable applications to share fence state between 2004e5c31af7Sopenharmony_citwo or more fences and other synchronization primitives across process and 2005e5c31af7Sopenharmony_ciAPI boundaries. 2006e5c31af7Sopenharmony_ci 2007e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_fence[] 2008e5c31af7Sopenharmony_ci 2009e5c31af7Sopenharmony_ciFences are represented by sname:VkFence handles: 2010e5c31af7Sopenharmony_ci 2011e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkFence.txt[] 2012e5c31af7Sopenharmony_ci-- 2013e5c31af7Sopenharmony_ci 2014e5c31af7Sopenharmony_ci[open,refpage='vkCreateFence',desc='Create a new fence object',type='protos'] 2015e5c31af7Sopenharmony_ci-- 2016e5c31af7Sopenharmony_ciTo create a fence, call: 2017e5c31af7Sopenharmony_ci 2018e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateFence.txt[] 2019e5c31af7Sopenharmony_ci 2020e5c31af7Sopenharmony_ci * pname:device is the logical device that creates the fence. 2021e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkFenceCreateInfo structure 2022e5c31af7Sopenharmony_ci containing information about how the fence is to be created. 2023e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 2024e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 2025e5c31af7Sopenharmony_ci * pname:pFence is a pointer to a handle in which the resulting fence 2026e5c31af7Sopenharmony_ci object is returned. 2027e5c31af7Sopenharmony_ci 2028e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateFence.txt[] 2029e5c31af7Sopenharmony_ci-- 2030e5c31af7Sopenharmony_ci 2031e5c31af7Sopenharmony_ci[open,refpage='VkFenceCreateInfo',desc='Structure specifying parameters of a newly created fence',type='structs'] 2032e5c31af7Sopenharmony_ci-- 2033e5c31af7Sopenharmony_ciThe sname:VkFenceCreateInfo structure is defined as: 2034e5c31af7Sopenharmony_ci 2035e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkFenceCreateInfo.txt[] 2036e5c31af7Sopenharmony_ci 2037e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2038e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2039e5c31af7Sopenharmony_ci structure. 2040e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkFenceCreateFlagBits specifying the 2041e5c31af7Sopenharmony_ci initial state and behavior of the fence. 2042e5c31af7Sopenharmony_ci 2043e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkFenceCreateInfo.txt[] 2044e5c31af7Sopenharmony_ci-- 2045e5c31af7Sopenharmony_ci 2046e5c31af7Sopenharmony_ci[open,refpage='VkFenceCreateFlagBits',desc='Bitmask specifying initial state and behavior of a fence',type='enums'] 2047e5c31af7Sopenharmony_ci-- 2048e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkFenceCreateFlagBits.txt[] 2049e5c31af7Sopenharmony_ci 2050e5c31af7Sopenharmony_ci * ename:VK_FENCE_CREATE_SIGNALED_BIT specifies that the fence object is 2051e5c31af7Sopenharmony_ci created in the signaled state. 2052e5c31af7Sopenharmony_ci Otherwise, it is created in the unsignaled state. 2053e5c31af7Sopenharmony_ci-- 2054e5c31af7Sopenharmony_ci 2055e5c31af7Sopenharmony_ci[open,refpage='VkFenceCreateFlags',desc='Bitmask of VkFenceCreateFlagBits',type='flags'] 2056e5c31af7Sopenharmony_ci-- 2057e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkFenceCreateFlags.txt[] 2058e5c31af7Sopenharmony_ci 2059e5c31af7Sopenharmony_citname:VkFenceCreateFlags is a bitmask type for setting a mask of zero or 2060e5c31af7Sopenharmony_cimore elink:VkFenceCreateFlagBits. 2061e5c31af7Sopenharmony_ci-- 2062e5c31af7Sopenharmony_ci 2063e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_fence[] 2064e5c31af7Sopenharmony_ci[open,refpage='VkExportFenceCreateInfo',desc='Structure specifying handle types that can be exported from a fence',type='structs'] 2065e5c31af7Sopenharmony_ci-- 2066e5c31af7Sopenharmony_ciTo create a fence whose payload can: be exported to external handles, add a 2067e5c31af7Sopenharmony_cislink:VkExportFenceCreateInfo structure to the pname:pNext chain of the 2068e5c31af7Sopenharmony_cislink:VkFenceCreateInfo structure. 2069e5c31af7Sopenharmony_ciThe sname:VkExportFenceCreateInfo structure is defined as: 2070e5c31af7Sopenharmony_ci 2071e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExportFenceCreateInfo.txt[] 2072e5c31af7Sopenharmony_ci 2073e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence[] 2074e5c31af7Sopenharmony_cior the equivalent 2075e5c31af7Sopenharmony_ci 2076e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExportFenceCreateInfoKHR.txt[] 2077e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence[] 2078e5c31af7Sopenharmony_ci 2079e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2080e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2081e5c31af7Sopenharmony_ci structure. 2082e5c31af7Sopenharmony_ci * pname:handleTypes is a bitmask of 2083e5c31af7Sopenharmony_ci elink:VkExternalFenceHandleTypeFlagBits specifying one or more fence 2084e5c31af7Sopenharmony_ci handle types the application can: export from the resulting fence. 2085e5c31af7Sopenharmony_ci The application can: request multiple handle types for the same fence. 2086e5c31af7Sopenharmony_ci 2087e5c31af7Sopenharmony_ci.Valid Usage 2088e5c31af7Sopenharmony_ci**** 2089e5c31af7Sopenharmony_ci * [[VUID-VkExportFenceCreateInfo-handleTypes-01446]] 2090e5c31af7Sopenharmony_ci The bits in pname:handleTypes must: be supported and compatible, as 2091e5c31af7Sopenharmony_ci reported by slink:VkExternalFenceProperties 2092e5c31af7Sopenharmony_ci**** 2093e5c31af7Sopenharmony_ci 2094e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkExportFenceCreateInfo.txt[] 2095e5c31af7Sopenharmony_ci-- 2096e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_fence[] 2097e5c31af7Sopenharmony_ci 2098e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32[] 2099e5c31af7Sopenharmony_ci[open,refpage='VkExportFenceWin32HandleInfoKHR',desc='Structure specifying additional attributes of Windows handles exported from a fence',type='structs'] 2100e5c31af7Sopenharmony_ci-- 2101e5c31af7Sopenharmony_ciTo specify additional attributes of NT handles exported from a fence, add a 2102e5c31af7Sopenharmony_cislink:VkExportFenceWin32HandleInfoKHR structure to the pname:pNext chain of 2103e5c31af7Sopenharmony_cithe slink:VkFenceCreateInfo structure. 2104e5c31af7Sopenharmony_ciThe sname:VkExportFenceWin32HandleInfoKHR structure is defined as: 2105e5c31af7Sopenharmony_ci 2106e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExportFenceWin32HandleInfoKHR.txt[] 2107e5c31af7Sopenharmony_ci 2108e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2109e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2110e5c31af7Sopenharmony_ci structure. 2111e5c31af7Sopenharmony_ci * pname:pAttributes is a pointer to a Windows code:SECURITY_ATTRIBUTES 2112e5c31af7Sopenharmony_ci structure specifying security attributes of the handle. 2113e5c31af7Sopenharmony_ci * pname:dwAccess is a code:DWORD specifying access rights of the handle. 2114e5c31af7Sopenharmony_ci * pname:name is a null-terminated UTF-16 string to associate with the 2115e5c31af7Sopenharmony_ci underlying synchronization primitive referenced by NT handles exported 2116e5c31af7Sopenharmony_ci from the created fence. 2117e5c31af7Sopenharmony_ci 2118e5c31af7Sopenharmony_ciIf slink:VkExportFenceCreateInfo is not inluded in the same pname:pNext 2119e5c31af7Sopenharmony_cichain, this structure is ignored. 2120e5c31af7Sopenharmony_ci 2121e5c31af7Sopenharmony_ciIf slink:VkExportFenceCreateInfo is included in the pname:pNext chain of 2122e5c31af7Sopenharmony_cislink:VkFenceCreateInfo with a Windows pname:handleType, but either 2123e5c31af7Sopenharmony_cisname:VkExportFenceWin32HandleInfoKHR is not included in the pname:pNext 2124e5c31af7Sopenharmony_cichain, or if it is but pname:pAttributes is set to `NULL`, default security 2125e5c31af7Sopenharmony_cidescriptor values will be used, and child processes created by the 2126e5c31af7Sopenharmony_ciapplication will not inherit the handle, as described in the MSDN 2127e5c31af7Sopenharmony_cidocumentation for "`Synchronization Object Security and Access Rights`"^1^. 2128e5c31af7Sopenharmony_ciFurther, if the structure is not present, the access rights will be 2129e5c31af7Sopenharmony_ci 2130e5c31af7Sopenharmony_cicode:DXGI_SHARED_RESOURCE_READ | code:DXGI_SHARED_RESOURCE_WRITE 2131e5c31af7Sopenharmony_ci 2132e5c31af7Sopenharmony_cifor handles of the following types: 2133e5c31af7Sopenharmony_ci 2134e5c31af7Sopenharmony_ciename:VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT 2135e5c31af7Sopenharmony_ci 2136e5c31af7Sopenharmony_ci1:: 2137e5c31af7Sopenharmony_ci https://docs.microsoft.com/en-us/windows/win32/sync/synchronization-object-security-and-access-rights 2138e5c31af7Sopenharmony_ci 2139e5c31af7Sopenharmony_ci.Valid Usage 2140e5c31af7Sopenharmony_ci**** 2141e5c31af7Sopenharmony_ci * [[VUID-VkExportFenceWin32HandleInfoKHR-handleTypes-01447]] 2142e5c31af7Sopenharmony_ci If slink:VkExportFenceCreateInfo::pname:handleTypes does not include 2143e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT, a 2144e5c31af7Sopenharmony_ci sname:VkExportFenceWin32HandleInfoKHR structure must: not be included in 2145e5c31af7Sopenharmony_ci the pname:pNext chain of slink:VkFenceCreateInfo 2146e5c31af7Sopenharmony_ci**** 2147e5c31af7Sopenharmony_ci 2148e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkExportFenceWin32HandleInfoKHR.txt[] 2149e5c31af7Sopenharmony_ci-- 2150e5c31af7Sopenharmony_ci 2151e5c31af7Sopenharmony_ci[open,refpage='vkGetFenceWin32HandleKHR',desc='Get a Windows HANDLE for a fence',type='protos'] 2152e5c31af7Sopenharmony_ci-- 2153e5c31af7Sopenharmony_ciTo export a Windows handle representing the state of a fence, call: 2154e5c31af7Sopenharmony_ci 2155e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetFenceWin32HandleKHR.txt[] 2156e5c31af7Sopenharmony_ci 2157e5c31af7Sopenharmony_ci * pname:device is the logical device that created the fence being 2158e5c31af7Sopenharmony_ci exported. 2159e5c31af7Sopenharmony_ci * pname:pGetWin32HandleInfo is a pointer to a 2160e5c31af7Sopenharmony_ci slink:VkFenceGetWin32HandleInfoKHR structure containing parameters of 2161e5c31af7Sopenharmony_ci the export operation. 2162e5c31af7Sopenharmony_ci * pname:pHandle will return the Windows handle representing the fence 2163e5c31af7Sopenharmony_ci state. 2164e5c31af7Sopenharmony_ci 2165e5c31af7Sopenharmony_ciFor handle types defined as NT handles, the handles returned by 2166e5c31af7Sopenharmony_cifname:vkGetFenceWin32HandleKHR are owned by the application. 2167e5c31af7Sopenharmony_ciTo avoid leaking resources, the application must: release ownership of them 2168e5c31af7Sopenharmony_ciusing the code:CloseHandle system call when they are no longer needed. 2169e5c31af7Sopenharmony_ci 2170e5c31af7Sopenharmony_ciExporting a Windows handle from a fence may: have side effects depending on 2171e5c31af7Sopenharmony_cithe transference of the specified handle type, as described in 2172e5c31af7Sopenharmony_ci<<synchronization-fences-importing,Importing Fence Payloads>>. 2173e5c31af7Sopenharmony_ci 2174e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetFenceWin32HandleKHR.txt[] 2175e5c31af7Sopenharmony_ci-- 2176e5c31af7Sopenharmony_ci 2177e5c31af7Sopenharmony_ci[open,refpage='VkFenceGetWin32HandleInfoKHR',desc='Structure describing a Win32 handle fence export operation',type='structs'] 2178e5c31af7Sopenharmony_ci-- 2179e5c31af7Sopenharmony_ciThe sname:VkFenceGetWin32HandleInfoKHR structure is defined as: 2180e5c31af7Sopenharmony_ci 2181e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkFenceGetWin32HandleInfoKHR.txt[] 2182e5c31af7Sopenharmony_ci 2183e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2184e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2185e5c31af7Sopenharmony_ci structure. 2186e5c31af7Sopenharmony_ci * pname:fence is the fence from which state will be exported. 2187e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalFenceHandleTypeFlagBits value 2188e5c31af7Sopenharmony_ci specifying the type of handle requested. 2189e5c31af7Sopenharmony_ci 2190e5c31af7Sopenharmony_ciThe properties of the handle returned depend on the value of 2191e5c31af7Sopenharmony_cipname:handleType. 2192e5c31af7Sopenharmony_ciSee elink:VkExternalFenceHandleTypeFlagBits for a description of the 2193e5c31af7Sopenharmony_ciproperties of the defined external fence handle types. 2194e5c31af7Sopenharmony_ci 2195e5c31af7Sopenharmony_ci.Valid Usage 2196e5c31af7Sopenharmony_ci**** 2197e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetWin32HandleInfoKHR-handleType-01448]] 2198e5c31af7Sopenharmony_ci pname:handleType must: have been included in 2199e5c31af7Sopenharmony_ci slink:VkExportFenceCreateInfo::pname:handleTypes when the pname:fence's 2200e5c31af7Sopenharmony_ci current payload was created 2201e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetWin32HandleInfoKHR-handleType-01449]] 2202e5c31af7Sopenharmony_ci If pname:handleType is defined as an NT handle, 2203e5c31af7Sopenharmony_ci flink:vkGetFenceWin32HandleKHR must: be called no more than once for 2204e5c31af7Sopenharmony_ci each valid unique combination of pname:fence and pname:handleType 2205e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetWin32HandleInfoKHR-fence-01450]] 2206e5c31af7Sopenharmony_ci pname:fence must: not currently have its payload replaced by an imported 2207e5c31af7Sopenharmony_ci payload as described below in 2208e5c31af7Sopenharmony_ci <<synchronization-fences-importing,Importing Fence Payloads>> unless 2209e5c31af7Sopenharmony_ci that imported payload's handle type was included in 2210e5c31af7Sopenharmony_ci slink:VkExternalFenceProperties::pname:exportFromImportedHandleTypes for 2211e5c31af7Sopenharmony_ci pname:handleType 2212e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetWin32HandleInfoKHR-handleType-01451]] 2213e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 2214e5c31af7Sopenharmony_ci transference semantics, pname:fence must: be signaled, or have an 2215e5c31af7Sopenharmony_ci associated <<synchronization-fences-signaling,fence signal operation>> 2216e5c31af7Sopenharmony_ci pending execution 2217e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetWin32HandleInfoKHR-handleType-01452]] 2218e5c31af7Sopenharmony_ci pname:handleType must: be defined as an NT handle or a global share 2219e5c31af7Sopenharmony_ci handle 2220e5c31af7Sopenharmony_ci**** 2221e5c31af7Sopenharmony_ci 2222e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkFenceGetWin32HandleInfoKHR.txt[] 2223e5c31af7Sopenharmony_ci-- 2224e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_win32[] 2225e5c31af7Sopenharmony_ci 2226e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_fd[] 2227e5c31af7Sopenharmony_ci[open,refpage='vkGetFenceFdKHR',desc='Get a POSIX file descriptor handle for a fence',type='protos'] 2228e5c31af7Sopenharmony_ci-- 2229e5c31af7Sopenharmony_ciTo export a POSIX file descriptor representing the payload of a fence, call: 2230e5c31af7Sopenharmony_ci 2231e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetFenceFdKHR.txt[] 2232e5c31af7Sopenharmony_ci 2233e5c31af7Sopenharmony_ci * pname:device is the logical device that created the fence being 2234e5c31af7Sopenharmony_ci exported. 2235e5c31af7Sopenharmony_ci * pname:pGetFdInfo is a pointer to a slink:VkFenceGetFdInfoKHR structure 2236e5c31af7Sopenharmony_ci containing parameters of the export operation. 2237e5c31af7Sopenharmony_ci * pname:pFd will return the file descriptor representing the fence 2238e5c31af7Sopenharmony_ci payload. 2239e5c31af7Sopenharmony_ci 2240e5c31af7Sopenharmony_ciEach call to fname:vkGetFenceFdKHR must: create a new file descriptor and 2241e5c31af7Sopenharmony_citransfer ownership of it to the application. 2242e5c31af7Sopenharmony_ciTo avoid leaking resources, the application must: release ownership of the 2243e5c31af7Sopenharmony_cifile descriptor when it is no longer needed. 2244e5c31af7Sopenharmony_ci 2245e5c31af7Sopenharmony_ci[NOTE] 2246e5c31af7Sopenharmony_ci.Note 2247e5c31af7Sopenharmony_ci==== 2248e5c31af7Sopenharmony_ciOwnership can be released in many ways. 2249e5c31af7Sopenharmony_ciFor example, the application can call code:close() on the file descriptor, 2250e5c31af7Sopenharmony_cior transfer ownership back to Vulkan by using the file descriptor to import 2251e5c31af7Sopenharmony_cia fence payload. 2252e5c31af7Sopenharmony_ci==== 2253e5c31af7Sopenharmony_ci 2254e5c31af7Sopenharmony_ciIf pname:pGetFdInfo->handleType is 2255e5c31af7Sopenharmony_ciename:VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT and the fence is signaled at 2256e5c31af7Sopenharmony_cithe time fname:vkGetFenceFdKHR is called, pname:pFd may: return the value 2257e5c31af7Sopenharmony_ci`-1` instead of a valid file descriptor. 2258e5c31af7Sopenharmony_ci 2259e5c31af7Sopenharmony_ciWhere supported by the operating system, the implementation must: set the 2260e5c31af7Sopenharmony_cifile descriptor to be closed automatically when an code:execve system call 2261e5c31af7Sopenharmony_ciis made. 2262e5c31af7Sopenharmony_ci 2263e5c31af7Sopenharmony_ciExporting a file descriptor from a fence may: have side effects depending on 2264e5c31af7Sopenharmony_cithe transference of the specified handle type, as described in 2265e5c31af7Sopenharmony_ci<<synchronization-fences-importing,Importing Fence State>>. 2266e5c31af7Sopenharmony_ci 2267e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetFenceFdKHR.txt[] 2268e5c31af7Sopenharmony_ci-- 2269e5c31af7Sopenharmony_ci 2270e5c31af7Sopenharmony_ci[open,refpage='VkFenceGetFdInfoKHR',desc='Structure describing a POSIX FD fence export operation',type='structs'] 2271e5c31af7Sopenharmony_ci-- 2272e5c31af7Sopenharmony_ciThe sname:VkFenceGetFdInfoKHR structure is defined as: 2273e5c31af7Sopenharmony_ci 2274e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkFenceGetFdInfoKHR.txt[] 2275e5c31af7Sopenharmony_ci 2276e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2277e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2278e5c31af7Sopenharmony_ci structure. 2279e5c31af7Sopenharmony_ci * pname:fence is the fence from which state will be exported. 2280e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalFenceHandleTypeFlagBits value 2281e5c31af7Sopenharmony_ci specifying the type of handle requested. 2282e5c31af7Sopenharmony_ci 2283e5c31af7Sopenharmony_ciThe properties of the file descriptor returned depend on the value of 2284e5c31af7Sopenharmony_cipname:handleType. 2285e5c31af7Sopenharmony_ciSee elink:VkExternalFenceHandleTypeFlagBits for a description of the 2286e5c31af7Sopenharmony_ciproperties of the defined external fence handle types. 2287e5c31af7Sopenharmony_ci 2288e5c31af7Sopenharmony_ci.Valid Usage 2289e5c31af7Sopenharmony_ci**** 2290e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetFdInfoKHR-handleType-01453]] 2291e5c31af7Sopenharmony_ci pname:handleType must: have been included in 2292e5c31af7Sopenharmony_ci slink:VkExportFenceCreateInfo::pname:handleTypes when pname:fence's 2293e5c31af7Sopenharmony_ci current payload was created 2294e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetFdInfoKHR-handleType-01454]] 2295e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 2296e5c31af7Sopenharmony_ci transference semantics, pname:fence must: be signaled, or have an 2297e5c31af7Sopenharmony_ci associated <<synchronization-fences-signaling,fence signal operation>> 2298e5c31af7Sopenharmony_ci pending execution 2299e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetFdInfoKHR-fence-01455]] 2300e5c31af7Sopenharmony_ci pname:fence must: not currently have its payload replaced by an imported 2301e5c31af7Sopenharmony_ci payload as described below in 2302e5c31af7Sopenharmony_ci <<synchronization-fences-importing,Importing Fence Payloads>> unless 2303e5c31af7Sopenharmony_ci that imported payload's handle type was included in 2304e5c31af7Sopenharmony_ci slink:VkExternalFenceProperties::pname:exportFromImportedHandleTypes for 2305e5c31af7Sopenharmony_ci pname:handleType 2306e5c31af7Sopenharmony_ci * [[VUID-VkFenceGetFdInfoKHR-handleType-01456]] 2307e5c31af7Sopenharmony_ci pname:handleType must: be defined as a POSIX file descriptor handle 2308e5c31af7Sopenharmony_ci**** 2309e5c31af7Sopenharmony_ci 2310e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkFenceGetFdInfoKHR.txt[] 2311e5c31af7Sopenharmony_ci-- 2312e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_fd[] 2313e5c31af7Sopenharmony_ci 2314e5c31af7Sopenharmony_ci[open,refpage='vkDestroyFence',desc='Destroy a fence object',type='protos'] 2315e5c31af7Sopenharmony_ci-- 2316e5c31af7Sopenharmony_ciTo destroy a fence, call: 2317e5c31af7Sopenharmony_ci 2318e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroyFence.txt[] 2319e5c31af7Sopenharmony_ci 2320e5c31af7Sopenharmony_ci * pname:device is the logical device that destroys the fence. 2321e5c31af7Sopenharmony_ci * pname:fence is the handle of the fence to destroy. 2322e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 2323e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 2324e5c31af7Sopenharmony_ci 2325e5c31af7Sopenharmony_ci.Valid Usage 2326e5c31af7Sopenharmony_ci**** 2327e5c31af7Sopenharmony_ci * [[VUID-vkDestroyFence-fence-01120]] 2328e5c31af7Sopenharmony_ci All <<devsandqueues-submission, queue submission>> commands that refer 2329e5c31af7Sopenharmony_ci to pname:fence must: have completed execution 2330e5c31af7Sopenharmony_ci * [[VUID-vkDestroyFence-fence-01121]] 2331e5c31af7Sopenharmony_ci If sname:VkAllocationCallbacks were provided when pname:fence was 2332e5c31af7Sopenharmony_ci created, a compatible set of callbacks must: be provided here 2333e5c31af7Sopenharmony_ci * [[VUID-vkDestroyFence-fence-01122]] 2334e5c31af7Sopenharmony_ci If no sname:VkAllocationCallbacks were provided when pname:fence was 2335e5c31af7Sopenharmony_ci created, pname:pAllocator must: be `NULL` 2336e5c31af7Sopenharmony_ci**** 2337e5c31af7Sopenharmony_ci 2338e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroyFence.txt[] 2339e5c31af7Sopenharmony_ci-- 2340e5c31af7Sopenharmony_ci 2341e5c31af7Sopenharmony_ci[open,refpage='vkGetFenceStatus',desc='Return the status of a fence',type='protos'] 2342e5c31af7Sopenharmony_ci-- 2343e5c31af7Sopenharmony_ciTo query the status of a fence from the host, call: 2344e5c31af7Sopenharmony_ci 2345e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetFenceStatus.txt[] 2346e5c31af7Sopenharmony_ci 2347e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the fence. 2348e5c31af7Sopenharmony_ci * pname:fence is the handle of the fence to query. 2349e5c31af7Sopenharmony_ci 2350e5c31af7Sopenharmony_ciUpon success, fname:vkGetFenceStatus returns the status of the fence object, 2351e5c31af7Sopenharmony_ciwith the following return codes: 2352e5c31af7Sopenharmony_ci 2353e5c31af7Sopenharmony_ci.Fence Object Status Codes 2354e5c31af7Sopenharmony_ci[width="80%",options="header"] 2355e5c31af7Sopenharmony_ci|==== 2356e5c31af7Sopenharmony_ci| Status | Meaning 2357e5c31af7Sopenharmony_ci| ename:VK_SUCCESS | The fence specified by pname:fence is signaled. 2358e5c31af7Sopenharmony_ci| ename:VK_NOT_READY | The fence specified by pname:fence is unsignaled. 2359e5c31af7Sopenharmony_ci| ename:VK_ERROR_DEVICE_LOST | The device has been lost. See <<devsandqueues-lost-device,Lost Device>>. 2360e5c31af7Sopenharmony_ci|==== 2361e5c31af7Sopenharmony_ci 2362e5c31af7Sopenharmony_ciIf a <<devsandqueues-submission, queue submission>> command is pending 2363e5c31af7Sopenharmony_ciexecution, then the value returned by this command may: immediately be out 2364e5c31af7Sopenharmony_ciof date. 2365e5c31af7Sopenharmony_ci 2366e5c31af7Sopenharmony_ciIf the device has been lost (see <<devsandqueues-lost-device,Lost Device>>), 2367e5c31af7Sopenharmony_cifname:vkGetFenceStatus may: return any of the above status codes. 2368e5c31af7Sopenharmony_ciIf the device has been lost and fname:vkGetFenceStatus is called repeatedly, 2369e5c31af7Sopenharmony_ciit will eventually return either ename:VK_SUCCESS or 2370e5c31af7Sopenharmony_ciename:VK_ERROR_DEVICE_LOST. 2371e5c31af7Sopenharmony_ci 2372e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetFenceStatus.txt[] 2373e5c31af7Sopenharmony_ci-- 2374e5c31af7Sopenharmony_ci 2375e5c31af7Sopenharmony_ci[[synchronization-fences-unsignaling]] 2376e5c31af7Sopenharmony_ci[open,refpage='vkResetFences',desc='Resets one or more fence objects',type='protos'] 2377e5c31af7Sopenharmony_ci-- 2378e5c31af7Sopenharmony_ciTo set the state of fences to unsignaled from the host, call: 2379e5c31af7Sopenharmony_ci 2380e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkResetFences.txt[] 2381e5c31af7Sopenharmony_ci 2382e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the fences. 2383e5c31af7Sopenharmony_ci * pname:fenceCount is the number of fences to reset. 2384e5c31af7Sopenharmony_ci * pname:pFences is a pointer to an array of fence handles to reset. 2385e5c31af7Sopenharmony_ci 2386e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_fence[] 2387e5c31af7Sopenharmony_ci 2388e5c31af7Sopenharmony_ciIf any member of pname:pFences currently has its 2389e5c31af7Sopenharmony_ci<<synchronization-fences-importing, payload imported>> with temporary 2390e5c31af7Sopenharmony_cipermanence, that fence's prior permanent payload is first restored. 2391e5c31af7Sopenharmony_ciThe remaining operations described therefore operate on the restored 2392e5c31af7Sopenharmony_cipayload. 2393e5c31af7Sopenharmony_ci 2394e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_fence[] 2395e5c31af7Sopenharmony_ci 2396e5c31af7Sopenharmony_ciWhen flink:vkResetFences is executed on the host, it defines a _fence 2397e5c31af7Sopenharmony_ciunsignal operation_ for each fence, which resets the fence to the unsignaled 2398e5c31af7Sopenharmony_cistate. 2399e5c31af7Sopenharmony_ci 2400e5c31af7Sopenharmony_ciIf any member of pname:pFences is already in the unsignaled state when 2401e5c31af7Sopenharmony_ciflink:vkResetFences is executed, then flink:vkResetFences has no effect on 2402e5c31af7Sopenharmony_cithat fence. 2403e5c31af7Sopenharmony_ci 2404e5c31af7Sopenharmony_ci.Valid Usage 2405e5c31af7Sopenharmony_ci**** 2406e5c31af7Sopenharmony_ci * [[VUID-vkResetFences-pFences-01123]] 2407e5c31af7Sopenharmony_ci Each element of pname:pFences must: not be currently associated with any 2408e5c31af7Sopenharmony_ci queue command that has not yet completed execution on that queue 2409e5c31af7Sopenharmony_ci**** 2410e5c31af7Sopenharmony_ci 2411e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkResetFences.txt[] 2412e5c31af7Sopenharmony_ci-- 2413e5c31af7Sopenharmony_ci 2414e5c31af7Sopenharmony_ci[[synchronization-fences-signaling]] 2415e5c31af7Sopenharmony_ciWhen a fence is submitted to a queue as part of a 2416e5c31af7Sopenharmony_ci<<devsandqueues-submission, queue submission>> command, it defines a memory 2417e5c31af7Sopenharmony_cidependency on the batches that were submitted as part of that command, and 2418e5c31af7Sopenharmony_cidefines a _fence signal operation_ which sets the fence to the signaled 2419e5c31af7Sopenharmony_cistate. 2420e5c31af7Sopenharmony_ci 2421e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 2422e5c31af7Sopenharmony_ciincludes every batch submitted in the same <<devsandqueues-submission, queue 2423e5c31af7Sopenharmony_cisubmission>> command. 2424e5c31af7Sopenharmony_ciFence signal operations that are defined by flink:vkQueueSubmit additionally 2425e5c31af7Sopenharmony_ciinclude in the first synchronization scope all commands that occur earlier 2426e5c31af7Sopenharmony_ciin <<synchronization-submission-order,submission order>>. 2427e5c31af7Sopenharmony_ciFence signal operations that are defined by flink:vkQueueSubmit or 2428e5c31af7Sopenharmony_ciflink:vkQueueBindSparse additionally include in the first synchronization 2429e5c31af7Sopenharmony_ciscope any semaphore and fence signal operations that occur earlier in 2430e5c31af7Sopenharmony_ci<<synchronization-signal-operation-order,signal operation order>>. 2431e5c31af7Sopenharmony_ci 2432e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 2433e5c31af7Sopenharmony_cionly includes the fence signal operation. 2434e5c31af7Sopenharmony_ci 2435e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> 2436e5c31af7Sopenharmony_ciincludes all memory access performed by the device. 2437e5c31af7Sopenharmony_ci 2438e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 2439e5c31af7Sopenharmony_ciempty. 2440e5c31af7Sopenharmony_ci 2441e5c31af7Sopenharmony_ci[open,refpage='vkWaitForFences',desc='Wait for one or more fences to become signaled',type='protos'] 2442e5c31af7Sopenharmony_ci-- 2443e5c31af7Sopenharmony_ciTo wait for one or more fences to enter the signaled state on the host, 2444e5c31af7Sopenharmony_cicall: 2445e5c31af7Sopenharmony_ci 2446e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkWaitForFences.txt[] 2447e5c31af7Sopenharmony_ci 2448e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the fences. 2449e5c31af7Sopenharmony_ci * pname:fenceCount is the number of fences to wait on. 2450e5c31af7Sopenharmony_ci * pname:pFences is a pointer to an array of pname:fenceCount fence 2451e5c31af7Sopenharmony_ci handles. 2452e5c31af7Sopenharmony_ci * pname:waitAll is the condition that must: be satisfied to successfully 2453e5c31af7Sopenharmony_ci unblock the wait. 2454e5c31af7Sopenharmony_ci If pname:waitAll is ename:VK_TRUE, then the condition is that all fences 2455e5c31af7Sopenharmony_ci in pname:pFences are signaled. 2456e5c31af7Sopenharmony_ci Otherwise, the condition is that at least one fence in pname:pFences is 2457e5c31af7Sopenharmony_ci signaled. 2458e5c31af7Sopenharmony_ci * pname:timeout is the timeout period in units of nanoseconds. 2459e5c31af7Sopenharmony_ci pname:timeout is adjusted to the closest value allowed by the 2460e5c31af7Sopenharmony_ci implementation-dependent timeout accuracy, which may: be substantially 2461e5c31af7Sopenharmony_ci longer than one nanosecond, and may: be longer than the requested 2462e5c31af7Sopenharmony_ci period. 2463e5c31af7Sopenharmony_ci 2464e5c31af7Sopenharmony_ciIf the condition is satisfied when fname:vkWaitForFences is called, then 2465e5c31af7Sopenharmony_cifname:vkWaitForFences returns immediately. 2466e5c31af7Sopenharmony_ciIf the condition is not satisfied at the time fname:vkWaitForFences is 2467e5c31af7Sopenharmony_cicalled, then fname:vkWaitForFences will block and wait until the condition 2468e5c31af7Sopenharmony_ciis satisfied or the pname:timeout has expired, whichever is sooner. 2469e5c31af7Sopenharmony_ci 2470e5c31af7Sopenharmony_ciIf pname:timeout is zero, then fname:vkWaitForFences does not wait, but 2471e5c31af7Sopenharmony_cisimply returns the current state of the fences. 2472e5c31af7Sopenharmony_ciename:VK_TIMEOUT will be returned in this case if the condition is not 2473e5c31af7Sopenharmony_cisatisfied, even though no actual wait was performed. 2474e5c31af7Sopenharmony_ci 2475e5c31af7Sopenharmony_ciIf the condition is satisfied before the pname:timeout has expired, 2476e5c31af7Sopenharmony_cifname:vkWaitForFences returns ename:VK_SUCCESS. 2477e5c31af7Sopenharmony_ciOtherwise, fname:vkWaitForFences returns ename:VK_TIMEOUT after the 2478e5c31af7Sopenharmony_cipname:timeout has expired. 2479e5c31af7Sopenharmony_ci 2480e5c31af7Sopenharmony_ciIf device loss occurs (see <<devsandqueues-lost-device,Lost Device>>) before 2481e5c31af7Sopenharmony_cithe timeout has expired, fname:vkWaitForFences must: return in finite time 2482e5c31af7Sopenharmony_ciwith either ename:VK_SUCCESS or ename:VK_ERROR_DEVICE_LOST. 2483e5c31af7Sopenharmony_ci 2484e5c31af7Sopenharmony_ci[NOTE] 2485e5c31af7Sopenharmony_ci.Note 2486e5c31af7Sopenharmony_ci==== 2487e5c31af7Sopenharmony_ciWhile we guarantee that fname:vkWaitForFences must: return in finite time, 2488e5c31af7Sopenharmony_cino guarantees are made that it returns immediately upon device loss. 2489e5c31af7Sopenharmony_ciHowever, the client can reasonably expect that the delay will be on the 2490e5c31af7Sopenharmony_ciorder of seconds and that calling fname:vkWaitForFences will not result in a 2491e5c31af7Sopenharmony_cipermanently (or seemingly permanently) dead process. 2492e5c31af7Sopenharmony_ci==== 2493e5c31af7Sopenharmony_ci 2494e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkWaitForFences.txt[] 2495e5c31af7Sopenharmony_ci-- 2496e5c31af7Sopenharmony_ci 2497e5c31af7Sopenharmony_ci[[synchronization-fences-waiting]] 2498e5c31af7Sopenharmony_ciAn execution dependency is defined by waiting for a fence to become 2499e5c31af7Sopenharmony_cisignaled, either via flink:vkWaitForFences or by polling on 2500e5c31af7Sopenharmony_ciflink:vkGetFenceStatus. 2501e5c31af7Sopenharmony_ci 2502e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 2503e5c31af7Sopenharmony_ciincludes only the fence signal operation. 2504e5c31af7Sopenharmony_ci 2505e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 2506e5c31af7Sopenharmony_ciincludes the host operations of flink:vkWaitForFences or 2507e5c31af7Sopenharmony_ciflink:vkGetFenceStatus indicating that the fence has become signaled. 2508e5c31af7Sopenharmony_ci 2509e5c31af7Sopenharmony_ci[NOTE] 2510e5c31af7Sopenharmony_ci.Note 2511e5c31af7Sopenharmony_ci==== 2512e5c31af7Sopenharmony_ciSignaling a fence and waiting on the host does not guarantee that the 2513e5c31af7Sopenharmony_ciresults of memory accesses will be visible to the host, as the access scope 2514e5c31af7Sopenharmony_ciof a memory dependency defined by a fence only includes device access. 2515e5c31af7Sopenharmony_ciA <<synchronization-memory-barriers, memory barrier>> or other memory 2516e5c31af7Sopenharmony_cidependency must: be used to guarantee this. 2517e5c31af7Sopenharmony_ciSee the description of <<synchronization-host-access-types, host access 2518e5c31af7Sopenharmony_citypes>> for more information. 2519e5c31af7Sopenharmony_ci==== 2520e5c31af7Sopenharmony_ci 2521e5c31af7Sopenharmony_ciifdef::VK_EXT_display_control[] 2522e5c31af7Sopenharmony_ciinclude::{chapters}/VK_EXT_display_control/fence_events.txt[] 2523e5c31af7Sopenharmony_ciendif::VK_EXT_display_control[] 2524e5c31af7Sopenharmony_ci 2525e5c31af7Sopenharmony_ci 2526e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_fence[] 2527e5c31af7Sopenharmony_ci[[synchronization-fences-importing]] 2528e5c31af7Sopenharmony_ci=== Importing Fence Payloads 2529e5c31af7Sopenharmony_ci 2530e5c31af7Sopenharmony_ciApplications can: import a fence payload into an existing fence using an 2531e5c31af7Sopenharmony_ciexternal fence handle. 2532e5c31af7Sopenharmony_ciThe effects of the import operation will be either temporary or permanent, 2533e5c31af7Sopenharmony_cias specified by the application. 2534e5c31af7Sopenharmony_ciIf the import is temporary, the fence will be _restored_ to its permanent 2535e5c31af7Sopenharmony_cistate the next time that fence is passed to flink:vkResetFences. 2536e5c31af7Sopenharmony_ci 2537e5c31af7Sopenharmony_ci[NOTE] 2538e5c31af7Sopenharmony_ci.Note 2539e5c31af7Sopenharmony_ci==== 2540e5c31af7Sopenharmony_ciRestoring a fence to its prior permanent payload is a distinct operation 2541e5c31af7Sopenharmony_cifrom resetting a fence payload. 2542e5c31af7Sopenharmony_ciSee flink:vkResetFences for more detail. 2543e5c31af7Sopenharmony_ci==== 2544e5c31af7Sopenharmony_ci 2545e5c31af7Sopenharmony_ciPerforming a subsequent temporary import on a fence before resetting it has 2546e5c31af7Sopenharmony_cino effect on this requirement; the next unsignal of the fence must: still 2547e5c31af7Sopenharmony_cirestore its last permanent state. 2548e5c31af7Sopenharmony_ciA permanent payload import behaves as if the target fence was destroyed, and 2549e5c31af7Sopenharmony_cia new fence was created with the same handle but the imported payload. 2550e5c31af7Sopenharmony_ciBecause importing a fence payload temporarily or permanently detaches the 2551e5c31af7Sopenharmony_ciexisting payload from a fence, similar usage restrictions to those applied 2552e5c31af7Sopenharmony_cito fname:vkDestroyFence are applied to any command that imports a fence 2553e5c31af7Sopenharmony_cipayload. 2554e5c31af7Sopenharmony_ciWhich of these import types is used is referred to as the import operation's 2555e5c31af7Sopenharmony_ci_permanence_. 2556e5c31af7Sopenharmony_ciEach handle type supports either one or both types of permanence. 2557e5c31af7Sopenharmony_ci 2558e5c31af7Sopenharmony_ciThe implementation must: perform the import operation by either referencing 2559e5c31af7Sopenharmony_cior copying the payload referred to by the specified external fence handle, 2560e5c31af7Sopenharmony_cidepending on the handle's type. 2561e5c31af7Sopenharmony_ciThe import method used is referred to as the handle type's _transference_. 2562e5c31af7Sopenharmony_ciWhen using handle types with reference transference, importing a payload to 2563e5c31af7Sopenharmony_cia fence adds the fence to the set of all fences sharing that payload. 2564e5c31af7Sopenharmony_ciThis set includes the fence from which the payload was exported. 2565e5c31af7Sopenharmony_ciFence signaling, waiting, and resetting operations performed on any fence in 2566e5c31af7Sopenharmony_cithe set must: behave as if the set were a single fence. 2567e5c31af7Sopenharmony_ciImporting a payload using handle types with copy transference creates a 2568e5c31af7Sopenharmony_ciduplicate copy of the payload at the time of import, but makes no further 2569e5c31af7Sopenharmony_cireference to it. 2570e5c31af7Sopenharmony_ciFence signaling, waiting, and resetting operations performed on the target 2571e5c31af7Sopenharmony_ciof copy imports must: not affect any other fence or payload. 2572e5c31af7Sopenharmony_ci 2573e5c31af7Sopenharmony_ciExport operations have the same transference as the specified handle type's 2574e5c31af7Sopenharmony_ciimport operations. 2575e5c31af7Sopenharmony_ciAdditionally, exporting a fence payload to a handle with copy transference 2576e5c31af7Sopenharmony_cihas the same side effects on the source fence's payload as executing a fence 2577e5c31af7Sopenharmony_cireset operation. 2578e5c31af7Sopenharmony_ciIf the fence was using a temporarily imported payload, the fence's prior 2579e5c31af7Sopenharmony_cipermanent payload will be restored. 2580e5c31af7Sopenharmony_ci 2581e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32,VK_KHR_external_fence_fd[] 2582e5c31af7Sopenharmony_ci[NOTE] 2583e5c31af7Sopenharmony_ci.Note 2584e5c31af7Sopenharmony_ci==== 2585e5c31af7Sopenharmony_ciThe 2586e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32+VK_KHR_external_fence_fd[tables] 2587e5c31af7Sopenharmony_ciifndef::VK_KHR_external_fence_win32+VK_KHR_external_fence_fd[table] 2588e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32[] 2589e5c31af7Sopenharmony_ci<<synchronization-fence-handletypes-win32,Handle Types Supported by 2590e5c31af7Sopenharmony_cisname:VkImportFenceWin32HandleInfoKHR>> 2591e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_win32[] 2592e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32+VK_KHR_external_fence_fd[and] 2593e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_fd[] 2594e5c31af7Sopenharmony_ci<<synchronization-fence-handletypes-fd,Handle Types Supported by 2595e5c31af7Sopenharmony_cisname:VkImportFenceFdInfoKHR>> 2596e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_fd[] 2597e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32+VK_KHR_external_fence_fd[define] 2598e5c31af7Sopenharmony_ciifndef::VK_KHR_external_fence_win32+VK_KHR_external_fence_fd[defines] 2599e5c31af7Sopenharmony_cithe permanence and transference of each handle type. 2600e5c31af7Sopenharmony_ci==== 2601e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_win32,VK_KHR_external_fence_fd[] 2602e5c31af7Sopenharmony_ci 2603e5c31af7Sopenharmony_ci<<fundamentals-threadingbehavior,External synchronization>> allows 2604e5c31af7Sopenharmony_ciimplementations to modify an object's internal state, i.e. payload, without 2605e5c31af7Sopenharmony_ciinternal synchronization. 2606e5c31af7Sopenharmony_ciHowever, for fences sharing a payload across processes, satisfying the 2607e5c31af7Sopenharmony_ciexternal synchronization requirements of sname:VkFence parameters as if all 2608e5c31af7Sopenharmony_cifences in the set were the same object is sometimes infeasible. 2609e5c31af7Sopenharmony_ciSatisfying valid usage constraints on the state of a fence would similarly 2610e5c31af7Sopenharmony_cirequire impractical coordination or levels of trust between processes. 2611e5c31af7Sopenharmony_ciTherefore, these constraints only apply to a specific fence handle, not to 2612e5c31af7Sopenharmony_ciits payload. 2613e5c31af7Sopenharmony_ciFor distinct fence objects which share a payload: 2614e5c31af7Sopenharmony_ci 2615e5c31af7Sopenharmony_ci * If multiple commands which queue a signal operation, or which unsignal a 2616e5c31af7Sopenharmony_ci fence, are called concurrently, behavior will be as if the commands were 2617e5c31af7Sopenharmony_ci called in an arbitrary sequential order. 2618e5c31af7Sopenharmony_ci * If a queue submission command is called with a fence that is sharing a 2619e5c31af7Sopenharmony_ci payload, and the payload is already associated with another queue 2620e5c31af7Sopenharmony_ci command that has not yet completed execution, either one or both of the 2621e5c31af7Sopenharmony_ci commands will cause the fence to become signaled when they complete 2622e5c31af7Sopenharmony_ci execution. 2623e5c31af7Sopenharmony_ci * If a fence payload is reset while it is associated with a queue command 2624e5c31af7Sopenharmony_ci that has not yet completed execution, the payload will become 2625e5c31af7Sopenharmony_ci unsignaled, but may: become signaled again when the command completes 2626e5c31af7Sopenharmony_ci execution. 2627e5c31af7Sopenharmony_ci * In the preceding cases, any of the devices associated with the fences 2628e5c31af7Sopenharmony_ci sharing the payload may: be lost, or any of the queue submission or 2629e5c31af7Sopenharmony_ci fence reset commands may: return ename:VK_ERROR_INITIALIZATION_FAILED. 2630e5c31af7Sopenharmony_ci 2631e5c31af7Sopenharmony_ciOther than these non-deterministic results, behavior is well defined. 2632e5c31af7Sopenharmony_ciIn particular: 2633e5c31af7Sopenharmony_ci 2634e5c31af7Sopenharmony_ci * The implementation must: not crash or enter an internally inconsistent 2635e5c31af7Sopenharmony_ci state where future valid Vulkan commands might cause undefined: results, 2636e5c31af7Sopenharmony_ci * Timeouts on future wait commands on fences sharing the payload must: be 2637e5c31af7Sopenharmony_ci effective. 2638e5c31af7Sopenharmony_ci 2639e5c31af7Sopenharmony_ci[NOTE] 2640e5c31af7Sopenharmony_ci.Note 2641e5c31af7Sopenharmony_ci==== 2642e5c31af7Sopenharmony_ciThese rules allow processes to synchronize access to shared memory without 2643e5c31af7Sopenharmony_citrusting each other. 2644e5c31af7Sopenharmony_ciHowever, such processes must still be cautious not to use the shared fence 2645e5c31af7Sopenharmony_cifor more than synchronizing access to the shared memory. 2646e5c31af7Sopenharmony_ciFor example, a process should not use a fence with shared payload to tell 2647e5c31af7Sopenharmony_ciwhen commands it submitted to a queue have completed and objects used by 2648e5c31af7Sopenharmony_cithose commands may be destroyed, since the other process can accidentally or 2649e5c31af7Sopenharmony_cimaliciously cause the fence to signal before the commands actually complete. 2650e5c31af7Sopenharmony_ci==== 2651e5c31af7Sopenharmony_ci 2652e5c31af7Sopenharmony_ciWhen a fence is using an imported payload, its 2653e5c31af7Sopenharmony_cislink:VkExportFenceCreateInfo::pname:handleTypes value is specified when 2654e5c31af7Sopenharmony_cicreating the fence from which the payload was exported, rather than 2655e5c31af7Sopenharmony_cispecified when creating the fence. 2656e5c31af7Sopenharmony_ciAdditionally, 2657e5c31af7Sopenharmony_cislink:VkExternalFenceProperties::pname:exportFromImportedHandleTypes 2658e5c31af7Sopenharmony_cirestricts which handle types can: be exported from such a fence based on the 2659e5c31af7Sopenharmony_cispecific handle type used to import the current payload. 2660e5c31af7Sopenharmony_ciifdef::VK_KHR_swapchain[] 2661e5c31af7Sopenharmony_ciPassing a fence to flink:vkAcquireNextImageKHR is equivalent to temporarily 2662e5c31af7Sopenharmony_ciimporting a fence payload to that fence. 2663e5c31af7Sopenharmony_ci 2664e5c31af7Sopenharmony_ci[NOTE] 2665e5c31af7Sopenharmony_ci.Note 2666e5c31af7Sopenharmony_ci==== 2667e5c31af7Sopenharmony_ciBecause the exportable handle types of an imported fence correspond to its 2668e5c31af7Sopenharmony_cicurrent imported payload, and flink:vkAcquireNextImageKHR behaves the same 2669e5c31af7Sopenharmony_cias a temporary import operation for which the source fence is opaque to the 2670e5c31af7Sopenharmony_ciapplication, applications have no way of determining whether any external 2671e5c31af7Sopenharmony_cihandle types can: be exported from a fence in this state. 2672e5c31af7Sopenharmony_ciTherefore, applications must: not attempt to export handles from fences 2673e5c31af7Sopenharmony_ciusing a temporarily imported payload from flink:vkAcquireNextImageKHR. 2674e5c31af7Sopenharmony_ci==== 2675e5c31af7Sopenharmony_ciendif::VK_KHR_swapchain[] 2676e5c31af7Sopenharmony_ci 2677e5c31af7Sopenharmony_ciWhen importing a fence payload, it is the responsibility of the application 2678e5c31af7Sopenharmony_cito ensure the external handles meet all valid usage requirements. 2679e5c31af7Sopenharmony_ciHowever, implementations must: perform sufficient validation of external 2680e5c31af7Sopenharmony_cihandles to ensure that the operation results in a valid fence which will not 2681e5c31af7Sopenharmony_cicause program termination, device loss, queue stalls, host thread stalls, or 2682e5c31af7Sopenharmony_cicorruption of other resources when used as allowed according to its import 2683e5c31af7Sopenharmony_ciparameters. 2684e5c31af7Sopenharmony_ciIf the external handle provided does not meet these requirements, the 2685e5c31af7Sopenharmony_ciimplementation must: fail the fence payload import operation with the error 2686e5c31af7Sopenharmony_cicode ename:VK_ERROR_INVALID_EXTERNAL_HANDLE. 2687e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_fence[] 2688e5c31af7Sopenharmony_ci 2689e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32[] 2690e5c31af7Sopenharmony_ci[open,refpage='vkImportFenceWin32HandleKHR',desc='Import a fence from a Windows HANDLE',type='protos'] 2691e5c31af7Sopenharmony_ci-- 2692e5c31af7Sopenharmony_ciTo import a fence payload from a Windows handle, call: 2693e5c31af7Sopenharmony_ci 2694e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkImportFenceWin32HandleKHR.txt[] 2695e5c31af7Sopenharmony_ci 2696e5c31af7Sopenharmony_ci * pname:device is the logical device that created the fence. 2697e5c31af7Sopenharmony_ci * pname:pImportFenceWin32HandleInfo is a pointer to a 2698e5c31af7Sopenharmony_ci slink:VkImportFenceWin32HandleInfoKHR structure specifying the fence and 2699e5c31af7Sopenharmony_ci import parameters. 2700e5c31af7Sopenharmony_ci 2701e5c31af7Sopenharmony_ciImporting a fence payload from Windows handles does not transfer ownership 2702e5c31af7Sopenharmony_ciof the handle to the Vulkan implementation. 2703e5c31af7Sopenharmony_ciFor handle types defined as NT handles, the application must: release 2704e5c31af7Sopenharmony_ciownership using the code:CloseHandle system call when the handle is no 2705e5c31af7Sopenharmony_cilonger needed. 2706e5c31af7Sopenharmony_ci 2707e5c31af7Sopenharmony_ciApplications can: import the same fence payload into multiple instances of 2708e5c31af7Sopenharmony_ciVulkan, into the same instance from which it was exported, and multiple 2709e5c31af7Sopenharmony_citimes into a given Vulkan instance. 2710e5c31af7Sopenharmony_ci 2711e5c31af7Sopenharmony_ci.Valid Usage 2712e5c31af7Sopenharmony_ci**** 2713e5c31af7Sopenharmony_ci * [[VUID-vkImportFenceWin32HandleKHR-fence-04448]] 2714e5c31af7Sopenharmony_ci pname:fence must: not be associated with any queue command that has not 2715e5c31af7Sopenharmony_ci yet completed execution on that queue 2716e5c31af7Sopenharmony_ci**** 2717e5c31af7Sopenharmony_ci 2718e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkImportFenceWin32HandleKHR.txt[] 2719e5c31af7Sopenharmony_ci-- 2720e5c31af7Sopenharmony_ci 2721e5c31af7Sopenharmony_ci[open,refpage='VkImportFenceWin32HandleInfoKHR',desc='(None)',type='structs'] 2722e5c31af7Sopenharmony_ci-- 2723e5c31af7Sopenharmony_ciThe sname:VkImportFenceWin32HandleInfoKHR structure is defined as: 2724e5c31af7Sopenharmony_ci 2725e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImportFenceWin32HandleInfoKHR.txt[] 2726e5c31af7Sopenharmony_ci 2727e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2728e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2729e5c31af7Sopenharmony_ci structure. 2730e5c31af7Sopenharmony_ci * pname:fence is the fence into which the state will be imported. 2731e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkFenceImportFlagBits specifying 2732e5c31af7Sopenharmony_ci additional parameters for the fence payload import operation. 2733e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalFenceHandleTypeFlagBits value 2734e5c31af7Sopenharmony_ci specifying the type of pname:handle. 2735e5c31af7Sopenharmony_ci * pname:handle is `NULL` or the external handle to import. 2736e5c31af7Sopenharmony_ci * pname:name is `NULL` or a null-terminated UTF-16 string naming the 2737e5c31af7Sopenharmony_ci underlying synchronization primitive to import. 2738e5c31af7Sopenharmony_ci 2739e5c31af7Sopenharmony_ciThe handle types supported by pname:handleType are: 2740e5c31af7Sopenharmony_ci 2741e5c31af7Sopenharmony_ci[[synchronization-fence-handletypes-win32]] 2742e5c31af7Sopenharmony_ci.Handle Types Supported by sname:VkImportFenceWin32HandleInfoKHR 2743e5c31af7Sopenharmony_ci[width="80%",options="header"] 2744e5c31af7Sopenharmony_ci|==== 2745e5c31af7Sopenharmony_ci| Handle Type | Transference | Permanence Supported 2746e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT | Reference | Temporary,Permanent 2747e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | Reference | Temporary,Permanent 2748e5c31af7Sopenharmony_ci|==== 2749e5c31af7Sopenharmony_ci 2750e5c31af7Sopenharmony_ci.Valid Usage 2751e5c31af7Sopenharmony_ci**** 2752e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-handleType-01457]] 2753e5c31af7Sopenharmony_ci pname:handleType must: be a value included in the 2754e5c31af7Sopenharmony_ci <<synchronization-fence-handletypes-win32, Handle Types Supported by 2755e5c31af7Sopenharmony_ci sname:VkImportFenceWin32HandleInfoKHR>> table 2756e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-handleType-01459]] 2757e5c31af7Sopenharmony_ci If pname:handleType is not 2758e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT, pname:name must: 2759e5c31af7Sopenharmony_ci be `NULL` 2760e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-handleType-01460]] 2761e5c31af7Sopenharmony_ci If pname:handle is `NULL`, pname:name must: name a valid synchronization 2762e5c31af7Sopenharmony_ci primitive of the type specified by pname:handleType 2763e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-handleType-01461]] 2764e5c31af7Sopenharmony_ci If pname:name is `NULL`, pname:handle must: be a valid handle of the 2765e5c31af7Sopenharmony_ci type specified by pname:handleType 2766e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-handle-01462]] 2767e5c31af7Sopenharmony_ci If pname:handle is not `NULL`, pname:name must: be `NULL` 2768e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-handle-01539]] 2769e5c31af7Sopenharmony_ci If pname:handle is not `NULL`, it must: obey any requirements listed for 2770e5c31af7Sopenharmony_ci pname:handleType in <<external-fence-handle-types-compatibility,external 2771e5c31af7Sopenharmony_ci fence handle types compatibility>> 2772e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceWin32HandleInfoKHR-name-01540]] 2773e5c31af7Sopenharmony_ci If pname:name is not `NULL`, it must: obey any requirements listed for 2774e5c31af7Sopenharmony_ci pname:handleType in <<external-fence-handle-types-compatibility,external 2775e5c31af7Sopenharmony_ci fence handle types compatibility>> 2776e5c31af7Sopenharmony_ci**** 2777e5c31af7Sopenharmony_ci 2778e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImportFenceWin32HandleInfoKHR.txt[] 2779e5c31af7Sopenharmony_ci-- 2780e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_win32[] 2781e5c31af7Sopenharmony_ci 2782e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_fd[] 2783e5c31af7Sopenharmony_ci[open,refpage='vkImportFenceFdKHR',desc='Import a fence from a POSIX file descriptor',type='protos'] 2784e5c31af7Sopenharmony_ci-- 2785e5c31af7Sopenharmony_ciTo import a fence payload from a POSIX file descriptor, call: 2786e5c31af7Sopenharmony_ci 2787e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkImportFenceFdKHR.txt[] 2788e5c31af7Sopenharmony_ci 2789e5c31af7Sopenharmony_ci * pname:device is the logical device that created the fence. 2790e5c31af7Sopenharmony_ci * pname:pImportFenceFdInfo is a pointer to a slink:VkImportFenceFdInfoKHR 2791e5c31af7Sopenharmony_ci structure specifying the fence and import parameters. 2792e5c31af7Sopenharmony_ci 2793e5c31af7Sopenharmony_ciImporting a fence payload from a file descriptor transfers ownership of the 2794e5c31af7Sopenharmony_cifile descriptor from the application to the Vulkan implementation. 2795e5c31af7Sopenharmony_ciThe application must: not perform any operations on the file descriptor 2796e5c31af7Sopenharmony_ciafter a successful import. 2797e5c31af7Sopenharmony_ci 2798e5c31af7Sopenharmony_ciApplications can: import the same fence payload into multiple instances of 2799e5c31af7Sopenharmony_ciVulkan, into the same instance from which it was exported, and multiple 2800e5c31af7Sopenharmony_citimes into a given Vulkan instance. 2801e5c31af7Sopenharmony_ci 2802e5c31af7Sopenharmony_ci.Valid Usage 2803e5c31af7Sopenharmony_ci**** 2804e5c31af7Sopenharmony_ci * [[VUID-vkImportFenceFdKHR-fence-01463]] 2805e5c31af7Sopenharmony_ci pname:fence must: not be associated with any queue command that has not 2806e5c31af7Sopenharmony_ci yet completed execution on that queue 2807e5c31af7Sopenharmony_ci**** 2808e5c31af7Sopenharmony_ci 2809e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkImportFenceFdKHR.txt[] 2810e5c31af7Sopenharmony_ci-- 2811e5c31af7Sopenharmony_ci 2812e5c31af7Sopenharmony_ci[open,refpage='VkImportFenceFdInfoKHR',desc='(None)',type='structs'] 2813e5c31af7Sopenharmony_ci-- 2814e5c31af7Sopenharmony_ciThe sname:VkImportFenceFdInfoKHR structure is defined as: 2815e5c31af7Sopenharmony_ci 2816e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImportFenceFdInfoKHR.txt[] 2817e5c31af7Sopenharmony_ci 2818e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2819e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2820e5c31af7Sopenharmony_ci structure. 2821e5c31af7Sopenharmony_ci * pname:fence is the fence into which the payload will be imported. 2822e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkFenceImportFlagBits specifying 2823e5c31af7Sopenharmony_ci additional parameters for the fence payload import operation. 2824e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalFenceHandleTypeFlagBits value 2825e5c31af7Sopenharmony_ci specifying the type of pname:fd. 2826e5c31af7Sopenharmony_ci * pname:fd is the external handle to import. 2827e5c31af7Sopenharmony_ci 2828e5c31af7Sopenharmony_ciThe handle types supported by pname:handleType are: 2829e5c31af7Sopenharmony_ci 2830e5c31af7Sopenharmony_ci[[synchronization-fence-handletypes-fd]] 2831e5c31af7Sopenharmony_ci.Handle Types Supported by sname:VkImportFenceFdInfoKHR 2832e5c31af7Sopenharmony_ci[width="80%",options="header"] 2833e5c31af7Sopenharmony_ci|==== 2834e5c31af7Sopenharmony_ci| Handle Type | Transference | Permanence Supported 2835e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT | Reference | Temporary,Permanent 2836e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT | Copy | Temporary 2837e5c31af7Sopenharmony_ci|==== 2838e5c31af7Sopenharmony_ci 2839e5c31af7Sopenharmony_ci.Valid Usage 2840e5c31af7Sopenharmony_ci**** 2841e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceFdInfoKHR-handleType-01464]] 2842e5c31af7Sopenharmony_ci pname:handleType must: be a value included in the 2843e5c31af7Sopenharmony_ci <<synchronization-fence-handletypes-fd, Handle Types Supported by 2844e5c31af7Sopenharmony_ci sname:VkImportFenceFdInfoKHR>> table 2845e5c31af7Sopenharmony_ci * [[VUID-VkImportFenceFdInfoKHR-fd-01541]] 2846e5c31af7Sopenharmony_ci pname:fd must: obey any requirements listed for pname:handleType in 2847e5c31af7Sopenharmony_ci <<external-fence-handle-types-compatibility,external fence handle types 2848e5c31af7Sopenharmony_ci compatibility>> 2849e5c31af7Sopenharmony_ci**** 2850e5c31af7Sopenharmony_ci 2851e5c31af7Sopenharmony_ciIf pname:handleType is ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT, the 2852e5c31af7Sopenharmony_cispecial value `-1` for pname:fd is treated like a valid sync file descriptor 2853e5c31af7Sopenharmony_cireferring to an object that has already signaled. 2854e5c31af7Sopenharmony_ciThe import operation will succeed and the sname:VkFence will have a 2855e5c31af7Sopenharmony_citemporarily imported payload as if a valid file descriptor had been 2856e5c31af7Sopenharmony_ciprovided. 2857e5c31af7Sopenharmony_ci 2858e5c31af7Sopenharmony_ci[NOTE] 2859e5c31af7Sopenharmony_ci.Note 2860e5c31af7Sopenharmony_ci==== 2861e5c31af7Sopenharmony_ciThis special behavior for importing an invalid sync file descriptor allows 2862e5c31af7Sopenharmony_cieasier interoperability with other system APIs which use the convention that 2863e5c31af7Sopenharmony_cian invalid sync file descriptor represents work that has already completed 2864e5c31af7Sopenharmony_ciand does not need to be waited for. 2865e5c31af7Sopenharmony_ciIt is consistent with the option for implementations to return a `-1` file 2866e5c31af7Sopenharmony_cidescriptor when exporting a ename:VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT 2867e5c31af7Sopenharmony_cifrom a sname:VkFence which is signaled. 2868e5c31af7Sopenharmony_ci==== 2869e5c31af7Sopenharmony_ci 2870e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImportFenceFdInfoKHR.txt[] 2871e5c31af7Sopenharmony_ci-- 2872e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_fd[] 2873e5c31af7Sopenharmony_ci 2874e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_fence[] 2875e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32,VK_KHR_external_fence_fd[] 2876e5c31af7Sopenharmony_ci[open,refpage='VkFenceImportFlagBits',desc='Bitmask specifying additional parameters of fence payload import',type='enums'] 2877e5c31af7Sopenharmony_ci-- 2878e5c31af7Sopenharmony_ciBits which can: be set in 2879e5c31af7Sopenharmony_ci 2880e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_win32[] 2881e5c31af7Sopenharmony_ci * slink:VkImportFenceWin32HandleInfoKHR::pname:flags 2882e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_win32[] 2883e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence_fd[] 2884e5c31af7Sopenharmony_ci * slink:VkImportFenceFdInfoKHR::pname:flags 2885e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_fd[] 2886e5c31af7Sopenharmony_ci 2887e5c31af7Sopenharmony_cispecifying additional parameters of a fence import operation are: 2888e5c31af7Sopenharmony_ci 2889e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkFenceImportFlagBits.txt[] 2890e5c31af7Sopenharmony_ci 2891e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence[] 2892e5c31af7Sopenharmony_cior the equivalent 2893e5c31af7Sopenharmony_ci 2894e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkFenceImportFlagBitsKHR.txt[] 2895e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence[] 2896e5c31af7Sopenharmony_ci 2897e5c31af7Sopenharmony_ci * ename:VK_FENCE_IMPORT_TEMPORARY_BIT specifies that the fence payload 2898e5c31af7Sopenharmony_ci will be imported only temporarily, as described in 2899e5c31af7Sopenharmony_ci <<synchronization-fences-importing,Importing Fence Payloads>>, 2900e5c31af7Sopenharmony_ci regardless of the permanence of pname:handleType. 2901e5c31af7Sopenharmony_ci-- 2902e5c31af7Sopenharmony_ci 2903e5c31af7Sopenharmony_ci[open,refpage='VkFenceImportFlags',desc='Bitmask of VkFenceImportFlagBits',type='flags'] 2904e5c31af7Sopenharmony_ci-- 2905e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkFenceImportFlags.txt[] 2906e5c31af7Sopenharmony_ci 2907e5c31af7Sopenharmony_ciifdef::VK_KHR_external_fence[] 2908e5c31af7Sopenharmony_cior the equivalent 2909e5c31af7Sopenharmony_ci 2910e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkFenceImportFlagsKHR.txt[] 2911e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence[] 2912e5c31af7Sopenharmony_ci 2913e5c31af7Sopenharmony_citname:VkFenceImportFlags is a bitmask type for setting a mask of zero or 2914e5c31af7Sopenharmony_cimore elink:VkFenceImportFlagBits. 2915e5c31af7Sopenharmony_ci-- 2916e5c31af7Sopenharmony_ciendif::VK_KHR_external_fence_win32,VK_KHR_external_fence_fd[] 2917e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_fence[] 2918e5c31af7Sopenharmony_ci 2919e5c31af7Sopenharmony_ci 2920e5c31af7Sopenharmony_ci[[synchronization-semaphores]] 2921e5c31af7Sopenharmony_ci== Semaphores 2922e5c31af7Sopenharmony_ci 2923e5c31af7Sopenharmony_ci[open,refpage='VkSemaphore',desc='Opaque handle to a semaphore object',type='handles'] 2924e5c31af7Sopenharmony_ci-- 2925e5c31af7Sopenharmony_ciSemaphores are a synchronization primitive that can: be used to insert a 2926e5c31af7Sopenharmony_cidependency 2927e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2928e5c31af7Sopenharmony_cibetween queue operations. 2929e5c31af7Sopenharmony_ciSemaphores have two states - signaled and unsignaled. 2930e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2931e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2932e5c31af7Sopenharmony_cibetween queue operations or between a queue operation and the host. 2933e5c31af7Sopenharmony_ci<<glossary, Binary semaphores>> have two states - signaled and unsignaled. 2934e5c31af7Sopenharmony_ci<<glossary, Timeline semaphores>> have a strictly increasing 64-bit unsigned 2935e5c31af7Sopenharmony_ciinteger payload and are signaled with respect to a particular reference 2936e5c31af7Sopenharmony_civalue. 2937e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2938e5c31af7Sopenharmony_ciA semaphore can: be signaled after execution of a queue operation is 2939e5c31af7Sopenharmony_cicompleted, and a queue operation can: wait for a semaphore to become 2940e5c31af7Sopenharmony_cisignaled before it begins execution. 2941e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2942e5c31af7Sopenharmony_ciA timeline semaphore can: additionally be signaled from the host with the 2943e5c31af7Sopenharmony_ciflink:vkSignalSemaphore command and waited on from the host with the 2944e5c31af7Sopenharmony_ciflink:vkWaitSemaphores command. 2945e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2946e5c31af7Sopenharmony_ci 2947e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_semaphore[] 2948e5c31af7Sopenharmony_ci[[synchronization-semaphores-payloads]] 2949e5c31af7Sopenharmony_ciThe internal data of a semaphore may: include a reference to any resources 2950e5c31af7Sopenharmony_ciand pending work associated with signal or unsignal operations performed on 2951e5c31af7Sopenharmony_cithat semaphore object, collectively referred to as the semaphore's 2952e5c31af7Sopenharmony_ci_payload_. 2953e5c31af7Sopenharmony_ciMechanisms to import and export that internal data to and from semaphores 2954e5c31af7Sopenharmony_ciare provided <<VkExportSemaphoreCreateInfo, below>>. 2955e5c31af7Sopenharmony_ciThese mechanisms indirectly enable applications to share semaphore state 2956e5c31af7Sopenharmony_cibetween two or more semaphores and other synchronization primitives across 2957e5c31af7Sopenharmony_ciprocess and API boundaries. 2958e5c31af7Sopenharmony_ci 2959e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_semaphore[] 2960e5c31af7Sopenharmony_ci 2961e5c31af7Sopenharmony_ciSemaphores are represented by sname:VkSemaphore handles: 2962e5c31af7Sopenharmony_ci 2963e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkSemaphore.txt[] 2964e5c31af7Sopenharmony_ci-- 2965e5c31af7Sopenharmony_ci 2966e5c31af7Sopenharmony_ci[open,refpage='vkCreateSemaphore',desc='Create a new queue semaphore object',type='protos'] 2967e5c31af7Sopenharmony_ci-- 2968e5c31af7Sopenharmony_ciTo create a semaphore, call: 2969e5c31af7Sopenharmony_ci 2970e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateSemaphore.txt[] 2971e5c31af7Sopenharmony_ci 2972e5c31af7Sopenharmony_ci * pname:device is the logical device that creates the semaphore. 2973e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkSemaphoreCreateInfo 2974e5c31af7Sopenharmony_ci structure containing information about how the semaphore is to be 2975e5c31af7Sopenharmony_ci created. 2976e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 2977e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 2978e5c31af7Sopenharmony_ci * pname:pSemaphore is a pointer to a handle in which the resulting 2979e5c31af7Sopenharmony_ci semaphore object is returned. 2980e5c31af7Sopenharmony_ci 2981e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2982e5c31af7Sopenharmony_ciThis command creates a _binary semaphore_ that has a boolean payload 2983e5c31af7Sopenharmony_ciindicating whether the semaphore is currently signaled or unsignaled. 2984e5c31af7Sopenharmony_ciWhen created, the semaphore is in the unsignaled state. 2985e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 2986e5c31af7Sopenharmony_ci 2987e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateSemaphore.txt[] 2988e5c31af7Sopenharmony_ci-- 2989e5c31af7Sopenharmony_ci 2990e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreCreateInfo',desc='Structure specifying parameters of a newly created semaphore',type='structs'] 2991e5c31af7Sopenharmony_ci-- 2992e5c31af7Sopenharmony_ciThe sname:VkSemaphoreCreateInfo structure is defined as: 2993e5c31af7Sopenharmony_ci 2994e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreCreateInfo.txt[] 2995e5c31af7Sopenharmony_ci 2996e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 2997e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2998e5c31af7Sopenharmony_ci structure. 2999e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 3000e5c31af7Sopenharmony_ci 3001e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreCreateInfo.txt[] 3002e5c31af7Sopenharmony_ci-- 3003e5c31af7Sopenharmony_ci 3004e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreCreateFlags',desc='Reserved for future use',type='flags'] 3005e5c31af7Sopenharmony_ci-- 3006e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkSemaphoreCreateFlags.txt[] 3007e5c31af7Sopenharmony_ci 3008e5c31af7Sopenharmony_citname:VkSemaphoreCreateFlags is a bitmask type for setting a mask, but is 3009e5c31af7Sopenharmony_cicurrently reserved for future use. 3010e5c31af7Sopenharmony_ci-- 3011e5c31af7Sopenharmony_ci 3012e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3013e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreTypeCreateInfo',desc='Structure specifying the type of a newly created semaphore',type='structs',alias='VkSemaphoreTypeCreateInfoKHR'] 3014e5c31af7Sopenharmony_ci-- 3015e5c31af7Sopenharmony_ciThe sname:VkSemaphoreTypeCreateInfo structure is defined as: 3016e5c31af7Sopenharmony_ci 3017e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreTypeCreateInfo.txt[] 3018e5c31af7Sopenharmony_ci 3019e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3020e5c31af7Sopenharmony_cior the equivalent 3021e5c31af7Sopenharmony_ci 3022e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreTypeCreateInfoKHR.txt[] 3023e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3024e5c31af7Sopenharmony_ci 3025e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3026e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3027e5c31af7Sopenharmony_ci structure. 3028e5c31af7Sopenharmony_ci * pname:semaphoreType is a elink:VkSemaphoreType value specifying the type 3029e5c31af7Sopenharmony_ci of the semaphore. 3030e5c31af7Sopenharmony_ci * pname:initialValue is the initial payload value if pname:semaphoreType 3031e5c31af7Sopenharmony_ci is ename:VK_SEMAPHORE_TYPE_TIMELINE. 3032e5c31af7Sopenharmony_ci 3033e5c31af7Sopenharmony_ciTo create a semaphore of a specific type, add a 3034e5c31af7Sopenharmony_cisname:VkSemaphoreTypeCreateInfo structure to the 3035e5c31af7Sopenharmony_cislink:VkSemaphoreCreateInfo::pname:pNext chain. 3036e5c31af7Sopenharmony_ci 3037e5c31af7Sopenharmony_ciIf no sname:VkSemaphoreTypeCreateInfo structure is included in the 3038e5c31af7Sopenharmony_cipname:pNext chain of slink:VkSemaphoreCreateInfo, then the created semaphore 3039e5c31af7Sopenharmony_ciwill have a default elink:VkSemaphoreType of ename:VK_SEMAPHORE_TYPE_BINARY. 3040e5c31af7Sopenharmony_ci 3041e5c31af7Sopenharmony_ci.Valid Usage 3042e5c31af7Sopenharmony_ci**** 3043e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreTypeCreateInfo-timelineSemaphore-03252]] 3044e5c31af7Sopenharmony_ci If the <<features-timelineSemaphore,pname:timelineSemaphore>> feature is 3045e5c31af7Sopenharmony_ci not enabled, pname:semaphoreType must: not equal 3046e5c31af7Sopenharmony_ci ename:VK_SEMAPHORE_TYPE_TIMELINE 3047e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreTypeCreateInfo-semaphoreType-03279]] 3048e5c31af7Sopenharmony_ci If pname:semaphoreType is ename:VK_SEMAPHORE_TYPE_BINARY, 3049e5c31af7Sopenharmony_ci pname:initialValue must: be zero 3050e5c31af7Sopenharmony_ci**** 3051e5c31af7Sopenharmony_ci 3052e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreTypeCreateInfo.txt[] 3053e5c31af7Sopenharmony_ci-- 3054e5c31af7Sopenharmony_ci 3055e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreType',desc='Sepcifies the type of a semaphore object',type='enums',alias='VkSemaphoreTypeKHR'] 3056e5c31af7Sopenharmony_ci-- 3057e5c31af7Sopenharmony_ciPossible values of slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType, 3058e5c31af7Sopenharmony_cispecifying the type of a semaphore, are: 3059e5c31af7Sopenharmony_ci 3060e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSemaphoreType.txt[] 3061e5c31af7Sopenharmony_ci 3062e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3063e5c31af7Sopenharmony_cior the equivalent 3064e5c31af7Sopenharmony_ci 3065e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSemaphoreTypeKHR.txt[] 3066e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3067e5c31af7Sopenharmony_ci 3068e5c31af7Sopenharmony_ci * ename:VK_SEMAPHORE_TYPE_BINARY specifies a _binary semaphore_ type that 3069e5c31af7Sopenharmony_ci has a boolean payload indicating whether the semaphore is currently 3070e5c31af7Sopenharmony_ci signaled or unsignaled. 3071e5c31af7Sopenharmony_ci When created, the semaphore is in the unsignaled state. 3072e5c31af7Sopenharmony_ci * ename:VK_SEMAPHORE_TYPE_TIMELINE specifies a _timeline semaphore_ type 3073e5c31af7Sopenharmony_ci that has a strictly increasing 64-bit unsigned integer payload 3074e5c31af7Sopenharmony_ci indicating whether the semaphore is signaled with respect to a 3075e5c31af7Sopenharmony_ci particular reference value. 3076e5c31af7Sopenharmony_ci When created, the semaphore payload has the value given by the 3077e5c31af7Sopenharmony_ci pname:initialValue field of slink:VkSemaphoreTypeCreateInfo. 3078e5c31af7Sopenharmony_ci-- 3079e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3080e5c31af7Sopenharmony_ci 3081e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_semaphore[] 3082e5c31af7Sopenharmony_ci[open,refpage='VkExportSemaphoreCreateInfo',desc='Structure specifying handle types that can be exported from a semaphore',type='structs'] 3083e5c31af7Sopenharmony_ci-- 3084e5c31af7Sopenharmony_ciTo create a semaphore whose payload can: be exported to external handles, 3085e5c31af7Sopenharmony_ciadd a slink:VkExportSemaphoreCreateInfo structure to the pname:pNext chain 3086e5c31af7Sopenharmony_ciof the slink:VkSemaphoreCreateInfo structure. 3087e5c31af7Sopenharmony_ciThe sname:VkExportSemaphoreCreateInfo structure is defined as: 3088e5c31af7Sopenharmony_ci 3089e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExportSemaphoreCreateInfo.txt[] 3090e5c31af7Sopenharmony_ci 3091e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore[] 3092e5c31af7Sopenharmony_cior the equivalent 3093e5c31af7Sopenharmony_ci 3094e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExportSemaphoreCreateInfoKHR.txt[] 3095e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore[] 3096e5c31af7Sopenharmony_ci 3097e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3098e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3099e5c31af7Sopenharmony_ci structure. 3100e5c31af7Sopenharmony_ci * pname:handleTypes is a bitmask of 3101e5c31af7Sopenharmony_ci elink:VkExternalSemaphoreHandleTypeFlagBits specifying one or more 3102e5c31af7Sopenharmony_ci semaphore handle types the application can: export from the resulting 3103e5c31af7Sopenharmony_ci semaphore. 3104e5c31af7Sopenharmony_ci The application can: request multiple handle types for the same 3105e5c31af7Sopenharmony_ci semaphore. 3106e5c31af7Sopenharmony_ci 3107e5c31af7Sopenharmony_ci.Valid Usage 3108e5c31af7Sopenharmony_ci**** 3109e5c31af7Sopenharmony_ci * [[VUID-VkExportSemaphoreCreateInfo-handleTypes-01124]] 3110e5c31af7Sopenharmony_ci The bits in pname:handleTypes must: be supported and compatible, as 3111e5c31af7Sopenharmony_ci reported by slink:VkExternalSemaphoreProperties 3112e5c31af7Sopenharmony_ci**** 3113e5c31af7Sopenharmony_ci 3114e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkExportSemaphoreCreateInfo.txt[] 3115e5c31af7Sopenharmony_ci-- 3116e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_semaphore[] 3117e5c31af7Sopenharmony_ci 3118e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_win32[] 3119e5c31af7Sopenharmony_ci[open,refpage='VkExportSemaphoreWin32HandleInfoKHR',desc='Structure specifying additional attributes of Windows handles exported from a semaphore',type='structs'] 3120e5c31af7Sopenharmony_ci-- 3121e5c31af7Sopenharmony_ciTo specify additional attributes of NT handles exported from a semaphore, 3122e5c31af7Sopenharmony_ciadd a sname:VkExportSemaphoreWin32HandleInfoKHR structure to the pname:pNext 3123e5c31af7Sopenharmony_cichain of the slink:VkSemaphoreCreateInfo structure. 3124e5c31af7Sopenharmony_ciThe sname:VkExportSemaphoreWin32HandleInfoKHR structure is defined as: 3125e5c31af7Sopenharmony_ci 3126e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkExportSemaphoreWin32HandleInfoKHR.txt[] 3127e5c31af7Sopenharmony_ci 3128e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3129e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3130e5c31af7Sopenharmony_ci structure. 3131e5c31af7Sopenharmony_ci * pname:pAttributes is a pointer to a Windows code:SECURITY_ATTRIBUTES 3132e5c31af7Sopenharmony_ci structure specifying security attributes of the handle. 3133e5c31af7Sopenharmony_ci * pname:dwAccess is a code:DWORD specifying access rights of the handle. 3134e5c31af7Sopenharmony_ci * pname:name is a null-terminated UTF-16 string to associate with the 3135e5c31af7Sopenharmony_ci underlying synchronization primitive referenced by NT handles exported 3136e5c31af7Sopenharmony_ci from the created semaphore. 3137e5c31af7Sopenharmony_ci 3138e5c31af7Sopenharmony_ciIf slink:VkExportSemaphoreCreateInfo is not included in the same pname:pNext 3139e5c31af7Sopenharmony_cichain, this structure is ignored. 3140e5c31af7Sopenharmony_ci 3141e5c31af7Sopenharmony_ciIf slink:VkExportSemaphoreCreateInfo is included in the pname:pNext chain of 3142e5c31af7Sopenharmony_cislink:VkSemaphoreCreateInfo with a Windows pname:handleType, but either 3143e5c31af7Sopenharmony_cisname:VkExportSemaphoreWin32HandleInfoKHR is not included in the pname:pNext 3144e5c31af7Sopenharmony_cichain, or if it is but pname:pAttributes is set to `NULL`, default security 3145e5c31af7Sopenharmony_cidescriptor values will be used, and child processes created by the 3146e5c31af7Sopenharmony_ciapplication will not inherit the handle, as described in the MSDN 3147e5c31af7Sopenharmony_cidocumentation for "`Synchronization Object Security and Access Rights`"^1^. 3148e5c31af7Sopenharmony_ciFurther, if the structure is not present, the access rights used depend on 3149e5c31af7Sopenharmony_cithe handle type. 3150e5c31af7Sopenharmony_ci 3151e5c31af7Sopenharmony_ciFor handles of the following types: 3152e5c31af7Sopenharmony_ci 3153e5c31af7Sopenharmony_ciename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT 3154e5c31af7Sopenharmony_ci 3155e5c31af7Sopenharmony_ciThe implementation must: ensure the access rights allow both signal and wait 3156e5c31af7Sopenharmony_cioperations on the semaphore. 3157e5c31af7Sopenharmony_ci 3158e5c31af7Sopenharmony_ciFor handles of the following types: 3159e5c31af7Sopenharmony_ci 3160e5c31af7Sopenharmony_ciename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT 3161e5c31af7Sopenharmony_ci 3162e5c31af7Sopenharmony_ciThe access rights must: be: 3163e5c31af7Sopenharmony_ci 3164e5c31af7Sopenharmony_cicode:GENERIC_ALL 3165e5c31af7Sopenharmony_ci 3166e5c31af7Sopenharmony_ci1:: 3167e5c31af7Sopenharmony_ci https://docs.microsoft.com/en-us/windows/win32/sync/synchronization-object-security-and-access-rights 3168e5c31af7Sopenharmony_ci 3169e5c31af7Sopenharmony_ci.Valid Usage 3170e5c31af7Sopenharmony_ci**** 3171e5c31af7Sopenharmony_ci * [[VUID-VkExportSemaphoreWin32HandleInfoKHR-handleTypes-01125]] 3172e5c31af7Sopenharmony_ci If slink:VkExportSemaphoreCreateInfo::pname:handleTypes does not include 3173e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT or 3174e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, 3175e5c31af7Sopenharmony_ci sname:VkExportSemaphoreWin32HandleInfoKHR must: not be included in the 3176e5c31af7Sopenharmony_ci pname:pNext chain of slink:VkSemaphoreCreateInfo 3177e5c31af7Sopenharmony_ci**** 3178e5c31af7Sopenharmony_ci 3179e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkExportSemaphoreWin32HandleInfoKHR.txt[] 3180e5c31af7Sopenharmony_ci-- 3181e5c31af7Sopenharmony_ci 3182e5c31af7Sopenharmony_ci[open,refpage='vkGetSemaphoreWin32HandleKHR',desc='Get a Windows HANDLE for a semaphore',type='protos'] 3183e5c31af7Sopenharmony_ci-- 3184e5c31af7Sopenharmony_ciTo export a Windows handle representing the payload of a semaphore, call: 3185e5c31af7Sopenharmony_ci 3186e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetSemaphoreWin32HandleKHR.txt[] 3187e5c31af7Sopenharmony_ci 3188e5c31af7Sopenharmony_ci * pname:device is the logical device that created the semaphore being 3189e5c31af7Sopenharmony_ci exported. 3190e5c31af7Sopenharmony_ci * pname:pGetWin32HandleInfo is a pointer to a 3191e5c31af7Sopenharmony_ci slink:VkSemaphoreGetWin32HandleInfoKHR structure containing parameters 3192e5c31af7Sopenharmony_ci of the export operation. 3193e5c31af7Sopenharmony_ci * pname:pHandle will return the Windows handle representing the semaphore 3194e5c31af7Sopenharmony_ci state. 3195e5c31af7Sopenharmony_ci 3196e5c31af7Sopenharmony_ciFor handle types defined as NT handles, the handles returned by 3197e5c31af7Sopenharmony_cifname:vkGetSemaphoreWin32HandleKHR are owned by the application. 3198e5c31af7Sopenharmony_ciTo avoid leaking resources, the application must: release ownership of them 3199e5c31af7Sopenharmony_ciusing the code:CloseHandle system call when they are no longer needed. 3200e5c31af7Sopenharmony_ci 3201e5c31af7Sopenharmony_ciExporting a Windows handle from a semaphore may: have side effects depending 3202e5c31af7Sopenharmony_cion the transference of the specified handle type, as described in 3203e5c31af7Sopenharmony_ci<<synchronization-semaphores-importing,Importing Semaphore Payloads>>. 3204e5c31af7Sopenharmony_ci 3205e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetSemaphoreWin32HandleKHR.txt[] 3206e5c31af7Sopenharmony_ci-- 3207e5c31af7Sopenharmony_ci 3208e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreGetWin32HandleInfoKHR',desc='Structure describing a Win32 handle semaphore export operation',type='structs'] 3209e5c31af7Sopenharmony_ci-- 3210e5c31af7Sopenharmony_ciThe sname:VkSemaphoreGetWin32HandleInfoKHR structure is defined as: 3211e5c31af7Sopenharmony_ci 3212e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreGetWin32HandleInfoKHR.txt[] 3213e5c31af7Sopenharmony_ci 3214e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3215e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3216e5c31af7Sopenharmony_ci structure. 3217e5c31af7Sopenharmony_ci * pname:semaphore is the semaphore from which state will be exported. 3218e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalSemaphoreHandleTypeFlagBits value 3219e5c31af7Sopenharmony_ci specifying the type of handle requested. 3220e5c31af7Sopenharmony_ci 3221e5c31af7Sopenharmony_ciThe properties of the handle returned depend on the value of 3222e5c31af7Sopenharmony_cipname:handleType. 3223e5c31af7Sopenharmony_ciSee elink:VkExternalSemaphoreHandleTypeFlagBits for a description of the 3224e5c31af7Sopenharmony_ciproperties of the defined external semaphore handle types. 3225e5c31af7Sopenharmony_ci 3226e5c31af7Sopenharmony_ci.Valid Usage 3227e5c31af7Sopenharmony_ci**** 3228e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01126]] 3229e5c31af7Sopenharmony_ci pname:handleType must: have been included in 3230e5c31af7Sopenharmony_ci slink:VkExportSemaphoreCreateInfo::pname:handleTypes when the 3231e5c31af7Sopenharmony_ci pname:semaphore's current payload was created 3232e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01127]] 3233e5c31af7Sopenharmony_ci If pname:handleType is defined as an NT handle, 3234e5c31af7Sopenharmony_ci flink:vkGetSemaphoreWin32HandleKHR must: be called no more than once for 3235e5c31af7Sopenharmony_ci each valid unique combination of pname:semaphore and pname:handleType 3236e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetWin32HandleInfoKHR-semaphore-01128]] 3237e5c31af7Sopenharmony_ci pname:semaphore must: not currently have its payload replaced by an 3238e5c31af7Sopenharmony_ci imported payload as described below in 3239e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>> 3240e5c31af7Sopenharmony_ci unless that imported payload's handle type was included in 3241e5c31af7Sopenharmony_ci slink:VkExternalSemaphoreProperties::pname:exportFromImportedHandleTypes 3242e5c31af7Sopenharmony_ci for pname:handleType 3243e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01129]] 3244e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3245e5c31af7Sopenharmony_ci transference semantics, as defined below in 3246e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>>, 3247e5c31af7Sopenharmony_ci there must: be no queue waiting on pname:semaphore 3248e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01130]] 3249e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3250e5c31af7Sopenharmony_ci transference semantics, pname:semaphore must: be signaled, or have an 3251e5c31af7Sopenharmony_ci associated <<synchronization-semaphores-signaling,semaphore signal 3252e5c31af7Sopenharmony_ci operation>> pending execution 3253e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetWin32HandleInfoKHR-handleType-01131]] 3254e5c31af7Sopenharmony_ci pname:handleType must: be defined as an NT handle or a global share 3255e5c31af7Sopenharmony_ci handle 3256e5c31af7Sopenharmony_ci**** 3257e5c31af7Sopenharmony_ci 3258e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreGetWin32HandleInfoKHR.txt[] 3259e5c31af7Sopenharmony_ci-- 3260e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_win32[] 3261e5c31af7Sopenharmony_ci 3262e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_fd[] 3263e5c31af7Sopenharmony_ci[open,refpage='vkGetSemaphoreFdKHR',desc='Get a POSIX file descriptor handle for a semaphore',type='protos'] 3264e5c31af7Sopenharmony_ci-- 3265e5c31af7Sopenharmony_ciTo export a POSIX file descriptor representing the payload of a semaphore, 3266e5c31af7Sopenharmony_cicall: 3267e5c31af7Sopenharmony_ci 3268e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetSemaphoreFdKHR.txt[] 3269e5c31af7Sopenharmony_ci 3270e5c31af7Sopenharmony_ci * pname:device is the logical device that created the semaphore being 3271e5c31af7Sopenharmony_ci exported. 3272e5c31af7Sopenharmony_ci * pname:pGetFdInfo is a pointer to a slink:VkSemaphoreGetFdInfoKHR 3273e5c31af7Sopenharmony_ci structure containing parameters of the export operation. 3274e5c31af7Sopenharmony_ci * pname:pFd will return the file descriptor representing the semaphore 3275e5c31af7Sopenharmony_ci payload. 3276e5c31af7Sopenharmony_ci 3277e5c31af7Sopenharmony_ciEach call to fname:vkGetSemaphoreFdKHR must: create a new file descriptor 3278e5c31af7Sopenharmony_ciand transfer ownership of it to the application. 3279e5c31af7Sopenharmony_ciTo avoid leaking resources, the application must: release ownership of the 3280e5c31af7Sopenharmony_cifile descriptor when it is no longer needed. 3281e5c31af7Sopenharmony_ci 3282e5c31af7Sopenharmony_ci[NOTE] 3283e5c31af7Sopenharmony_ci.Note 3284e5c31af7Sopenharmony_ci==== 3285e5c31af7Sopenharmony_ciOwnership can be released in many ways. 3286e5c31af7Sopenharmony_ciFor example, the application can call code:close() on the file descriptor, 3287e5c31af7Sopenharmony_cior transfer ownership back to Vulkan by using the file descriptor to import 3288e5c31af7Sopenharmony_cia semaphore payload. 3289e5c31af7Sopenharmony_ci==== 3290e5c31af7Sopenharmony_ciWhere supported by the operating system, the implementation must: set the 3291e5c31af7Sopenharmony_cifile descriptor to be closed automatically when an code:execve system call 3292e5c31af7Sopenharmony_ciis made. 3293e5c31af7Sopenharmony_ci 3294e5c31af7Sopenharmony_ciExporting a file descriptor from a semaphore may: have side effects 3295e5c31af7Sopenharmony_cidepending on the transference of the specified handle type, as described in 3296e5c31af7Sopenharmony_ci<<synchronization-semaphores-importing,Importing Semaphore State>>. 3297e5c31af7Sopenharmony_ci 3298e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetSemaphoreFdKHR.txt[] 3299e5c31af7Sopenharmony_ci-- 3300e5c31af7Sopenharmony_ci 3301e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreGetFdInfoKHR',desc='Structure describing a POSIX FD semaphore export operation',type='structs'] 3302e5c31af7Sopenharmony_ci-- 3303e5c31af7Sopenharmony_ciThe sname:VkSemaphoreGetFdInfoKHR structure is defined as: 3304e5c31af7Sopenharmony_ci 3305e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreGetFdInfoKHR.txt[] 3306e5c31af7Sopenharmony_ci 3307e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3308e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3309e5c31af7Sopenharmony_ci structure. 3310e5c31af7Sopenharmony_ci * pname:semaphore is the semaphore from which state will be exported. 3311e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalSemaphoreHandleTypeFlagBits value 3312e5c31af7Sopenharmony_ci specifying the type of handle requested. 3313e5c31af7Sopenharmony_ci 3314e5c31af7Sopenharmony_ciThe properties of the file descriptor returned depend on the value of 3315e5c31af7Sopenharmony_cipname:handleType. 3316e5c31af7Sopenharmony_ciSee elink:VkExternalSemaphoreHandleTypeFlagBits for a description of the 3317e5c31af7Sopenharmony_ciproperties of the defined external semaphore handle types. 3318e5c31af7Sopenharmony_ci 3319e5c31af7Sopenharmony_ci.Valid Usage 3320e5c31af7Sopenharmony_ci**** 3321e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-handleType-01132]] 3322e5c31af7Sopenharmony_ci pname:handleType must: have been included in 3323e5c31af7Sopenharmony_ci slink:VkExportSemaphoreCreateInfo::pname:handleTypes when 3324e5c31af7Sopenharmony_ci pname:semaphore's current payload was created 3325e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-semaphore-01133]] 3326e5c31af7Sopenharmony_ci pname:semaphore must: not currently have its payload replaced by an 3327e5c31af7Sopenharmony_ci imported payload as described below in 3328e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>> 3329e5c31af7Sopenharmony_ci unless that imported payload's handle type was included in 3330e5c31af7Sopenharmony_ci slink:VkExternalSemaphoreProperties::pname:exportFromImportedHandleTypes 3331e5c31af7Sopenharmony_ci for pname:handleType 3332e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-handleType-01134]] 3333e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3334e5c31af7Sopenharmony_ci transference semantics, as defined below in 3335e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>>, 3336e5c31af7Sopenharmony_ci there must: be no queue waiting on pname:semaphore 3337e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-handleType-01135]] 3338e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3339e5c31af7Sopenharmony_ci transference semantics, pname:semaphore must: be signaled, or have an 3340e5c31af7Sopenharmony_ci associated <<synchronization-semaphores-signaling,semaphore signal 3341e5c31af7Sopenharmony_ci operation>> pending execution 3342e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-handleType-01136]] 3343e5c31af7Sopenharmony_ci pname:handleType must: be defined as a POSIX file descriptor handle 3344e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3345e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-handleType-03253]] 3346e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3347e5c31af7Sopenharmony_ci transference semantics, pname:semaphore must: have been created with a 3348e5c31af7Sopenharmony_ci elink:VkSemaphoreType of ename:VK_SEMAPHORE_TYPE_BINARY 3349e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetFdInfoKHR-handleType-03254]] 3350e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3351e5c31af7Sopenharmony_ci transference semantics, pname:semaphore must: have an associated 3352e5c31af7Sopenharmony_ci semaphore signal operation that has been submitted for execution and any 3353e5c31af7Sopenharmony_ci semaphore signal operations on which it depends (if any) must: have also 3354e5c31af7Sopenharmony_ci been submitted for execution 3355e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3356e5c31af7Sopenharmony_ci**** 3357e5c31af7Sopenharmony_ci 3358e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreGetFdInfoKHR.txt[] 3359e5c31af7Sopenharmony_ci-- 3360e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_fd[] 3361e5c31af7Sopenharmony_ci 3362e5c31af7Sopenharmony_ciifdef::VK_FUCHSIA_external_semaphore[] 3363e5c31af7Sopenharmony_ci[open,refpage='vkGetSemaphoreZirconHandleFUCHSIA',desc='Get a Zircon event handle for a semaphore',type='protos'] 3364e5c31af7Sopenharmony_ci-- 3365e5c31af7Sopenharmony_ciTo export a Zircon event handle representing the payload of a semaphore, 3366e5c31af7Sopenharmony_cicall: 3367e5c31af7Sopenharmony_ci 3368e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetSemaphoreZirconHandleFUCHSIA.txt[] 3369e5c31af7Sopenharmony_ci 3370e5c31af7Sopenharmony_ci * pname:device is the logical device that created the semaphore being 3371e5c31af7Sopenharmony_ci exported. 3372e5c31af7Sopenharmony_ci * pname:pGetZirconHandleInfo is a pointer to a 3373e5c31af7Sopenharmony_ci slink:VkSemaphoreGetZirconHandleInfoFUCHSIA structure containing 3374e5c31af7Sopenharmony_ci parameters of the export operation. 3375e5c31af7Sopenharmony_ci * pname:pZirconHandle will return the Zircon event handle representing the 3376e5c31af7Sopenharmony_ci semaphore payload. 3377e5c31af7Sopenharmony_ci 3378e5c31af7Sopenharmony_ciEach call to fname:vkGetSemaphoreZirconHandleFUCHSIA must: create a Zircon 3379e5c31af7Sopenharmony_cievent handle and transfer ownership of it to the application. 3380e5c31af7Sopenharmony_ciTo avoid leaking resources, the application must: release ownership of the 3381e5c31af7Sopenharmony_ciZircon event handle when it is no longer needed. 3382e5c31af7Sopenharmony_ci 3383e5c31af7Sopenharmony_ci[NOTE] 3384e5c31af7Sopenharmony_ci.Note 3385e5c31af7Sopenharmony_ci==== 3386e5c31af7Sopenharmony_ciOwnership can be released in many ways. 3387e5c31af7Sopenharmony_ciFor example, the application can call zx_handle_close() on the file 3388e5c31af7Sopenharmony_cidescriptor, or transfer ownership back to Vulkan by using the file 3389e5c31af7Sopenharmony_cidescriptor to import a semaphore payload. 3390e5c31af7Sopenharmony_ci==== 3391e5c31af7Sopenharmony_ci 3392e5c31af7Sopenharmony_ciExporting a Zircon event handle from a semaphore may: have side effects 3393e5c31af7Sopenharmony_cidepending on the transference of the specified handle type, as described in 3394e5c31af7Sopenharmony_ci<<synchronization-semaphores-importing,Importing Semaphore State>>. 3395e5c31af7Sopenharmony_ci 3396e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetSemaphoreZirconHandleFUCHSIA.txt[] 3397e5c31af7Sopenharmony_ci-- 3398e5c31af7Sopenharmony_ci 3399e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreGetZirconHandleInfoFUCHSIA',desc='Structure describing a Zircon event handle semaphore export operation',type='structs'] 3400e5c31af7Sopenharmony_ci-- 3401e5c31af7Sopenharmony_ciThe sname:VkSemaphoreGetZirconHandleInfoFUCHSIA structure is defined as: 3402e5c31af7Sopenharmony_ci 3403e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreGetZirconHandleInfoFUCHSIA.txt[] 3404e5c31af7Sopenharmony_ci 3405e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3406e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3407e5c31af7Sopenharmony_ci structure. 3408e5c31af7Sopenharmony_ci * pname:semaphore is the semaphore from which state will be exported. 3409e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalSemaphoreHandleTypeFlagBits value 3410e5c31af7Sopenharmony_ci specifying the type of handle requested. 3411e5c31af7Sopenharmony_ci 3412e5c31af7Sopenharmony_ciThe properties of the Zircon event handle returned depend on the value of 3413e5c31af7Sopenharmony_cipname:handleType. 3414e5c31af7Sopenharmony_ciSee elink:VkExternalSemaphoreHandleTypeFlagBits for a description of the 3415e5c31af7Sopenharmony_ciproperties of the defined external semaphore handle types. 3416e5c31af7Sopenharmony_ci 3417e5c31af7Sopenharmony_ci.Valid Usage 3418e5c31af7Sopenharmony_ci**** 3419e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04758]] 3420e5c31af7Sopenharmony_ci pname:handleType must: have been included in 3421e5c31af7Sopenharmony_ci slink:VkExportSemaphoreCreateInfo::pname:handleTypes when 3422e5c31af7Sopenharmony_ci pname:semaphore's current payload was created 3423e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-semaphore-04759]] 3424e5c31af7Sopenharmony_ci pname:semaphore must: not currently have its payload replaced by an 3425e5c31af7Sopenharmony_ci imported payload as described below in 3426e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>> 3427e5c31af7Sopenharmony_ci unless that imported payload's handle type was included in 3428e5c31af7Sopenharmony_ci slink:VkExternalSemaphoreProperties::pname:exportFromImportedHandleTypes 3429e5c31af7Sopenharmony_ci for pname:handleType 3430e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04760]] 3431e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3432e5c31af7Sopenharmony_ci transference semantics, as defined below in 3433e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>>, 3434e5c31af7Sopenharmony_ci there must: be no queue waiting on pname:semaphore 3435e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04761]] 3436e5c31af7Sopenharmony_ci If pname:handleType refers to a handle type with copy payload 3437e5c31af7Sopenharmony_ci transference semantics, pname:semaphore must: be signaled, or have an 3438e5c31af7Sopenharmony_ci associated <<synchronization-semaphores-signaling,semaphore signal 3439e5c31af7Sopenharmony_ci operation>> pending execution 3440e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-handleType-04762]] 3441e5c31af7Sopenharmony_ci pname:handleType must: be defined as a Zircon event handle 3442e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreGetZirconHandleInfoFUCHSIA-semaphore-04763]] 3443e5c31af7Sopenharmony_ci pname:semaphore must: have been created with a elink:VkSemaphoreType of 3444e5c31af7Sopenharmony_ci ename:VK_SEMAPHORE_TYPE_BINARY 3445e5c31af7Sopenharmony_ci**** 3446e5c31af7Sopenharmony_ci 3447e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreGetZirconHandleInfoFUCHSIA.txt[] 3448e5c31af7Sopenharmony_ci-- 3449e5c31af7Sopenharmony_ciendif::VK_FUCHSIA_external_semaphore[] 3450e5c31af7Sopenharmony_ci 3451e5c31af7Sopenharmony_ci[open,refpage='vkDestroySemaphore',desc='Destroy a semaphore object',type='protos'] 3452e5c31af7Sopenharmony_ci-- 3453e5c31af7Sopenharmony_ciTo destroy a semaphore, call: 3454e5c31af7Sopenharmony_ci 3455e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroySemaphore.txt[] 3456e5c31af7Sopenharmony_ci 3457e5c31af7Sopenharmony_ci * pname:device is the logical device that destroys the semaphore. 3458e5c31af7Sopenharmony_ci * pname:semaphore is the handle of the semaphore to destroy. 3459e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 3460e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 3461e5c31af7Sopenharmony_ci 3462e5c31af7Sopenharmony_ci.Valid Usage 3463e5c31af7Sopenharmony_ci**** 3464e5c31af7Sopenharmony_ci * [[VUID-vkDestroySemaphore-semaphore-01137]] 3465e5c31af7Sopenharmony_ci All submitted batches that refer to pname:semaphore must: have completed 3466e5c31af7Sopenharmony_ci execution 3467e5c31af7Sopenharmony_ci * [[VUID-vkDestroySemaphore-semaphore-01138]] 3468e5c31af7Sopenharmony_ci If sname:VkAllocationCallbacks were provided when pname:semaphore was 3469e5c31af7Sopenharmony_ci created, a compatible set of callbacks must: be provided here 3470e5c31af7Sopenharmony_ci * [[VUID-vkDestroySemaphore-semaphore-01139]] 3471e5c31af7Sopenharmony_ci If no sname:VkAllocationCallbacks were provided when pname:semaphore was 3472e5c31af7Sopenharmony_ci created, pname:pAllocator must: be `NULL` 3473e5c31af7Sopenharmony_ci**** 3474e5c31af7Sopenharmony_ci 3475e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroySemaphore.txt[] 3476e5c31af7Sopenharmony_ci-- 3477e5c31af7Sopenharmony_ci 3478e5c31af7Sopenharmony_ci 3479e5c31af7Sopenharmony_ci[[synchronization-semaphores-signaling]] 3480e5c31af7Sopenharmony_ci=== Semaphore Signaling 3481e5c31af7Sopenharmony_ci 3482e5c31af7Sopenharmony_ciWhen a batch is submitted to a queue via a <<devsandqueues-submission, queue 3483e5c31af7Sopenharmony_cisubmission>>, and it includes semaphores to be signaled, it defines a memory 3484e5c31af7Sopenharmony_cidependency on the batch, and defines _semaphore signal operations_ which set 3485e5c31af7Sopenharmony_cithe semaphores to the signaled state. 3486e5c31af7Sopenharmony_ci 3487e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3488e5c31af7Sopenharmony_ciIn case of semaphores created with a elink:VkSemaphoreType of 3489e5c31af7Sopenharmony_ciename:VK_SEMAPHORE_TYPE_TIMELINE the semaphore is considered signaled with 3490e5c31af7Sopenharmony_cirespect to the counter value set to be signaled as specified in 3491e5c31af7Sopenharmony_cislink:VkTimelineSemaphoreSubmitInfo or slink:VkSemaphoreSignalInfo. 3492e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3493e5c31af7Sopenharmony_ci 3494e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 3495e5c31af7Sopenharmony_ciincludes every command submitted in the same batch. 3496e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 3497e5c31af7Sopenharmony_ciIn the case of flink:vkQueueSubmit2KHR, the first synchronization scope is 3498e5c31af7Sopenharmony_cilimited to the pipeline stage specified by 3499e5c31af7Sopenharmony_cislink:VkSemaphoreSubmitInfoKHR::pname:stageMask. 3500e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 3501e5c31af7Sopenharmony_ciSemaphore signal operations that are defined by flink:vkQueueSubmit 3502e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 3503e5c31af7Sopenharmony_cior flink:vkQueueSubmit2KHR 3504e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 3505e5c31af7Sopenharmony_ciadditionally include all commands that occur earlier in 3506e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 3507e5c31af7Sopenharmony_ciSemaphore signal operations that are defined by flink:vkQueueSubmit or 3508e5c31af7Sopenharmony_ciflink:vkQueueBindSparse additionally include in the first synchronization 3509e5c31af7Sopenharmony_ciscope any semaphore and fence signal operations that occur earlier in 3510e5c31af7Sopenharmony_ci<<synchronization-signal-operation-order,signal operation order>>. 3511e5c31af7Sopenharmony_ci 3512e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 3513e5c31af7Sopenharmony_ciincludes only the semaphore signal operation. 3514e5c31af7Sopenharmony_ci 3515e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> 3516e5c31af7Sopenharmony_ciincludes all memory access performed by the device. 3517e5c31af7Sopenharmony_ci 3518e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 3519e5c31af7Sopenharmony_ciempty. 3520e5c31af7Sopenharmony_ci 3521e5c31af7Sopenharmony_ci 3522e5c31af7Sopenharmony_ci[[synchronization-semaphores-waiting]] 3523e5c31af7Sopenharmony_ci=== Semaphore Waiting 3524e5c31af7Sopenharmony_ci 3525e5c31af7Sopenharmony_ciWhen a batch is submitted to a queue via a <<devsandqueues-submission, queue 3526e5c31af7Sopenharmony_cisubmission>>, and it includes semaphores to be waited on, it defines a 3527e5c31af7Sopenharmony_cimemory dependency between prior semaphore signal operations and the batch, 3528e5c31af7Sopenharmony_ciand defines _semaphore wait operations_. 3529e5c31af7Sopenharmony_ci 3530e5c31af7Sopenharmony_ciSuch semaphore wait operations set the semaphores 3531e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3532e5c31af7Sopenharmony_cicreated with a elink:VkSemaphoreType of ename:VK_SEMAPHORE_TYPE_BINARY 3533e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3534e5c31af7Sopenharmony_cito the unsignaled state. 3535e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3536e5c31af7Sopenharmony_ciIn case of semaphores created with a elink:VkSemaphoreType of 3537e5c31af7Sopenharmony_ciename:VK_SEMAPHORE_TYPE_TIMELINE a prior semaphore signal operation defines 3538e5c31af7Sopenharmony_cia memory dependency with a semaphore wait operation if the value the 3539e5c31af7Sopenharmony_cisemaphore is signaled with is greater than or equal to the value the 3540e5c31af7Sopenharmony_cisemaphore is waited with, thus the semaphore will continue to be considered 3541e5c31af7Sopenharmony_cisignaled with respect to the counter value waited on as specified in 3542e5c31af7Sopenharmony_cislink:VkTimelineSemaphoreSubmitInfo. 3543e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3544e5c31af7Sopenharmony_ci 3545e5c31af7Sopenharmony_ciThe first synchronization scope includes all semaphore signal operations 3546e5c31af7Sopenharmony_cithat operate on semaphores waited on in the same batch, and that 3547e5c31af7Sopenharmony_cihappen-before the wait completes. 3548e5c31af7Sopenharmony_ci 3549e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 3550e5c31af7Sopenharmony_ciincludes every command submitted in the same batch. 3551e5c31af7Sopenharmony_ciIn the case of flink:vkQueueSubmit, the second synchronization scope is 3552e5c31af7Sopenharmony_cilimited to operations on the pipeline stages determined by the 3553e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, destination stage mask>> specified 3554e5c31af7Sopenharmony_ciby the corresponding element of pname:pWaitDstStageMask. 3555e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 3556e5c31af7Sopenharmony_ciIn the case of flink:vkQueueSubmit2KHR, the second synchronization scope is 3557e5c31af7Sopenharmony_cilimited to the pipeline stage specified by 3558e5c31af7Sopenharmony_cislink:VkSemaphoreSubmitInfoKHR::pname:stageMask. 3559e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 3560e5c31af7Sopenharmony_ciAlso, in the case of 3561e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 3562e5c31af7Sopenharmony_cieither flink:vkQueueSubmit2KHR or 3563e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 3564e5c31af7Sopenharmony_ciflink:vkQueueSubmit, the second synchronization scope additionally includes 3565e5c31af7Sopenharmony_ciall commands that occur later in 3566e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 3567e5c31af7Sopenharmony_ci 3568e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> is 3569e5c31af7Sopenharmony_ciempty. 3570e5c31af7Sopenharmony_ci 3571e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> 3572e5c31af7Sopenharmony_ciincludes all memory access performed by the device. 3573e5c31af7Sopenharmony_ci 3574e5c31af7Sopenharmony_ciThe semaphore wait operation happens-after the first set of operations in 3575e5c31af7Sopenharmony_cithe execution dependency, and happens-before the second set of operations in 3576e5c31af7Sopenharmony_cithe execution dependency. 3577e5c31af7Sopenharmony_ci 3578e5c31af7Sopenharmony_ci[NOTE] 3579e5c31af7Sopenharmony_ci.Note 3580e5c31af7Sopenharmony_ci==== 3581e5c31af7Sopenharmony_ciUnlike 3582e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3583e5c31af7Sopenharmony_citimeline semaphores, 3584e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3585e5c31af7Sopenharmony_cifences or events, the act of waiting for a binary semaphore also unsignals 3586e5c31af7Sopenharmony_cithat semaphore. 3587e5c31af7Sopenharmony_ciApplications must: ensure that between two such wait operations, the 3588e5c31af7Sopenharmony_cisemaphore is signaled again, with execution dependencies used to ensure 3589e5c31af7Sopenharmony_cithese occur in order. 3590e5c31af7Sopenharmony_ciBinary semaphore waits and signals should thus occur in discrete 1:1 pairs. 3591e5c31af7Sopenharmony_ci==== 3592e5c31af7Sopenharmony_ci 3593e5c31af7Sopenharmony_ciifdef::VK_KHR_swapchain[] 3594e5c31af7Sopenharmony_ci[NOTE] 3595e5c31af7Sopenharmony_ci.Note 3596e5c31af7Sopenharmony_ci==== 3597e5c31af7Sopenharmony_ciA common scenario for using pname:pWaitDstStageMask with values other than 3598e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT is when synchronizing a window 3599e5c31af7Sopenharmony_cisystem presentation operation against subsequent command buffers which 3600e5c31af7Sopenharmony_cirender the next frame. 3601e5c31af7Sopenharmony_ciIn this case, a presentation image must: not be overwritten until the 3602e5c31af7Sopenharmony_cipresentation operation completes, but other pipeline stages can: execute 3603e5c31af7Sopenharmony_ciwithout waiting. 3604e5c31af7Sopenharmony_ciA mask of ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT prevents 3605e5c31af7Sopenharmony_cisubsequent color attachment writes from executing until the semaphore 3606e5c31af7Sopenharmony_cisignals. 3607e5c31af7Sopenharmony_ciSome implementations may: be able to execute transfer operations and/or 3608e5c31af7Sopenharmony_cipre-rasterization work before the semaphore is signaled. 3609e5c31af7Sopenharmony_ci 3610e5c31af7Sopenharmony_ciIf an image layout transition needs to be performed on a presentable image 3611e5c31af7Sopenharmony_cibefore it is used in a framebuffer, that can: be performed as the first 3612e5c31af7Sopenharmony_cioperation submitted to the queue after acquiring the image, and should: not 3613e5c31af7Sopenharmony_ciprevent other work from overlapping with the presentation operation. 3614e5c31af7Sopenharmony_ciFor example, a sname:VkImageMemoryBarrier could use: 3615e5c31af7Sopenharmony_ci 3616e5c31af7Sopenharmony_ci * pname:srcStageMask = ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 3617e5c31af7Sopenharmony_ci * pname:srcAccessMask = 0 3618e5c31af7Sopenharmony_ci * pname:dstStageMask = ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 3619e5c31af7Sopenharmony_ci * pname:dstAccessMask = ename:VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | 3620e5c31af7Sopenharmony_ci ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT. 3621e5c31af7Sopenharmony_ci * pname:oldLayout = ename:VK_IMAGE_LAYOUT_PRESENT_SRC_KHR 3622e5c31af7Sopenharmony_ci * pname:newLayout = ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 3623e5c31af7Sopenharmony_ci 3624e5c31af7Sopenharmony_ciAlternatively, pname:oldLayout can: be ename:VK_IMAGE_LAYOUT_UNDEFINED, if 3625e5c31af7Sopenharmony_cithe image's contents need not be preserved. 3626e5c31af7Sopenharmony_ci 3627e5c31af7Sopenharmony_ciThis barrier accomplishes a dependency chain between previous presentation 3628e5c31af7Sopenharmony_cioperations and subsequent color attachment output operations, with the 3629e5c31af7Sopenharmony_cilayout transition performed in between, and does not introduce a dependency 3630e5c31af7Sopenharmony_cibetween previous work and any 3631e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader 3632e5c31af7Sopenharmony_cistage>>s. 3633e5c31af7Sopenharmony_ciMore precisely, the semaphore signals after the presentation operation 3634e5c31af7Sopenharmony_cicompletes, the semaphore wait stalls the 3635e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT stage, and there is a 3636e5c31af7Sopenharmony_cidependency from that same stage to itself with the layout transition 3637e5c31af7Sopenharmony_ciperformed in between. 3638e5c31af7Sopenharmony_ci==== 3639e5c31af7Sopenharmony_ciendif::VK_KHR_swapchain[] 3640e5c31af7Sopenharmony_ci 3641e5c31af7Sopenharmony_ci 3642e5c31af7Sopenharmony_ci[[synchronization-semaphores-waiting-state]] 3643e5c31af7Sopenharmony_ci=== Semaphore State Requirements For Wait Operations 3644e5c31af7Sopenharmony_ci 3645e5c31af7Sopenharmony_ciBefore waiting on a semaphore, the application must: ensure the semaphore is 3646e5c31af7Sopenharmony_ciin a valid state for a wait operation. 3647e5c31af7Sopenharmony_ciSpecifically, when a <<synchronization-semaphores-waiting,semaphore wait 3648e5c31af7Sopenharmony_cioperation>> is submitted to a queue: 3649e5c31af7Sopenharmony_ci 3650e5c31af7Sopenharmony_ci * A binary semaphore must: be signaled, or have an associated 3651e5c31af7Sopenharmony_ci <<synchronization-semaphores-signaling,semaphore signal operation>> that 3652e5c31af7Sopenharmony_ci is pending execution. 3653e5c31af7Sopenharmony_ci * Any <<synchronization-semaphores-signaling,semaphore signal operations>> 3654e5c31af7Sopenharmony_ci on which the pending binary semaphore signal operation depends must: 3655e5c31af7Sopenharmony_ci also be completed or pending execution. 3656e5c31af7Sopenharmony_ci * There must: be no other queue waiting on the same binary semaphore when 3657e5c31af7Sopenharmony_ci the operation executes. 3658e5c31af7Sopenharmony_ci 3659e5c31af7Sopenharmony_ci 3660e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3661e5c31af7Sopenharmony_ci[[synchronization-semaphores-hostops]] 3662e5c31af7Sopenharmony_ci=== Host Operations on Semaphores 3663e5c31af7Sopenharmony_ci 3664e5c31af7Sopenharmony_ciIn addition to <<synchronization-semaphores-signaling,semaphore signal 3665e5c31af7Sopenharmony_cioperations>> and <<synchronization-semaphores-waiting,semaphore wait 3666e5c31af7Sopenharmony_cioperations>> submitted to device queues, timeline semaphores support the 3667e5c31af7Sopenharmony_cifollowing host operations: 3668e5c31af7Sopenharmony_ci 3669e5c31af7Sopenharmony_ci * Query the current counter value of the semaphore using the 3670e5c31af7Sopenharmony_ci flink:vkGetSemaphoreCounterValue command. 3671e5c31af7Sopenharmony_ci * Wait for a set of semaphores to reach particular counter values using 3672e5c31af7Sopenharmony_ci the flink:vkWaitSemaphores command. 3673e5c31af7Sopenharmony_ci * Signal the semaphore with a particular counter value from the host using 3674e5c31af7Sopenharmony_ci the flink:vkSignalSemaphore command. 3675e5c31af7Sopenharmony_ci 3676e5c31af7Sopenharmony_ci[open,refpage='vkGetSemaphoreCounterValue',desc='Query the current state of a timeline semaphore',type='protos',alias='vkGetSemaphoreCounterValueKHR'] 3677e5c31af7Sopenharmony_ci-- 3678e5c31af7Sopenharmony_ciTo query the current counter value of a semaphore created with a 3679e5c31af7Sopenharmony_cielink:VkSemaphoreType of ename:VK_SEMAPHORE_TYPE_TIMELINE from the host, 3680e5c31af7Sopenharmony_cicall: 3681e5c31af7Sopenharmony_ci 3682e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 3683e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetSemaphoreCounterValue.txt[] 3684e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 3685e5c31af7Sopenharmony_ci 3686e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2+VK_KHR_timeline_semaphore[or the equivalent command] 3687e5c31af7Sopenharmony_ci 3688e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3689e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetSemaphoreCounterValueKHR.txt[] 3690e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3691e5c31af7Sopenharmony_ci 3692e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the semaphore. 3693e5c31af7Sopenharmony_ci * pname:semaphore is the handle of the semaphore to query. 3694e5c31af7Sopenharmony_ci * pname:pValue is a pointer to a 64-bit integer value in which the current 3695e5c31af7Sopenharmony_ci counter value of the semaphore is returned. 3696e5c31af7Sopenharmony_ci 3697e5c31af7Sopenharmony_ci[NOTE] 3698e5c31af7Sopenharmony_ci.Note 3699e5c31af7Sopenharmony_ci==== 3700e5c31af7Sopenharmony_ciIf a <<devsandqueues-submission, queue submission>> command is pending 3701e5c31af7Sopenharmony_ciexecution, then the value returned by this command may: immediately be out 3702e5c31af7Sopenharmony_ciof date. 3703e5c31af7Sopenharmony_ci==== 3704e5c31af7Sopenharmony_ci 3705e5c31af7Sopenharmony_ci.Valid Usage 3706e5c31af7Sopenharmony_ci**** 3707e5c31af7Sopenharmony_ci * [[VUID-vkGetSemaphoreCounterValue-semaphore-03255]] 3708e5c31af7Sopenharmony_ci pname:semaphore must: have been created with a elink:VkSemaphoreType of 3709e5c31af7Sopenharmony_ci ename:VK_SEMAPHORE_TYPE_TIMELINE 3710e5c31af7Sopenharmony_ci**** 3711e5c31af7Sopenharmony_ci 3712e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetSemaphoreCounterValue.txt[] 3713e5c31af7Sopenharmony_ci-- 3714e5c31af7Sopenharmony_ci 3715e5c31af7Sopenharmony_ci[open,refpage='vkWaitSemaphores',desc='Wait for timeline semaphores on the host',type='protos',alias='vkWaitSemaphoresKHR'] 3716e5c31af7Sopenharmony_ci-- 3717e5c31af7Sopenharmony_ciTo wait for a set of semaphores created with a elink:VkSemaphoreType of 3718e5c31af7Sopenharmony_ciename:VK_SEMAPHORE_TYPE_TIMELINE to reach particular counter values on the 3719e5c31af7Sopenharmony_cihost, call: 3720e5c31af7Sopenharmony_ci 3721e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 3722e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkWaitSemaphores.txt[] 3723e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 3724e5c31af7Sopenharmony_ci 3725e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2+VK_KHR_timeline_semaphore[or the equivalent command] 3726e5c31af7Sopenharmony_ci 3727e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3728e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkWaitSemaphoresKHR.txt[] 3729e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3730e5c31af7Sopenharmony_ci 3731e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the semaphores. 3732e5c31af7Sopenharmony_ci * pname:pWaitInfo is a pointer to a slink:VkSemaphoreWaitInfo structure 3733e5c31af7Sopenharmony_ci containing information about the wait condition. 3734e5c31af7Sopenharmony_ci * pname:timeout is the timeout period in units of nanoseconds. 3735e5c31af7Sopenharmony_ci pname:timeout is adjusted to the closest value allowed by the 3736e5c31af7Sopenharmony_ci implementation-dependent timeout accuracy, which may: be substantially 3737e5c31af7Sopenharmony_ci longer than one nanosecond, and may: be longer than the requested 3738e5c31af7Sopenharmony_ci period. 3739e5c31af7Sopenharmony_ci 3740e5c31af7Sopenharmony_ciIf the condition is satisfied when fname:vkWaitSemaphores is called, then 3741e5c31af7Sopenharmony_cifname:vkWaitSemaphores returns immediately. 3742e5c31af7Sopenharmony_ciIf the condition is not satisfied at the time fname:vkWaitSemaphores is 3743e5c31af7Sopenharmony_cicalled, then fname:vkWaitSemaphores will block and wait until the condition 3744e5c31af7Sopenharmony_ciis satisfied or the pname:timeout has expired, whichever is sooner. 3745e5c31af7Sopenharmony_ci 3746e5c31af7Sopenharmony_ciIf pname:timeout is zero, then fname:vkWaitSemaphores does not wait, but 3747e5c31af7Sopenharmony_cisimply returns information about the current state of the semaphores. 3748e5c31af7Sopenharmony_ciename:VK_TIMEOUT will be returned in this case if the condition is not 3749e5c31af7Sopenharmony_cisatisfied, even though no actual wait was performed. 3750e5c31af7Sopenharmony_ci 3751e5c31af7Sopenharmony_ciIf the condition is satisfied before the pname:timeout has expired, 3752e5c31af7Sopenharmony_cifname:vkWaitSemaphores returns ename:VK_SUCCESS. 3753e5c31af7Sopenharmony_ciOtherwise, fname:vkWaitSemaphores returns ename:VK_TIMEOUT after the 3754e5c31af7Sopenharmony_cipname:timeout has expired. 3755e5c31af7Sopenharmony_ci 3756e5c31af7Sopenharmony_ciIf device loss occurs (see <<devsandqueues-lost-device,Lost Device>>) before 3757e5c31af7Sopenharmony_cithe timeout has expired, fname:vkWaitSemaphores must: return in finite time 3758e5c31af7Sopenharmony_ciwith either ename:VK_SUCCESS or ename:VK_ERROR_DEVICE_LOST. 3759e5c31af7Sopenharmony_ci 3760e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkWaitSemaphores.txt[] 3761e5c31af7Sopenharmony_ci-- 3762e5c31af7Sopenharmony_ci 3763e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreWaitInfo',desc='Structure containing information about the semaphore wait condition',type='structs',alias='VkSemaphoreWaitInfoKHR'] 3764e5c31af7Sopenharmony_ci-- 3765e5c31af7Sopenharmony_ciThe sname:VkSemaphoreWaitInfo structure is defined as: 3766e5c31af7Sopenharmony_ci 3767e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreWaitInfo.txt[] 3768e5c31af7Sopenharmony_ci 3769e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3770e5c31af7Sopenharmony_cior the equivalent 3771e5c31af7Sopenharmony_ci 3772e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreWaitInfoKHR.txt[] 3773e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3774e5c31af7Sopenharmony_ci 3775e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3776e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3777e5c31af7Sopenharmony_ci structure. 3778e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkSemaphoreWaitFlagBits specifying 3779e5c31af7Sopenharmony_ci additional parameters for the semaphore wait operation. 3780e5c31af7Sopenharmony_ci * pname:semaphoreCount is the number of semaphores to wait on. 3781e5c31af7Sopenharmony_ci * pname:pSemaphores is a pointer to an array of pname:semaphoreCount 3782e5c31af7Sopenharmony_ci semaphore handles to wait on. 3783e5c31af7Sopenharmony_ci * pname:pValues is a pointer to an array of pname:semaphoreCount timeline 3784e5c31af7Sopenharmony_ci semaphore values. 3785e5c31af7Sopenharmony_ci 3786e5c31af7Sopenharmony_ci.Valid Usage 3787e5c31af7Sopenharmony_ci**** 3788e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreWaitInfo-pSemaphores-03256]] 3789e5c31af7Sopenharmony_ci All of the elements of pname:pSemaphores must: reference a semaphore 3790e5c31af7Sopenharmony_ci that was created with a elink:VkSemaphoreType of 3791e5c31af7Sopenharmony_ci ename:VK_SEMAPHORE_TYPE_TIMELINE 3792e5c31af7Sopenharmony_ci**** 3793e5c31af7Sopenharmony_ci 3794e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreWaitInfo.txt[] 3795e5c31af7Sopenharmony_ci-- 3796e5c31af7Sopenharmony_ci 3797e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreWaitFlagBits',desc='Bitmask specifying additional parameters of a semaphore wait operation',type='enums',alias='VkSemaphoreWaitFlagBitsKHR'] 3798e5c31af7Sopenharmony_ci-- 3799e5c31af7Sopenharmony_ciBits which can: be set in slink:VkSemaphoreWaitInfo::pname:flags, specifying 3800e5c31af7Sopenharmony_ciadditional parameters of a semaphore wait operation, are: 3801e5c31af7Sopenharmony_ci 3802e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSemaphoreWaitFlagBits.txt[] 3803e5c31af7Sopenharmony_ci 3804e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3805e5c31af7Sopenharmony_cior the equivalent 3806e5c31af7Sopenharmony_ci 3807e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSemaphoreWaitFlagBitsKHR.txt[] 3808e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3809e5c31af7Sopenharmony_ci 3810e5c31af7Sopenharmony_ci * ename:VK_SEMAPHORE_WAIT_ANY_BIT specifies that the semaphore wait 3811e5c31af7Sopenharmony_ci condition is that at least one of the semaphores in 3812e5c31af7Sopenharmony_ci sname:VkSemaphoreWaitInfo::pname:pSemaphores has reached the value 3813e5c31af7Sopenharmony_ci specified by the corresponding element of 3814e5c31af7Sopenharmony_ci sname:VkSemaphoreWaitInfo::pname:pValues. 3815e5c31af7Sopenharmony_ci If ename:VK_SEMAPHORE_WAIT_ANY_BIT is not set, the semaphore wait 3816e5c31af7Sopenharmony_ci condition is that all of the semaphores in 3817e5c31af7Sopenharmony_ci sname:VkSemaphoreWaitInfo::pname:pSemaphores have reached the value 3818e5c31af7Sopenharmony_ci specified by the corresponding element of 3819e5c31af7Sopenharmony_ci sname:VkSemaphoreWaitInfo::pname:pValues. 3820e5c31af7Sopenharmony_ci-- 3821e5c31af7Sopenharmony_ci 3822e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreWaitFlags',desc='Bitmask of VkSemaphoreWaitFlagBits',type='flags',alias='VkSemaphoreWaitFlagsKHR'] 3823e5c31af7Sopenharmony_ci-- 3824e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkSemaphoreWaitFlags.txt[] 3825e5c31af7Sopenharmony_ci 3826e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3827e5c31af7Sopenharmony_cior the equivalent 3828e5c31af7Sopenharmony_ci 3829e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkSemaphoreWaitFlagsKHR.txt[] 3830e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3831e5c31af7Sopenharmony_ci 3832e5c31af7Sopenharmony_citname:VkSemaphoreWaitFlags is a bitmask type for setting a mask of zero or 3833e5c31af7Sopenharmony_cimore elink:VkSemaphoreWaitFlagBits. 3834e5c31af7Sopenharmony_ci-- 3835e5c31af7Sopenharmony_ci 3836e5c31af7Sopenharmony_ci[open,refpage='vkSignalSemaphore',desc='Signal a timeline semaphore on the host',type='protos',alias='vkSignalSemaphoreKHR'] 3837e5c31af7Sopenharmony_ci-- 3838e5c31af7Sopenharmony_ciTo signal a semaphore created with a elink:VkSemaphoreType of 3839e5c31af7Sopenharmony_ciename:VK_SEMAPHORE_TYPE_TIMELINE with a particular counter value, on the 3840e5c31af7Sopenharmony_cihost, call: 3841e5c31af7Sopenharmony_ci 3842e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 3843e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkSignalSemaphore.txt[] 3844e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 3845e5c31af7Sopenharmony_ci 3846e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2+VK_KHR_timeline_semaphore[or the equivalent command] 3847e5c31af7Sopenharmony_ci 3848e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3849e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkSignalSemaphoreKHR.txt[] 3850e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3851e5c31af7Sopenharmony_ci 3852e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the semaphore. 3853e5c31af7Sopenharmony_ci * pname:pSignalInfo is a pointer to a slink:VkSemaphoreSignalInfo 3854e5c31af7Sopenharmony_ci structure containing information about the signal operation. 3855e5c31af7Sopenharmony_ci 3856e5c31af7Sopenharmony_ciWhen fname:vkSignalSemaphore is executed on the host, it defines and 3857e5c31af7Sopenharmony_ciimmediately executes a <<synchronization-semaphores-signaling,_semaphore 3858e5c31af7Sopenharmony_cisignal operation_>> which sets the timeline semaphore to the given value. 3859e5c31af7Sopenharmony_ci 3860e5c31af7Sopenharmony_ciThe first synchronization scope is defined by the host execution model, but 3861e5c31af7Sopenharmony_ciincludes execution of fname:vkSignalSemaphore on the host and anything that 3862e5c31af7Sopenharmony_cihappened-before it. 3863e5c31af7Sopenharmony_ci 3864e5c31af7Sopenharmony_ciThe second synchronization scope is empty. 3865e5c31af7Sopenharmony_ci 3866e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkSignalSemaphore.txt[] 3867e5c31af7Sopenharmony_ci-- 3868e5c31af7Sopenharmony_ci 3869e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreSignalInfo',desc='Structure containing information about a semaphore signal operation',type='structs',alias='VkSemaphoreSignalInfoKHR'] 3870e5c31af7Sopenharmony_ci-- 3871e5c31af7Sopenharmony_ciThe sname:VkSemaphoreSignalInfo structure is defined as: 3872e5c31af7Sopenharmony_ci 3873e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreSignalInfo.txt[] 3874e5c31af7Sopenharmony_ci 3875e5c31af7Sopenharmony_ciifdef::VK_KHR_timeline_semaphore[] 3876e5c31af7Sopenharmony_cior the equivalent 3877e5c31af7Sopenharmony_ci 3878e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSemaphoreSignalInfoKHR.txt[] 3879e5c31af7Sopenharmony_ciendif::VK_KHR_timeline_semaphore[] 3880e5c31af7Sopenharmony_ci 3881e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 3882e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 3883e5c31af7Sopenharmony_ci structure. 3884e5c31af7Sopenharmony_ci * pname:semaphore is the handle of the semaphore to signal. 3885e5c31af7Sopenharmony_ci * pname:value is the value to signal. 3886e5c31af7Sopenharmony_ci 3887e5c31af7Sopenharmony_ci.Valid Usage 3888e5c31af7Sopenharmony_ci**** 3889e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreSignalInfo-semaphore-03257]] 3890e5c31af7Sopenharmony_ci pname:semaphore must: have been created with a elink:VkSemaphoreType of 3891e5c31af7Sopenharmony_ci ename:VK_SEMAPHORE_TYPE_TIMELINE 3892e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreSignalInfo-value-03258]] 3893e5c31af7Sopenharmony_ci pname:value must: have a value greater than the current value of the 3894e5c31af7Sopenharmony_ci semaphore 3895e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreSignalInfo-value-03259]] 3896e5c31af7Sopenharmony_ci pname:value must: be less than the value of any pending semaphore signal 3897e5c31af7Sopenharmony_ci operations 3898e5c31af7Sopenharmony_ci * [[VUID-VkSemaphoreSignalInfo-value-03260]] 3899e5c31af7Sopenharmony_ci pname:value must: have a value which does not differ from the current 3900e5c31af7Sopenharmony_ci value of the semaphore or the value of any outstanding semaphore wait or 3901e5c31af7Sopenharmony_ci signal operation on pname:semaphore by more than 3902e5c31af7Sopenharmony_ci <<limits-maxTimelineSemaphoreValueDifference, 3903e5c31af7Sopenharmony_ci pname:maxTimelineSemaphoreValueDifference>> 3904e5c31af7Sopenharmony_ci**** 3905e5c31af7Sopenharmony_ci 3906e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSemaphoreSignalInfo.txt[] 3907e5c31af7Sopenharmony_ci-- 3908e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 3909e5c31af7Sopenharmony_ci 3910e5c31af7Sopenharmony_ci 3911e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_semaphore[] 3912e5c31af7Sopenharmony_ci[[synchronization-semaphores-importing]] 3913e5c31af7Sopenharmony_ci=== Importing Semaphore Payloads 3914e5c31af7Sopenharmony_ci 3915e5c31af7Sopenharmony_ciApplications can: import a semaphore payload into an existing semaphore 3916e5c31af7Sopenharmony_ciusing an external semaphore handle. 3917e5c31af7Sopenharmony_ciThe effects of the import operation will be either temporary or permanent, 3918e5c31af7Sopenharmony_cias specified by the application. 3919e5c31af7Sopenharmony_ciIf the import is temporary, the implementation must: restore the semaphore 3920e5c31af7Sopenharmony_cito its prior permanent state after submitting the next semaphore wait 3921e5c31af7Sopenharmony_cioperation. 3922e5c31af7Sopenharmony_ciPerforming a subsequent temporary import on a semaphore before performing a 3923e5c31af7Sopenharmony_cisemaphore wait has no effect on this requirement; the next wait submitted on 3924e5c31af7Sopenharmony_cithe semaphore must: still restore its last permanent state. 3925e5c31af7Sopenharmony_ciA permanent payload import behaves as if the target semaphore was destroyed, 3926e5c31af7Sopenharmony_ciand a new semaphore was created with the same handle but the imported 3927e5c31af7Sopenharmony_cipayload. 3928e5c31af7Sopenharmony_ciBecause importing a semaphore payload temporarily or permanently detaches 3929e5c31af7Sopenharmony_cithe existing payload from a semaphore, similar usage restrictions to those 3930e5c31af7Sopenharmony_ciapplied to fname:vkDestroySemaphore are applied to any command that imports 3931e5c31af7Sopenharmony_cia semaphore payload. 3932e5c31af7Sopenharmony_ciWhich of these import types is used is referred to as the import operation's 3933e5c31af7Sopenharmony_ci_permanence_. 3934e5c31af7Sopenharmony_ciEach handle type supports either one or both types of permanence. 3935e5c31af7Sopenharmony_ci 3936e5c31af7Sopenharmony_ciThe implementation must: perform the import operation by either referencing 3937e5c31af7Sopenharmony_cior copying the payload referred to by the specified external semaphore 3938e5c31af7Sopenharmony_cihandle, depending on the handle's type. 3939e5c31af7Sopenharmony_ciThe import method used is referred to as the handle type's _transference_. 3940e5c31af7Sopenharmony_ciWhen using handle types with reference transference, importing a payload to 3941e5c31af7Sopenharmony_cia semaphore adds the semaphore to the set of all semaphores sharing that 3942e5c31af7Sopenharmony_cipayload. 3943e5c31af7Sopenharmony_ciThis set includes the semaphore from which the payload was exported. 3944e5c31af7Sopenharmony_ciSemaphore signaling and waiting operations performed on any semaphore in the 3945e5c31af7Sopenharmony_ciset must: behave as if the set were a single semaphore. 3946e5c31af7Sopenharmony_ciImporting a payload using handle types with copy transference creates a 3947e5c31af7Sopenharmony_ciduplicate copy of the payload at the time of import, but makes no further 3948e5c31af7Sopenharmony_cireference to it. 3949e5c31af7Sopenharmony_ciSemaphore signaling and waiting operations performed on the target of copy 3950e5c31af7Sopenharmony_ciimports must: not affect any other semaphore or payload. 3951e5c31af7Sopenharmony_ci 3952e5c31af7Sopenharmony_ciExport operations have the same transference as the specified handle type's 3953e5c31af7Sopenharmony_ciimport operations. 3954e5c31af7Sopenharmony_ciAdditionally, exporting a semaphore payload to a handle with copy 3955e5c31af7Sopenharmony_citransference has the same side effects on the source semaphore's payload as 3956e5c31af7Sopenharmony_ciexecuting a semaphore wait operation. 3957e5c31af7Sopenharmony_ciIf the semaphore was using a temporarily imported payload, the semaphore's 3958e5c31af7Sopenharmony_ciprior permanent payload will be restored. 3959e5c31af7Sopenharmony_ci 3960e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_win32,VK_KHR_external_semaphore_fd,VK_FUCHSIA_external_semaphore[] 3961e5c31af7Sopenharmony_ci[NOTE] 3962e5c31af7Sopenharmony_ci.Note 3963e5c31af7Sopenharmony_ci==== 3964e5c31af7Sopenharmony_ciThe permanence and transference of handle types can be found in: 3965e5c31af7Sopenharmony_ci 3966e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_win32[] 3967e5c31af7Sopenharmony_ci * <<synchronization-semaphore-handletypes-win32,Handle Types Supported by 3968e5c31af7Sopenharmony_ci sname:VkImportSemaphoreWin32HandleInfoKHR>> 3969e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_win32[] 3970e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_fd[] 3971e5c31af7Sopenharmony_ci * <<synchronization-semaphore-handletypes-fd,Handle Types Supported by 3972e5c31af7Sopenharmony_ci sname:VkImportSemaphoreFdInfoKHR>> 3973e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_fd[] 3974e5c31af7Sopenharmony_ciifdef::VK_FUCHSIA_external_semaphore[] 3975e5c31af7Sopenharmony_ci * <<synchronization-semaphore-handletypes-fuchsia,Handle Types Supported 3976e5c31af7Sopenharmony_ci by sname:VkImportSemaphoreZirconHandleInfoFUCHSIA>> 3977e5c31af7Sopenharmony_ciendif::VK_FUCHSIA_external_semaphore[] 3978e5c31af7Sopenharmony_ci==== 3979e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_win32,VK_KHR_external_semaphore_fd,VK_FUCHSIA_external_semaphore[] 3980e5c31af7Sopenharmony_ci 3981e5c31af7Sopenharmony_ci<<fundamentals-threadingbehavior,External synchronization>> allows 3982e5c31af7Sopenharmony_ciimplementations to modify an object's internal state, i.e. payload, without 3983e5c31af7Sopenharmony_ciinternal synchronization. 3984e5c31af7Sopenharmony_ciHowever, for semaphores sharing a payload across processes, satisfying the 3985e5c31af7Sopenharmony_ciexternal synchronization requirements of sname:VkSemaphore parameters as if 3986e5c31af7Sopenharmony_ciall semaphores in the set were the same object is sometimes infeasible. 3987e5c31af7Sopenharmony_ciSatisfying the <<synchronization-semaphores-waiting-state,wait operation 3988e5c31af7Sopenharmony_cistate requirements>> would similarly require impractical coordination or 3989e5c31af7Sopenharmony_cilevels of trust between processes. 3990e5c31af7Sopenharmony_ciTherefore, these constraints only apply to a specific semaphore handle, not 3991e5c31af7Sopenharmony_cito its payload. 3992e5c31af7Sopenharmony_ciFor distinct semaphore objects which share a payload, if the semaphores are 3993e5c31af7Sopenharmony_cipassed to separate queue submission commands concurrently, behavior will be 3994e5c31af7Sopenharmony_cias if the commands were called in an arbitrary sequential order. 3995e5c31af7Sopenharmony_ciIf the <<synchronization-semaphores-waiting-state,wait operation state 3996e5c31af7Sopenharmony_cirequirements>> are violated for the shared payload by a queue submission 3997e5c31af7Sopenharmony_cicommand, or if a signal operation is queued for a shared payload that is 3998e5c31af7Sopenharmony_cialready signaled or has a pending signal operation, effects must: be limited 3999e5c31af7Sopenharmony_cito one or more of the following: 4000e5c31af7Sopenharmony_ci 4001e5c31af7Sopenharmony_ci * Returning ename:VK_ERROR_INITIALIZATION_FAILED from the command which 4002e5c31af7Sopenharmony_ci resulted in the violation. 4003e5c31af7Sopenharmony_ci * Losing the logical device on which the violation occurred immediately or 4004e5c31af7Sopenharmony_ci at a future time, resulting in a ename:VK_ERROR_DEVICE_LOST error from 4005e5c31af7Sopenharmony_ci subsequent commands, including the one causing the violation. 4006e5c31af7Sopenharmony_ci * Continuing execution of the violating command or operation as if the 4007e5c31af7Sopenharmony_ci semaphore wait completed successfully after an implementation-dependent 4008e5c31af7Sopenharmony_ci timeout. 4009e5c31af7Sopenharmony_ci In this case, the state of the payload becomes undefined:, and future 4010e5c31af7Sopenharmony_ci operations on semaphores sharing the payload will be subject to these 4011e5c31af7Sopenharmony_ci same rules. 4012e5c31af7Sopenharmony_ci The semaphore must: be destroyed or have its payload replaced by an 4013e5c31af7Sopenharmony_ci import operation to again have a well-defined state. 4014e5c31af7Sopenharmony_ci 4015e5c31af7Sopenharmony_ci[NOTE] 4016e5c31af7Sopenharmony_ci.Note 4017e5c31af7Sopenharmony_ci==== 4018e5c31af7Sopenharmony_ciThese rules allow processes to synchronize access to shared memory without 4019e5c31af7Sopenharmony_citrusting each other. 4020e5c31af7Sopenharmony_ciHowever, such processes must still be cautious not to use the shared 4021e5c31af7Sopenharmony_cisemaphore for more than synchronizing access to the shared memory. 4022e5c31af7Sopenharmony_ciFor example, a process should not use a shared semaphore as part of an 4023e5c31af7Sopenharmony_ciexecution dependency chain that, when complete, leads to objects being 4024e5c31af7Sopenharmony_cidestroyed, if it does not trust other processes sharing the semaphore 4025e5c31af7Sopenharmony_cipayload. 4026e5c31af7Sopenharmony_ci==== 4027e5c31af7Sopenharmony_ci 4028e5c31af7Sopenharmony_ciWhen a semaphore is using an imported payload, its 4029e5c31af7Sopenharmony_cislink:VkExportSemaphoreCreateInfo::pname:handleTypes value is specified when 4030e5c31af7Sopenharmony_cicreating the semaphore from which the payload was exported, rather than 4031e5c31af7Sopenharmony_cispecified when creating the semaphore. 4032e5c31af7Sopenharmony_ciAdditionally, 4033e5c31af7Sopenharmony_cislink:VkExternalSemaphoreProperties::pname:exportFromImportedHandleTypes 4034e5c31af7Sopenharmony_cirestricts which handle types can: be exported from such a semaphore based on 4035e5c31af7Sopenharmony_cithe specific handle type used to import the current payload. 4036e5c31af7Sopenharmony_ciifdef::VK_KHR_swapchain[] 4037e5c31af7Sopenharmony_ciPassing a semaphore to flink:vkAcquireNextImageKHR is equivalent to 4038e5c31af7Sopenharmony_citemporarily importing a semaphore payload to that semaphore. 4039e5c31af7Sopenharmony_ci 4040e5c31af7Sopenharmony_ci[NOTE] 4041e5c31af7Sopenharmony_ci.Note 4042e5c31af7Sopenharmony_ci==== 4043e5c31af7Sopenharmony_ciBecause the exportable handle types of an imported semaphore correspond to 4044e5c31af7Sopenharmony_ciits current imported payload, and flink:vkAcquireNextImageKHR behaves the 4045e5c31af7Sopenharmony_cisame as a temporary import operation for which the source semaphore is 4046e5c31af7Sopenharmony_ciopaque to the application, applications have no way of determining whether 4047e5c31af7Sopenharmony_ciany external handle types can: be exported from a semaphore in this state. 4048e5c31af7Sopenharmony_ciTherefore, applications must: not attempt to export external handles from 4049e5c31af7Sopenharmony_cisemaphores using a temporarily imported payload from 4050e5c31af7Sopenharmony_ciflink:vkAcquireNextImageKHR. 4051e5c31af7Sopenharmony_ci==== 4052e5c31af7Sopenharmony_ciendif::VK_KHR_swapchain[] 4053e5c31af7Sopenharmony_ci 4054e5c31af7Sopenharmony_ciWhen importing a semaphore payload, it is the responsibility of the 4055e5c31af7Sopenharmony_ciapplication to ensure the external handles meet all valid usage 4056e5c31af7Sopenharmony_cirequirements. 4057e5c31af7Sopenharmony_ciHowever, implementations must: perform sufficient validation of external 4058e5c31af7Sopenharmony_cihandles to ensure that the operation results in a valid semaphore which will 4059e5c31af7Sopenharmony_cinot cause program termination, device loss, queue stalls, or corruption of 4060e5c31af7Sopenharmony_ciother resources when used as allowed according to its import parameters, and 4061e5c31af7Sopenharmony_ciexcepting those side effects allowed for violations of the 4062e5c31af7Sopenharmony_ci<<synchronization-semaphores-waiting-state,valid semaphore state for wait 4063e5c31af7Sopenharmony_cioperations>> rules. 4064e5c31af7Sopenharmony_ciIf the external handle provided does not meet these requirements, the 4065e5c31af7Sopenharmony_ciimplementation must: fail the semaphore payload import operation with the 4066e5c31af7Sopenharmony_cierror code ename:VK_ERROR_INVALID_EXTERNAL_HANDLE. 4067e5c31af7Sopenharmony_ci 4068e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4069e5c31af7Sopenharmony_ciIn addition, when importing a semaphore payload that is not compatible with 4070e5c31af7Sopenharmony_cithe payload type corresponding to the elink:VkSemaphoreType the semaphore 4071e5c31af7Sopenharmony_ciwas created with, the implementation may: fail the semaphore payload import 4072e5c31af7Sopenharmony_cioperation with the error code ename:VK_ERROR_INVALID_EXTERNAL_HANDLE. 4073e5c31af7Sopenharmony_ci 4074e5c31af7Sopenharmony_ci[NOTE] 4075e5c31af7Sopenharmony_ci.Note 4076e5c31af7Sopenharmony_ci==== 4077e5c31af7Sopenharmony_ciAs the introduction of the external semaphore handle type 4078e5c31af7Sopenharmony_ciename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT predates that of 4079e5c31af7Sopenharmony_citimeline semaphores, support for importing semaphore payloads from external 4080e5c31af7Sopenharmony_cihandles of that type into semaphores created (implicitly or explicitly) with 4081e5c31af7Sopenharmony_cia elink:VkSemaphoreType of ename:VK_SEMAPHORE_TYPE_BINARY is preserved for 4082e5c31af7Sopenharmony_cibackwards compatibility. 4083e5c31af7Sopenharmony_ciHowever, applications should: prefer importing such handle types into 4084e5c31af7Sopenharmony_cisemaphores created with a elink:VkSemaphoreType of 4085e5c31af7Sopenharmony_ciename:VK_SEMAPHORE_TYPE_TIMELINE. 4086e5c31af7Sopenharmony_ci==== 4087e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4088e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_semaphore[] 4089e5c31af7Sopenharmony_ci 4090e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_win32[] 4091e5c31af7Sopenharmony_ci[open,refpage='vkImportSemaphoreWin32HandleKHR',desc='Import a semaphore from a Windows HANDLE',type='protos'] 4092e5c31af7Sopenharmony_ci-- 4093e5c31af7Sopenharmony_ciTo import a semaphore payload from a Windows handle, call: 4094e5c31af7Sopenharmony_ci 4095e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkImportSemaphoreWin32HandleKHR.txt[] 4096e5c31af7Sopenharmony_ci 4097e5c31af7Sopenharmony_ci * pname:device is the logical device that created the semaphore. 4098e5c31af7Sopenharmony_ci * pname:pImportSemaphoreWin32HandleInfo is a pointer to a 4099e5c31af7Sopenharmony_ci slink:VkImportSemaphoreWin32HandleInfoKHR structure specifying the 4100e5c31af7Sopenharmony_ci semaphore and import parameters. 4101e5c31af7Sopenharmony_ci 4102e5c31af7Sopenharmony_ciImporting a semaphore payload from Windows handles does not transfer 4103e5c31af7Sopenharmony_ciownership of the handle to the Vulkan implementation. 4104e5c31af7Sopenharmony_ciFor handle types defined as NT handles, the application must: release 4105e5c31af7Sopenharmony_ciownership using the code:CloseHandle system call when the handle is no 4106e5c31af7Sopenharmony_cilonger needed. 4107e5c31af7Sopenharmony_ci 4108e5c31af7Sopenharmony_ciApplications can: import the same semaphore payload into multiple instances 4109e5c31af7Sopenharmony_ciof Vulkan, into the same instance from which it was exported, and multiple 4110e5c31af7Sopenharmony_citimes into a given Vulkan instance. 4111e5c31af7Sopenharmony_ci 4112e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkImportSemaphoreWin32HandleKHR.txt[] 4113e5c31af7Sopenharmony_ci-- 4114e5c31af7Sopenharmony_ci 4115e5c31af7Sopenharmony_ci[open,refpage='VkImportSemaphoreWin32HandleInfoKHR',desc='Structure specifying Windows handle to import to a semaphore',type='structs'] 4116e5c31af7Sopenharmony_ci-- 4117e5c31af7Sopenharmony_ciThe sname:VkImportSemaphoreWin32HandleInfoKHR structure is defined as: 4118e5c31af7Sopenharmony_ci 4119e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImportSemaphoreWin32HandleInfoKHR.txt[] 4120e5c31af7Sopenharmony_ci 4121e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 4122e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 4123e5c31af7Sopenharmony_ci structure. 4124e5c31af7Sopenharmony_ci * pname:semaphore is the semaphore into which the payload will be 4125e5c31af7Sopenharmony_ci imported. 4126e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkSemaphoreImportFlagBits specifying 4127e5c31af7Sopenharmony_ci additional parameters for the semaphore payload import operation. 4128e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalSemaphoreHandleTypeFlagBits value 4129e5c31af7Sopenharmony_ci specifying the type of pname:handle. 4130e5c31af7Sopenharmony_ci * pname:handle is `NULL` or the external handle to import. 4131e5c31af7Sopenharmony_ci * pname:name is `NULL` or a null-terminated UTF-16 string naming the 4132e5c31af7Sopenharmony_ci underlying synchronization primitive to import. 4133e5c31af7Sopenharmony_ci 4134e5c31af7Sopenharmony_ciThe handle types supported by pname:handleType are: 4135e5c31af7Sopenharmony_ci 4136e5c31af7Sopenharmony_ci[[synchronization-semaphore-handletypes-win32]] 4137e5c31af7Sopenharmony_ci.Handle Types Supported by sname:VkImportSemaphoreWin32HandleInfoKHR 4138e5c31af7Sopenharmony_ci[width="80%",options="header"] 4139e5c31af7Sopenharmony_ci|==== 4140e5c31af7Sopenharmony_ci| Handle Type | Transference | Permanence Supported 4141e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT | Reference | Temporary,Permanent 4142e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | Reference | Temporary,Permanent 4143e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT | Reference | Temporary,Permanent 4144e5c31af7Sopenharmony_ci|==== 4145e5c31af7Sopenharmony_ci 4146e5c31af7Sopenharmony_ci.Valid Usage 4147e5c31af7Sopenharmony_ci**** 4148e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01140]] 4149e5c31af7Sopenharmony_ci pname:handleType must: be a value included in the 4150e5c31af7Sopenharmony_ci <<synchronization-semaphore-handletypes-win32,Handle Types Supported by 4151e5c31af7Sopenharmony_ci sname:VkImportSemaphoreWin32HandleInfoKHR>> table 4152e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01466]] 4153e5c31af7Sopenharmony_ci If pname:handleType is not 4154e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT or 4155e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, pname:name 4156e5c31af7Sopenharmony_ci must: be `NULL` 4157e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01467]] 4158e5c31af7Sopenharmony_ci If pname:handle is `NULL`, pname:name must: name a valid synchronization 4159e5c31af7Sopenharmony_ci primitive of the type specified by pname:handleType 4160e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-01468]] 4161e5c31af7Sopenharmony_ci If pname:name is `NULL`, pname:handle must: be a valid handle of the 4162e5c31af7Sopenharmony_ci type specified by pname:handleType 4163e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handle-01469]] 4164e5c31af7Sopenharmony_ci If pname:handle is not `NULL`, pname:name must: be `NULL` 4165e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handle-01542]] 4166e5c31af7Sopenharmony_ci If pname:handle is not `NULL`, it must: obey any requirements listed for 4167e5c31af7Sopenharmony_ci pname:handleType in 4168e5c31af7Sopenharmony_ci <<external-semaphore-handle-types-compatibility,external semaphore 4169e5c31af7Sopenharmony_ci handle types compatibility>> 4170e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-name-01543]] 4171e5c31af7Sopenharmony_ci If pname:name is not `NULL`, it must: obey any requirements listed for 4172e5c31af7Sopenharmony_ci pname:handleType in 4173e5c31af7Sopenharmony_ci <<external-semaphore-handle-types-compatibility,external semaphore 4174e5c31af7Sopenharmony_ci handle types compatibility>> 4175e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-03261]] 4176e5c31af7Sopenharmony_ci If pname:handleType is 4177e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT or 4178e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, the 4179e5c31af7Sopenharmony_ci slink:VkSemaphoreCreateInfo::pname:flags field must: match that of the 4180e5c31af7Sopenharmony_ci semaphore from which pname:handle or pname:name was exported 4181e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4182e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-handleType-03262]] 4183e5c31af7Sopenharmony_ci If pname:handleType is 4184e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT or 4185e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, the 4186e5c31af7Sopenharmony_ci slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType field must: match 4187e5c31af7Sopenharmony_ci that of the semaphore from which pname:handle or pname:name was exported 4188e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreWin32HandleInfoKHR-flags-03322]] 4189e5c31af7Sopenharmony_ci If pname:flags contains ename:VK_SEMAPHORE_IMPORT_TEMPORARY_BIT, the 4190e5c31af7Sopenharmony_ci slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType field of the 4191e5c31af7Sopenharmony_ci semaphore from which pname:handle or pname:name was exported must: not 4192e5c31af7Sopenharmony_ci be ename:VK_SEMAPHORE_TYPE_TIMELINE 4193e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4194e5c31af7Sopenharmony_ci**** 4195e5c31af7Sopenharmony_ci 4196e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImportSemaphoreWin32HandleInfoKHR.txt[] 4197e5c31af7Sopenharmony_ci-- 4198e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_win32[] 4199e5c31af7Sopenharmony_ci 4200e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_fd[] 4201e5c31af7Sopenharmony_ci[open,refpage='vkImportSemaphoreFdKHR',desc='Import a semaphore from a POSIX file descriptor',type='protos'] 4202e5c31af7Sopenharmony_ci-- 4203e5c31af7Sopenharmony_ciTo import a semaphore payload from a POSIX file descriptor, call: 4204e5c31af7Sopenharmony_ci 4205e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkImportSemaphoreFdKHR.txt[] 4206e5c31af7Sopenharmony_ci 4207e5c31af7Sopenharmony_ci * pname:device is the logical device that created the semaphore. 4208e5c31af7Sopenharmony_ci * pname:pImportSemaphoreFdInfo is a pointer to a 4209e5c31af7Sopenharmony_ci slink:VkImportSemaphoreFdInfoKHR structure specifying the semaphore and 4210e5c31af7Sopenharmony_ci import parameters. 4211e5c31af7Sopenharmony_ci 4212e5c31af7Sopenharmony_ciImporting a semaphore payload from a file descriptor transfers ownership of 4213e5c31af7Sopenharmony_cithe file descriptor from the application to the Vulkan implementation. 4214e5c31af7Sopenharmony_ciThe application must: not perform any operations on the file descriptor 4215e5c31af7Sopenharmony_ciafter a successful import. 4216e5c31af7Sopenharmony_ci 4217e5c31af7Sopenharmony_ciApplications can: import the same semaphore payload into multiple instances 4218e5c31af7Sopenharmony_ciof Vulkan, into the same instance from which it was exported, and multiple 4219e5c31af7Sopenharmony_citimes into a given Vulkan instance. 4220e5c31af7Sopenharmony_ci 4221e5c31af7Sopenharmony_ci.Valid Usage 4222e5c31af7Sopenharmony_ci**** 4223e5c31af7Sopenharmony_ci * [[VUID-vkImportSemaphoreFdKHR-semaphore-01142]] 4224e5c31af7Sopenharmony_ci pname:semaphore must: not be associated with any queue command that has 4225e5c31af7Sopenharmony_ci not yet completed execution on that queue 4226e5c31af7Sopenharmony_ci**** 4227e5c31af7Sopenharmony_ci 4228e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkImportSemaphoreFdKHR.txt[] 4229e5c31af7Sopenharmony_ci-- 4230e5c31af7Sopenharmony_ci 4231e5c31af7Sopenharmony_ci[open,refpage='VkImportSemaphoreFdInfoKHR',desc='Structure specifying POSIX file descriptor to import to a semaphore',type='structs'] 4232e5c31af7Sopenharmony_ci-- 4233e5c31af7Sopenharmony_ciThe sname:VkImportSemaphoreFdInfoKHR structure is defined as: 4234e5c31af7Sopenharmony_ci 4235e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImportSemaphoreFdInfoKHR.txt[] 4236e5c31af7Sopenharmony_ci 4237e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 4238e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 4239e5c31af7Sopenharmony_ci structure. 4240e5c31af7Sopenharmony_ci * pname:semaphore is the semaphore into which the payload will be 4241e5c31af7Sopenharmony_ci imported. 4242e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkSemaphoreImportFlagBits specifying 4243e5c31af7Sopenharmony_ci additional parameters for the semaphore payload import operation. 4244e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalSemaphoreHandleTypeFlagBits value 4245e5c31af7Sopenharmony_ci specifying the type of pname:fd. 4246e5c31af7Sopenharmony_ci * pname:fd is the external handle to import. 4247e5c31af7Sopenharmony_ci 4248e5c31af7Sopenharmony_ciThe handle types supported by pname:handleType are: 4249e5c31af7Sopenharmony_ci 4250e5c31af7Sopenharmony_ci[[synchronization-semaphore-handletypes-fd]] 4251e5c31af7Sopenharmony_ci.Handle Types Supported by sname:VkImportSemaphoreFdInfoKHR 4252e5c31af7Sopenharmony_ci[width="80%",options="header"] 4253e5c31af7Sopenharmony_ci|==== 4254e5c31af7Sopenharmony_ci| Handle Type | Transference | Permanence Supported 4255e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT | Reference | Temporary,Permanent 4256e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT | Copy | Temporary 4257e5c31af7Sopenharmony_ci|==== 4258e5c31af7Sopenharmony_ci 4259e5c31af7Sopenharmony_ci.Valid Usage 4260e5c31af7Sopenharmony_ci**** 4261e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreFdInfoKHR-handleType-01143]] 4262e5c31af7Sopenharmony_ci pname:handleType must: be a value included in the 4263e5c31af7Sopenharmony_ci <<synchronization-semaphore-handletypes-fd,Handle Types Supported by 4264e5c31af7Sopenharmony_ci sname:VkImportSemaphoreFdInfoKHR>> table 4265e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreFdInfoKHR-fd-01544]] 4266e5c31af7Sopenharmony_ci pname:fd must: obey any requirements listed for pname:handleType in 4267e5c31af7Sopenharmony_ci <<external-semaphore-handle-types-compatibility,external semaphore 4268e5c31af7Sopenharmony_ci handle types compatibility>> 4269e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreFdInfoKHR-handleType-03263]] 4270e5c31af7Sopenharmony_ci If pname:handleType is 4271e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT, the 4272e5c31af7Sopenharmony_ci slink:VkSemaphoreCreateInfo::pname:flags field must: match that of the 4273e5c31af7Sopenharmony_ci semaphore from which pname:fd was exported 4274e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4275e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreFdInfoKHR-handleType-03264]] 4276e5c31af7Sopenharmony_ci If pname:handleType is 4277e5c31af7Sopenharmony_ci ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT, the 4278e5c31af7Sopenharmony_ci slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType field must: match 4279e5c31af7Sopenharmony_ci that of the semaphore from which pname:fd was exported 4280e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreFdInfoKHR-flags-03323]] 4281e5c31af7Sopenharmony_ci If pname:flags contains ename:VK_SEMAPHORE_IMPORT_TEMPORARY_BIT, the 4282e5c31af7Sopenharmony_ci slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType field of the 4283e5c31af7Sopenharmony_ci semaphore from which pname:fd was exported must: not be 4284e5c31af7Sopenharmony_ci ename:VK_SEMAPHORE_TYPE_TIMELINE 4285e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4286e5c31af7Sopenharmony_ci**** 4287e5c31af7Sopenharmony_ci 4288e5c31af7Sopenharmony_ciIf pname:handleType is ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, 4289e5c31af7Sopenharmony_cithe special value `-1` for pname:fd is treated like a valid sync file 4290e5c31af7Sopenharmony_cidescriptor referring to an object that has already signaled. 4291e5c31af7Sopenharmony_ciThe import operation will succeed and the sname:VkSemaphore will have a 4292e5c31af7Sopenharmony_citemporarily imported payload as if a valid file descriptor had been 4293e5c31af7Sopenharmony_ciprovided. 4294e5c31af7Sopenharmony_ci 4295e5c31af7Sopenharmony_ci[NOTE] 4296e5c31af7Sopenharmony_ci.Note 4297e5c31af7Sopenharmony_ci==== 4298e5c31af7Sopenharmony_ciThis special behavior for importing an invalid sync file descriptor allows 4299e5c31af7Sopenharmony_cieasier interoperability with other system APIs which use the convention that 4300e5c31af7Sopenharmony_cian invalid sync file descriptor represents work that has already completed 4301e5c31af7Sopenharmony_ciand does not need to be waited for. 4302e5c31af7Sopenharmony_ciIt is consistent with the option for implementations to return a `-1` file 4303e5c31af7Sopenharmony_cidescriptor when exporting a 4304e5c31af7Sopenharmony_ciename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT from a sname:VkSemaphore 4305e5c31af7Sopenharmony_ciwhich is signaled. 4306e5c31af7Sopenharmony_ci==== 4307e5c31af7Sopenharmony_ci 4308e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImportSemaphoreFdInfoKHR.txt[] 4309e5c31af7Sopenharmony_ci-- 4310e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_fd[] 4311e5c31af7Sopenharmony_ci 4312e5c31af7Sopenharmony_ciifdef::VK_FUCHSIA_external_semaphore[] 4313e5c31af7Sopenharmony_ci[open,refpage='vkImportSemaphoreZirconHandleFUCHSIA',desc='Import a semaphore from a Zircon event handle',type='protos'] 4314e5c31af7Sopenharmony_ci-- 4315e5c31af7Sopenharmony_ciTo import a semaphore payload from a Zircon event handle, call: 4316e5c31af7Sopenharmony_ci 4317e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkImportSemaphoreZirconHandleFUCHSIA.txt[] 4318e5c31af7Sopenharmony_ci 4319e5c31af7Sopenharmony_ci * pname:device is the logical device that created the semaphore. 4320e5c31af7Sopenharmony_ci * pname:pImportSemaphoreZirconHandleInfo is a pointer to a 4321e5c31af7Sopenharmony_ci slink:VkImportSemaphoreZirconHandleInfoFUCHSIA structure specifying the 4322e5c31af7Sopenharmony_ci semaphore and import parameters. 4323e5c31af7Sopenharmony_ci 4324e5c31af7Sopenharmony_ciImporting a semaphore payload from a Zircon event handle transfers ownership 4325e5c31af7Sopenharmony_ciof the handle from the application to the Vulkan implementation. 4326e5c31af7Sopenharmony_ciThe application must: not perform any operations on the handle after a 4327e5c31af7Sopenharmony_cisuccessful import. 4328e5c31af7Sopenharmony_ci 4329e5c31af7Sopenharmony_ciApplications can: import the same semaphore payload into multiple instances 4330e5c31af7Sopenharmony_ciof Vulkan, into the same instance from which it was exported, and multiple 4331e5c31af7Sopenharmony_citimes into a given Vulkan instance. 4332e5c31af7Sopenharmony_ci 4333e5c31af7Sopenharmony_ci.Valid Usage 4334e5c31af7Sopenharmony_ci**** 4335e5c31af7Sopenharmony_ci * [[VUID-vkImportSemaphoreZirconHandleFUCHSIA-semaphore-04764]] 4336e5c31af7Sopenharmony_ci pname:semaphore must: not be associated with any queue command that has 4337e5c31af7Sopenharmony_ci not yet completed execution on that queue 4338e5c31af7Sopenharmony_ci**** 4339e5c31af7Sopenharmony_ci 4340e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkImportSemaphoreZirconHandleFUCHSIA.txt[] 4341e5c31af7Sopenharmony_ci-- 4342e5c31af7Sopenharmony_ci 4343e5c31af7Sopenharmony_ci[open,refpage='VkImportSemaphoreZirconHandleInfoFUCHSIA',desc='Structure specifying Zircon event handle to import to a semaphore',type='structs'] 4344e5c31af7Sopenharmony_ci-- 4345e5c31af7Sopenharmony_ciThe sname:VkImportSemaphoreZirconHandleInfoFUCHSIA structure is defined as: 4346e5c31af7Sopenharmony_ci 4347e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImportSemaphoreZirconHandleInfoFUCHSIA.txt[] 4348e5c31af7Sopenharmony_ci 4349e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 4350e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 4351e5c31af7Sopenharmony_ci structure. 4352e5c31af7Sopenharmony_ci * pname:semaphore is the semaphore into which the payload will be 4353e5c31af7Sopenharmony_ci imported. 4354e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkSemaphoreImportFlagBits specifying 4355e5c31af7Sopenharmony_ci additional parameters for the semaphore payload import operation. 4356e5c31af7Sopenharmony_ci * pname:handleType is a elink:VkExternalSemaphoreHandleTypeFlagBits value 4357e5c31af7Sopenharmony_ci specifying the type of pname:zirconHandle. 4358e5c31af7Sopenharmony_ci * pname:zirconHandle is the external handle to import. 4359e5c31af7Sopenharmony_ci 4360e5c31af7Sopenharmony_ciThe handle types supported by pname:handleType are: 4361e5c31af7Sopenharmony_ci 4362e5c31af7Sopenharmony_ci[[synchronization-semaphore-handletypes-fuchsia]] 4363e5c31af7Sopenharmony_ci.Handle Types Supported by sname:VkImportSemaphoreZirconHandleInfoFUCHSIA 4364e5c31af7Sopenharmony_ci[width="80%",options="header"] 4365e5c31af7Sopenharmony_ci|==== 4366e5c31af7Sopenharmony_ci| Handle Type | Transference | Permanence Supported 4367e5c31af7Sopenharmony_ci| ename:VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA | Reference | Temporary,Permanent 4368e5c31af7Sopenharmony_ci|==== 4369e5c31af7Sopenharmony_ci 4370e5c31af7Sopenharmony_ci.Valid Usage 4371e5c31af7Sopenharmony_ci**** 4372e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-handleType-04765]] 4373e5c31af7Sopenharmony_ci pname:handleType must: be a value included in the 4374e5c31af7Sopenharmony_ci <<synchronization-semaphore-handletypes-fuchsia,Handle Types Supported 4375e5c31af7Sopenharmony_ci by sname:VkImportSemaphoreZirconHandleInfoFUCHSIA>> table 4376e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-zirconHandle-04766]] 4377e5c31af7Sopenharmony_ci pname:zirconHandle must: obey any requirements listed for 4378e5c31af7Sopenharmony_ci pname:handleType in 4379e5c31af7Sopenharmony_ci <<external-semaphore-handle-types-compatibility,external semaphore 4380e5c31af7Sopenharmony_ci handle types compatibility>> 4381e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-zirconHandle-04767]] 4382e5c31af7Sopenharmony_ci pname:zirconHandle must: have code:ZX_RIGHTS_BASIC and 4383e5c31af7Sopenharmony_ci code:ZX_RIGHTS_SIGNAL rights 4384e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4385e5c31af7Sopenharmony_ci * [[VUID-VkImportSemaphoreZirconHandleInfoFUCHSIA-semaphoreType-04768]] 4386e5c31af7Sopenharmony_ci The slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType field must: not 4387e5c31af7Sopenharmony_ci be ename:VK_SEMAPHORE_TYPE_TIMELINE 4388e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_timeline_semaphore[] 4389e5c31af7Sopenharmony_ci**** 4390e5c31af7Sopenharmony_ci 4391e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImportSemaphoreZirconHandleInfoFUCHSIA.txt[] 4392e5c31af7Sopenharmony_ci-- 4393e5c31af7Sopenharmony_ciendif::VK_FUCHSIA_external_semaphore[] 4394e5c31af7Sopenharmony_ci 4395e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_semaphore[] 4396e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_win32,VK_KHR_external_semaphore_fd,VK_FUCHSIA_external_semaphore[] 4397e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreImportFlagBits',desc='Bitmask specifying additional parameters of semaphore payload import',type='enums'] 4398e5c31af7Sopenharmony_ci-- 4399e5c31af7Sopenharmony_ciBits which can: be set in 4400e5c31af7Sopenharmony_ci 4401e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_win32[] 4402e5c31af7Sopenharmony_ci * slink:VkImportSemaphoreWin32HandleInfoKHR::pname:flags 4403e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_win32[] 4404e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore_fd[] 4405e5c31af7Sopenharmony_ci * slink:VkImportSemaphoreFdInfoKHR::pname:flags 4406e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_fd[] 4407e5c31af7Sopenharmony_ciifdef::VK_FUCHSIA_external_semaphore[] 4408e5c31af7Sopenharmony_ci * slink:VkImportSemaphoreZirconHandleInfoFUCHSIA::pname:flags 4409e5c31af7Sopenharmony_ciendif::VK_FUCHSIA_external_semaphore[] 4410e5c31af7Sopenharmony_ci 4411e5c31af7Sopenharmony_cispecifying additional parameters of a semaphore import operation are: 4412e5c31af7Sopenharmony_ci 4413e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSemaphoreImportFlagBits.txt[] 4414e5c31af7Sopenharmony_ci 4415e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore[] 4416e5c31af7Sopenharmony_cior the equivalent 4417e5c31af7Sopenharmony_ci 4418e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkSemaphoreImportFlagBitsKHR.txt[] 4419e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore[] 4420e5c31af7Sopenharmony_ci 4421e5c31af7Sopenharmony_ciThese bits have the following meanings: 4422e5c31af7Sopenharmony_ci 4423e5c31af7Sopenharmony_ci * ename:VK_SEMAPHORE_IMPORT_TEMPORARY_BIT specifies that the semaphore 4424e5c31af7Sopenharmony_ci payload will be imported only temporarily, as described in 4425e5c31af7Sopenharmony_ci <<synchronization-semaphores-importing,Importing Semaphore Payloads>>, 4426e5c31af7Sopenharmony_ci regardless of the permanence of pname:handleType. 4427e5c31af7Sopenharmony_ci-- 4428e5c31af7Sopenharmony_ci 4429e5c31af7Sopenharmony_ci[open,refpage='VkSemaphoreImportFlags',desc='Bitmask of VkSemaphoreImportFlagBits',type='flags'] 4430e5c31af7Sopenharmony_ci-- 4431e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkSemaphoreImportFlags.txt[] 4432e5c31af7Sopenharmony_ci 4433e5c31af7Sopenharmony_ciifdef::VK_KHR_external_semaphore[] 4434e5c31af7Sopenharmony_cior the equivalent 4435e5c31af7Sopenharmony_ci 4436e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkSemaphoreImportFlagsKHR.txt[] 4437e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore[] 4438e5c31af7Sopenharmony_ci 4439e5c31af7Sopenharmony_citname:VkSemaphoreImportFlags is a bitmask type for setting a mask of zero or 4440e5c31af7Sopenharmony_cimore elink:VkSemaphoreImportFlagBits. 4441e5c31af7Sopenharmony_ci-- 4442e5c31af7Sopenharmony_ciendif::VK_KHR_external_semaphore_win32,VK_KHR_external_semaphore_fd,VK_FUCHSIA_external_semaphore[] 4443e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_semaphore[] 4444e5c31af7Sopenharmony_ci 4445e5c31af7Sopenharmony_ci 4446e5c31af7Sopenharmony_ci[[synchronization-events]] 4447e5c31af7Sopenharmony_ci== Events 4448e5c31af7Sopenharmony_ci 4449e5c31af7Sopenharmony_ci[open,refpage='VkEvent',desc='Opaque handle to an event object',type='handles'] 4450e5c31af7Sopenharmony_ci-- 4451e5c31af7Sopenharmony_ciEvents are a synchronization primitive that can: be used to insert a 4452e5c31af7Sopenharmony_cifine-grained dependency between commands submitted to the same queue, or 4453e5c31af7Sopenharmony_cibetween the host and a queue. 4454e5c31af7Sopenharmony_ciEvents must: not be used to insert a dependency between commands submitted 4455e5c31af7Sopenharmony_cito different queues. 4456e5c31af7Sopenharmony_ciEvents have two states - signaled and unsignaled. 4457e5c31af7Sopenharmony_ciAn application can: signal or unsignal an event either on the host or on the 4458e5c31af7Sopenharmony_cidevice. 4459e5c31af7Sopenharmony_ciA device can: be made to wait for an event to become signaled before 4460e5c31af7Sopenharmony_ciexecuting further operations. 4461e5c31af7Sopenharmony_ciNo command exists to wait for an event to become signaled on the host, but 4462e5c31af7Sopenharmony_cithe current state of an event can: be queried. 4463e5c31af7Sopenharmony_ci 4464e5c31af7Sopenharmony_ciEvents are represented by sname:VkEvent handles: 4465e5c31af7Sopenharmony_ci 4466e5c31af7Sopenharmony_ciinclude::{generated}/api/handles/VkEvent.txt[] 4467e5c31af7Sopenharmony_ci-- 4468e5c31af7Sopenharmony_ci 4469e5c31af7Sopenharmony_ci[open,refpage='vkCreateEvent',desc='Create a new event object',type='protos'] 4470e5c31af7Sopenharmony_ci-- 4471e5c31af7Sopenharmony_ciTo create an event, call: 4472e5c31af7Sopenharmony_ci 4473e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCreateEvent.txt[] 4474e5c31af7Sopenharmony_ci 4475e5c31af7Sopenharmony_ci * pname:device is the logical device that creates the event. 4476e5c31af7Sopenharmony_ci * pname:pCreateInfo is a pointer to a slink:VkEventCreateInfo structure 4477e5c31af7Sopenharmony_ci containing information about how the event is to be created. 4478e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 4479e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 4480e5c31af7Sopenharmony_ci * pname:pEvent is a pointer to a handle in which the resulting event 4481e5c31af7Sopenharmony_ci object is returned. 4482e5c31af7Sopenharmony_ci 4483e5c31af7Sopenharmony_ciWhen created, the event object is in the unsignaled state. 4484e5c31af7Sopenharmony_ci 4485e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 4486e5c31af7Sopenharmony_ci.Valid Usage 4487e5c31af7Sopenharmony_ci**** 4488e5c31af7Sopenharmony_ci * [[VUID-vkCreateEvent-events-04468]] 4489e5c31af7Sopenharmony_ci If the `apiext:VK_KHR_portability_subset` extension is enabled, and 4490e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:events is 4491e5c31af7Sopenharmony_ci ename:VK_FALSE, then the implementation does not support 4492e5c31af7Sopenharmony_ci <<synchronization-events, events>>, and flink:vkCreateEvent must: not be 4493e5c31af7Sopenharmony_ci used 4494e5c31af7Sopenharmony_ci**** 4495e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 4496e5c31af7Sopenharmony_ci 4497e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCreateEvent.txt[] 4498e5c31af7Sopenharmony_ci-- 4499e5c31af7Sopenharmony_ci 4500e5c31af7Sopenharmony_ci[open,refpage='VkEventCreateInfo',desc='Structure specifying parameters of a newly created event',type='structs'] 4501e5c31af7Sopenharmony_ci-- 4502e5c31af7Sopenharmony_ciThe sname:VkEventCreateInfo structure is defined as: 4503e5c31af7Sopenharmony_ci 4504e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkEventCreateInfo.txt[] 4505e5c31af7Sopenharmony_ci 4506e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 4507e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 4508e5c31af7Sopenharmony_ci structure. 4509e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkEventCreateFlagBits defining 4510e5c31af7Sopenharmony_ci additional creation parameters. 4511e5c31af7Sopenharmony_ci 4512e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkEventCreateInfo.txt[] 4513e5c31af7Sopenharmony_ci-- 4514e5c31af7Sopenharmony_ci 4515e5c31af7Sopenharmony_ci[open,refpage='VkEventCreateFlagBits',desc='Event creation flag bits',type='enums'] 4516e5c31af7Sopenharmony_ci-- 4517e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkEventCreateFlagBits.txt[] 4518e5c31af7Sopenharmony_ci 4519e5c31af7Sopenharmony_ciifndef::VK_KHR_synchronization2[] 4520e5c31af7Sopenharmony_ciAll values for this enum are defined by extensions. 4521e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4522e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4523e5c31af7Sopenharmony_ci * ename:VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR specifies that host event 4524e5c31af7Sopenharmony_ci commands will not be used with this event. 4525e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4526e5c31af7Sopenharmony_ci-- 4527e5c31af7Sopenharmony_ci 4528e5c31af7Sopenharmony_ci[open,refpage='VkEventCreateFlags',desc='Bitmask of event creation flag bits',type='flags'] 4529e5c31af7Sopenharmony_ci-- 4530e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkEventCreateFlags.txt[] 4531e5c31af7Sopenharmony_ci 4532e5c31af7Sopenharmony_citname:VkEventCreateFlags is a bitmask type for setting a mask of 4533e5c31af7Sopenharmony_cielink:VkEventCreateFlagBits. 4534e5c31af7Sopenharmony_ci-- 4535e5c31af7Sopenharmony_ci 4536e5c31af7Sopenharmony_ci[open,refpage='vkDestroyEvent',desc='Destroy an event object',type='protos'] 4537e5c31af7Sopenharmony_ci-- 4538e5c31af7Sopenharmony_ciTo destroy an event, call: 4539e5c31af7Sopenharmony_ci 4540e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDestroyEvent.txt[] 4541e5c31af7Sopenharmony_ci 4542e5c31af7Sopenharmony_ci * pname:device is the logical device that destroys the event. 4543e5c31af7Sopenharmony_ci * pname:event is the handle of the event to destroy. 4544e5c31af7Sopenharmony_ci * pname:pAllocator controls host memory allocation as described in the 4545e5c31af7Sopenharmony_ci <<memory-allocation, Memory Allocation>> chapter. 4546e5c31af7Sopenharmony_ci 4547e5c31af7Sopenharmony_ci.Valid Usage 4548e5c31af7Sopenharmony_ci**** 4549e5c31af7Sopenharmony_ci * [[VUID-vkDestroyEvent-event-01145]] 4550e5c31af7Sopenharmony_ci All submitted commands that refer to pname:event must: have completed 4551e5c31af7Sopenharmony_ci execution 4552e5c31af7Sopenharmony_ci * [[VUID-vkDestroyEvent-event-01146]] 4553e5c31af7Sopenharmony_ci If sname:VkAllocationCallbacks were provided when pname:event was 4554e5c31af7Sopenharmony_ci created, a compatible set of callbacks must: be provided here 4555e5c31af7Sopenharmony_ci * [[VUID-vkDestroyEvent-event-01147]] 4556e5c31af7Sopenharmony_ci If no sname:VkAllocationCallbacks were provided when pname:event was 4557e5c31af7Sopenharmony_ci created, pname:pAllocator must: be `NULL` 4558e5c31af7Sopenharmony_ci**** 4559e5c31af7Sopenharmony_ci 4560e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDestroyEvent.txt[] 4561e5c31af7Sopenharmony_ci-- 4562e5c31af7Sopenharmony_ci 4563e5c31af7Sopenharmony_ci[open,refpage='vkGetEventStatus',desc='Retrieve the status of an event object',type='protos'] 4564e5c31af7Sopenharmony_ci-- 4565e5c31af7Sopenharmony_ciTo query the state of an event from the host, call: 4566e5c31af7Sopenharmony_ci 4567e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetEventStatus.txt[] 4568e5c31af7Sopenharmony_ci 4569e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the event. 4570e5c31af7Sopenharmony_ci * pname:event is the handle of the event to query. 4571e5c31af7Sopenharmony_ci 4572e5c31af7Sopenharmony_ciUpon success, fname:vkGetEventStatus returns the state of the event object 4573e5c31af7Sopenharmony_ciwith the following return codes: 4574e5c31af7Sopenharmony_ci 4575e5c31af7Sopenharmony_ci.Event Object Status Codes 4576e5c31af7Sopenharmony_ci[width="80%",options="header"] 4577e5c31af7Sopenharmony_ci|==== 4578e5c31af7Sopenharmony_ci| Status | Meaning 4579e5c31af7Sopenharmony_ci| ename:VK_EVENT_SET | The event specified by pname:event is signaled. 4580e5c31af7Sopenharmony_ci| ename:VK_EVENT_RESET | The event specified by pname:event is unsignaled. 4581e5c31af7Sopenharmony_ci|==== 4582e5c31af7Sopenharmony_ci 4583e5c31af7Sopenharmony_ciIf a fname:vkCmdSetEvent or fname:vkCmdResetEvent command is in a command 4584e5c31af7Sopenharmony_cibuffer that is in the <<commandbuffers-lifecycle, pending state>>, then the 4585e5c31af7Sopenharmony_civalue returned by this command may: immediately be out of date. 4586e5c31af7Sopenharmony_ci 4587e5c31af7Sopenharmony_ciThe state of an event can: be updated by the host. 4588e5c31af7Sopenharmony_ciThe state of the event is immediately changed, and subsequent calls to 4589e5c31af7Sopenharmony_cifname:vkGetEventStatus will return the new state. 4590e5c31af7Sopenharmony_ciIf an event is already in the requested state, then updating it to the same 4591e5c31af7Sopenharmony_cistate has no effect. 4592e5c31af7Sopenharmony_ci 4593e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4594e5c31af7Sopenharmony_ci.Valid Usage 4595e5c31af7Sopenharmony_ci**** 4596e5c31af7Sopenharmony_ci * [[VUID-vkGetEventStatus-event-03940]] 4597e5c31af7Sopenharmony_ci pname:event must: not have been created with 4598e5c31af7Sopenharmony_ci ename:VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR 4599e5c31af7Sopenharmony_ci**** 4600e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4601e5c31af7Sopenharmony_ci 4602e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetEventStatus.txt[] 4603e5c31af7Sopenharmony_ci-- 4604e5c31af7Sopenharmony_ci 4605e5c31af7Sopenharmony_ci[[synchronization-events-signaling-host]] 4606e5c31af7Sopenharmony_ci[open,refpage='vkSetEvent',desc='Set an event to signaled state',type='protos'] 4607e5c31af7Sopenharmony_ci-- 4608e5c31af7Sopenharmony_ciTo set the state of an event to signaled from the host, call: 4609e5c31af7Sopenharmony_ci 4610e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkSetEvent.txt[] 4611e5c31af7Sopenharmony_ci 4612e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the event. 4613e5c31af7Sopenharmony_ci * pname:event is the event to set. 4614e5c31af7Sopenharmony_ci 4615e5c31af7Sopenharmony_ciWhen flink:vkSetEvent is executed on the host, it defines an _event signal 4616e5c31af7Sopenharmony_cioperation_ which sets the event to the signaled state. 4617e5c31af7Sopenharmony_ci 4618e5c31af7Sopenharmony_ciIf pname:event is already in the signaled state when flink:vkSetEvent is 4619e5c31af7Sopenharmony_ciexecuted, then flink:vkSetEvent has no effect, and no event signal operation 4620e5c31af7Sopenharmony_cioccurs. 4621e5c31af7Sopenharmony_ci 4622e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4623e5c31af7Sopenharmony_ci.Valid Usage 4624e5c31af7Sopenharmony_ci**** 4625e5c31af7Sopenharmony_ci * [[VUID-vkSetEvent-event-03941]] 4626e5c31af7Sopenharmony_ci pname:event must: not have been created with 4627e5c31af7Sopenharmony_ci ename:VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR 4628e5c31af7Sopenharmony_ci**** 4629e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4630e5c31af7Sopenharmony_ci 4631e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkSetEvent.txt[] 4632e5c31af7Sopenharmony_ci-- 4633e5c31af7Sopenharmony_ci 4634e5c31af7Sopenharmony_ci[[synchronization-events-unsignaling-host]] 4635e5c31af7Sopenharmony_ci[open,refpage='vkResetEvent',desc='Reset an event to non-signaled state',type='protos'] 4636e5c31af7Sopenharmony_ci-- 4637e5c31af7Sopenharmony_ciTo set the state of an event to unsignaled from the host, call: 4638e5c31af7Sopenharmony_ci 4639e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkResetEvent.txt[] 4640e5c31af7Sopenharmony_ci 4641e5c31af7Sopenharmony_ci * pname:device is the logical device that owns the event. 4642e5c31af7Sopenharmony_ci * pname:event is the event to reset. 4643e5c31af7Sopenharmony_ci 4644e5c31af7Sopenharmony_ciWhen flink:vkResetEvent is executed on the host, it defines an _event 4645e5c31af7Sopenharmony_ciunsignal operation_ which resets the event to the unsignaled state. 4646e5c31af7Sopenharmony_ci 4647e5c31af7Sopenharmony_ciIf pname:event is already in the unsignaled state when flink:vkResetEvent is 4648e5c31af7Sopenharmony_ciexecuted, then flink:vkResetEvent has no effect, and no event unsignal 4649e5c31af7Sopenharmony_cioperation occurs. 4650e5c31af7Sopenharmony_ci 4651e5c31af7Sopenharmony_ci.Valid Usage 4652e5c31af7Sopenharmony_ci**** 4653e5c31af7Sopenharmony_ci * [[VUID-vkResetEvent-event-03821]] 4654e5c31af7Sopenharmony_ci There must: be an execution dependency between fname:vkResetEvent and 4655e5c31af7Sopenharmony_ci the execution of any flink:vkCmdWaitEvents that includes pname:event in 4656e5c31af7Sopenharmony_ci its pname:pEvents parameter 4657e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4658e5c31af7Sopenharmony_ci * [[VUID-vkResetEvent-event-03822]] 4659e5c31af7Sopenharmony_ci There must: be an execution dependency between fname:vkResetEvent and 4660e5c31af7Sopenharmony_ci the execution of any flink:vkCmdWaitEvents2KHR that includes pname:event 4661e5c31af7Sopenharmony_ci in its pname:pEvents parameter 4662e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4663e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4664e5c31af7Sopenharmony_ci * [[VUID-vkResetEvent-event-03823]] 4665e5c31af7Sopenharmony_ci pname:event must: not have been created with 4666e5c31af7Sopenharmony_ci ename:VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR 4667e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4668e5c31af7Sopenharmony_ci**** 4669e5c31af7Sopenharmony_ci 4670e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkResetEvent.txt[] 4671e5c31af7Sopenharmony_ci-- 4672e5c31af7Sopenharmony_ci 4673e5c31af7Sopenharmony_ciThe state of an event can: also be updated on the device by commands 4674e5c31af7Sopenharmony_ciinserted in command buffers. 4675e5c31af7Sopenharmony_ci 4676e5c31af7Sopenharmony_ci[[synchronization-events-signaling-device]] 4677e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4678e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetEvent2KHR',desc='Set an event object to signaled state',type='protos'] 4679e5c31af7Sopenharmony_ci-- 4680e5c31af7Sopenharmony_ciTo signal an event from a device, call: 4681e5c31af7Sopenharmony_ci 4682e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetEvent2KHR.txt[] 4683e5c31af7Sopenharmony_ci 4684e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 4685e5c31af7Sopenharmony_ci recorded. 4686e5c31af7Sopenharmony_ci * pname:event is the event that will be signaled. 4687e5c31af7Sopenharmony_ci * pname:pDependencyInfo is a pointer to a slink:VkDependencyInfoKHR 4688e5c31af7Sopenharmony_ci structure defining the first scopes of this operation. 4689e5c31af7Sopenharmony_ci 4690e5c31af7Sopenharmony_ciWhen flink:vkCmdSetEvent2KHR is submitted to a queue, it defines the first 4691e5c31af7Sopenharmony_cihalf of memory dependencies defined by pname:pDependencyInfo, as well as an 4692e5c31af7Sopenharmony_cievent signal operation which sets the event to the signaled state. 4693e5c31af7Sopenharmony_ciA memory dependency is defined between the event signal operation and 4694e5c31af7Sopenharmony_cicommands that occur earlier in submission order. 4695e5c31af7Sopenharmony_ci 4696e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> and 4697e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> are defined by 4698e5c31af7Sopenharmony_cithe union of all the memory dependencies defined by pname:pDependencyInfo, 4699e5c31af7Sopenharmony_ciand are applied to all operations that occur earlier in 4700e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 4701e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, Queue family ownership transfers>> and 4702e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transitions>> 4703e5c31af7Sopenharmony_cidefined by pname:pDependencyInfo are also included in the first scopes. 4704e5c31af7Sopenharmony_ci 4705e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 4706e5c31af7Sopenharmony_ciincludes only the event signal operation, and any 4707e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, queue family ownership transfers>> and 4708e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transitions>> 4709e5c31af7Sopenharmony_cidefined by pname:pDependencyInfo. 4710e5c31af7Sopenharmony_ci 4711e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> 4712e5c31af7Sopenharmony_ciincludes only <<synchronization-queue-transfers, queue family ownership 4713e5c31af7Sopenharmony_citransfers>> and <<synchronization-image-layout-transitions, image layout 4714e5c31af7Sopenharmony_citransitions>>. 4715e5c31af7Sopenharmony_ci 4716e5c31af7Sopenharmony_ciFuture flink:vkCmdWaitEvents2KHR commands rely on all values of each element 4717e5c31af7Sopenharmony_ciin pname:pDependencyInfo matching exactly with those used to signal the 4718e5c31af7Sopenharmony_cicorresponding event. 4719e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents must: not be used to wait on the result of a signal 4720e5c31af7Sopenharmony_cioperation defined by fname:vkCmdSetEvent2KHR. 4721e5c31af7Sopenharmony_ci 4722e5c31af7Sopenharmony_ci[NOTE] 4723e5c31af7Sopenharmony_ci.Note 4724e5c31af7Sopenharmony_ci==== 4725e5c31af7Sopenharmony_ciThe extra information provided by flink:vkCmdSetEvent2KHR compared to 4726e5c31af7Sopenharmony_ciflink:vkCmdSetEvent allows implementations to more efficiently schedule the 4727e5c31af7Sopenharmony_cioperations required to satisfy the requested dependencies. 4728e5c31af7Sopenharmony_ciWith flink:vkCmdSetEvent, the full dependency information is not known until 4729e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents is recorded, forcing implementations to insert the 4730e5c31af7Sopenharmony_cirequired operations at that point and not before. 4731e5c31af7Sopenharmony_ci==== 4732e5c31af7Sopenharmony_ci 4733e5c31af7Sopenharmony_ciIf pname:event is already in the signaled state when flink:vkCmdSetEvent2KHR 4734e5c31af7Sopenharmony_ciis executed on the device, then flink:vkCmdSetEvent2KHR has no effect, no 4735e5c31af7Sopenharmony_cievent signal operation occurs, and no dependency is generated. 4736e5c31af7Sopenharmony_ci 4737e5c31af7Sopenharmony_ci.Valid Usage 4738e5c31af7Sopenharmony_ci**** 4739e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent2KHR-synchronization2-03824]] 4740e5c31af7Sopenharmony_ci The <<features-synchronization2, pname:synchronization2>> feature must: 4741e5c31af7Sopenharmony_ci be enabled 4742e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent2KHR-dependencyFlags-03825]] 4743e5c31af7Sopenharmony_ci The pname:dependencyFlags member of pname:pDependencyInfo must: be `0` 4744e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 4745e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent2KHR-commandBuffer-03826]] 4746e5c31af7Sopenharmony_ci The current device mask of pname:commandBuffer must: include exactly one 4747e5c31af7Sopenharmony_ci physical device 4748e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 4749e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent2KHR-srcStageMask-03827]] 4750e5c31af7Sopenharmony_ci The pname:srcStageMask member of any element of the 4751e5c31af7Sopenharmony_ci pname:pMemoryBarriers, pname:pBufferMemoryBarriers, or 4752e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers members of pname:pDependencyInfo must: only 4753e5c31af7Sopenharmony_ci include pipeline stages valid for the queue family that was used to 4754e5c31af7Sopenharmony_ci create the command pool that pname:commandBuffer was allocated from 4755e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent2KHR-dstStageMask-03828]] 4756e5c31af7Sopenharmony_ci The pname:dstStageMask member of any element of the 4757e5c31af7Sopenharmony_ci pname:pMemoryBarriers, pname:pBufferMemoryBarriers, or 4758e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers members of pname:pDependencyInfo must: only 4759e5c31af7Sopenharmony_ci include pipeline stages valid for the queue family that was used to 4760e5c31af7Sopenharmony_ci create the command pool that pname:commandBuffer was allocated from 4761e5c31af7Sopenharmony_ci**** 4762e5c31af7Sopenharmony_ci 4763e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetEvent2KHR.txt[] 4764e5c31af7Sopenharmony_ci-- 4765e5c31af7Sopenharmony_ci 4766e5c31af7Sopenharmony_ci[open,refpage='VkDependencyInfoKHR',desc='Structure specifying dependency information for a synchronization command',type='structs'] 4767e5c31af7Sopenharmony_ci-- 4768e5c31af7Sopenharmony_ciThe sname:VkDependencyInfoKHR structure is defined as: 4769e5c31af7Sopenharmony_ci 4770e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDependencyInfoKHR.txt[] 4771e5c31af7Sopenharmony_ci 4772e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 4773e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 4774e5c31af7Sopenharmony_ci structure. 4775e5c31af7Sopenharmony_ci * pname:dependencyFlags is a bitmask of elink:VkDependencyFlagBits 4776e5c31af7Sopenharmony_ci specifying how execution and memory dependencies are formed. 4777e5c31af7Sopenharmony_ci * pname:memoryBarrierCount is the length of the pname:pMemoryBarriers 4778e5c31af7Sopenharmony_ci array. 4779e5c31af7Sopenharmony_ci * pname:pMemoryBarriers is a pointer to an array of 4780e5c31af7Sopenharmony_ci slink:VkMemoryBarrier2KHR structures defining memory dependencies 4781e5c31af7Sopenharmony_ci between any memory accesses. 4782e5c31af7Sopenharmony_ci * pname:bufferMemoryBarrierCount is the length of the 4783e5c31af7Sopenharmony_ci pname:pBufferMemoryBarriers array. 4784e5c31af7Sopenharmony_ci * pname:pBufferMemoryBarriers is a pointer to an array of 4785e5c31af7Sopenharmony_ci slink:VkBufferMemoryBarrier2KHR structures defining memory dependencies 4786e5c31af7Sopenharmony_ci between buffer ranges. 4787e5c31af7Sopenharmony_ci * pname:imageMemoryBarrierCount is the length of the 4788e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers array. 4789e5c31af7Sopenharmony_ci * pname:pImageMemoryBarriers is a pointer to an array of 4790e5c31af7Sopenharmony_ci slink:VkImageMemoryBarrier2KHR structures defining memory dependencies 4791e5c31af7Sopenharmony_ci between image subresources. 4792e5c31af7Sopenharmony_ci 4793e5c31af7Sopenharmony_ciThis structure defines a set of <<synchronization-dependencies-memory, 4794e5c31af7Sopenharmony_cimemory dependencies>>, as well as <<synchronization-queue-transfers, queue 4795e5c31af7Sopenharmony_cifamily transfer operations>> and <<synchronization-image-layout-transitions, 4796e5c31af7Sopenharmony_ciimage layout transitions>>. 4797e5c31af7Sopenharmony_ci 4798e5c31af7Sopenharmony_ciEach member of pname:pMemoryBarriers, pname:pBufferMemoryBarriers, and 4799e5c31af7Sopenharmony_cipname:pImageMemoryBarriers defines a separate 4800e5c31af7Sopenharmony_ci<<synchronization-dependencies-memory, memory dependency>>. 4801e5c31af7Sopenharmony_ci 4802e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDependencyInfoKHR.txt[] 4803e5c31af7Sopenharmony_ci-- 4804e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4805e5c31af7Sopenharmony_ci 4806e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetEvent',desc='Set an event object to signaled state',type='protos'] 4807e5c31af7Sopenharmony_ci-- 4808e5c31af7Sopenharmony_ci:refpage: vkCmdSetEvent 4809e5c31af7Sopenharmony_ci 4810e5c31af7Sopenharmony_ciTo set the state of an event to signaled from a device, call: 4811e5c31af7Sopenharmony_ci 4812e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetEvent.txt[] 4813e5c31af7Sopenharmony_ci 4814e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 4815e5c31af7Sopenharmony_ci recorded. 4816e5c31af7Sopenharmony_ci * pname:event is the event that will be signaled. 4817e5c31af7Sopenharmony_ci * pname:stageMask specifies the <<synchronization-pipeline-stages,source 4818e5c31af7Sopenharmony_ci stage mask>> used to determine the first 4819e5c31af7Sopenharmony_ci <<synchronization-dependencies-scopes, synchronization scope>>. 4820e5c31af7Sopenharmony_ci 4821e5c31af7Sopenharmony_ci 4822e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4823e5c31af7Sopenharmony_cifname:vkCmdSetEvent behaves identically to flink:vkCmdSetEvent2KHR, except 4824e5c31af7Sopenharmony_cithat it does not define an access scope, and must: only be used with 4825e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents, not flink:vkCmdWaitEvents2KHR. 4826e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4827e5c31af7Sopenharmony_ci 4828e5c31af7Sopenharmony_ciifndef::VK_KHR_synchronization2[] 4829e5c31af7Sopenharmony_ciWhen flink:vkCmdSetEvent is submitted to a queue, it defines an execution 4830e5c31af7Sopenharmony_cidependency on commands that were submitted before it, and defines an event 4831e5c31af7Sopenharmony_cisignal operation which sets the event to the signaled state. 4832e5c31af7Sopenharmony_ci 4833e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 4834e5c31af7Sopenharmony_ciincludes all commands that occur earlier in 4835e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 4836e5c31af7Sopenharmony_ciThe synchronization scope is limited to operations on the pipeline stages 4837e5c31af7Sopenharmony_cidetermined by the <<synchronization-pipeline-stages-masks, source stage 4838e5c31af7Sopenharmony_cimask>> specified by pname:stageMask. 4839e5c31af7Sopenharmony_ci 4840e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 4841e5c31af7Sopenharmony_ciincludes only the event signal operation. 4842e5c31af7Sopenharmony_ci 4843e5c31af7Sopenharmony_ciIf pname:event is already in the signaled state when flink:vkCmdSetEvent is 4844e5c31af7Sopenharmony_ciexecuted on the device, then flink:vkCmdSetEvent has no effect, no event 4845e5c31af7Sopenharmony_cisignal operation occurs, and no execution dependency is generated. 4846e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4847e5c31af7Sopenharmony_ci 4848e5c31af7Sopenharmony_ci.Valid Usage 4849e5c31af7Sopenharmony_ci**** 4850e5c31af7Sopenharmony_ci:stageMaskName: stageMask 4851e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_common.txt[] 4852e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent-stageMask-06457]] 4853e5c31af7Sopenharmony_ci Any pipeline stage included in pname:stageMask must: be supported by the 4854e5c31af7Sopenharmony_ci capabilities of the queue family specified by the pname:queueFamilyIndex 4855e5c31af7Sopenharmony_ci member of the slink:VkCommandPoolCreateInfo structure that was used to 4856e5c31af7Sopenharmony_ci create the sname:VkCommandPool that pname:commandBuffer was allocated 4857e5c31af7Sopenharmony_ci from, as specified in the <<synchronization-pipeline-stages-supported, 4858e5c31af7Sopenharmony_ci table of supported pipeline stages>> 4859e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent-stageMask-01149]] 4860e5c31af7Sopenharmony_ci pname:stageMask must: not include ename:VK_PIPELINE_STAGE_HOST_BIT 4861e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 4862e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetEvent-commandBuffer-01152]] 4863e5c31af7Sopenharmony_ci pname:commandBuffer's current device mask must: include exactly one 4864e5c31af7Sopenharmony_ci physical device 4865e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 4866e5c31af7Sopenharmony_ci**** 4867e5c31af7Sopenharmony_ci 4868e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetEvent.txt[] 4869e5c31af7Sopenharmony_ci-- 4870e5c31af7Sopenharmony_ci 4871e5c31af7Sopenharmony_ci[[synchronization-events-unsignaling-device]] 4872e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4873e5c31af7Sopenharmony_ci[open,refpage='vkCmdResetEvent2KHR',desc='Reset an event object to non-signaled state',type='protos'] 4874e5c31af7Sopenharmony_ci-- 4875e5c31af7Sopenharmony_ci:refpage: vkCmdResetEvent2KHR 4876e5c31af7Sopenharmony_ci 4877e5c31af7Sopenharmony_ciTo unsignal the event from a device, call: 4878e5c31af7Sopenharmony_ci 4879e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdResetEvent2KHR.txt[] 4880e5c31af7Sopenharmony_ci 4881e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 4882e5c31af7Sopenharmony_ci recorded. 4883e5c31af7Sopenharmony_ci * pname:event is the event that will be unsignaled. 4884e5c31af7Sopenharmony_ci * pname:stageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 4885e5c31af7Sopenharmony_ci stages used to determine the first 4886e5c31af7Sopenharmony_ci <<synchronization-dependencies-scopes, synchronization scope>>. 4887e5c31af7Sopenharmony_ci 4888e5c31af7Sopenharmony_ciWhen flink:vkCmdResetEvent2KHR is submitted to a queue, it defines an 4889e5c31af7Sopenharmony_ciexecution dependency on commands that were submitted before it, and defines 4890e5c31af7Sopenharmony_cian event unsignal operation which resets the event to the unsignaled state. 4891e5c31af7Sopenharmony_ci 4892e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 4893e5c31af7Sopenharmony_ciincludes all commands that occur earlier in 4894e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 4895e5c31af7Sopenharmony_ciThe synchronization scope is limited to operations by pname:stageMask or 4896e5c31af7Sopenharmony_cistages that are <<synchronization-pipeline-stages-order,logically earlier>> 4897e5c31af7Sopenharmony_cithan pname:stageMask. 4898e5c31af7Sopenharmony_ci 4899e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 4900e5c31af7Sopenharmony_ciincludes only the event unsignal operation. 4901e5c31af7Sopenharmony_ci 4902e5c31af7Sopenharmony_ciIf pname:event is already in the unsignaled state when 4903e5c31af7Sopenharmony_ciflink:vkCmdResetEvent2KHR is executed on the device, then this command has 4904e5c31af7Sopenharmony_cino effect, no event unsignal operation occurs, and no execution dependency 4905e5c31af7Sopenharmony_ciis generated. 4906e5c31af7Sopenharmony_ci 4907e5c31af7Sopenharmony_ci.Valid Usage 4908e5c31af7Sopenharmony_ci**** 4909e5c31af7Sopenharmony_ci:stageMaskName: stageMask 4910e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 4911e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent2KHR-synchronization2-03829]] 4912e5c31af7Sopenharmony_ci The <<features-synchronization2, pname:synchronization2>> feature must: 4913e5c31af7Sopenharmony_ci be enabled 4914e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent2KHR-stageMask-03830]] 4915e5c31af7Sopenharmony_ci pname:stageMask must: not include ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR 4916e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent2KHR-event-03831]] 4917e5c31af7Sopenharmony_ci There must: be an execution dependency between fname:vkCmdResetEvent2KHR 4918e5c31af7Sopenharmony_ci and the execution of any flink:vkCmdWaitEvents that includes pname:event 4919e5c31af7Sopenharmony_ci in its pname:pEvents parameter 4920e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent2KHR-event-03832]] 4921e5c31af7Sopenharmony_ci There must: be an execution dependency between fname:vkCmdResetEvent2KHR 4922e5c31af7Sopenharmony_ci and the execution of any flink:vkCmdWaitEvents2KHR that includes 4923e5c31af7Sopenharmony_ci pname:event in its pname:pEvents parameter 4924e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 4925e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent2KHR-commandBuffer-03833]] 4926e5c31af7Sopenharmony_ci pname:commandBuffer's current device mask must: include exactly one 4927e5c31af7Sopenharmony_ci physical device 4928e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 4929e5c31af7Sopenharmony_ci**** 4930e5c31af7Sopenharmony_ci 4931e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdResetEvent2KHR.txt[] 4932e5c31af7Sopenharmony_ci-- 4933e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4934e5c31af7Sopenharmony_ci 4935e5c31af7Sopenharmony_ci[open,refpage='vkCmdResetEvent',desc='Reset an event object to non-signaled state',type='protos'] 4936e5c31af7Sopenharmony_ci-- 4937e5c31af7Sopenharmony_ci:refpage: vkCmdResetEvent 4938e5c31af7Sopenharmony_ci 4939e5c31af7Sopenharmony_ciTo set the state of an event to unsignaled from a device, call: 4940e5c31af7Sopenharmony_ci 4941e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdResetEvent.txt[] 4942e5c31af7Sopenharmony_ci 4943e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 4944e5c31af7Sopenharmony_ci recorded. 4945e5c31af7Sopenharmony_ci * pname:event is the event that will be unsignaled. 4946e5c31af7Sopenharmony_ci * pname:stageMask is a bitmask of elink:VkPipelineStageFlagBits specifying 4947e5c31af7Sopenharmony_ci the <<synchronization-pipeline-stages, source stage mask>> used to 4948e5c31af7Sopenharmony_ci determine when the pname:event is unsignaled. 4949e5c31af7Sopenharmony_ci 4950e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4951e5c31af7Sopenharmony_cifname:vkCmdResetEvent behaves identically to flink:vkCmdResetEvent2KHR. 4952e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4953e5c31af7Sopenharmony_ci 4954e5c31af7Sopenharmony_ciifndef::VK_KHR_synchronization2[] 4955e5c31af7Sopenharmony_ciWhen flink:vkCmdResetEvent is submitted to a queue, it defines an execution 4956e5c31af7Sopenharmony_cidependency on commands that were submitted before it, and defines an event 4957e5c31af7Sopenharmony_ciunsignal operation which resets the event to the unsignaled state. 4958e5c31af7Sopenharmony_ci 4959e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> 4960e5c31af7Sopenharmony_ciincludes all commands that occur earlier in 4961e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 4962e5c31af7Sopenharmony_ciThe synchronization scope is limited to operations on the pipeline stages 4963e5c31af7Sopenharmony_cidetermined by the <<synchronization-pipeline-stages-masks, source stage 4964e5c31af7Sopenharmony_cimask>> specified by pname:stageMask. 4965e5c31af7Sopenharmony_ci 4966e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 4967e5c31af7Sopenharmony_ciincludes only the event unsignal operation. 4968e5c31af7Sopenharmony_ci 4969e5c31af7Sopenharmony_ciIf pname:event is already in the unsignaled state when flink:vkCmdResetEvent 4970e5c31af7Sopenharmony_ciis executed on the device, then flink:vkCmdResetEvent has no effect, no 4971e5c31af7Sopenharmony_cievent unsignal operation occurs, and no execution dependency is generated. 4972e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4973e5c31af7Sopenharmony_ci 4974e5c31af7Sopenharmony_ci.Valid Usage 4975e5c31af7Sopenharmony_ci**** 4976e5c31af7Sopenharmony_ci:stageMaskName: stageMask 4977e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_common.txt[] 4978e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent-stageMask-06458]] 4979e5c31af7Sopenharmony_ci Any pipeline stage included in pname:stageMask must: be supported by the 4980e5c31af7Sopenharmony_ci capabilities of the queue family specified by the pname:queueFamilyIndex 4981e5c31af7Sopenharmony_ci member of the slink:VkCommandPoolCreateInfo structure that was used to 4982e5c31af7Sopenharmony_ci create the sname:VkCommandPool that pname:commandBuffer was allocated 4983e5c31af7Sopenharmony_ci from, as specified in the <<synchronization-pipeline-stages-supported, 4984e5c31af7Sopenharmony_ci table of supported pipeline stages>> 4985e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent-stageMask-01153]] 4986e5c31af7Sopenharmony_ci pname:stageMask must: not include ename:VK_PIPELINE_STAGE_HOST_BIT 4987e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent-event-03834]] 4988e5c31af7Sopenharmony_ci There must: be an execution dependency between fname:vkCmdResetEvent and 4989e5c31af7Sopenharmony_ci the execution of any flink:vkCmdWaitEvents that includes pname:event in 4990e5c31af7Sopenharmony_ci its pname:pEvents parameter 4991e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 4992e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent-event-03835]] 4993e5c31af7Sopenharmony_ci There must: be an execution dependency between fname:vkCmdResetEvent and 4994e5c31af7Sopenharmony_ci the execution of any flink:vkCmdWaitEvents2KHR that includes pname:event 4995e5c31af7Sopenharmony_ci in its pname:pEvents parameter 4996e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 4997e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 4998e5c31af7Sopenharmony_ci * [[VUID-vkCmdResetEvent-commandBuffer-01157]] 4999e5c31af7Sopenharmony_ci pname:commandBuffer's current device mask must: include exactly one 5000e5c31af7Sopenharmony_ci physical device 5001e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 5002e5c31af7Sopenharmony_ci**** 5003e5c31af7Sopenharmony_ci 5004e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdResetEvent.txt[] 5005e5c31af7Sopenharmony_ci-- 5006e5c31af7Sopenharmony_ci 5007e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5008e5c31af7Sopenharmony_ci[open,refpage='vkCmdWaitEvents2KHR',desc='Wait for one or more events',type='protos'] 5009e5c31af7Sopenharmony_ci-- 5010e5c31af7Sopenharmony_ciTo wait for one or more events to enter the signaled state on a device, 5011e5c31af7Sopenharmony_cicall: 5012e5c31af7Sopenharmony_ci 5013e5c31af7Sopenharmony_ci[[synchronization-events-waiting-device]] 5014e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWaitEvents2KHR.txt[] 5015e5c31af7Sopenharmony_ci 5016e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 5017e5c31af7Sopenharmony_ci recorded. 5018e5c31af7Sopenharmony_ci * pname:eventCount is the length of the pname:pEvents array. 5019e5c31af7Sopenharmony_ci * pname:pEvents is a pointer to an array of pname:eventCount events to 5020e5c31af7Sopenharmony_ci wait on. 5021e5c31af7Sopenharmony_ci * pname:pDependencyInfos is a pointer to an array of pname:eventCount 5022e5c31af7Sopenharmony_ci slink:VkDependencyInfoKHR structures, defining the second 5023e5c31af7Sopenharmony_ci <<synchronization-dependencies-scopes, synchronization scope>>. 5024e5c31af7Sopenharmony_ci 5025e5c31af7Sopenharmony_ciWhen fname:vkCmdWaitEvents2KHR is submitted to a queue, it inserts memory 5026e5c31af7Sopenharmony_cidependencies according to the elements of pname:pDependencyInfos and each 5027e5c31af7Sopenharmony_cicorresponding element of pname:pEvents. 5028e5c31af7Sopenharmony_cifname:vkCmdWaitEvents2KHR must: not be used to wait on event signal 5029e5c31af7Sopenharmony_cioperations occurring on other queues, or signal operations execyted by 5030e5c31af7Sopenharmony_ciflink:vkCmdSetEvent. 5031e5c31af7Sopenharmony_ci 5032e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> and 5033e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> of each memory 5034e5c31af7Sopenharmony_cidependency defined by any element [eq]#i# of pname:pDependencyInfos are 5035e5c31af7Sopenharmony_ciapplied to operations that occurred earlier in 5036e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>> than the last event 5037e5c31af7Sopenharmony_cisignal operation on element [eq]#i# of pname:pEvents. 5038e5c31af7Sopenharmony_ci 5039e5c31af7Sopenharmony_ciSignal operations for an event at index [eq]#i# are only included if: 5040e5c31af7Sopenharmony_ci 5041e5c31af7Sopenharmony_ci * The event was signaled by a flink:vkCmdSetEvent2KHR command that 5042e5c31af7Sopenharmony_ci occurred earlier in <<synchronization-submission-order,submission 5043e5c31af7Sopenharmony_ci order>> with a pname:dependencyInfo parameter exactly equal to the 5044e5c31af7Sopenharmony_ci element of pname:pDependencyInfos at index [eq]#i# ; or 5045e5c31af7Sopenharmony_ci * The event was created without ename:VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR, 5046e5c31af7Sopenharmony_ci and the first <<synchronization-dependencies-scopes, synchronization 5047e5c31af7Sopenharmony_ci scope>> defined by the element of pname:pDependencyInfos at index 5048e5c31af7Sopenharmony_ci [eq]#i# only includes host operations 5049e5c31af7Sopenharmony_ci (ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR). 5050e5c31af7Sopenharmony_ci 5051e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 5052e5c31af7Sopenharmony_ciand <<synchronization-dependencies-access-scopes, access scope>> of each 5053e5c31af7Sopenharmony_cimemory dependency defined by any element [eq]#i# of pname:pDependencyInfos 5054e5c31af7Sopenharmony_ciare applied to operations that occurred later in 5055e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>> than 5056e5c31af7Sopenharmony_cifname:vkCmdWaitEvents2KHR. 5057e5c31af7Sopenharmony_ci 5058e5c31af7Sopenharmony_ci[NOTE] 5059e5c31af7Sopenharmony_ci.Note 5060e5c31af7Sopenharmony_ci==== 5061e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents2KHR is used with flink:vkCmdSetEvent2KHR to define a 5062e5c31af7Sopenharmony_cimemory dependency between two sets of action commands, roughly in the same 5063e5c31af7Sopenharmony_ciway as pipeline barriers, but split into two commands such that work between 5064e5c31af7Sopenharmony_cithe two may: execute unhindered. 5065e5c31af7Sopenharmony_ci==== 5066e5c31af7Sopenharmony_ci 5067e5c31af7Sopenharmony_ci[NOTE] 5068e5c31af7Sopenharmony_ci.Note 5069e5c31af7Sopenharmony_ci==== 5070e5c31af7Sopenharmony_ciApplications should be careful to avoid race conditions when using events. 5071e5c31af7Sopenharmony_ciThere is no direct ordering guarantee between fname:vkCmdSetEvent2KHR and 5072e5c31af7Sopenharmony_ciflink:vkCmdResetEvent2KHR, flink:vkCmdResetEvent, or flink:vkCmdSetEvent. 5073e5c31af7Sopenharmony_ciAnother execution dependency (e.g. a pipeline barrier or semaphore with 5074e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR) is needed to prevent such a 5075e5c31af7Sopenharmony_cirace condition. 5076e5c31af7Sopenharmony_ci==== 5077e5c31af7Sopenharmony_ci 5078e5c31af7Sopenharmony_ci.Valid Usage 5079e5c31af7Sopenharmony_ci**** 5080e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-synchronization2-03836]] 5081e5c31af7Sopenharmony_ci The <<features-synchronization2, pname:synchronization2>> feature must: 5082e5c31af7Sopenharmony_ci be enabled 5083e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-pEvents-03837]] 5084e5c31af7Sopenharmony_ci Members of pname:pEvents must: not have been signaled by 5085e5c31af7Sopenharmony_ci flink:vkCmdSetEvent 5086e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-pEvents-03838]] 5087e5c31af7Sopenharmony_ci For any element [eq]#i# of pname:pEvents, if that event is signaled by 5088e5c31af7Sopenharmony_ci flink:vkCmdSetEvent2KHR, that command's pname:dependencyInfo parameter 5089e5c31af7Sopenharmony_ci must: be exactly equal to the [eq]##i##th element of 5090e5c31af7Sopenharmony_ci pname:pDependencyInfos 5091e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-pEvents-03839]] 5092e5c31af7Sopenharmony_ci For any element [eq]#i# of pname:pEvents, if that event is signaled by 5093e5c31af7Sopenharmony_ci flink:vkSetEvent, barriers in the [eq]##i##th element of 5094e5c31af7Sopenharmony_ci pname:pDependencyInfos must: include only host operations in their first 5095e5c31af7Sopenharmony_ci <<synchronization-dependencies-scopes, synchronization scope>> 5096e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-pEvents-03840]] 5097e5c31af7Sopenharmony_ci For any element [eq]#i# of pname:pEvents, if barriers in the [eq]##i##th 5098e5c31af7Sopenharmony_ci element of pname:pDependencyInfos include only host operations, the 5099e5c31af7Sopenharmony_ci [eq]##i##th element of pname:pEvents must: be signaled before 5100e5c31af7Sopenharmony_ci flink:vkCmdWaitEvents2KHR is executed 5101e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-pEvents-03841]] 5102e5c31af7Sopenharmony_ci For any element [eq]#i# of pname:pEvents, if barriers in the [eq]##i##th 5103e5c31af7Sopenharmony_ci element of pname:pDependencyInfos do not include host operations, the 5104e5c31af7Sopenharmony_ci [eq]##i##th element of pname:pEvents must: be signaled by a 5105e5c31af7Sopenharmony_ci corresponding flink:vkCmdSetEvent2KHR that occurred earlier in 5106e5c31af7Sopenharmony_ci <<synchronization-submission-order,submission order>> 5107e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-srcStageMask-03842]] 5108e5c31af7Sopenharmony_ci The pname:srcStageMask member of any element of the 5109e5c31af7Sopenharmony_ci pname:pMemoryBarriers, pname:pBufferMemoryBarriers, or 5110e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers members of pname:pDependencyInfos must: 5111e5c31af7Sopenharmony_ci either include only pipeline stages valid for the queue family that was 5112e5c31af7Sopenharmony_ci used to create the command pool that pname:commandBuffer was allocated 5113e5c31af7Sopenharmony_ci from, or include only ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR 5114e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-dstStageMask-03843]] 5115e5c31af7Sopenharmony_ci The pname:dstStageMask member of any element of the 5116e5c31af7Sopenharmony_ci pname:pMemoryBarriers, pname:pBufferMemoryBarriers, or 5117e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers members of pname:pDependencyInfos must: only 5118e5c31af7Sopenharmony_ci include pipeline stages valid for the queue family that was used to 5119e5c31af7Sopenharmony_ci create the command pool that pname:commandBuffer was allocated from 5120e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-dependencyFlags-03844]] 5121e5c31af7Sopenharmony_ci The pname:dependencyFlags member of any element of pname:pDependencyInfo 5122e5c31af7Sopenharmony_ci must: be `0` 5123e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-pEvents-03845]] 5124e5c31af7Sopenharmony_ci If pname:pEvents includes one or more events that will be signaled by 5125e5c31af7Sopenharmony_ci flink:vkSetEvent after pname:commandBuffer has been submitted to a 5126e5c31af7Sopenharmony_ci queue, then fname:vkCmdWaitEvents2KHR must: not be called inside a 5127e5c31af7Sopenharmony_ci render pass instance 5128e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents2KHR-commandBuffer-03846]] 5129e5c31af7Sopenharmony_ci pname:commandBuffer's current device mask must: include exactly one 5130e5c31af7Sopenharmony_ci physical device 5131e5c31af7Sopenharmony_ci**** 5132e5c31af7Sopenharmony_ci 5133e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdWaitEvents2KHR.txt[] 5134e5c31af7Sopenharmony_ci-- 5135e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5136e5c31af7Sopenharmony_ci 5137e5c31af7Sopenharmony_ci[open,refpage='vkCmdWaitEvents',desc='Wait for one or more events and insert a set of memory',type='protos'] 5138e5c31af7Sopenharmony_ci-- 5139e5c31af7Sopenharmony_ci:refpage: vkCmdWaitEvents 5140e5c31af7Sopenharmony_ci 5141e5c31af7Sopenharmony_ciTo wait for one or more events to enter the signaled state on a device, 5142e5c31af7Sopenharmony_cicall: 5143e5c31af7Sopenharmony_ci 5144e5c31af7Sopenharmony_ci[[synchronization-events-waiting-device]] 5145e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWaitEvents.txt[] 5146e5c31af7Sopenharmony_ci 5147e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 5148e5c31af7Sopenharmony_ci recorded. 5149e5c31af7Sopenharmony_ci * pname:eventCount is the length of the pname:pEvents array. 5150e5c31af7Sopenharmony_ci * pname:pEvents is a pointer to an array of event object handles to wait 5151e5c31af7Sopenharmony_ci on. 5152e5c31af7Sopenharmony_ci * pname:srcStageMask is a bitmask of elink:VkPipelineStageFlagBits 5153e5c31af7Sopenharmony_ci specifying the <<synchronization-pipeline-stages, source stage mask>>. 5154e5c31af7Sopenharmony_ci * pname:dstStageMask is a bitmask of elink:VkPipelineStageFlagBits 5155e5c31af7Sopenharmony_ci specifying the <<synchronization-pipeline-stages, destination stage 5156e5c31af7Sopenharmony_ci mask>>. 5157e5c31af7Sopenharmony_ci * pname:memoryBarrierCount is the length of the pname:pMemoryBarriers 5158e5c31af7Sopenharmony_ci array. 5159e5c31af7Sopenharmony_ci * pname:pMemoryBarriers is a pointer to an array of slink:VkMemoryBarrier 5160e5c31af7Sopenharmony_ci structures. 5161e5c31af7Sopenharmony_ci * pname:bufferMemoryBarrierCount is the length of the 5162e5c31af7Sopenharmony_ci pname:pBufferMemoryBarriers array. 5163e5c31af7Sopenharmony_ci * pname:pBufferMemoryBarriers is a pointer to an array of 5164e5c31af7Sopenharmony_ci slink:VkBufferMemoryBarrier structures. 5165e5c31af7Sopenharmony_ci * pname:imageMemoryBarrierCount is the length of the 5166e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers array. 5167e5c31af7Sopenharmony_ci * pname:pImageMemoryBarriers is a pointer to an array of 5168e5c31af7Sopenharmony_ci slink:VkImageMemoryBarrier structures. 5169e5c31af7Sopenharmony_ci 5170e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5171e5c31af7Sopenharmony_cifname:vkCmdWaitEvents is largely similar to flink:vkCmdWaitEvents2KHR, but 5172e5c31af7Sopenharmony_cican: only wait on signal operations defined by flink:vkCmdSetEvent. 5173e5c31af7Sopenharmony_ciAs flink:vkCmdSetEvent does not define any access scopes, 5174e5c31af7Sopenharmony_cifname:vkCmdWaitEvents defines the first access scope for each event signal 5175e5c31af7Sopenharmony_cioperation in addition to its own access scopes. 5176e5c31af7Sopenharmony_ci 5177e5c31af7Sopenharmony_ci[NOTE] 5178e5c31af7Sopenharmony_ci.Note 5179e5c31af7Sopenharmony_ci==== 5180e5c31af7Sopenharmony_ciSince flink:vkCmdSetEvent does not have any dependency information beyond a 5181e5c31af7Sopenharmony_cistage mask, implementations do not have the same opportunity to perform 5182e5c31af7Sopenharmony_ci<<synchronization-dependencies-available-and-visible, availability and 5183e5c31af7Sopenharmony_civisibility operations>> or <<synchronization-image-layout-transitions, image 5184e5c31af7Sopenharmony_cilayout transitions>> in advance as they do with flink:vkCmdSetEvent2KHR and 5185e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents2KHR. 5186e5c31af7Sopenharmony_ci==== 5187e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5188e5c31af7Sopenharmony_ci 5189e5c31af7Sopenharmony_ciWhen fname:vkCmdWaitEvents is submitted to a queue, it defines a memory 5190e5c31af7Sopenharmony_cidependency between prior event signal operations on the same queue or the 5191e5c31af7Sopenharmony_cihost, and subsequent commands. 5192e5c31af7Sopenharmony_cifname:vkCmdWaitEvents must: not be used to wait on event signal operations 5193e5c31af7Sopenharmony_cioccurring on other queues. 5194e5c31af7Sopenharmony_ci 5195e5c31af7Sopenharmony_ciThe first synchronization scope only includes event signal operations that 5196e5c31af7Sopenharmony_cioperate on members of pname:pEvents, and the operations that happened-before 5197e5c31af7Sopenharmony_cithe event signal operations. 5198e5c31af7Sopenharmony_ciEvent signal operations performed by flink:vkCmdSetEvent that occur earlier 5199e5c31af7Sopenharmony_ciin <<synchronization-submission-order,submission order>> are included in the 5200e5c31af7Sopenharmony_cifirst synchronization scope, if the <<synchronization-pipeline-stages-order, 5201e5c31af7Sopenharmony_cilogically latest>> pipeline stage in their pname:stageMask parameter is 5202e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-order, logically earlier>> than or equal 5203e5c31af7Sopenharmony_cito the <<synchronization-pipeline-stages-order, logically latest>> pipeline 5204e5c31af7Sopenharmony_cistage in pname:srcStageMask. 5205e5c31af7Sopenharmony_ciEvent signal operations performed by flink:vkSetEvent are only included in 5206e5c31af7Sopenharmony_cithe first synchronization scope if ename:VK_PIPELINE_STAGE_HOST_BIT is 5207e5c31af7Sopenharmony_ciincluded in pname:srcStageMask. 5208e5c31af7Sopenharmony_ci 5209e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 5210e5c31af7Sopenharmony_ciincludes all commands that occur later in 5211e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 5212e5c31af7Sopenharmony_ciThe second synchronization scope is limited to operations on the pipeline 5213e5c31af7Sopenharmony_cistages determined by the <<synchronization-pipeline-stages-masks, 5214e5c31af7Sopenharmony_cidestination stage mask>> specified by pname:dstStageMask. 5215e5c31af7Sopenharmony_ci 5216e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> is 5217e5c31af7Sopenharmony_cilimited to accesses in the pipeline stages determined by the 5218e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, source stage mask>> specified by 5219e5c31af7Sopenharmony_cipname:srcStageMask. 5220e5c31af7Sopenharmony_ciWithin that, the first access scope only includes the first access scopes 5221e5c31af7Sopenharmony_cidefined by elements of the pname:pMemoryBarriers, 5222e5c31af7Sopenharmony_cipname:pBufferMemoryBarriers and pname:pImageMemoryBarriers arrays, which 5223e5c31af7Sopenharmony_cieach define a set of <<synchronization-memory-barriers, memory barriers>>. 5224e5c31af7Sopenharmony_ciIf no memory barriers are specified, then the first access scope includes no 5225e5c31af7Sopenharmony_ciaccesses. 5226e5c31af7Sopenharmony_ci 5227e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 5228e5c31af7Sopenharmony_cilimited to accesses in the pipeline stages determined by the 5229e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, destination stage mask>> specified 5230e5c31af7Sopenharmony_ciby pname:dstStageMask. 5231e5c31af7Sopenharmony_ciWithin that, the second access scope only includes the second access scopes 5232e5c31af7Sopenharmony_cidefined by elements of the pname:pMemoryBarriers, 5233e5c31af7Sopenharmony_cipname:pBufferMemoryBarriers and pname:pImageMemoryBarriers arrays, which 5234e5c31af7Sopenharmony_cieach define a set of <<synchronization-memory-barriers, memory barriers>>. 5235e5c31af7Sopenharmony_ciIf no memory barriers are specified, then the second access scope includes 5236e5c31af7Sopenharmony_cino accesses. 5237e5c31af7Sopenharmony_ci 5238e5c31af7Sopenharmony_ciifndef::VK_KHR_synchronization2[] 5239e5c31af7Sopenharmony_ci[NOTE] 5240e5c31af7Sopenharmony_ci.Note 5241e5c31af7Sopenharmony_ci==== 5242e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents is used with flink:vkCmdSetEvent to define a memory 5243e5c31af7Sopenharmony_cidependency between two sets of action commands, roughly in the same way as 5244e5c31af7Sopenharmony_cipipeline barriers, but split into two commands such that work between the 5245e5c31af7Sopenharmony_citwo may: execute unhindered. 5246e5c31af7Sopenharmony_ci 5247e5c31af7Sopenharmony_ciUnlike flink:vkCmdPipelineBarrier, a <<synchronization-queue-transfers, 5248e5c31af7Sopenharmony_ciqueue family ownership transfer>> cannot: be performed using 5249e5c31af7Sopenharmony_ciflink:vkCmdWaitEvents. 5250e5c31af7Sopenharmony_ci==== 5251e5c31af7Sopenharmony_ci 5252e5c31af7Sopenharmony_ci[NOTE] 5253e5c31af7Sopenharmony_ci.Note 5254e5c31af7Sopenharmony_ci==== 5255e5c31af7Sopenharmony_ciApplications should be careful to avoid race conditions when using events. 5256e5c31af7Sopenharmony_ciThere is no direct ordering guarantee between flink:vkCmdWaitEvents and 5257e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[flink:vkCmdResetEvent2KHR,] 5258e5c31af7Sopenharmony_ciflink:vkCmdResetEvent, or flink:vkCmdSetEvent. 5259e5c31af7Sopenharmony_ciAnother execution dependency (e.g. a pipeline barrier or semaphore with 5260e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) is needed to prevent such a race 5261e5c31af7Sopenharmony_cicondition. 5262e5c31af7Sopenharmony_ci==== 5263e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5264e5c31af7Sopenharmony_ci 5265e5c31af7Sopenharmony_ci.Valid Usage 5266e5c31af7Sopenharmony_ci**** 5267e5c31af7Sopenharmony_ci:stageMaskName: srcStageMask 5268e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_common.txt[] 5269e5c31af7Sopenharmony_ci 5270e5c31af7Sopenharmony_ci:stageMaskName: dstStageMask 5271e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_common.txt[] 5272e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/fine_sync_commands_common.txt[] 5273e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-srcStageMask-06459]] 5274e5c31af7Sopenharmony_ci Any pipeline stage included in pname:srcStageMask must: be supported by 5275e5c31af7Sopenharmony_ci the capabilities of the queue family specified by the 5276e5c31af7Sopenharmony_ci pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 5277e5c31af7Sopenharmony_ci structure that was used to create the sname:VkCommandPool that 5278e5c31af7Sopenharmony_ci pname:commandBuffer was allocated from, as specified in the 5279e5c31af7Sopenharmony_ci <<synchronization-pipeline-stages-supported, table of supported pipeline 5280e5c31af7Sopenharmony_ci stages>> 5281e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-dstStageMask-06460]] 5282e5c31af7Sopenharmony_ci Any pipeline stage included in pname:dstStageMask must: be supported by 5283e5c31af7Sopenharmony_ci the capabilities of the queue family specified by the 5284e5c31af7Sopenharmony_ci pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 5285e5c31af7Sopenharmony_ci structure that was used to create the sname:VkCommandPool that 5286e5c31af7Sopenharmony_ci pname:commandBuffer was allocated from, as specified in the 5287e5c31af7Sopenharmony_ci <<synchronization-pipeline-stages-supported, table of supported pipeline 5288e5c31af7Sopenharmony_ci stages>> 5289e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-srcStageMask-01158]] 5290e5c31af7Sopenharmony_ci pname:srcStageMask must: be the bitwise OR of the pname:stageMask 5291e5c31af7Sopenharmony_ci parameter used in previous calls to fname:vkCmdSetEvent with any of the 5292e5c31af7Sopenharmony_ci elements of pname:pEvents and ename:VK_PIPELINE_STAGE_HOST_BIT if any of 5293e5c31af7Sopenharmony_ci the elements of pname:pEvents was set using fname:vkSetEvent 5294e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-pEvents-01163]] 5295e5c31af7Sopenharmony_ci If pname:pEvents includes one or more events that will be signaled by 5296e5c31af7Sopenharmony_ci fname:vkSetEvent after pname:commandBuffer has been submitted to a 5297e5c31af7Sopenharmony_ci queue, then fname:vkCmdWaitEvents must: not be called inside a render 5298e5c31af7Sopenharmony_ci pass instance 5299e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-srcQueueFamilyIndex-02803]] 5300e5c31af7Sopenharmony_ci The pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex members of 5301e5c31af7Sopenharmony_ci any element of pname:pBufferMemoryBarriers or pname:pImageMemoryBarriers 5302e5c31af7Sopenharmony_ci must: be equal 5303e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 5304e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-commandBuffer-01167]] 5305e5c31af7Sopenharmony_ci pname:commandBuffer's current device mask must: include exactly one 5306e5c31af7Sopenharmony_ci physical device 5307e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 5308e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5309e5c31af7Sopenharmony_ci * [[VUID-vkCmdWaitEvents-pEvents-03847]] 5310e5c31af7Sopenharmony_ci Elements of pname:pEvents must: not have been signaled by 5311e5c31af7Sopenharmony_ci flink:vkCmdSetEvent2KHR 5312e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5313e5c31af7Sopenharmony_ci**** 5314e5c31af7Sopenharmony_ci 5315e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdWaitEvents.txt[] 5316e5c31af7Sopenharmony_ci-- 5317e5c31af7Sopenharmony_ci 5318e5c31af7Sopenharmony_ci 5319e5c31af7Sopenharmony_ci[[synchronization-pipeline-barriers]] 5320e5c31af7Sopenharmony_ci== Pipeline Barriers 5321e5c31af7Sopenharmony_ci 5322e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5323e5c31af7Sopenharmony_ci[open,refpage='vkCmdPipelineBarrier2KHR',desc='Insert a memory dependency',type='protos'] 5324e5c31af7Sopenharmony_ci-- 5325e5c31af7Sopenharmony_ci:refpage: vkCmdPipelineBarrier2KHR 5326e5c31af7Sopenharmony_ci 5327e5c31af7Sopenharmony_ciTo record a pipeline barrier, call: 5328e5c31af7Sopenharmony_ci 5329e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdPipelineBarrier2KHR.txt[] 5330e5c31af7Sopenharmony_ci 5331e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 5332e5c31af7Sopenharmony_ci recorded. 5333e5c31af7Sopenharmony_ci * pname:pDependencyInfo is a pointer to a slink:VkDependencyInfoKHR 5334e5c31af7Sopenharmony_ci structure defining the scopes of this operation. 5335e5c31af7Sopenharmony_ci 5336e5c31af7Sopenharmony_ciWhen flink:vkCmdPipelineBarrier2KHR is submitted to a queue, it defines 5337e5c31af7Sopenharmony_cimemory dependencies between commands that were submitted before it, and 5338e5c31af7Sopenharmony_cithose submitted after it. 5339e5c31af7Sopenharmony_ci 5340e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> and 5341e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> of each memory 5342e5c31af7Sopenharmony_cidependency defined by pname:pDependencyInfo are applied to operations that 5343e5c31af7Sopenharmony_cioccurred earlier in <<synchronization-submission-order,submission order>>. 5344e5c31af7Sopenharmony_ci 5345e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 5346e5c31af7Sopenharmony_ciand <<synchronization-dependencies-access-scopes, access scope>> of each 5347e5c31af7Sopenharmony_cimemory dependency defined by pname:pDependencyInfo are applied to operations 5348e5c31af7Sopenharmony_cithat occurred later in <<synchronization-submission-order,submission 5349e5c31af7Sopenharmony_ciorder>>. 5350e5c31af7Sopenharmony_ci 5351e5c31af7Sopenharmony_ciIf fname:vkCmdPipelineBarrier2KHR is recorded within a render pass instance, 5352e5c31af7Sopenharmony_cithe synchronization scopes are 5353e5c31af7Sopenharmony_ci<<synchronization-pipeline-barriers-subpass-self-dependencies, limited to 5354e5c31af7Sopenharmony_cioperations within the same subpass>>. 5355e5c31af7Sopenharmony_ci 5356e5c31af7Sopenharmony_ci.Valid Usage 5357e5c31af7Sopenharmony_ci**** 5358e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/pipeline_barrier_common.txt[] 5359e5c31af7Sopenharmony_ci * [[VUID-vkCmdPipelineBarrier2KHR-synchronization2-03848]] 5360e5c31af7Sopenharmony_ci The <<features-synchronization2, pname:synchronization2>> feature must: 5361e5c31af7Sopenharmony_ci be enabled 5362e5c31af7Sopenharmony_ci * [[VUID-vkCmdPipelineBarrier2KHR-srcStageMask-03849]] 5363e5c31af7Sopenharmony_ci The pname:srcStageMask member of any element of the 5364e5c31af7Sopenharmony_ci pname:pMemoryBarriers, pname:pBufferMemoryBarriers, or 5365e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers members of pname:pDependencyInfo must: only 5366e5c31af7Sopenharmony_ci include pipeline stages valid for the queue family that was used to 5367e5c31af7Sopenharmony_ci create the command pool that pname:commandBuffer was allocated from 5368e5c31af7Sopenharmony_ci * [[VUID-vkCmdPipelineBarrier2KHR-dstStageMask-03850]] 5369e5c31af7Sopenharmony_ci The pname:dstStageMask member of any element of the 5370e5c31af7Sopenharmony_ci pname:pMemoryBarriers, pname:pBufferMemoryBarriers, or 5371e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers members of pname:pDependencyInfo must: only 5372e5c31af7Sopenharmony_ci include pipeline stages valid for the queue family that was used to 5373e5c31af7Sopenharmony_ci create the command pool that pname:commandBuffer was allocated from 5374e5c31af7Sopenharmony_ci**** 5375e5c31af7Sopenharmony_ci 5376e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdPipelineBarrier2KHR.txt[] 5377e5c31af7Sopenharmony_ci-- 5378e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5379e5c31af7Sopenharmony_ci 5380e5c31af7Sopenharmony_ci[open,refpage='vkCmdPipelineBarrier',desc='Insert a memory dependency',type='protos'] 5381e5c31af7Sopenharmony_ci-- 5382e5c31af7Sopenharmony_ci:refpage: vkCmdPipelineBarrier 5383e5c31af7Sopenharmony_ci 5384e5c31af7Sopenharmony_ciTo record a pipeline barrier, call: 5385e5c31af7Sopenharmony_ci 5386e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdPipelineBarrier.txt[] 5387e5c31af7Sopenharmony_ci 5388e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command is 5389e5c31af7Sopenharmony_ci recorded. 5390e5c31af7Sopenharmony_ci * pname:srcStageMask is a bitmask of elink:VkPipelineStageFlagBits 5391e5c31af7Sopenharmony_ci specifying the <<synchronization-pipeline-stages-masks,source stages>>. 5392e5c31af7Sopenharmony_ci * pname:dstStageMask is a bitmask of elink:VkPipelineStageFlagBits 5393e5c31af7Sopenharmony_ci specifying the <<synchronization-pipeline-stages-masks,destination 5394e5c31af7Sopenharmony_ci stages>>. 5395e5c31af7Sopenharmony_ci * pname:dependencyFlags is a bitmask of elink:VkDependencyFlagBits 5396e5c31af7Sopenharmony_ci specifying how execution and memory dependencies are formed. 5397e5c31af7Sopenharmony_ci * pname:memoryBarrierCount is the length of the pname:pMemoryBarriers 5398e5c31af7Sopenharmony_ci array. 5399e5c31af7Sopenharmony_ci * pname:pMemoryBarriers is a pointer to an array of slink:VkMemoryBarrier 5400e5c31af7Sopenharmony_ci structures. 5401e5c31af7Sopenharmony_ci * pname:bufferMemoryBarrierCount is the length of the 5402e5c31af7Sopenharmony_ci pname:pBufferMemoryBarriers array. 5403e5c31af7Sopenharmony_ci * pname:pBufferMemoryBarriers is a pointer to an array of 5404e5c31af7Sopenharmony_ci slink:VkBufferMemoryBarrier structures. 5405e5c31af7Sopenharmony_ci * pname:imageMemoryBarrierCount is the length of the 5406e5c31af7Sopenharmony_ci pname:pImageMemoryBarriers array. 5407e5c31af7Sopenharmony_ci * pname:pImageMemoryBarriers is a pointer to an array of 5408e5c31af7Sopenharmony_ci slink:VkImageMemoryBarrier structures. 5409e5c31af7Sopenharmony_ci 5410e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5411e5c31af7Sopenharmony_cifname:vkCmdPipelineBarrier operates almost identically to 5412e5c31af7Sopenharmony_ciflink:vkCmdPipelineBarrier2KHR, except that the scopes and barriers are 5413e5c31af7Sopenharmony_cidefined as direct parameters rather than being defined by an 5414e5c31af7Sopenharmony_cislink:VkDependencyInfoKHR. 5415e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5416e5c31af7Sopenharmony_ci 5417e5c31af7Sopenharmony_ciWhen flink:vkCmdPipelineBarrier is submitted to a queue, it defines a memory 5418e5c31af7Sopenharmony_cidependency between commands that were submitted before it, and those 5419e5c31af7Sopenharmony_cisubmitted after it. 5420e5c31af7Sopenharmony_ci 5421e5c31af7Sopenharmony_ciIf flink:vkCmdPipelineBarrier was recorded outside a render pass instance, 5422e5c31af7Sopenharmony_cithe first <<synchronization-dependencies-scopes, synchronization scope>> 5423e5c31af7Sopenharmony_ciincludes all commands that occur earlier in 5424e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 5425e5c31af7Sopenharmony_ciIf flink:vkCmdPipelineBarrier was recorded inside a render pass instance, 5426e5c31af7Sopenharmony_cithe first synchronization scope includes only commands that occur earlier in 5427e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>> within the same 5428e5c31af7Sopenharmony_cisubpass. 5429e5c31af7Sopenharmony_ciIn either case, the first synchronization scope is limited to operations on 5430e5c31af7Sopenharmony_cithe pipeline stages determined by the 5431e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, source stage mask>> specified by 5432e5c31af7Sopenharmony_cipname:srcStageMask. 5433e5c31af7Sopenharmony_ci 5434e5c31af7Sopenharmony_ciIf flink:vkCmdPipelineBarrier was recorded outside a render pass instance, 5435e5c31af7Sopenharmony_cithe second <<synchronization-dependencies-scopes, synchronization scope>> 5436e5c31af7Sopenharmony_ciincludes all commands that occur later in 5437e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 5438e5c31af7Sopenharmony_ciIf flink:vkCmdPipelineBarrier was recorded inside a render pass instance, 5439e5c31af7Sopenharmony_cithe second synchronization scope includes only commands that occur later in 5440e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>> within the same 5441e5c31af7Sopenharmony_cisubpass. 5442e5c31af7Sopenharmony_ciIn either case, the second synchronization scope is limited to operations on 5443e5c31af7Sopenharmony_cithe pipeline stages determined by the 5444e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, destination stage mask>> specified 5445e5c31af7Sopenharmony_ciby pname:dstStageMask. 5446e5c31af7Sopenharmony_ci 5447e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> is 5448e5c31af7Sopenharmony_cilimited to accesses in the pipeline stages determined by the 5449e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, source stage mask>> specified by 5450e5c31af7Sopenharmony_cipname:srcStageMask. 5451e5c31af7Sopenharmony_ciWithin that, the first access scope only includes the first access scopes 5452e5c31af7Sopenharmony_cidefined by elements of the pname:pMemoryBarriers, 5453e5c31af7Sopenharmony_cipname:pBufferMemoryBarriers and pname:pImageMemoryBarriers arrays, which 5454e5c31af7Sopenharmony_cieach define a set of <<synchronization-memory-barriers, memory barriers>>. 5455e5c31af7Sopenharmony_ciIf no memory barriers are specified, then the first access scope includes no 5456e5c31af7Sopenharmony_ciaccesses. 5457e5c31af7Sopenharmony_ci 5458e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 5459e5c31af7Sopenharmony_cilimited to accesses in the pipeline stages determined by the 5460e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages-masks, destination stage mask>> specified 5461e5c31af7Sopenharmony_ciby pname:dstStageMask. 5462e5c31af7Sopenharmony_ciWithin that, the second access scope only includes the second access scopes 5463e5c31af7Sopenharmony_cidefined by elements of the pname:pMemoryBarriers, 5464e5c31af7Sopenharmony_cipname:pBufferMemoryBarriers and pname:pImageMemoryBarriers arrays, which 5465e5c31af7Sopenharmony_cieach define a set of <<synchronization-memory-barriers, memory barriers>>. 5466e5c31af7Sopenharmony_ciIf no memory barriers are specified, then the second access scope includes 5467e5c31af7Sopenharmony_cino accesses. 5468e5c31af7Sopenharmony_ci 5469e5c31af7Sopenharmony_ciIf pname:dependencyFlags includes ename:VK_DEPENDENCY_BY_REGION_BIT, then 5470e5c31af7Sopenharmony_ciany dependency between <<synchronization-framebuffer-regions, 5471e5c31af7Sopenharmony_ciframebuffer-space>> pipeline stages is 5472e5c31af7Sopenharmony_ci<<synchronization-framebuffer-regions, framebuffer-local>> - otherwise it is 5473e5c31af7Sopenharmony_ci<<synchronization-framebuffer-regions, framebuffer-global>>. 5474e5c31af7Sopenharmony_ci 5475e5c31af7Sopenharmony_ci.Valid Usage 5476e5c31af7Sopenharmony_ci**** 5477e5c31af7Sopenharmony_ci:stageMaskName: srcStageMask 5478e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_common.txt[] 5479e5c31af7Sopenharmony_ci 5480e5c31af7Sopenharmony_ci:stageMaskName: dstStageMask 5481e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_common.txt[] 5482e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/fine_sync_commands_common.txt[] 5483e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/pipeline_barrier_common.txt[] 5484e5c31af7Sopenharmony_ci * [[VUID-vkCmdPipelineBarrier-srcStageMask-06461]] 5485e5c31af7Sopenharmony_ci Any pipeline stage included in pname:srcStageMask must: be supported by 5486e5c31af7Sopenharmony_ci the capabilities of the queue family specified by the 5487e5c31af7Sopenharmony_ci pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 5488e5c31af7Sopenharmony_ci structure that was used to create the sname:VkCommandPool that 5489e5c31af7Sopenharmony_ci pname:commandBuffer was allocated from, as specified in the 5490e5c31af7Sopenharmony_ci <<synchronization-pipeline-stages-supported, table of supported pipeline 5491e5c31af7Sopenharmony_ci stages>> 5492e5c31af7Sopenharmony_ci * [[VUID-vkCmdPipelineBarrier-dstStageMask-06462]] 5493e5c31af7Sopenharmony_ci Any pipeline stage included in pname:dstStageMask must: be supported by 5494e5c31af7Sopenharmony_ci the capabilities of the queue family specified by the 5495e5c31af7Sopenharmony_ci pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 5496e5c31af7Sopenharmony_ci structure that was used to create the sname:VkCommandPool that 5497e5c31af7Sopenharmony_ci pname:commandBuffer was allocated from, as specified in the 5498e5c31af7Sopenharmony_ci <<synchronization-pipeline-stages-supported, table of supported pipeline 5499e5c31af7Sopenharmony_ci stages>> 5500e5c31af7Sopenharmony_ci**** 5501e5c31af7Sopenharmony_ci 5502e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdPipelineBarrier.txt[] 5503e5c31af7Sopenharmony_ci-- 5504e5c31af7Sopenharmony_ci 5505e5c31af7Sopenharmony_ci[open,refpage='VkDependencyFlagBits',desc='Bitmask specifying how execution and memory dependencies are formed',type='enums'] 5506e5c31af7Sopenharmony_ci-- 5507e5c31af7Sopenharmony_ciBits which can: be set in fname:vkCmdPipelineBarrier::pname:dependencyFlags, 5508e5c31af7Sopenharmony_cispecifying how execution and memory dependencies are formed, are: 5509e5c31af7Sopenharmony_ci 5510e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkDependencyFlagBits.txt[] 5511e5c31af7Sopenharmony_ci 5512e5c31af7Sopenharmony_ci * ename:VK_DEPENDENCY_BY_REGION_BIT specifies that dependencies will be 5513e5c31af7Sopenharmony_ci <<synchronization-framebuffer-regions, framebuffer-local>>. 5514e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 5515e5c31af7Sopenharmony_ci * ename:VK_DEPENDENCY_VIEW_LOCAL_BIT specifies that a 5516e5c31af7Sopenharmony_ci <<synchronization-pipeline-barriers-subpass-self-dependencies, subpass 5517e5c31af7Sopenharmony_ci has more than one view>>. 5518e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 5519e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 5520e5c31af7Sopenharmony_ci * ename:VK_DEPENDENCY_DEVICE_GROUP_BIT specifies that dependencies are 5521e5c31af7Sopenharmony_ci <<synchronization-device-local-dependencies, non-device-local>>. 5522e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 5523e5c31af7Sopenharmony_ci-- 5524e5c31af7Sopenharmony_ci 5525e5c31af7Sopenharmony_ci[open,refpage='VkDependencyFlags',desc='Bitmask of VkDependencyFlagBits',type='flags'] 5526e5c31af7Sopenharmony_ci-- 5527e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkDependencyFlags.txt[] 5528e5c31af7Sopenharmony_ci 5529e5c31af7Sopenharmony_citname:VkDependencyFlags is a bitmask type for setting a mask of zero or more 5530e5c31af7Sopenharmony_cielink:VkDependencyFlagBits. 5531e5c31af7Sopenharmony_ci-- 5532e5c31af7Sopenharmony_ci 5533e5c31af7Sopenharmony_ci 5534e5c31af7Sopenharmony_ci[[synchronization-pipeline-barriers-subpass-self-dependencies]] 5535e5c31af7Sopenharmony_ci=== Subpass Self-dependency 5536e5c31af7Sopenharmony_ci 5537e5c31af7Sopenharmony_ciifdef::VK_KHR_dynamic_rendering[] 5538e5c31af7Sopenharmony_ciflink:vkCmdPipelineBarrier 5539e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5540e5c31af7Sopenharmony_cior flink:vkCmdPipelineBarrier2KHR 5541e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5542e5c31af7Sopenharmony_cimust: not be called within a render pass instance started with 5543e5c31af7Sopenharmony_ciflink:vkCmdBeginRenderingKHR. 5544e5c31af7Sopenharmony_ciendif::VK_KHR_dynamic_rendering[] 5545e5c31af7Sopenharmony_ci 5546e5c31af7Sopenharmony_ciIf flink:vkCmdPipelineBarrier 5547e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5548e5c31af7Sopenharmony_cior flink:vkCmdPipelineBarrier2KHR 5549e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5550e5c31af7Sopenharmony_ciis called inside a render pass instance, the following restrictions apply. 5551e5c31af7Sopenharmony_ciFor a given subpass to allow a pipeline barrier, the render pass must: 5552e5c31af7Sopenharmony_cideclare a _self-dependency_ from that subpass to itself. 5553e5c31af7Sopenharmony_ciThat is, there must: exist a subpass dependency with pname:srcSubpass and 5554e5c31af7Sopenharmony_cipname:dstSubpass both equal to that subpass index. 5555e5c31af7Sopenharmony_ciMore than one self-dependency can: be declared for each subpass. 5556e5c31af7Sopenharmony_ci 5557e5c31af7Sopenharmony_ciSelf-dependencies must: only include pipeline stage bits that are graphics 5558e5c31af7Sopenharmony_cistages. 5559e5c31af7Sopenharmony_ciIf any of the stages in pname:srcStageMask are 5560e5c31af7Sopenharmony_ci<<synchronization-framebuffer-regions,framebuffer-space stages>>, 5561e5c31af7Sopenharmony_cipname:dstStageMask must: only contain 5562e5c31af7Sopenharmony_ci<<synchronization-framebuffer-regions,framebuffer-space stages>>. 5563e5c31af7Sopenharmony_ciThis means that pseudo-stages like ename:VK_PIPELINE_STAGE_ALL_COMMANDS_BIT 5564e5c31af7Sopenharmony_ciwhich include the execution of both framebuffer-space stages and 5565e5c31af7Sopenharmony_cinon-framebuffer-space stages must: not be used. 5566e5c31af7Sopenharmony_ci 5567e5c31af7Sopenharmony_ciIf the source and destination stage masks both include framebuffer-space 5568e5c31af7Sopenharmony_cistages, then pname:dependencyFlags must: include 5569e5c31af7Sopenharmony_ciename:VK_DEPENDENCY_BY_REGION_BIT. 5570e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 5571e5c31af7Sopenharmony_ciIf the subpass has more than one view, then pname:dependencyFlags must: 5572e5c31af7Sopenharmony_ciinclude ename:VK_DEPENDENCY_VIEW_LOCAL_BIT. 5573e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 5574e5c31af7Sopenharmony_ci 5575e5c31af7Sopenharmony_ciEach of the <<synchronization-dependencies-scopes, synchronization scopes>> 5576e5c31af7Sopenharmony_ciand <<synchronization-dependencies-access-scopes, access scopes>> of a 5577e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5578e5c31af7Sopenharmony_ciflink:vkCmdPipelineBarrier2KHR or 5579e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5580e5c31af7Sopenharmony_ciflink:vkCmdPipelineBarrier command inside a render pass instance must: be a 5581e5c31af7Sopenharmony_cisubset of the scopes of one of the self-dependencies for the current 5582e5c31af7Sopenharmony_cisubpass. 5583e5c31af7Sopenharmony_ci 5584e5c31af7Sopenharmony_ciIf the self-dependency has ename:VK_DEPENDENCY_BY_REGION_BIT 5585e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 5586e5c31af7Sopenharmony_cior ename:VK_DEPENDENCY_VIEW_LOCAL_BIT 5587e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 5588e5c31af7Sopenharmony_ciset, then so must: the pipeline barrier. 5589e5c31af7Sopenharmony_ciPipeline barriers within a render pass instance must: not include buffer 5590e5c31af7Sopenharmony_cimemory barriers. 5591e5c31af7Sopenharmony_ciImage memory barriers must: only specify image subresources that are used as 5592e5c31af7Sopenharmony_ciattachments within the subpass, and must: not define an 5593e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transition>> or 5594e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, queue family ownership transfer>>. 5595e5c31af7Sopenharmony_ci 5596e5c31af7Sopenharmony_ci 5597e5c31af7Sopenharmony_ci[[synchronization-memory-barriers]] 5598e5c31af7Sopenharmony_ci== Memory Barriers 5599e5c31af7Sopenharmony_ci 5600e5c31af7Sopenharmony_ci_Memory barriers_ are used to explicitly control access to buffer and image 5601e5c31af7Sopenharmony_cisubresource ranges. 5602e5c31af7Sopenharmony_ciMemory barriers are used to <<synchronization-queue-transfers, transfer 5603e5c31af7Sopenharmony_ciownership between queue families>>, 5604e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, change image layouts>>, and 5605e5c31af7Sopenharmony_cidefine <<synchronization-dependencies-available-and-visible, availability 5606e5c31af7Sopenharmony_ciand visibility operations>>. 5607e5c31af7Sopenharmony_ciThey explicitly define the <<synchronization-access-types, access types>> 5608e5c31af7Sopenharmony_ciand buffer and image subresource ranges that are included in the 5609e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scopes>> of a memory 5610e5c31af7Sopenharmony_cidependency that is created by a synchronization command that includes them. 5611e5c31af7Sopenharmony_ci 5612e5c31af7Sopenharmony_ci 5613e5c31af7Sopenharmony_ci[[synchronization-global-memory-barriers]] 5614e5c31af7Sopenharmony_ci=== Global Memory Barriers 5615e5c31af7Sopenharmony_ci 5616e5c31af7Sopenharmony_ciGlobal memory barriers apply to memory accesses involving all memory objects 5617e5c31af7Sopenharmony_cithat exist at the time of its execution. 5618e5c31af7Sopenharmony_ci 5619e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5620e5c31af7Sopenharmony_ci[open,refpage='VkMemoryBarrier2KHR',desc='Structure specifying a global memory barrier',type='structs'] 5621e5c31af7Sopenharmony_ci-- 5622e5c31af7Sopenharmony_ci:refpage: VkMemoryBarrier2KHR 5623e5c31af7Sopenharmony_ci 5624e5c31af7Sopenharmony_ciThe sname:VkMemoryBarrier2KHR structure is defined as: 5625e5c31af7Sopenharmony_ci 5626e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkMemoryBarrier2KHR.txt[] 5627e5c31af7Sopenharmony_ci 5628e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 5629e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 5630e5c31af7Sopenharmony_ci structure. 5631e5c31af7Sopenharmony_ci * pname:srcStageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 5632e5c31af7Sopenharmony_ci stages to be included in the <<synchronization-dependencies-scopes, 5633e5c31af7Sopenharmony_ci first synchronization scope>>. 5634e5c31af7Sopenharmony_ci * pname:srcAccessMask is a tlink:VkAccessFlags2KHR mask of access flags to 5635e5c31af7Sopenharmony_ci be included in the <<synchronization-dependencies-access-scopes, first 5636e5c31af7Sopenharmony_ci access scope>>. 5637e5c31af7Sopenharmony_ci * pname:dstStageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 5638e5c31af7Sopenharmony_ci stages to be included in the <<synchronization-dependencies-scopes, 5639e5c31af7Sopenharmony_ci second synchronization scope>>. 5640e5c31af7Sopenharmony_ci * pname:dstAccessMask is a tlink:VkAccessFlags2KHR mask of access flags to 5641e5c31af7Sopenharmony_ci be included in the <<synchronization-dependencies-access-scopes, second 5642e5c31af7Sopenharmony_ci access scope>>. 5643e5c31af7Sopenharmony_ci 5644e5c31af7Sopenharmony_ciThis structure defines a <<synchronization-dependencies-memory, memory 5645e5c31af7Sopenharmony_cidependency>> affecting all device memory. 5646e5c31af7Sopenharmony_ci 5647e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> and 5648e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> described by 5649e5c31af7Sopenharmony_cithis structure include only operations and memory accesses specified by 5650e5c31af7Sopenharmony_cipname:srcStageMask and pname:srcAccessMask. 5651e5c31af7Sopenharmony_ci 5652e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 5653e5c31af7Sopenharmony_ciand <<synchronization-dependencies-access-scopes, access scope>> described 5654e5c31af7Sopenharmony_ciby this structure include only operations and memory accesses specified by 5655e5c31af7Sopenharmony_cipname:dstStageMask and pname:dstAccessMask. 5656e5c31af7Sopenharmony_ci 5657e5c31af7Sopenharmony_ci.Valid Usage 5658e5c31af7Sopenharmony_ci**** 5659e5c31af7Sopenharmony_ci:stageMaskName: srcStageMask 5660e5c31af7Sopenharmony_ci:accessMaskName: srcAccessMask 5661e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 5662e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/access_mask_2_common.txt[] 5663e5c31af7Sopenharmony_ci 5664e5c31af7Sopenharmony_ci:stageMaskName: dstStageMask 5665e5c31af7Sopenharmony_ci:accessMaskName: dstAccessMask 5666e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 5667e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/access_mask_2_common.txt[] 5668e5c31af7Sopenharmony_ci**** 5669e5c31af7Sopenharmony_ci 5670e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkMemoryBarrier2KHR.txt[] 5671e5c31af7Sopenharmony_ci-- 5672e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5673e5c31af7Sopenharmony_ci 5674e5c31af7Sopenharmony_ci[open,refpage='VkMemoryBarrier',desc='Structure specifying a global memory barrier',type='structs'] 5675e5c31af7Sopenharmony_ci-- 5676e5c31af7Sopenharmony_ciThe sname:VkMemoryBarrier structure is defined as: 5677e5c31af7Sopenharmony_ci 5678e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkMemoryBarrier.txt[] 5679e5c31af7Sopenharmony_ci 5680e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 5681e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 5682e5c31af7Sopenharmony_ci structure. 5683e5c31af7Sopenharmony_ci * pname:srcAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 5684e5c31af7Sopenharmony_ci <<synchronization-access-masks, source access mask>>. 5685e5c31af7Sopenharmony_ci * pname:dstAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 5686e5c31af7Sopenharmony_ci <<synchronization-access-masks, destination access mask>>. 5687e5c31af7Sopenharmony_ci 5688e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> is 5689e5c31af7Sopenharmony_cilimited to access types in the <<synchronization-access-masks, source access 5690e5c31af7Sopenharmony_cimask>> specified by pname:srcAccessMask. 5691e5c31af7Sopenharmony_ci 5692e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 5693e5c31af7Sopenharmony_cilimited to access types in the <<synchronization-access-masks, destination 5694e5c31af7Sopenharmony_ciaccess mask>> specified by pname:dstAccessMask. 5695e5c31af7Sopenharmony_ci 5696e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkMemoryBarrier.txt[] 5697e5c31af7Sopenharmony_ci-- 5698e5c31af7Sopenharmony_ci 5699e5c31af7Sopenharmony_ci 5700e5c31af7Sopenharmony_ci[[synchronization-buffer-memory-barriers]] 5701e5c31af7Sopenharmony_ci=== Buffer Memory Barriers 5702e5c31af7Sopenharmony_ci 5703e5c31af7Sopenharmony_ciBuffer memory barriers only apply to memory accesses involving a specific 5704e5c31af7Sopenharmony_cibuffer range. 5705e5c31af7Sopenharmony_ciThat is, a memory dependency formed from a buffer memory barrier is 5706e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, scoped>> to access via the 5707e5c31af7Sopenharmony_cispecified buffer range. 5708e5c31af7Sopenharmony_ciBuffer memory barriers can: also be used to define a 5709e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, queue family ownership transfer>> for the 5710e5c31af7Sopenharmony_cispecified buffer range. 5711e5c31af7Sopenharmony_ci 5712e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5713e5c31af7Sopenharmony_ci[open,refpage='VkBufferMemoryBarrier2KHR',desc='Structure specifying a buffer memory barrier',type='structs'] 5714e5c31af7Sopenharmony_ci-- 5715e5c31af7Sopenharmony_ci:refpage: VkBufferMemoryBarrier2KHR 5716e5c31af7Sopenharmony_ci 5717e5c31af7Sopenharmony_ciThe sname:VkBufferMemoryBarrier2KHR structure is defined as: 5718e5c31af7Sopenharmony_ci 5719e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBufferMemoryBarrier2KHR.txt[] 5720e5c31af7Sopenharmony_ci 5721e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 5722e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 5723e5c31af7Sopenharmony_ci structure. 5724e5c31af7Sopenharmony_ci * pname:srcStageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 5725e5c31af7Sopenharmony_ci stages to be included in the <<synchronization-dependencies-scopes, 5726e5c31af7Sopenharmony_ci first synchronization scope>>. 5727e5c31af7Sopenharmony_ci * pname:srcAccessMask is a tlink:VkAccessFlags2KHR mask of access flags to 5728e5c31af7Sopenharmony_ci be included in the <<synchronization-dependencies-access-scopes, first 5729e5c31af7Sopenharmony_ci access scope>>. 5730e5c31af7Sopenharmony_ci * pname:dstStageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 5731e5c31af7Sopenharmony_ci stages to be included in the <<synchronization-dependencies-scopes, 5732e5c31af7Sopenharmony_ci second synchronization scope>>. 5733e5c31af7Sopenharmony_ci * pname:dstAccessMask is a tlink:VkAccessFlags2KHR mask of access flags to 5734e5c31af7Sopenharmony_ci be included in the <<synchronization-dependencies-access-scopes, second 5735e5c31af7Sopenharmony_ci access scope>>. 5736e5c31af7Sopenharmony_ci * pname:srcQueueFamilyIndex is the source queue family for a 5737e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 5738e5c31af7Sopenharmony_ci * pname:dstQueueFamilyIndex is the destination queue family for a 5739e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 5740e5c31af7Sopenharmony_ci * pname:buffer is a handle to the buffer whose backing memory is affected 5741e5c31af7Sopenharmony_ci by the barrier. 5742e5c31af7Sopenharmony_ci * pname:offset is an offset in bytes into the backing memory for 5743e5c31af7Sopenharmony_ci pname:buffer; this is relative to the base offset as bound to the buffer 5744e5c31af7Sopenharmony_ci (see flink:vkBindBufferMemory). 5745e5c31af7Sopenharmony_ci * pname:size is a size in bytes of the affected area of backing memory for 5746e5c31af7Sopenharmony_ci pname:buffer, or ename:VK_WHOLE_SIZE to use the range from pname:offset 5747e5c31af7Sopenharmony_ci to the end of the buffer. 5748e5c31af7Sopenharmony_ci 5749e5c31af7Sopenharmony_ciThis structure defines a <<synchronization-dependencies-memory, memory 5750e5c31af7Sopenharmony_cidependency>> limited to a range of a buffer, and can: define a 5751e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, queue family transfer operation>> for 5752e5c31af7Sopenharmony_cithat range. 5753e5c31af7Sopenharmony_ci 5754e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> and 5755e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> described by 5756e5c31af7Sopenharmony_cithis structure include only operations and memory accesses specified by 5757e5c31af7Sopenharmony_cipname:srcStageMask and pname:srcAccessMask. 5758e5c31af7Sopenharmony_ci 5759e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 5760e5c31af7Sopenharmony_ciand <<synchronization-dependencies-access-scopes, access scope>> described 5761e5c31af7Sopenharmony_ciby this structure include only operations and memory accesses specified by 5762e5c31af7Sopenharmony_cipname:dstStageMask and pname:dstAccessMask. 5763e5c31af7Sopenharmony_ci 5764e5c31af7Sopenharmony_ciBoth <<synchronization-dependencies-access-scopes, access scopes>> are 5765e5c31af7Sopenharmony_cilimited to only memory accesses to pname:buffer in the range defined by 5766e5c31af7Sopenharmony_cipname:offset and pname:size. 5767e5c31af7Sopenharmony_ci 5768e5c31af7Sopenharmony_ciIf pname:buffer was created with ename:VK_SHARING_MODE_EXCLUSIVE, and 5769e5c31af7Sopenharmony_cipname:srcQueueFamilyIndex is not equal to pname:dstQueueFamilyIndex, this 5770e5c31af7Sopenharmony_cimemory barrier defines a <<synchronization-queue-transfers, queue family 5771e5c31af7Sopenharmony_citransfer operation>>. 5772e5c31af7Sopenharmony_ciWhen executed on a queue in the family identified by 5773e5c31af7Sopenharmony_cipname:srcQueueFamilyIndex, this barrier defines a 5774e5c31af7Sopenharmony_ci<<synchronization-queue-transfers-release, queue family release operation>> 5775e5c31af7Sopenharmony_cifor the specified buffer range, and the second synchronization and access 5776e5c31af7Sopenharmony_ciscopes do not synchronize operations on that queue. 5777e5c31af7Sopenharmony_ciWhen executed on a queue in the family identified by 5778e5c31af7Sopenharmony_cipname:dstQueueFamilyIndex, this barrier defines a 5779e5c31af7Sopenharmony_ci<<synchronization-queue-transfers-acquire, queue family acquire operation>> 5780e5c31af7Sopenharmony_cifor the specified buffer range, and the first synchronization and access 5781e5c31af7Sopenharmony_ciscopes do not synchronize operations on that queue. 5782e5c31af7Sopenharmony_ci 5783e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 5784e5c31af7Sopenharmony_ciA <<synchronization-queue-transfers, queue family transfer operation>> is 5785e5c31af7Sopenharmony_cialso defined if the values are not equal, and either is one of the special 5786e5c31af7Sopenharmony_ciqueue family values reserved for external memory ownership transfers, as 5787e5c31af7Sopenharmony_cidescribed in <<synchronization-queue-transfers>>. 5788e5c31af7Sopenharmony_ciA <<synchronization-queue-transfers-release, queue family release 5789e5c31af7Sopenharmony_cioperation>> is defined when pname:dstQueueFamilyIndex is one of those 5790e5c31af7Sopenharmony_civalues, and a <<synchronization-queue-transfers-acquire, queue family 5791e5c31af7Sopenharmony_ciacquire operation>> is defined when pname:srcQueueFamilyIndex is one of 5792e5c31af7Sopenharmony_cithose values. 5793e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 5794e5c31af7Sopenharmony_ci 5795e5c31af7Sopenharmony_ci 5796e5c31af7Sopenharmony_ci.Valid Usage 5797e5c31af7Sopenharmony_ci**** 5798e5c31af7Sopenharmony_ci 5799e5c31af7Sopenharmony_ci:stageMaskName: srcStageMask 5800e5c31af7Sopenharmony_ci:accessMaskName: srcAccessMask 5801e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 5802e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/access_mask_2_common.txt[] 5803e5c31af7Sopenharmony_ci 5804e5c31af7Sopenharmony_ci:stageMaskName: dstStageMask 5805e5c31af7Sopenharmony_ci:accessMaskName: dstAccessMask 5806e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 5807e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/access_mask_2_common.txt[] 5808e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/buffer_memory_barrier_common.txt[] 5809e5c31af7Sopenharmony_ci * [[VUID-VkBufferMemoryBarrier2KHR-srcStageMask-03851]] 5810e5c31af7Sopenharmony_ci If either pname:srcStageMask or pname:dstStageMask includes 5811e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR, pname:srcQueueFamilyIndex and 5812e5c31af7Sopenharmony_ci pname:dstQueueFamilyIndex must: be equal 5813e5c31af7Sopenharmony_ci**** 5814e5c31af7Sopenharmony_ci 5815e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBufferMemoryBarrier2KHR.txt[] 5816e5c31af7Sopenharmony_ci-- 5817e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 5818e5c31af7Sopenharmony_ci 5819e5c31af7Sopenharmony_ci[open,refpage='VkBufferMemoryBarrier',desc='Structure specifying a buffer memory barrier',type='structs'] 5820e5c31af7Sopenharmony_ci-- 5821e5c31af7Sopenharmony_ci:refpage: VkBufferMemoryBarrier 5822e5c31af7Sopenharmony_ci 5823e5c31af7Sopenharmony_ciThe sname:VkBufferMemoryBarrier structure is defined as: 5824e5c31af7Sopenharmony_ci 5825e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBufferMemoryBarrier.txt[] 5826e5c31af7Sopenharmony_ci 5827e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 5828e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 5829e5c31af7Sopenharmony_ci structure. 5830e5c31af7Sopenharmony_ci * pname:srcAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 5831e5c31af7Sopenharmony_ci <<synchronization-access-masks, source access mask>>. 5832e5c31af7Sopenharmony_ci * pname:dstAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 5833e5c31af7Sopenharmony_ci <<synchronization-access-masks, destination access mask>>. 5834e5c31af7Sopenharmony_ci * pname:srcQueueFamilyIndex is the source queue family for a 5835e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 5836e5c31af7Sopenharmony_ci * pname:dstQueueFamilyIndex is the destination queue family for a 5837e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 5838e5c31af7Sopenharmony_ci * pname:buffer is a handle to the buffer whose backing memory is affected 5839e5c31af7Sopenharmony_ci by the barrier. 5840e5c31af7Sopenharmony_ci * pname:offset is an offset in bytes into the backing memory for 5841e5c31af7Sopenharmony_ci pname:buffer; this is relative to the base offset as bound to the buffer 5842e5c31af7Sopenharmony_ci (see flink:vkBindBufferMemory). 5843e5c31af7Sopenharmony_ci * pname:size is a size in bytes of the affected area of backing memory for 5844e5c31af7Sopenharmony_ci pname:buffer, or ename:VK_WHOLE_SIZE to use the range from pname:offset 5845e5c31af7Sopenharmony_ci to the end of the buffer. 5846e5c31af7Sopenharmony_ci 5847e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> is 5848e5c31af7Sopenharmony_cilimited to access to memory through the specified buffer range, via access 5849e5c31af7Sopenharmony_citypes in the <<synchronization-access-masks, source access mask>> specified 5850e5c31af7Sopenharmony_ciby pname:srcAccessMask. 5851e5c31af7Sopenharmony_ciIf pname:srcAccessMask includes ename:VK_ACCESS_HOST_WRITE_BIT, memory 5852e5c31af7Sopenharmony_ciwrites performed by that access type are also made visible, as that access 5853e5c31af7Sopenharmony_citype is not performed through a resource. 5854e5c31af7Sopenharmony_ci 5855e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 5856e5c31af7Sopenharmony_cilimited to access to memory through the specified buffer range, via access 5857e5c31af7Sopenharmony_citypes in the <<synchronization-access-masks, destination access mask>> 5858e5c31af7Sopenharmony_cispecified by pname:dstAccessMask. 5859e5c31af7Sopenharmony_ciIf pname:dstAccessMask includes ename:VK_ACCESS_HOST_WRITE_BIT or 5860e5c31af7Sopenharmony_ciename:VK_ACCESS_HOST_READ_BIT, available memory writes are also made visible 5861e5c31af7Sopenharmony_cito accesses of those types, as those access types are not performed through 5862e5c31af7Sopenharmony_cia resource. 5863e5c31af7Sopenharmony_ci 5864e5c31af7Sopenharmony_ciIf pname:srcQueueFamilyIndex is not equal to pname:dstQueueFamilyIndex, and 5865e5c31af7Sopenharmony_cipname:srcQueueFamilyIndex is equal to the current queue family, then the 5866e5c31af7Sopenharmony_cimemory barrier defines a <<synchronization-queue-transfers-release, queue 5867e5c31af7Sopenharmony_cifamily release operation>> for the specified buffer range, and the second 5868e5c31af7Sopenharmony_ciaccess scope includes no access, as if pname:dstAccessMask was `0`. 5869e5c31af7Sopenharmony_ci 5870e5c31af7Sopenharmony_ciIf pname:dstQueueFamilyIndex is not equal to pname:srcQueueFamilyIndex, and 5871e5c31af7Sopenharmony_cipname:dstQueueFamilyIndex is equal to the current queue family, then the 5872e5c31af7Sopenharmony_cimemory barrier defines a <<synchronization-queue-transfers-acquire, queue 5873e5c31af7Sopenharmony_cifamily acquire operation>> for the specified buffer range, and the first 5874e5c31af7Sopenharmony_ciaccess scope includes no access, as if pname:srcAccessMask was `0`. 5875e5c31af7Sopenharmony_ci 5876e5c31af7Sopenharmony_ci.Valid Usage 5877e5c31af7Sopenharmony_ci**** 5878e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/buffer_memory_barrier_common.txt[] 5879e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_external_memory[] 5880e5c31af7Sopenharmony_ci * [[VUID-VkBufferMemoryBarrier-synchronization2-03852]] 5881e5c31af7Sopenharmony_ci If the <<features-synchronization2,pname:synchronization2 feature>> is 5882e5c31af7Sopenharmony_ci not enabled, and pname:buffer was created with a sharing mode of 5883e5c31af7Sopenharmony_ci ename:VK_SHARING_MODE_CONCURRENT, pname:srcQueueFamilyIndex and 5884e5c31af7Sopenharmony_ci pname:dstQueueFamilyIndex must: both be ename:VK_QUEUE_FAMILY_IGNORED 5885e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 5886e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 5887e5c31af7Sopenharmony_ci * [[VUID-VkBufferMemoryBarrier-synchronization2-03853]] 5888e5c31af7Sopenharmony_ci If the <<features-synchronization2,pname:synchronization2 feature>> is 5889e5c31af7Sopenharmony_ci not enabled, and pname:buffer was created with a sharing mode of 5890e5c31af7Sopenharmony_ci ename:VK_SHARING_MODE_CONCURRENT, at least one of 5891e5c31af7Sopenharmony_ci pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex must: be 5892e5c31af7Sopenharmony_ci ename:VK_QUEUE_FAMILY_IGNORED 5893e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 5894e5c31af7Sopenharmony_ci**** 5895e5c31af7Sopenharmony_ci 5896e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBufferMemoryBarrier.txt[] 5897e5c31af7Sopenharmony_ci-- 5898e5c31af7Sopenharmony_ci 5899e5c31af7Sopenharmony_ci[open,refpage='VK_WHOLE_SIZE',desc='Sentinel value to use entire remaining array length',type='consts'] 5900e5c31af7Sopenharmony_ci-- 5901e5c31af7Sopenharmony_ciename:VK_WHOLE_SIZE is a special value indicating that the entire remaining 5902e5c31af7Sopenharmony_cilength of a buffer following a given pname:offset should be used. 5903e5c31af7Sopenharmony_ciIt can: be specified for slink:VkBufferMemoryBarrier::pname:size and other 5904e5c31af7Sopenharmony_cistructures. 5905e5c31af7Sopenharmony_ci 5906e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_WHOLE_SIZE.txt[] 5907e5c31af7Sopenharmony_ci-- 5908e5c31af7Sopenharmony_ci 5909e5c31af7Sopenharmony_ci 5910e5c31af7Sopenharmony_ci[[synchronization-image-memory-barriers]] 5911e5c31af7Sopenharmony_ci=== Image Memory Barriers 5912e5c31af7Sopenharmony_ci 5913e5c31af7Sopenharmony_ciImage memory barriers only apply to memory accesses involving a specific 5914e5c31af7Sopenharmony_ciimage subresource range. 5915e5c31af7Sopenharmony_ciThat is, a memory dependency formed from an image memory barrier is 5916e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, scoped>> to access via the 5917e5c31af7Sopenharmony_cispecified image subresource range. 5918e5c31af7Sopenharmony_ciImage memory barriers can: also be used to define 5919e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transitions>> or a 5920e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, queue family ownership transfer>> for the 5921e5c31af7Sopenharmony_cispecified image subresource range. 5922e5c31af7Sopenharmony_ci 5923e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 5924e5c31af7Sopenharmony_ci[open,refpage='VkImageMemoryBarrier2KHR',desc='Structure specifying an image memory barrier',type='structs'] 5925e5c31af7Sopenharmony_ci-- 5926e5c31af7Sopenharmony_ci:refpage: VkImageMemoryBarrier2KHR 5927e5c31af7Sopenharmony_ci 5928e5c31af7Sopenharmony_ciThe sname:VkImageMemoryBarrier2KHR structure is defined as: 5929e5c31af7Sopenharmony_ci 5930e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageMemoryBarrier2KHR.txt[] 5931e5c31af7Sopenharmony_ci 5932e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 5933e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 5934e5c31af7Sopenharmony_ci structure. 5935e5c31af7Sopenharmony_ci * pname:srcStageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 5936e5c31af7Sopenharmony_ci stages to be included in the <<synchronization-dependencies-scopes, 5937e5c31af7Sopenharmony_ci first synchronization scope>>. 5938e5c31af7Sopenharmony_ci * pname:srcAccessMask is a tlink:VkAccessFlags2KHR mask of access flags to 5939e5c31af7Sopenharmony_ci be included in the <<synchronization-dependencies-access-scopes, first 5940e5c31af7Sopenharmony_ci access scope>>. 5941e5c31af7Sopenharmony_ci * pname:dstStageMask is a tlink:VkPipelineStageFlags2KHR mask of pipeline 5942e5c31af7Sopenharmony_ci stages to be included in the <<synchronization-dependencies-scopes, 5943e5c31af7Sopenharmony_ci second synchronization scope>>. 5944e5c31af7Sopenharmony_ci * pname:dstAccessMask is a tlink:VkAccessFlags2KHR mask of access flags to 5945e5c31af7Sopenharmony_ci be included in the <<synchronization-dependencies-access-scopes, second 5946e5c31af7Sopenharmony_ci access scope>>. 5947e5c31af7Sopenharmony_ci * pname:oldLayout is the old layout in an 5948e5c31af7Sopenharmony_ci <<synchronization-image-layout-transitions, image layout transition>>. 5949e5c31af7Sopenharmony_ci * pname:newLayout is the new layout in an 5950e5c31af7Sopenharmony_ci <<synchronization-image-layout-transitions, image layout transition>>. 5951e5c31af7Sopenharmony_ci * pname:srcQueueFamilyIndex is the source queue family for a 5952e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 5953e5c31af7Sopenharmony_ci * pname:dstQueueFamilyIndex is the destination queue family for a 5954e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 5955e5c31af7Sopenharmony_ci * pname:image is a handle to the image affected by this barrier. 5956e5c31af7Sopenharmony_ci * pname:subresourceRange describes the <<resources-image-views, image 5957e5c31af7Sopenharmony_ci subresource range>> within pname:image that is affected by this barrier. 5958e5c31af7Sopenharmony_ci 5959e5c31af7Sopenharmony_ciThis structure defines a <<synchronization-dependencies-memory, memory 5960e5c31af7Sopenharmony_cidependency>> limited to an image subresource range, and can: define a 5961e5c31af7Sopenharmony_ci<<synchronization-queue-transfers, queue family transfer operation>> and 5962e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transition>> for 5963e5c31af7Sopenharmony_cithat subresource range. 5964e5c31af7Sopenharmony_ci 5965e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> and 5966e5c31af7Sopenharmony_ci<<synchronization-dependencies-access-scopes, access scope>> described by 5967e5c31af7Sopenharmony_cithis structure include only operations and memory accesses specified by 5968e5c31af7Sopenharmony_cipname:srcStageMask and pname:srcAccessMask. 5969e5c31af7Sopenharmony_ci 5970e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 5971e5c31af7Sopenharmony_ciand <<synchronization-dependencies-access-scopes, access scope>> described 5972e5c31af7Sopenharmony_ciby this structure include only operations and memory accesses specified by 5973e5c31af7Sopenharmony_cipname:dstStageMask and pname:dstAccessMask. 5974e5c31af7Sopenharmony_ci 5975e5c31af7Sopenharmony_ciBoth <<synchronization-dependencies-access-scopes, access scopes>> are 5976e5c31af7Sopenharmony_cilimited to only memory accesses to pname:image in the subresource range 5977e5c31af7Sopenharmony_cidefined by pname:subresourceRange. 5978e5c31af7Sopenharmony_ci 5979e5c31af7Sopenharmony_ciIf pname:image was created with ename:VK_SHARING_MODE_EXCLUSIVE, and 5980e5c31af7Sopenharmony_cipname:srcQueueFamilyIndex is not equal to pname:dstQueueFamilyIndex, this 5981e5c31af7Sopenharmony_cimemory barrier defines a <<synchronization-queue-transfers, queue family 5982e5c31af7Sopenharmony_citransfer operation>>. 5983e5c31af7Sopenharmony_ciWhen executed on a queue in the family identified by 5984e5c31af7Sopenharmony_cipname:srcQueueFamilyIndex, this barrier defines a 5985e5c31af7Sopenharmony_ci<<synchronization-queue-transfers-release, queue family release operation>> 5986e5c31af7Sopenharmony_cifor the specified image subresource range, and the second synchronization 5987e5c31af7Sopenharmony_ciand access scopes do not synchronize operations on that queue. 5988e5c31af7Sopenharmony_ciWhen executed on a queue in the family identified by 5989e5c31af7Sopenharmony_cipname:dstQueueFamilyIndex, this barrier defines a 5990e5c31af7Sopenharmony_ci<<synchronization-queue-transfers-acquire, queue family acquire operation>> 5991e5c31af7Sopenharmony_cifor the specified image subresource range, and the first synchronization and 5992e5c31af7Sopenharmony_ciaccess scopes do not synchronize operations on that queue. 5993e5c31af7Sopenharmony_ci 5994e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 5995e5c31af7Sopenharmony_ciA <<synchronization-queue-transfers, queue family transfer operation>> is 5996e5c31af7Sopenharmony_cialso defined if the values are not equal, and either is one of the special 5997e5c31af7Sopenharmony_ciqueue family values reserved for external memory ownership transfers, as 5998e5c31af7Sopenharmony_cidescribed in <<synchronization-queue-transfers>>. 5999e5c31af7Sopenharmony_ciA <<synchronization-queue-transfers-release, queue family release 6000e5c31af7Sopenharmony_cioperation>> is defined when pname:dstQueueFamilyIndex is one of those 6001e5c31af7Sopenharmony_civalues, and a <<synchronization-queue-transfers-acquire, queue family 6002e5c31af7Sopenharmony_ciacquire operation>> is defined when pname:srcQueueFamilyIndex is one of 6003e5c31af7Sopenharmony_cithose values. 6004e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 6005e5c31af7Sopenharmony_ci 6006e5c31af7Sopenharmony_ciIf pname:oldLayout is not equal to pname:newLayout, then the memory barrier 6007e5c31af7Sopenharmony_cidefines an <<synchronization-image-layout-transitions, image layout 6008e5c31af7Sopenharmony_citransition>> for the specified image subresource range. 6009e5c31af7Sopenharmony_ciIf this memory barrier defines a <<synchronization-queue-transfers, queue 6010e5c31af7Sopenharmony_cifamily transfer operation>>, the layout transition is only executed once 6011e5c31af7Sopenharmony_cibetween the queues. 6012e5c31af7Sopenharmony_ci 6013e5c31af7Sopenharmony_ci[NOTE] 6014e5c31af7Sopenharmony_ci.Note 6015e5c31af7Sopenharmony_ci==== 6016e5c31af7Sopenharmony_ciWhen the old and new layout are equal, the layout values are ignored - data 6017e5c31af7Sopenharmony_ciis preserved no matter what values are specified, or what layout the image 6018e5c31af7Sopenharmony_ciis currently in. 6019e5c31af7Sopenharmony_ci==== 6020e5c31af7Sopenharmony_ci 6021e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 6022e5c31af7Sopenharmony_ci 6023e5c31af7Sopenharmony_ciIf pname:image has a multi-planar format and the image is _disjoint_, then 6024e5c31af7Sopenharmony_ciincluding ename:VK_IMAGE_ASPECT_COLOR_BIT in the pname:aspectMask member of 6025e5c31af7Sopenharmony_cipname:subresourceRange is equivalent to including 6026e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_0_BIT, ename:VK_IMAGE_ASPECT_PLANE_1_BIT, and 6027e5c31af7Sopenharmony_ci(for three-plane formats only) ename:VK_IMAGE_ASPECT_PLANE_2_BIT. 6028e5c31af7Sopenharmony_ci 6029e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 6030e5c31af7Sopenharmony_ci 6031e5c31af7Sopenharmony_ci.Valid Usage 6032e5c31af7Sopenharmony_ci**** 6033e5c31af7Sopenharmony_ci 6034e5c31af7Sopenharmony_ci:stageMaskName: srcStageMask 6035e5c31af7Sopenharmony_ci:accessMaskName: srcAccessMask 6036e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 6037e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/access_mask_2_common.txt[] 6038e5c31af7Sopenharmony_ci 6039e5c31af7Sopenharmony_ci:stageMaskName: dstStageMask 6040e5c31af7Sopenharmony_ci:accessMaskName: dstAccessMask 6041e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/stage_mask_2_common.txt[] 6042e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/access_mask_2_common.txt[] 6043e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_memory_barrier_common.txt[] 6044e5c31af7Sopenharmony_ci * [[VUID-VkImageMemoryBarrier2KHR-srcStageMask-03854]] 6045e5c31af7Sopenharmony_ci If either pname:srcStageMask or pname:dstStageMask includes 6046e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR, pname:srcQueueFamilyIndex and 6047e5c31af7Sopenharmony_ci pname:dstQueueFamilyIndex must: be equal 6048e5c31af7Sopenharmony_ci * [[VUID-VkImageMemoryBarrier2KHR-srcStageMask-03855]] 6049e5c31af7Sopenharmony_ci If pname:srcStageMask includes ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR, 6050e5c31af7Sopenharmony_ci and pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a 6051e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>> or 6052e5c31af7Sopenharmony_ci pname:oldLayout and pname:newLayout define an 6053e5c31af7Sopenharmony_ci <<synchronization-image-layout-transitions, image layout transition>>, 6054e5c31af7Sopenharmony_ci pname:oldLayout must: be one of ename:VK_IMAGE_LAYOUT_PREINITIALIZED, 6055e5c31af7Sopenharmony_ci ename:VK_IMAGE_LAYOUT_UNDEFINED, or ename:VK_IMAGE_LAYOUT_GENERAL 6056e5c31af7Sopenharmony_ci**** 6057e5c31af7Sopenharmony_ci 6058e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageMemoryBarrier2KHR.txt[] 6059e5c31af7Sopenharmony_ci-- 6060e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 6061e5c31af7Sopenharmony_ci 6062e5c31af7Sopenharmony_ci[open,refpage='VkImageMemoryBarrier',desc='Structure specifying the parameters of an image memory barrier',type='structs'] 6063e5c31af7Sopenharmony_ci-- 6064e5c31af7Sopenharmony_ci:refpage: VkImageMemoryBarrier 6065e5c31af7Sopenharmony_ci 6066e5c31af7Sopenharmony_ciThe sname:VkImageMemoryBarrier structure is defined as: 6067e5c31af7Sopenharmony_ci 6068e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageMemoryBarrier.txt[] 6069e5c31af7Sopenharmony_ci 6070e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 6071e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 6072e5c31af7Sopenharmony_ci structure. 6073e5c31af7Sopenharmony_ci * pname:srcAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 6074e5c31af7Sopenharmony_ci <<synchronization-access-masks, source access mask>>. 6075e5c31af7Sopenharmony_ci * pname:dstAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 6076e5c31af7Sopenharmony_ci <<synchronization-access-masks, destination access mask>>. 6077e5c31af7Sopenharmony_ci * pname:oldLayout is the old layout in an 6078e5c31af7Sopenharmony_ci <<synchronization-image-layout-transitions, image layout transition>>. 6079e5c31af7Sopenharmony_ci * pname:newLayout is the new layout in an 6080e5c31af7Sopenharmony_ci <<synchronization-image-layout-transitions, image layout transition>>. 6081e5c31af7Sopenharmony_ci * pname:srcQueueFamilyIndex is the source queue family for a 6082e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 6083e5c31af7Sopenharmony_ci * pname:dstQueueFamilyIndex is the destination queue family for a 6084e5c31af7Sopenharmony_ci <<synchronization-queue-transfers, queue family ownership transfer>>. 6085e5c31af7Sopenharmony_ci * pname:image is a handle to the image affected by this barrier. 6086e5c31af7Sopenharmony_ci * pname:subresourceRange describes the <<resources-image-views, image 6087e5c31af7Sopenharmony_ci subresource range>> within pname:image that is affected by this barrier. 6088e5c31af7Sopenharmony_ci 6089e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> is 6090e5c31af7Sopenharmony_cilimited to access to memory through the specified image subresource range, 6091e5c31af7Sopenharmony_civia access types in the <<synchronization-access-masks, source access mask>> 6092e5c31af7Sopenharmony_cispecified by pname:srcAccessMask. 6093e5c31af7Sopenharmony_ciIf pname:srcAccessMask includes ename:VK_ACCESS_HOST_WRITE_BIT, memory 6094e5c31af7Sopenharmony_ciwrites performed by that access type are also made visible, as that access 6095e5c31af7Sopenharmony_citype is not performed through a resource. 6096e5c31af7Sopenharmony_ci 6097e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> is 6098e5c31af7Sopenharmony_cilimited to access to memory through the specified image subresource range, 6099e5c31af7Sopenharmony_civia access types in the <<synchronization-access-masks, destination access 6100e5c31af7Sopenharmony_cimask>> specified by pname:dstAccessMask. 6101e5c31af7Sopenharmony_ciIf pname:dstAccessMask includes ename:VK_ACCESS_HOST_WRITE_BIT or 6102e5c31af7Sopenharmony_ciename:VK_ACCESS_HOST_READ_BIT, available memory writes are also made visible 6103e5c31af7Sopenharmony_cito accesses of those types, as those access types are not performed through 6104e5c31af7Sopenharmony_cia resource. 6105e5c31af7Sopenharmony_ci 6106e5c31af7Sopenharmony_ciIf pname:srcQueueFamilyIndex is not equal to pname:dstQueueFamilyIndex, and 6107e5c31af7Sopenharmony_cipname:srcQueueFamilyIndex is equal to the current queue family, then the 6108e5c31af7Sopenharmony_cimemory barrier defines a <<synchronization-queue-transfers-release, queue 6109e5c31af7Sopenharmony_cifamily release operation>> for the specified image subresource range, and 6110e5c31af7Sopenharmony_cithe second access scope includes no access, as if pname:dstAccessMask was 6111e5c31af7Sopenharmony_ci`0`. 6112e5c31af7Sopenharmony_ci 6113e5c31af7Sopenharmony_ciIf pname:dstQueueFamilyIndex is not equal to pname:srcQueueFamilyIndex, and 6114e5c31af7Sopenharmony_cipname:dstQueueFamilyIndex is equal to the current queue family, then the 6115e5c31af7Sopenharmony_cimemory barrier defines a <<synchronization-queue-transfers-acquire, queue 6116e5c31af7Sopenharmony_cifamily acquire operation>> for the specified image subresource range, and 6117e5c31af7Sopenharmony_cithe first access scope includes no access, as if pname:srcAccessMask was 6118e5c31af7Sopenharmony_ci`0`. 6119e5c31af7Sopenharmony_ci 6120e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 6121e5c31af7Sopenharmony_ciIf the <<features-synchronization2,pname:synchronization2 feature>> is not 6122e5c31af7Sopenharmony_cienabled or pname:oldLayout is not equal to pname:newLayout, 6123e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 6124e5c31af7Sopenharmony_cipname:oldLayout and pname:newLayout define an 6125e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transition>> for 6126e5c31af7Sopenharmony_cithe specified image subresource range. 6127e5c31af7Sopenharmony_ci 6128e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 6129e5c31af7Sopenharmony_ci[NOTE] 6130e5c31af7Sopenharmony_ci.Note 6131e5c31af7Sopenharmony_ci==== 6132e5c31af7Sopenharmony_ciIf the <<features-synchronization2,pname:synchronization2 feature>> is 6133e5c31af7Sopenharmony_cienabled, when the old and new layout are equal, the layout values are 6134e5c31af7Sopenharmony_ciignored - data is preserved no matter what values are specified, or what 6135e5c31af7Sopenharmony_cilayout the image is currently in. 6136e5c31af7Sopenharmony_ci==== 6137e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 6138e5c31af7Sopenharmony_ci 6139e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 6140e5c31af7Sopenharmony_ci 6141e5c31af7Sopenharmony_ciIf pname:image has a multi-planar format and the image is _disjoint_, then 6142e5c31af7Sopenharmony_ciincluding ename:VK_IMAGE_ASPECT_COLOR_BIT in the pname:aspectMask member of 6143e5c31af7Sopenharmony_cipname:subresourceRange is equivalent to including 6144e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_0_BIT, ename:VK_IMAGE_ASPECT_PLANE_1_BIT, and 6145e5c31af7Sopenharmony_ci(for three-plane formats only) ename:VK_IMAGE_ASPECT_PLANE_2_BIT. 6146e5c31af7Sopenharmony_ci 6147e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 6148e5c31af7Sopenharmony_ci 6149e5c31af7Sopenharmony_ci.Valid Usage 6150e5c31af7Sopenharmony_ci**** 6151e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_memory_barrier_common.txt[] 6152e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_external_memory[] 6153e5c31af7Sopenharmony_ci * [[VUID-VkImageMemoryBarrier-synchronization2-03856]] 6154e5c31af7Sopenharmony_ci If the <<features-synchronization2,pname:synchronization2 feature>> is 6155e5c31af7Sopenharmony_ci not enabled, and pname:image was created with a sharing mode of 6156e5c31af7Sopenharmony_ci ename:VK_SHARING_MODE_CONCURRENT, pname:srcQueueFamilyIndex and 6157e5c31af7Sopenharmony_ci pname:dstQueueFamilyIndex must: both be ename:VK_QUEUE_FAMILY_IGNORED 6158e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 6159e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 6160e5c31af7Sopenharmony_ci * [[VUID-VkImageMemoryBarrier-synchronization2-03857]] 6161e5c31af7Sopenharmony_ci If the <<features-synchronization2,pname:synchronization2 feature>> is 6162e5c31af7Sopenharmony_ci not enabled, and pname:image was created with a sharing mode of 6163e5c31af7Sopenharmony_ci ename:VK_SHARING_MODE_CONCURRENT, at least one of 6164e5c31af7Sopenharmony_ci pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex must: be 6165e5c31af7Sopenharmony_ci ename:VK_QUEUE_FAMILY_IGNORED 6166e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 6167e5c31af7Sopenharmony_ci**** 6168e5c31af7Sopenharmony_ci 6169e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageMemoryBarrier.txt[] 6170e5c31af7Sopenharmony_ci-- 6171e5c31af7Sopenharmony_ci 6172e5c31af7Sopenharmony_ci 6173e5c31af7Sopenharmony_ci[[synchronization-queue-transfers]] 6174e5c31af7Sopenharmony_ci=== Queue Family Ownership Transfer 6175e5c31af7Sopenharmony_ci 6176e5c31af7Sopenharmony_ciResources created with a elink:VkSharingMode of 6177e5c31af7Sopenharmony_ciename:VK_SHARING_MODE_EXCLUSIVE must: have their ownership explicitly 6178e5c31af7Sopenharmony_citransferred from one queue family to another in order to access their 6179e5c31af7Sopenharmony_cicontent in a well-defined manner on a queue in a different queue family. 6180e5c31af7Sopenharmony_ci 6181e5c31af7Sopenharmony_ci[open,refpage='VK_QUEUE_FAMILY_IGNORED',desc='Ignored queue family index sentinel',type='consts'] 6182e5c31af7Sopenharmony_ci-- 6183e5c31af7Sopenharmony_ciThe special queue family index ename:VK_QUEUE_FAMILY_IGNORED indicates that 6184e5c31af7Sopenharmony_cia queue family parameter or member is ignored. 6185e5c31af7Sopenharmony_ci 6186e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_QUEUE_FAMILY_IGNORED.txt[] 6187e5c31af7Sopenharmony_ci-- 6188e5c31af7Sopenharmony_ci 6189e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_external_memory[] 6190e5c31af7Sopenharmony_ciResources shared with external APIs or instances using external memory must: 6191e5c31af7Sopenharmony_cialso explicitly manage ownership transfers between local and external queues 6192e5c31af7Sopenharmony_ci(or equivalent constructs in external APIs) regardless of the 6193e5c31af7Sopenharmony_cielink:VkSharingMode specified when creating them. 6194e5c31af7Sopenharmony_ci 6195e5c31af7Sopenharmony_ci[open,refpage='VK_QUEUE_FAMILY_EXTERNAL',desc='External queue family index sentinel',type='consts',alias='VK_QUEUE_FAMILY_EXTERNAL_KHR'] 6196e5c31af7Sopenharmony_ci-- 6197e5c31af7Sopenharmony_ciThe special queue family index ename:VK_QUEUE_FAMILY_EXTERNAL represents any 6198e5c31af7Sopenharmony_ciqueue external to the resource's current Vulkan instance, as long as the 6199e5c31af7Sopenharmony_ciqueue uses the same underlying 6200e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[device group or] 6201e5c31af7Sopenharmony_ciphysical device, and the same driver version as the resource's 6202e5c31af7Sopenharmony_cislink:VkDevice, as indicated by 6203e5c31af7Sopenharmony_cislink:VkPhysicalDeviceIDProperties::pname:deviceUUID and 6204e5c31af7Sopenharmony_cislink:VkPhysicalDeviceIDProperties::pname:driverUUID. 6205e5c31af7Sopenharmony_ci 6206e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_QUEUE_FAMILY_EXTERNAL.txt[] 6207e5c31af7Sopenharmony_ci 6208e5c31af7Sopenharmony_ciifdef::VK_KHR_external_memory[] 6209e5c31af7Sopenharmony_cior the equivalent 6210e5c31af7Sopenharmony_ci 6211e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_QUEUE_FAMILY_EXTERNAL_KHR.txt[] 6212e5c31af7Sopenharmony_ciendif::VK_KHR_external_memory[] 6213e5c31af7Sopenharmony_ci-- 6214e5c31af7Sopenharmony_ci 6215e5c31af7Sopenharmony_ciifdef::VK_EXT_queue_family_foreign[] 6216e5c31af7Sopenharmony_ci[open,refpage='VK_QUEUE_FAMILY_FOREIGN_EXT',desc='Foreign queue family index sentinel',type='consts'] 6217e5c31af7Sopenharmony_ci-- 6218e5c31af7Sopenharmony_ciThe special queue family index ename:VK_QUEUE_FAMILY_FOREIGN_EXT represents 6219e5c31af7Sopenharmony_ciany queue external to the resource's current Vulkan instance, regardless of 6220e5c31af7Sopenharmony_cithe queue's underlying physical device or driver version. 6221e5c31af7Sopenharmony_ciThis includes, for example, queues for fixed-function image processing 6222e5c31af7Sopenharmony_cidevices, media codec devices, and display devices, as well as all queues 6223e5c31af7Sopenharmony_cithat use the same underlying 6224e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[device group or] 6225e5c31af7Sopenharmony_ciphysical device, and the same driver version as the resource's 6226e5c31af7Sopenharmony_cislink:VkDevice. 6227e5c31af7Sopenharmony_ci 6228e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VK_QUEUE_FAMILY_FOREIGN_EXT.txt[] 6229e5c31af7Sopenharmony_ci-- 6230e5c31af7Sopenharmony_ciendif::VK_EXT_queue_family_foreign[] 6231e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_external_memory[] 6232e5c31af7Sopenharmony_ci 6233e5c31af7Sopenharmony_ciIf memory dependencies are correctly expressed between uses of such a 6234e5c31af7Sopenharmony_ciresource between two queues in different families, but no ownership transfer 6235e5c31af7Sopenharmony_ciis defined, the contents of that resource are undefined: for any read 6236e5c31af7Sopenharmony_ciaccesses performed by the second queue family. 6237e5c31af7Sopenharmony_ci 6238e5c31af7Sopenharmony_ci[NOTE] 6239e5c31af7Sopenharmony_ci.Note 6240e5c31af7Sopenharmony_ci==== 6241e5c31af7Sopenharmony_ciIf an application does not need the contents of a resource to remain valid 6242e5c31af7Sopenharmony_ciwhen transferring from one queue family to another, then the ownership 6243e5c31af7Sopenharmony_citransfer should: be skipped. 6244e5c31af7Sopenharmony_ci==== 6245e5c31af7Sopenharmony_ci 6246e5c31af7Sopenharmony_ciifdef::VK_EXT_queue_family_foreign[] 6247e5c31af7Sopenharmony_ci[NOTE] 6248e5c31af7Sopenharmony_ci.Note 6249e5c31af7Sopenharmony_ci==== 6250e5c31af7Sopenharmony_ciApplications should expect transfers to/from 6251e5c31af7Sopenharmony_ciename:VK_QUEUE_FAMILY_FOREIGN_EXT to be more expensive than transfers 6252e5c31af7Sopenharmony_cito/from ename:VK_QUEUE_FAMILY_EXTERNAL_KHR. 6253e5c31af7Sopenharmony_ci==== 6254e5c31af7Sopenharmony_ciendif::VK_EXT_queue_family_foreign[] 6255e5c31af7Sopenharmony_ci 6256e5c31af7Sopenharmony_ciA queue family ownership transfer consists of two distinct parts: 6257e5c31af7Sopenharmony_ci 6258e5c31af7Sopenharmony_ci . Release exclusive ownership from the source queue family 6259e5c31af7Sopenharmony_ci . Acquire exclusive ownership for the destination queue family 6260e5c31af7Sopenharmony_ci 6261e5c31af7Sopenharmony_ciAn application must: ensure that these operations occur in the correct order 6262e5c31af7Sopenharmony_ciby defining an execution dependency between them, e.g. using a semaphore. 6263e5c31af7Sopenharmony_ci 6264e5c31af7Sopenharmony_ci[[synchronization-queue-transfers-release]] A _release operation_ is used to 6265e5c31af7Sopenharmony_cirelease exclusive ownership of a range of a buffer or image subresource 6266e5c31af7Sopenharmony_cirange. 6267e5c31af7Sopenharmony_ciA release operation is defined by executing a 6268e5c31af7Sopenharmony_ci<<synchronization-buffer-memory-barriers, buffer memory barrier>> (for a 6269e5c31af7Sopenharmony_cibuffer range) or an <<synchronization-image-memory-barriers, image memory 6270e5c31af7Sopenharmony_cibarrier>> (for an image subresource range) using a pipeline barrier command, 6271e5c31af7Sopenharmony_cion a queue from the source queue family. 6272e5c31af7Sopenharmony_ciThe pname:srcQueueFamilyIndex parameter of the barrier must: be set to the 6273e5c31af7Sopenharmony_cisource queue family index, and the pname:dstQueueFamilyIndex parameter to 6274e5c31af7Sopenharmony_cithe destination queue family index. 6275e5c31af7Sopenharmony_cipname:dstAccessMask is ignored for such a barrier, such that no visibility 6276e5c31af7Sopenharmony_cioperation is executed - the value of this mask does not affect the validity 6277e5c31af7Sopenharmony_ciof the barrier. 6278e5c31af7Sopenharmony_ciThe release operation happens-after the availability operation, and 6279e5c31af7Sopenharmony_cihappens-before operations specified in the second synchronization scope of 6280e5c31af7Sopenharmony_cithe calling command. 6281e5c31af7Sopenharmony_ci 6282e5c31af7Sopenharmony_ci[[synchronization-queue-transfers-acquire]] An _acquire operation_ is used 6283e5c31af7Sopenharmony_cito acquire exclusive ownership of a range of a buffer or image subresource 6284e5c31af7Sopenharmony_cirange. 6285e5c31af7Sopenharmony_ciAn acquire operation is defined by executing a 6286e5c31af7Sopenharmony_ci<<synchronization-buffer-memory-barriers, buffer memory barrier>> (for a 6287e5c31af7Sopenharmony_cibuffer range) or an <<synchronization-image-memory-barriers, image memory 6288e5c31af7Sopenharmony_cibarrier>> (for an image subresource range) using a pipeline barrier command, 6289e5c31af7Sopenharmony_cion a queue from the destination queue family. 6290e5c31af7Sopenharmony_ciThe buffer range or image subresource range specified in an acquire 6291e5c31af7Sopenharmony_cioperation must: match exactly that of a previous release operation. 6292e5c31af7Sopenharmony_ciThe pname:srcQueueFamilyIndex parameter of the barrier must: be set to the 6293e5c31af7Sopenharmony_cisource queue family index, and the pname:dstQueueFamilyIndex parameter to 6294e5c31af7Sopenharmony_cithe destination queue family index. 6295e5c31af7Sopenharmony_cipname:srcAccessMask is ignored for such a barrier, such that no availability 6296e5c31af7Sopenharmony_cioperation is executed - the value of this mask does not affect the validity 6297e5c31af7Sopenharmony_ciof the barrier. 6298e5c31af7Sopenharmony_ciThe acquire operation happens-after operations in the first synchronization 6299e5c31af7Sopenharmony_ciscope of the calling command, and happens-before the visibility operation. 6300e5c31af7Sopenharmony_ci 6301e5c31af7Sopenharmony_ci[NOTE] 6302e5c31af7Sopenharmony_ci.Note 6303e5c31af7Sopenharmony_ci==== 6304e5c31af7Sopenharmony_ciWhilst it is not invalid to provide destination or source access masks for 6305e5c31af7Sopenharmony_cimemory barriers used for release or acquire operations, respectively, they 6306e5c31af7Sopenharmony_cihave no practical effect. 6307e5c31af7Sopenharmony_ciAccess after a release operation has undefined: results, and so visibility 6308e5c31af7Sopenharmony_cifor those accesses has no practical effect. 6309e5c31af7Sopenharmony_ciSimilarly, write access before an acquire operation will produce undefined: 6310e5c31af7Sopenharmony_ciresults for future access, so availability of those writes has no practical 6311e5c31af7Sopenharmony_ciuse. 6312e5c31af7Sopenharmony_ciIn an earlier version of the specification, these were required to match on 6313e5c31af7Sopenharmony_ciboth sides - but this was subsequently relaxed. 6314e5c31af7Sopenharmony_ciThese masks should: be set to 0. 6315e5c31af7Sopenharmony_ci==== 6316e5c31af7Sopenharmony_ci 6317e5c31af7Sopenharmony_ciIf the transfer is via an image memory barrier, and an 6318e5c31af7Sopenharmony_ci<<synchronization-image-layout-transitions, image layout transition>> is 6319e5c31af7Sopenharmony_cidesired, then the values of pname:oldLayout and pname:newLayout in the 6320e5c31af7Sopenharmony_ci_release operation_'s memory barrier must: be equal to values of 6321e5c31af7Sopenharmony_cipname:oldLayout and pname:newLayout in the _acquire operation_'s memory 6322e5c31af7Sopenharmony_cibarrier. 6323e5c31af7Sopenharmony_ciAlthough the image layout transition is submitted twice, it will only be 6324e5c31af7Sopenharmony_ciexecuted once. 6325e5c31af7Sopenharmony_ciA layout transition specified in this way happens-after the _release 6326e5c31af7Sopenharmony_cioperation_ and happens-before the _acquire operation_. 6327e5c31af7Sopenharmony_ci 6328e5c31af7Sopenharmony_ciIf the values of pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex are 6329e5c31af7Sopenharmony_ciequal, no ownership transfer is performed, and the barrier operates as if 6330e5c31af7Sopenharmony_cithey were both set to ename:VK_QUEUE_FAMILY_IGNORED. 6331e5c31af7Sopenharmony_ci 6332e5c31af7Sopenharmony_ciQueue family ownership transfers may: perform read and write accesses on all 6333e5c31af7Sopenharmony_cimemory bound to the image subresource or buffer range, so applications must: 6334e5c31af7Sopenharmony_ciensure that all memory writes have been made 6335e5c31af7Sopenharmony_ci<<synchronization-dependencies-available-and-visible, available>> before a 6336e5c31af7Sopenharmony_ciqueue family ownership transfer is executed. 6337e5c31af7Sopenharmony_ciAvailable memory is automatically made visible to queue family release and 6338e5c31af7Sopenharmony_ciacquire operations, and writes performed by those operations are 6339e5c31af7Sopenharmony_ciautomatically made available. 6340e5c31af7Sopenharmony_ci 6341e5c31af7Sopenharmony_ciOnce a queue family has acquired ownership of a buffer range or image 6342e5c31af7Sopenharmony_cisubresource range of a ename:VK_SHARING_MODE_EXCLUSIVE resource, its 6343e5c31af7Sopenharmony_cicontents are undefined: to other queue families unless ownership is 6344e5c31af7Sopenharmony_citransferred. 6345e5c31af7Sopenharmony_ciThe contents of any portion of another resource which aliases memory that is 6346e5c31af7Sopenharmony_cibound to the transferred buffer or image subresource range are undefined: 6347e5c31af7Sopenharmony_ciafter a release or acquire operation. 6348e5c31af7Sopenharmony_ci 6349e5c31af7Sopenharmony_ci[NOTE] 6350e5c31af7Sopenharmony_ci.Note 6351e5c31af7Sopenharmony_ci==== 6352e5c31af7Sopenharmony_ciBecause <<synchronization-events, events>> cannot: be used directly for 6353e5c31af7Sopenharmony_ciinter-queue synchronization, and because flink:vkCmdSetEvent does not have 6354e5c31af7Sopenharmony_cithe queue family index or memory barrier parameters needed by a _release 6355e5c31af7Sopenharmony_cioperation_, the release and acquire operations of a queue family ownership 6356e5c31af7Sopenharmony_citransfer can: only be performed using flink:vkCmdPipelineBarrier. 6357e5c31af7Sopenharmony_ci==== 6358e5c31af7Sopenharmony_ci 6359e5c31af7Sopenharmony_ci 6360e5c31af7Sopenharmony_ci[[synchronization-wait-idle]] 6361e5c31af7Sopenharmony_ci== Wait Idle Operations 6362e5c31af7Sopenharmony_ci 6363e5c31af7Sopenharmony_ci[open,refpage='vkQueueWaitIdle',desc='Wait for a queue to become idle',type='protos'] 6364e5c31af7Sopenharmony_ci-- 6365e5c31af7Sopenharmony_ciTo wait on the host for the completion of outstanding queue operations for a 6366e5c31af7Sopenharmony_cigiven queue, call: 6367e5c31af7Sopenharmony_ci 6368e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkQueueWaitIdle.txt[] 6369e5c31af7Sopenharmony_ci 6370e5c31af7Sopenharmony_ci * pname:queue is the queue on which to wait. 6371e5c31af7Sopenharmony_ci 6372e5c31af7Sopenharmony_cifname:vkQueueWaitIdle is equivalent to having submitted a valid fence to 6373e5c31af7Sopenharmony_cievery previously executed <<devsandqueues-submission,queue submission 6374e5c31af7Sopenharmony_cicommand>> that accepts a fence, then waiting for all of those fences to 6375e5c31af7Sopenharmony_cisignal using flink:vkWaitForFences with an infinite timeout and 6376e5c31af7Sopenharmony_cipname:waitAll set to ename:VK_TRUE. 6377e5c31af7Sopenharmony_ci 6378e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkQueueWaitIdle.txt[] 6379e5c31af7Sopenharmony_ci-- 6380e5c31af7Sopenharmony_ci 6381e5c31af7Sopenharmony_ci[open,refpage='vkDeviceWaitIdle',desc='Wait for a device to become idle',type='protos'] 6382e5c31af7Sopenharmony_ci-- 6383e5c31af7Sopenharmony_ciTo wait on the host for the completion of outstanding queue operations for 6384e5c31af7Sopenharmony_ciall queues on a given logical device, call: 6385e5c31af7Sopenharmony_ci 6386e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkDeviceWaitIdle.txt[] 6387e5c31af7Sopenharmony_ci 6388e5c31af7Sopenharmony_ci * pname:device is the logical device to idle. 6389e5c31af7Sopenharmony_ci 6390e5c31af7Sopenharmony_cifname:vkDeviceWaitIdle is equivalent to calling fname:vkQueueWaitIdle for 6391e5c31af7Sopenharmony_ciall queues owned by pname:device. 6392e5c31af7Sopenharmony_ci 6393e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkDeviceWaitIdle.txt[] 6394e5c31af7Sopenharmony_ci-- 6395e5c31af7Sopenharmony_ci 6396e5c31af7Sopenharmony_ci 6397e5c31af7Sopenharmony_ci[[synchronization-submission-host-writes]] 6398e5c31af7Sopenharmony_ci== Host Write Ordering Guarantees 6399e5c31af7Sopenharmony_ci 6400e5c31af7Sopenharmony_ciWhen batches of command buffers are submitted to a queue via a 6401e5c31af7Sopenharmony_ci<<devsandqueues-submission, queue submission command>>, it defines a memory 6402e5c31af7Sopenharmony_cidependency with prior host operations, and execution of command buffers 6403e5c31af7Sopenharmony_cisubmitted to the queue. 6404e5c31af7Sopenharmony_ci 6405e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-scopes, synchronization scope>> is 6406e5c31af7Sopenharmony_cidefined by the host execution model, but includes execution of 6407e5c31af7Sopenharmony_ciflink:vkQueueSubmit on the host and anything that happened-before it. 6408e5c31af7Sopenharmony_ci 6409e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-scopes, synchronization scope>> 6410e5c31af7Sopenharmony_ciincludes all commands submitted in the same <<devsandqueues-submission, 6411e5c31af7Sopenharmony_ciqueue submission>>, and all commands that occur later in 6412e5c31af7Sopenharmony_ci<<synchronization-submission-order,submission order>>. 6413e5c31af7Sopenharmony_ci 6414e5c31af7Sopenharmony_ciThe first <<synchronization-dependencies-access-scopes, access scope>> 6415e5c31af7Sopenharmony_ciincludes all host writes to mappable device memory that are available to the 6416e5c31af7Sopenharmony_cihost memory domain. 6417e5c31af7Sopenharmony_ci 6418e5c31af7Sopenharmony_ciThe second <<synchronization-dependencies-access-scopes, access scope>> 6419e5c31af7Sopenharmony_ciincludes all memory access performed by the device. 6420e5c31af7Sopenharmony_ci 6421e5c31af7Sopenharmony_ci 6422e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6423e5c31af7Sopenharmony_ci[[synchronization-device-group]] 6424e5c31af7Sopenharmony_ci== Synchronization and Multiple Physical Devices 6425e5c31af7Sopenharmony_ci 6426e5c31af7Sopenharmony_ciIf a logical device includes more than one physical device, then fences, 6427e5c31af7Sopenharmony_cisemaphores, and events all still have a single instance of the signaled 6428e5c31af7Sopenharmony_cistate. 6429e5c31af7Sopenharmony_ci 6430e5c31af7Sopenharmony_ciA fence becomes signaled when all physical devices complete the necessary 6431e5c31af7Sopenharmony_ciqueue operations. 6432e5c31af7Sopenharmony_ci 6433e5c31af7Sopenharmony_ciSemaphore wait and signal operations all include a device index that is the 6434e5c31af7Sopenharmony_cisole physical device that performs the operation. 6435e5c31af7Sopenharmony_ciThese indices are provided in the slink:VkDeviceGroupSubmitInfo and 6436e5c31af7Sopenharmony_cislink:VkDeviceGroupBindSparseInfo structures. 6437e5c31af7Sopenharmony_ciSemaphores are not exclusively owned by any physical device. 6438e5c31af7Sopenharmony_ciFor example, a semaphore can be signaled by one physical device and then 6439e5c31af7Sopenharmony_ciwaited on by a different physical device. 6440e5c31af7Sopenharmony_ci 6441e5c31af7Sopenharmony_ciAn event can: only be waited on by the same physical device that signaled it 6442e5c31af7Sopenharmony_ci(or the host). 6443e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 6444e5c31af7Sopenharmony_ci 6445e5c31af7Sopenharmony_ci 6446e5c31af7Sopenharmony_ciifdef::VK_EXT_calibrated_timestamps[] 6447e5c31af7Sopenharmony_ci[[calibrated-timestamps]] 6448e5c31af7Sopenharmony_ci== Calibrated timestamps 6449e5c31af7Sopenharmony_ci 6450e5c31af7Sopenharmony_ci[open,refpage='vkGetCalibratedTimestampsEXT',desc='Query calibrated timestamps',type='protos'] 6451e5c31af7Sopenharmony_ci-- 6452e5c31af7Sopenharmony_ciIn order to be able to correlate the time a particular operation took place 6453e5c31af7Sopenharmony_ciat on timelines of different time domains (e.g. a device operation vs a host 6454e5c31af7Sopenharmony_cioperation), Vulkan allows querying calibrated timestamps from multiple time 6455e5c31af7Sopenharmony_cidomains. 6456e5c31af7Sopenharmony_ci 6457e5c31af7Sopenharmony_ciTo query calibrated timestamps from a set of time domains, call: 6458e5c31af7Sopenharmony_ci 6459e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetCalibratedTimestampsEXT.txt[] 6460e5c31af7Sopenharmony_ci 6461e5c31af7Sopenharmony_ci * pname:device is the logical device used to perform the query. 6462e5c31af7Sopenharmony_ci * pname:timestampCount is the number of timestamps to query. 6463e5c31af7Sopenharmony_ci * pname:pTimestampInfos is a pointer to an array of pname:timestampCount 6464e5c31af7Sopenharmony_ci slink:VkCalibratedTimestampInfoEXT structures, describing the time 6465e5c31af7Sopenharmony_ci domains the calibrated timestamps should be captured from. 6466e5c31af7Sopenharmony_ci * pname:pTimestamps is a pointer to an array of pname:timestampCount 6467e5c31af7Sopenharmony_ci 64-bit unsigned integer values in which the requested calibrated 6468e5c31af7Sopenharmony_ci timestamp values are returned. 6469e5c31af7Sopenharmony_ci * pname:pMaxDeviation is a pointer to a 64-bit unsigned integer value in 6470e5c31af7Sopenharmony_ci which the strictly positive maximum deviation, in nanoseconds, of the 6471e5c31af7Sopenharmony_ci calibrated timestamp values is returned. 6472e5c31af7Sopenharmony_ci 6473e5c31af7Sopenharmony_ci[NOTE] 6474e5c31af7Sopenharmony_ci.Note 6475e5c31af7Sopenharmony_ci==== 6476e5c31af7Sopenharmony_ciThe maximum deviation may: vary between calls to 6477e5c31af7Sopenharmony_cifname:vkGetCalibratedTimestampsEXT even for the same set of time domains due 6478e5c31af7Sopenharmony_cito implementation and platform specific reasons. 6479e5c31af7Sopenharmony_ciIt is the application's responsibility to assess whether the returned 6480e5c31af7Sopenharmony_cimaximum deviation makes the timestamp values suitable for any particular 6481e5c31af7Sopenharmony_cipurpose and can: choose to re-issue the timestamp calibration call pursuing 6482e5c31af7Sopenharmony_cia lower devation value. 6483e5c31af7Sopenharmony_ci==== 6484e5c31af7Sopenharmony_ci 6485e5c31af7Sopenharmony_ciCalibrated timestamp values can: be extrapolated to estimate future 6486e5c31af7Sopenharmony_cicoinciding timestamp values, however, depending on the nature of the time 6487e5c31af7Sopenharmony_cidomains and other properties of the platform extrapolating values over a 6488e5c31af7Sopenharmony_cisufficiently long period of time may: no longer be accurate enough to fit 6489e5c31af7Sopenharmony_ciany particular purpose, so applications are expected to re-calibrate the 6490e5c31af7Sopenharmony_citimestamps on a regular basis. 6491e5c31af7Sopenharmony_ci 6492e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetCalibratedTimestampsEXT.txt[] 6493e5c31af7Sopenharmony_ci-- 6494e5c31af7Sopenharmony_ci 6495e5c31af7Sopenharmony_ci[open,refpage='VkCalibratedTimestampInfoEXT',desc='Structure specifying the input parameters of a calibrated timestamp query',type='structs'] 6496e5c31af7Sopenharmony_ci-- 6497e5c31af7Sopenharmony_ciThe sname:VkCalibratedTimestampInfoEXT structure is defined as: 6498e5c31af7Sopenharmony_ci 6499e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCalibratedTimestampInfoEXT.txt[] 6500e5c31af7Sopenharmony_ci 6501e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 6502e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 6503e5c31af7Sopenharmony_ci structure. 6504e5c31af7Sopenharmony_ci * pname:timeDomain is a elink:VkTimeDomainEXT value specifying the time 6505e5c31af7Sopenharmony_ci domain from which the calibrated timestamp value should be returned. 6506e5c31af7Sopenharmony_ci 6507e5c31af7Sopenharmony_ci.Valid Usage 6508e5c31af7Sopenharmony_ci**** 6509e5c31af7Sopenharmony_ci * [[VUID-VkCalibratedTimestampInfoEXT-timeDomain-02354]] 6510e5c31af7Sopenharmony_ci pname:timeDomain must: be one of the elink:VkTimeDomainEXT values 6511e5c31af7Sopenharmony_ci returned by flink:vkGetPhysicalDeviceCalibrateableTimeDomainsEXT 6512e5c31af7Sopenharmony_ci**** 6513e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCalibratedTimestampInfoEXT.txt[] 6514e5c31af7Sopenharmony_ci-- 6515e5c31af7Sopenharmony_ci 6516e5c31af7Sopenharmony_ci[open,refpage='VkTimeDomainEXT',desc='Supported time domains',type='enums'] 6517e5c31af7Sopenharmony_ci-- 6518e5c31af7Sopenharmony_ciThe set of supported time domains consists of: 6519e5c31af7Sopenharmony_ci 6520e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkTimeDomainEXT.txt[] 6521e5c31af7Sopenharmony_ci 6522e5c31af7Sopenharmony_ci * ename:VK_TIME_DOMAIN_DEVICE_EXT specifies the device time domain. 6523e5c31af7Sopenharmony_ci Timestamp values in this time domain use the same units and are 6524e5c31af7Sopenharmony_ci comparable with device timestamp values captured using 6525e5c31af7Sopenharmony_ci flink:vkCmdWriteTimestamp 6526e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 6527e5c31af7Sopenharmony_ci or flink:vkCmdWriteTimestamp2KHR 6528e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 6529e5c31af7Sopenharmony_ci and are defined to be incrementing according to the 6530e5c31af7Sopenharmony_ci <<limits-timestampPeriod,timestampPeriod>> of the device. 6531e5c31af7Sopenharmony_ci 6532e5c31af7Sopenharmony_ci * ename:VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT specifies the CLOCK_MONOTONIC 6533e5c31af7Sopenharmony_ci time domain available on POSIX platforms. 6534e5c31af7Sopenharmony_ci Timestamp values in this time domain are in units of nanoseconds and are 6535e5c31af7Sopenharmony_ci comparable with platform timestamp values captured using the POSIX 6536e5c31af7Sopenharmony_ci clock_gettime API as computed by this example: 6537e5c31af7Sopenharmony_ci 6538e5c31af7Sopenharmony_ci[NOTE] 6539e5c31af7Sopenharmony_ci.Note 6540e5c31af7Sopenharmony_ci==== 6541e5c31af7Sopenharmony_ciAn implementation supporting `apiext:VK_EXT_calibrated_timestamps` will use 6542e5c31af7Sopenharmony_cithe same time domain for all its slink:VkQueue so that timestamp values 6543e5c31af7Sopenharmony_cireported for ename:VK_TIME_DOMAIN_DEVICE_EXT can be matched to any timestamp 6544e5c31af7Sopenharmony_cicaptured through flink:vkCmdWriteTimestamp 6545e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 6546e5c31af7Sopenharmony_cior flink:vkCmdWriteTimestamp2KHR 6547e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 6548e5c31af7Sopenharmony_ci. 6549e5c31af7Sopenharmony_ci==== 6550e5c31af7Sopenharmony_ci 6551e5c31af7Sopenharmony_ci[source,c] 6552e5c31af7Sopenharmony_ci~~~~ 6553e5c31af7Sopenharmony_cistruct timespec tv; 6554e5c31af7Sopenharmony_ciclock_gettime(CLOCK_MONOTONIC, &tv); 6555e5c31af7Sopenharmony_cireturn tv.tv_nsec + tv.tv_sec*1000000000ull; 6556e5c31af7Sopenharmony_ci~~~~ 6557e5c31af7Sopenharmony_ci 6558e5c31af7Sopenharmony_ci * ename:VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT specifies the 6559e5c31af7Sopenharmony_ci CLOCK_MONOTONIC_RAW time domain available on POSIX platforms. 6560e5c31af7Sopenharmony_ci Timestamp values in this time domain are in units of nanoseconds and are 6561e5c31af7Sopenharmony_ci comparable with platform timestamp values captured using the POSIX 6562e5c31af7Sopenharmony_ci clock_gettime API as computed by this example: 6563e5c31af7Sopenharmony_ci 6564e5c31af7Sopenharmony_ci[source,c] 6565e5c31af7Sopenharmony_ci~~~~ 6566e5c31af7Sopenharmony_cistruct timespec tv; 6567e5c31af7Sopenharmony_ciclock_gettime(CLOCK_MONOTONIC_RAW, &tv); 6568e5c31af7Sopenharmony_cireturn tv.tv_nsec + tv.tv_sec*1000000000ull; 6569e5c31af7Sopenharmony_ci~~~~ 6570e5c31af7Sopenharmony_ci 6571e5c31af7Sopenharmony_ci * ename:VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT specifies the 6572e5c31af7Sopenharmony_ci performance counter (QPC) time domain available on Windows. 6573e5c31af7Sopenharmony_ci Timestamp values in this time domain are in the same units as those 6574e5c31af7Sopenharmony_ci provided by the Windows QueryPerformanceCounter API and are comparable 6575e5c31af7Sopenharmony_ci with platform timestamp values captured using that API as computed by 6576e5c31af7Sopenharmony_ci this example: 6577e5c31af7Sopenharmony_ci 6578e5c31af7Sopenharmony_ci[source,c] 6579e5c31af7Sopenharmony_ci~~~~ 6580e5c31af7Sopenharmony_ciLARGE_INTEGER counter; 6581e5c31af7Sopenharmony_ciQueryPerformanceCounter(&counter); 6582e5c31af7Sopenharmony_cireturn counter.QuadPart; 6583e5c31af7Sopenharmony_ci~~~~ 6584e5c31af7Sopenharmony_ci-- 6585e5c31af7Sopenharmony_ciendif::VK_EXT_calibrated_timestamps[] 6586