1Name 2 3 NV_shader_atomic_int64 4 5Name Strings 6 7 GL_NV_shader_atomic_int64 8 9Contact 10 11 Pat Brown, NVIDIA (pbrown 'at' nvidia.com) 12 13Contributors 14 15 Pat Brown, NVIDIA 16 Jeff Bolz, NVIDIA 17 Cyril Crassin, NVIDIA 18 Christoph Kubisch, NVIDIA 19 20Status 21 22 Shipping 23 24Version 25 26 Last Modified Date: May 11, 2021 27 NVIDIA Revision: 3 28 29Number 30 31 OpenGL Extension #455 32 33Dependencies 34 35 This extension is written against version 4.40 (revision 8) of the OpenGL 36 Shading Language Specification, dated January 22, 2014. 37 38 This extension interacts with NV_shader_buffer_store and NV_gpu_shader5. 39 40 This extension interacts with NV_gpu_program5, NV_compute_program5, and 41 NV_shader_storage_buffer_object. 42 43Overview 44 45 This extension provides additional GLSL built-in functions and assembly 46 opcodes allowing shaders to perform additional atomic read-modify-write 47 operations on 64-bit signed and unsigned integers stored in buffer object 48 memory. 49 50New Procedures and Functions 51 52 None. 53 54New Tokens 55 56 None. 57 58Additions to OpenGL 4.4 Specification 59 60 None. 61 62Additions to the AGL/GLX/WGL Specifications 63 64 None. 65 66GLX Protocol 67 68 None. 69 70Modifications to the OpenGL Shading Language Specification, Version 4.40 71(revision 8) 72 73 Including the following line in a shader can be used to control the 74 language features described in this extension: 75 76 #extension GL_NV_shader_atomic_int64 : <behavior> 77 78 where <behavior> is as specified in section 3.3. 79 80 New preprocessor #defines are added to the OpenGL Shading Language: 81 82 #define GL_NV_shader_atomic_int64 1 83 84 Modify Section 8.11, Atomic Memory Functions, p. 168 85 86 Add the following new functions to the table on p. 173: 87 88 uint64_t atomicMin(inout uint64_t mem, uint64_t data); 89 uint64_t atomicMax(inout uint64_t mem, uint64_t data); 90 uint64_t atomicAnd(inout uint64_t mem, uint64_t data); 91 uint64_t atomicOr (inout uint64_t mem, uint64_t data); 92 uint64_t atomicXor(inout uint64_t mem, uint64_t data); 93 94 int64_t atomicMin(inout int64_t mem, int64_t data); 95 int64_t atomicMax(inout int64_t mem, int64_t data); 96 int64_t atomicAnd(inout int64_t mem, int64_t data); 97 int64_t atomicOr (inout int64_t mem, int64_t data); 98 int64_t atomicXor(inout int64_t mem, int64_t data); 99 100 int64_t atomicAdd(inout int64_t mem, int64_t data); 101 int64_t atomicExchange(inout int64_t mem, int64_t data); 102 int64_t atomicCompSwap(inout int64_t mem, int64_t data); 103 104Dependencies on NV_shader_buffer_store and NV_gpu_shader5 105 106 If NV_shader_buffer_store and NV_gpu_shader5 are supported, the following 107 functions should be added to the "Section 8.Y, Shader Memory Functions" 108 language in the NV_shader_buffer_store specification: 109 110 uint64_t atomicMin(uint64_t *address, uint64_t data); 111 uint64_t atomicMax(uint64_t *address, uint64_t data); 112 uint64_t atomicAnd(uint64_t *address, uint64_t data); 113 uint64_t atomicOr (uint64_t *address, uint64_t data); 114 uint64_t atomicXor(uint64_t *address, uint64_t data); 115 116 int64_t atomicMin(int64_t *address, int64_t data); 117 int64_t atomicMax(int64_t *address, int64_t data); 118 int64_t atomicAnd(int64_t *address, int64_t data); 119 int64_t atomicOr (int64_t *address, int64_t data); 120 int64_t atomicXor(int64_t *address, int64_t data); 121 122 int64_t atomicAdd(int64_t *address, int64_t data); 123 int64_t atomicExchange(int64_t *address, int64_t data); 124 int64_t atomicCompSwap(int64_t *address, int64_t data); 125 126Dependencies on NV_gpu_program5, NV_compute_program5, and 127NV_shader_storage_buffer_object 128 129 If NV_gpu_program5 is supported and "OPTION NV_shader_atomic_int64" is 130 specified in an assembly program, new combinations of atomic operations 131 and storage modifiers are supported for the ATOM, ATOMB, and ATOMS 132 instructions. (Note: ATOMB comes from NV_shader_storage_buffer_object 133 and ATOMS comes from NV_compute_program5.) "S64" should be allowed as a 134 storage modifier for the atomic operations "MIN', "MAX", "AND", "OR", 135 "XOR", "ADD", "EXCH", and "CSWAP". "U64" should be allowed a s storage 136 modifier for the atomic operations "MIN", "MAX", "AND", "OR", and "XOR". 137 138 (Add to "Section 2.X.6, Program Options" of the NV_gpu_program4 extension, 139 as extended by NV_gpu_program5:) 140 141 + Extended 64-bit Atomic Operations (NV_shader_atomic_int64) 142 143 If a program specifies the "NV_shader_atomic_int64" option, it may 144 use the "S64" storage modifier with the atomic operations "MIN', 145 "MAX", "AND", "OR", "XOR", "ADD", "EXCH", and "CSWAP", and the "U64" 146 storage modifier with the atomic operations "MIN", "MAX", "AND", "OR", 147 and "XOR". 148 149 (Add "U64" and or "S64" opcode modifiers to the table in "Section 2.X.8.Z: 150 ATOM" in NV_gpu_program5, "Section 2.X.8.Z: ATOMS" in 151 NV_compute_program5, and "Section 2.X.8.Z: ATOMB" in 152 NV_shader_storage_buffer_object) 153 154 atomic storage 155 modifier modifiers operation 156 -------- ------------------ -------------------------------------- 157 ADD U32, S32, U64, S64 compute a sum 158 MIN U32, S32, U64, S64 compute minimum 159 MAX U32, S32, U64, S64 compute maximum 160 AND U32, S32, U64, S64 compute bit-wise AND 161 OR U32, S32, U64, S64 compute bit-wise OR 162 XOR U32, S32, U64, S64 compute bit-wise XOR 163 EXCH U32, S32, U64, S64 exchange memory with operand 164 CSWAP U32, S32, U64, S64 compare-and-swap 165 166 No new support is provided for the IWRAP and DWRAP atomic operations. 167 168Errors 169 170 None. 171 172New State 173 174 None. 175 176New Implementation Dependent State 177 178 None. 179 180Issues 181 182 None. 183 184Revision History 185 186 Revision 3, May 11, 2021 187 188 Fix typos in the NV_gpu_program5 assembly option name, which should 189 have been specified as "NV_shader_atomic_int64". 190 191 Revision 2, March 13, 2014 (pbrown) 192 193 Update to OpenGL 4.4 / GLSL 4.40, plus minor clarifications. 194 195 Revision 1, November 8, 2013 (ckubisch) 196 197 Initial revision. 198