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