1// Copyright 2016-2021 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5include::{generated}/meta/{refprefix}VK_EXT_shader_subgroup_ballot.txt[] 6 7=== Other Extension Metadata 8 9*Last Modified Date*:: 10 2016-11-28 11*IP Status*:: 12 No known IP claims. 13*Interactions and External Dependencies*:: 14 - This extension requires 15 {spirv}/KHR/SPV_KHR_shader_ballot.html[`SPV_KHR_shader_ballot`] 16 - This extension provides API support for 17 https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shader_ballot.txt[`GL_ARB_shader_ballot`] 18*Contributors*:: 19 - Jeff Bolz, NVIDIA 20 - Neil Henning, Codeplay 21 - Daniel Koch, NVIDIA Corporation 22 23=== Description 24 25This extension adds support for the following SPIR-V extension in Vulkan: 26 27 * `SPV_KHR_shader_ballot` 28 29This extension provides the ability for a group of invocations, which 30execute in parallel, to do limited forms of cross-invocation communication 31via a group broadcast of a invocation value, or broadcast of a bitarray 32representing a predicate value from each invocation in the group. 33 34This extension provides access to a number of additional built-in shader 35variables in Vulkan: 36 37 * code:SubgroupEqMaskKHR, containing the subgroup mask of the current 38 subgroup invocation, 39 * code:SubgroupGeMaskKHR, containing the subgroup mask of the invocations 40 greater than or equal to the current invocation, 41 * code:SubgroupGtMaskKHR, containing the subgroup mask of the invocations 42 greater than the current invocation, 43 * code:SubgroupLeMaskKHR, containing the subgroup mask of the invocations 44 less than or equal to the current invocation, 45 * code:SubgroupLtMaskKHR, containing the subgroup mask of the invocations 46 less than the current invocation, 47 * code:SubgroupLocalInvocationId, containing the index of an invocation 48 within a subgroup, and 49 * code:SubgroupSize, containing the maximum number of invocations in a 50 subgroup. 51 52Additionally, this extension provides access to the new SPIR-V instructions: 53 54 * code:OpSubgroupBallotKHR, 55 * code:OpSubgroupFirstInvocationKHR, and 56 * code:OpSubgroupReadInvocationKHR, 57 58When using GLSL source-based shader languages, the following variables and 59shader functions from GL_ARB_shader_ballot can map to these SPIR-V built-in 60decorations and instructions: 61 62 * `in uint64_t gl_SubGroupEqMaskARB;` -> code:SubgroupEqMaskKHR, 63 * `in uint64_t gl_SubGroupGeMaskARB;` -> code:SubgroupGeMaskKHR, 64 * `in uint64_t gl_SubGroupGtMaskARB;` -> code:SubgroupGtMaskKHR, 65 * `in uint64_t gl_SubGroupLeMaskARB;` -> code:SubgroupLeMaskKHR, 66 * `in uint64_t gl_SubGroupLtMaskARB;` -> code:SubgroupLtMaskKHR, 67 * `in uint gl_SubGroupInvocationARB;` -> code:SubgroupLocalInvocationId, 68 * `uniform uint gl_SubGroupSizeARB;` -> code:SubgroupSize, 69 * code:ballotARB() -> code:OpSubgroupBallotKHR, 70 * code:readFirstInvocationARB() -> code:OpSubgroupFirstInvocationKHR, and 71 * code:readInvocationARB() -> code:OpSubgroupReadInvocationKHR. 72 73=== Deprecated by Vulkan 1.2 74 75Most of the functionality in this extension is superseded by the core Vulkan 761.1 <<VkPhysicalDeviceSubgroupProperties, subgroup operations>>. 77However, Vulkan 1.1 required the code:OpGroupNonUniformBroadcast "`Id`" to 78be constant. 79This restriction was removed in Vulkan 1.2 with the addition of the 80<<features-subgroupBroadcastDynamicId,subgroupBroadcastDynamicId>> feature. 81 82include::{generated}/interfaces/VK_EXT_shader_subgroup_ballot.txt[] 83 84=== New Built-In Variables 85 86 * <<interfaces-builtin-variables-sgeq,code:SubgroupEqMaskKHR>> 87 * <<interfaces-builtin-variables-sgge,code:SubgroupGeMaskKHR>> 88 * <<interfaces-builtin-variables-sggt,code:SubgroupGtMaskKHR>> 89 * <<interfaces-builtin-variables-sgle,code:SubgroupLeMaskKHR>> 90 * <<interfaces-builtin-variables-sglt,code:SubgroupLtMaskKHR>> 91 * <<interfaces-builtin-variables-sgli,code:SubgroupLocalInvocationId>> 92 * <<interfaces-builtin-variables-sgs,code:SubgroupSize>> 93 94=== New SPIR-V Capabilities 95 96 * <<spirvenv-capabilities-table-SubgroupBallotKHR,SubgroupBallotKHR>> 97 98=== Version History 99 100 * Revision 1, 2016-11-28 (Daniel Koch) 101 - Initial draft 102