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