1// Copyright 2020-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5include::{generated}/meta/{refprefix}VK_KHR_synchronization2.adoc[] 6 7=== Other Extension Metadata 8 9*Last Modified Date*:: 10 2020-12-03 11*Interactions and External Dependencies*:: 12 - Promoted to Vulkan 1.3 Core 13 - Interacts with `apiext:VK_KHR_create_renderpass2` 14*Contributors*:: 15 - Tobias Hector 16 17=== Description 18 19This extension modifies the original core synchronization APIs to simplify 20the interface and improve usability of these APIs. 21It also adds new pipeline stage and access flag types that extend into the 2264-bit range, as we have run out within the 32-bit range. 23The new flags are identical to the old values within the 32-bit range, with 24new stages and bits beyond that. 25 26Pipeline stages and access flags are now specified together in memory 27barrier structures, making the connection between the two more obvious. 28Additionally, scoping the pipeline stages into the barrier structs allows 29the use of the etext:MEMORY_READ and etext:MEMORY_WRITE flags without 30sacrificing precision. 31The per-stage access flags should be used to disambiguate specific accesses 32in a given stage or set of stages - for instance, between uniform reads and 33sampling operations. 34 35Layout transitions have been simplified as well; rather than requiring a 36different set of layouts for depth/stencil/color attachments, there are 37generic ename:VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR and 38ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR layouts which are contextually 39applied based on the image format. 40For example, for a depth format image, 41ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR is equivalent to 42ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR. 43ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR also functionally replaces 44ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. 45 46Events are now more efficient, because they include memory dependency 47information when you set them on the device. 48Previously, this information was only known when waiting on an event, so the 49dependencies could not be satisfied until the wait occurred. 50That sometimes meant stalling the pipeline when the wait occurred. 51The new API provides enough information for implementations to satisfy these 52dependencies in parallel with other tasks. 53 54Queue submission has been changed to wrap command buffers and semaphores in 55extensible structures, which incorporate changes from Vulkan 1.1, 56`apiext:VK_KHR_device_group`, and `apiext:VK_KHR_timeline_semaphore`. 57This also adds a pipeline stage to the semaphore signal operation, mirroring 58the existing pipeline stage specification for wait operations. 59 60Other miscellaneous changes include: 61 62 * Events can now be specified as interacting only with the device, 63 allowing more efficient access to the underlying object. 64 * Image memory barriers that do not perform an image layout transition can 65 be specified by setting pname:oldLayout equal to pname:newLayout. 66 ** E.g. the old and new layout can both be set to 67 ename:VK_IMAGE_LAYOUT_UNDEFINED, without discarding data in the image. 68 * Queue family ownership transfer parameters are simplified in some cases. 69 * Where two synchronization commands need to be matched up (queue transfer 70 operations, events), the dependency information specified in each place 71 must now match completely for consistency. 72 * Extensions with commands or functions with a tlink:VkPipelineStageFlags 73 or elink:VkPipelineStageFlagBits parameter have had those APIs replaced 74 with equivalents using tlink:VkPipelineStageFlags2KHR. 75 * The new event and barrier interfaces are now more extensible for future 76 changes. 77 * Relevant pipeline stage masks can now be specified as empty with the new 78 ename:VK_PIPELINE_STAGE_NONE_KHR and ename:VK_PIPELINE_STAGE_2_NONE_KHR 79 values. 80ifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 81 * slink:VkMemoryBarrier2KHR can be chained to slink:VkSubpassDependency2, 82 overriding the original 32-bit stage and access masks. 83endif::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 84 85include::{generated}/interfaces/VK_KHR_synchronization2.adoc[] 86 87=== Promotion to Vulkan 1.3 88 89Functionality in this extension is included in core Vulkan 1.3, with the KHR 90suffix omitted. 91The original type, enum and command names are still available as aliases of 92the core functionality. 93 94=== Examples 95 96See 97https://github.com/KhronosGroup/Vulkan-Docs/wiki/Synchronization-Examples 98 99 100=== Version History 101 102 * Revision 1, 2020-12-03 (Tobias Hector) 103 ** Internal revisions 104