1Name 2 3 AMD_gpu_shader_int64 4 5Name Strings 6 7 GL_AMD_gpu_shader_int64 8 9Contact 10 11 Daniel Rakos, AMD (daniel.rakos 'at' amd.com) 12 13Contributors 14 15 Daniel Rakos, AMD 16 Graham Sellers, AMD 17 18Status 19 20 Shipping 21 22Version 23 24 Last Modified Date: 07/07/2014 25 Author Revision: 3 26 27Number 28 29 OpenGL Extension #451 30 31Dependencies 32 33 This extension is written against the OpenGL 4.4 (Core Profile) 34 Specification. 35 36 This extension is written against version 4.40 of the OpenGL Shading 37 Language Specification. 38 39 OpenGL 4.0 and GLSL 4.00 are required. 40 41 This extension interacts with NV_gpu_shader5. 42 43 This extension interacts with NV_shader_buffer_load. 44 45 This extension interacts with EXT_direct_state_access. 46 47 This extension interacts with NV_vertex_attrib_integer_64bit. 48 49 This extension interacts with EXT_shader_integer_mix. 50 51Overview 52 53 This extension was developed based on the NV_gpu_shader5 extension to 54 allow implementations supporting 64-bit integers to expose the feature 55 without the additional requirements that are present in NV_gpu_shader5. 56 57 The extension introduces the following features for all shader types: 58 59 * support for 64-bit scalar and vector integer data types, including 60 uniform API, uniform buffer object, transform feedback, and shader 61 input and output support; 62 63 * new built-in functions to pack and unpack 64-bit integer types into a 64 two-component 32-bit integer vector; 65 66 * new built-in functions to convert double-precision floating-point 67 values to or from their 64-bit integer bit encodings; 68 69 * vector relational functions supporting comparisons of vectors of 70 64-bit integer types; and 71 72 * common functions abs, sign, min, max, clamp, and mix supporting 73 arguments of 64-bit integer types. 74 75 This extension is designed to be a functional superset of the 64-bit 76 integer support introduced by NV_gpu_shader5 and to be source code 77 compatible with that, thus the new procedures, functions, and tokens 78 are identical to those found in that extension. 79 80 81New Procedures and Functions 82 83 (The functions are identical to those defined in NV_gpu_shader5.) 84 85 void Uniform1i64NV(int location, int64EXT x); 86 void Uniform2i64NV(int location, int64EXT x, int64EXT y); 87 void Uniform3i64NV(int location, int64EXT x, int64EXT y, int64EXT z); 88 void Uniform4i64NV(int location, int64EXT x, int64EXT y, int64EXT z, 89 int64EXT w); 90 void Uniform1i64vNV(int location, sizei count, const int64EXT *value); 91 void Uniform2i64vNV(int location, sizei count, const int64EXT *value); 92 void Uniform3i64vNV(int location, sizei count, const int64EXT *value); 93 void Uniform4i64vNV(int location, sizei count, const int64EXT *value); 94 95 void Uniform1ui64NV(int location, uint64EXT x); 96 void Uniform2ui64NV(int location, uint64EXT x, uint64EXT y); 97 void Uniform3ui64NV(int location, uint64EXT x, uint64EXT y, uint64EXT z); 98 void Uniform4ui64NV(int location, uint64EXT x, uint64EXT y, uint64EXT z, 99 uint64EXT w); 100 void Uniform1ui64vNV(int location, sizei count, const uint64EXT *value); 101 void Uniform2ui64vNV(int location, sizei count, const uint64EXT *value); 102 void Uniform3ui64vNV(int location, sizei count, const uint64EXT *value); 103 void Uniform4ui64vNV(int location, sizei count, const uint64EXT *value); 104 105 void GetUniformi64vNV(uint program, int location, int64EXT *params); 106 107 108 (The following function is also provided by NV_shader_buffer_load.) 109 110 void GetUniformui64vNV(uint program, int location, uint64EXT *params); 111 112 113 (All of the following ProgramUniform* functions are supported if and only 114 if EXT_direct_state_access is supported.) 115 116 void ProgramUniform1i64NV(uint program, int location, int64EXT x); 117 void ProgramUniform2i64NV(uint program, int location, int64EXT x, 118 int64EXT y); 119 void ProgramUniform3i64NV(uint program, int location, int64EXT x, 120 int64EXT y, int64EXT z); 121 void ProgramUniform4i64NV(uint program, int location, int64EXT x, 122 int64EXT y, int64EXT z, int64EXT w); 123 void ProgramUniform1i64vNV(uint program, int location, sizei count, 124 const int64EXT *value); 125 void ProgramUniform2i64vNV(uint program, int location, sizei count, 126 const int64EXT *value); 127 void ProgramUniform3i64vNV(uint program, int location, sizei count, 128 const int64EXT *value); 129 void ProgramUniform4i64vNV(uint program, int location, sizei count, 130 const int64EXT *value); 131 132 void ProgramUniform1ui64NV(uint program, int location, uint64EXT x); 133 void ProgramUniform2ui64NV(uint program, int location, uint64EXT x, 134 uint64EXT y); 135 void ProgramUniform3ui64NV(uint program, int location, uint64EXT x, 136 uint64EXT y, uint64EXT z); 137 void ProgramUniform4ui64NV(uint program, int location, uint64EXT x, 138 uint64EXT y, uint64EXT z, uint64EXT w); 139 void ProgramUniform1ui64vNV(uint program, int location, sizei count, 140 const uint64EXT *value); 141 void ProgramUniform2ui64vNV(uint program, int location, sizei count, 142 const uint64EXT *value); 143 void ProgramUniform3ui64vNV(uint program, int location, sizei count, 144 const uint64EXT *value); 145 void ProgramUniform4ui64vNV(uint program, int location, sizei count, 146 const uint64EXT *value); 147 148 149New Tokens 150 151 Returned by the <type> parameter of GetActiveAttrib, GetActiveUniform, and 152 GetTransformFeedbackVarying: 153 154 (The tokens are identical to those defined in NV_gpu_shader5.) 155 156 INT64_NV 0x140E 157 UNSIGNED_INT64_NV 0x140F 158 159 INT8_NV 0x8FE0 160 INT8_VEC2_NV 0x8FE1 161 INT8_VEC3_NV 0x8FE2 162 INT8_VEC4_NV 0x8FE3 163 INT16_NV 0x8FE4 164 INT16_VEC2_NV 0x8FE5 165 INT16_VEC3_NV 0x8FE6 166 INT16_VEC4_NV 0x8FE7 167 INT64_VEC2_NV 0x8FE9 168 INT64_VEC3_NV 0x8FEA 169 INT64_VEC4_NV 0x8FEB 170 UNSIGNED_INT8_NV 0x8FEC 171 UNSIGNED_INT8_VEC2_NV 0x8FED 172 UNSIGNED_INT8_VEC3_NV 0x8FEE 173 UNSIGNED_INT8_VEC4_NV 0x8FEF 174 UNSIGNED_INT16_NV 0x8FF0 175 UNSIGNED_INT16_VEC2_NV 0x8FF1 176 UNSIGNED_INT16_VEC3_NV 0x8FF2 177 UNSIGNED_INT16_VEC4_NV 0x8FF3 178 UNSIGNED_INT64_VEC2_NV 0x8FF5 179 UNSIGNED_INT64_VEC3_NV 0x8FF6 180 UNSIGNED_INT64_VEC4_NV 0x8FF7 181 FLOAT16_NV 0x8FF8 182 FLOAT16_VEC2_NV 0x8FF9 183 FLOAT16_VEC3_NV 0x8FFA 184 FLOAT16_VEC4_NV 0x8FFB 185 186 187Additions to Chapter 7 of the OpenGL 4.4 (Core Profile) Specification 188(Program Objects) 189 190 Modify Section 7.3.1, Program Interfaces 191 192 (add to Table 7.3, OpenGL Shading Language type tokens, p. 107) 193 194 +----------------------------+--------------+--------+--------+--------+ 195 | Type Name Token | Keyword | Attrib | Xfb | Buffer | 196 +----------------------------+--------------+--------+--------+--------+ 197 | INT64_NV | int64_t | * | * | * | 198 | INT64_VEC2_NV | i64vec2 | * | * | * | 199 | INT64_VEC3_NV | i64vec3 | * | * | * | 200 | INT64_VEC4_NV | i64vec4 | * | * | * | 201 | UNSIGNED_INT64_NV | uint64_t | * | * | * | 202 | UNSIGNED_INT64_VEC2_NV | u64vec2 | * | * | * | 203 | UNSIGNED_INT64_VEC3_NV | u64vec3 | * | * | * | 204 | UNSIGNED_INT64_VEC4_NV | u64vec4 | * | * | * | 205 +----------------------------+--------------+--------+--------+--------+ 206 207 Modify Section 7.6, Uniform Variables 208 209 (modify second paragraph on p. 120) 210 211 Scalar, vector, and matrix uniforms with double-precision components, 212 and scalar and vector uniforms with 64-bit integer components will consume 213 no more than twice the number of components of equivalent uniforms with 214 single-precision components. 215 216 217 Modify Section 7.6.1, Loading Uniform Variables 218 219 (add to the list of commands in first paragraph on p. 125) 220 221 void Uniform{1,2,3,4}{i64,ui64}NV(int location, T value); 222 void Uniform{1,2,3,4}{i64,ui64}vNV(int location, T value); 223 224 (insert after third paragraph on p. 127) 225 226 The Uniform*i64{v}NV and Uniform*ui{v}NV commands will load count sets 227 of one to four 64-bit signed or unsigned integer values into a uniform 228 location defined as a 64-bit signed or unsigned integer scalar or vector 229 types. 230 231 232 Modify Section 7.6.2.1, Uniform Buffer Object Storage 233 234 (modify the first two bullets of the first paragraph on p. 130) 235 236 * Members of type bool int, uint, float, double, int64_t, and uint64_t 237 are respectively extracted from a buffer object by reading a single 238 uint, int, uint, float, double, int64_t, or uint64_t value at the 239 specified offset. 240 241 * Vectors with N elements with basic data types of bool, int, uint, 242 float, double, int64_t, or uint64_t are extracted as N values in 243 consecutive memory locations beginning at the specified offset, with 244 components stored in order with the first (X) component at the 245 lowest offset. The GL data type used for component extraction is 246 derived according to the rules for scalar members above. 247 248 249 Modify Section 7.13, Shader, Program, and Program Pipeline Queries 250 251 (add to the list of commands in last paragraph on p. 155) 252 253 void GetUniformi64vNV(uint program, int location, int64* params) 254 void GetUniformui64vNV(uint program, int location, uint64* params) 255 256 257Additions to Chapter 11 of the OpenGL 4.4 (Core Profile) Specification 258(Programmable Vertex Processing) 259 260 Modify Section 11.1.1, Vertex Attributes 261 262 (modify third sentence of second paragraph on p. 344) 263 264 ... hardware resources. For the purposes of this test, attribute variables 265 of the type dvec3, dvec4, dmat2x3, dmat2x3, dmat3, dmat3x4, dmat4x3, 266 dmat4, i64vec3, i64vec4, u64vec3, and u64vec4 may count as consuming twice 267 as many attributes as equivalent single-precision types. While these types 268 use the same number of generic attributes as their single-precision 269 vectors of internal storage for each three- or four-component 270 double-precision or 64-bit integer vector. 271 272 273 Modify Section 11.1.2.1, Output Variables 274 275 (modify last sentence of fourth paragraph on p. 345) 276 277 ... multiple components. Each component of variables declared as double- 278 precision floating point scalars, vectors, or matrices, or declared as 279 64-bit integer scalars or vectors may be counted as consuming two 280 components. 281 282 (modify third bullet of the first paragraph on p. 349) 283 284 * any variable containing double-precision floating-point or 64-bit 285 integer components 286 287 - has an xfb_offset layout qualifier that is not a multiple of eight; 288 or 289 - is associated with a binding point with an xfb_stride layout 290 qualifier that is not a multiple of eight; 291 292 (modify second paragraph on p. 349) 293 294 For transform feedback purposes, each component of outputs declared as 295 double-precision floating-point scalars, vectors, or matrices, or 64-bit 296 integer scalars or vectors are considered to consume eight basic machine 297 units, and each component of any other type is considered to consume four 298 basic machine units. 299 300 301Modifications to the OpenGL Shading Language Specification, Version 4.40 302 303 Including the following line in a shader can be used to control the 304 language features described in this extension: 305 306 #extension GL_AMD_gpu_shader_int64 : <behavior> 307 308 where <behavior> is as specified in section 3.3. 309 310 New preprocessor #defines are added to the OpenGL Shading Language: 311 312 #define GL_AMD_gpu_shader_int64 1 313 314 315Additions to Chapter 3 of the OpenGL Shading Language Specification (Basics) 316 317 Modify Section 3.6, Keywords 318 319 (add the following to the list of reserved keywords at p. 15) 320 321 int64_t i64vec2 i64vec3 i64vec4 uint64_t u64vec2 u64vec3 u64vec4 322 323 324Additions to Chapter 4 of the OpenGL Shading Language Specification 325(Variables and Types) 326 327 Modify Section 4.1, Basic Types 328 329 (add to the basic "Transparent Types" table, p. 19) 330 331 +-----------+------------------------------------------------------------+ 332 | Type | Meaning | 333 +-----------+------------------------------------------------------------+ 334 | int64_t | a 64-bit signed integer | 335 | uint64_t | a 64-bit unsigned integer | 336 | i64vec2 | a two-component 64-bit signed integer vector | 337 | i64vec3 | a three-component 64-bit signed integer vector | 338 | i64vec4 | a four-component 64-bit signed integer vector | 339 | u64vec2 | a two-component 64-bit unsigned integer vector | 340 | u64vec3 | a three-component 64-bit unsigned integer vector | 341 | u64vec4 | a four-component 64-bit unsigned integer vector | 342 +-----------+------------------------------------------------------------+ 343 344 345 Modify Section 4.1.3, Integers 346 347 (replace first paragraph of the section, p. 23) 348 349 Signed and unsigned integer variables are fully supported. In this 350 document, the term integer is meant to generally include both signed and 351 unsigned integers, including both 32-bit and 64-bit integers. Unsigned 352 integers of type uint, uvec2, uvec3, and uvec4 have exactly 32 bits of 353 precision, while unsigned integers of type uint64_t, u64vec2, u64vec3, and 354 u64vec4 have exactly 64 bits of precision. Signed integers of type int, 355 ivec2, ivec3, and ivec4 have exactly 32 bits of precision, while signed 356 integers of type int64_t, i64vec2, i64vec3, and i64vec4 have exactly 357 64 bits of precision. Addition, subtraction, and shift operations 358 resulting in overflow or underflow will not cause any exceptions, nor 359 will they saturate, rather they will "wrap" to yield the low-order bits 360 of the result. Divison and multiplication operations resulting in overflow 361 or underflow will not cause any exception but will result in an undefined 362 value. 363 364 (add after the first paragraph of the section, p. 23) 365 366 Variables with the types "int64_t" and "uint64_t" represent signed and 367 unsigned integer values, respectively, with exactly 64 bits of precision. 368 369 (modify grammar rule for "integer-suffix", p. 24) 370 371 integer-suffix: one of 372 u U l L ul UL 373 374 (modify first sentence of second paragraph on p. 24) 375 376 No white space is allowed between the digits of an integer constant, 377 including after the leading 0 or after the leading 0x or 0X of a constant, 378 or before the suffix u, U, l, L, ul, or UL. 379 380 (modify third sentence of second paragraph on p. 24) 381 382 When the suffix u or U is present, the literal has type uint. When the 383 suffix l or L is present, the literal has type int64_t. When the suffix 384 ul or UL is present, the literal has type uint64_t. Otherwise, the type is 385 int. 386 387 388 Modify Section 4.1.10, Implicit Conversions 389 390 (modify table of implicit conversions on p. 33) 391 392 +----------------------+-------------------------------------------------+ 393 | Type of expression | Can be implicitly converted to | 394 +----------------------+-------------------------------------------------+ 395 | int | uint, int64_t, uint64_t, float, double | 396 | uint | uint64_t, float, double | 397 | int64_t | uint64_t, double | 398 | uint64_t | double | 399 | ivec2 | uvec2, i64vec2, u64vec2, vec2, dvec2 | 400 | ivec3 | uvec3, i64vec3, u64vec3, vec3, dvec3 | 401 | ivec4 | uvec4, i64vec4, u64vec4, vec4, dvec4 | 402 | uvec2 | u64vec2, vec2, dvec2 | 403 | uvec3 | u64vec3, vec3, dvec3 | 404 | uvec4 | u64vec4, vec4, dvec4 | 405 | i64vec2 | u64vec2, dvec2 | 406 | i64vec3 | u64vec3, dvec3 | 407 | i64vec4 | u64vec4, dvec4 | 408 | u64vec2 | dvec2 | 409 | u64vec3 | dvec3 | 410 | u64vec4 | dvec4 | 411 +----------------------+-------------------------------------------------+ 412 413 414 Modify Section 4.3.6, Output Variables 415 416 (modify third and fourth sentence of second paragraph on p. 46) 417 418 ... in a fragment shader. Fragment outputs can only be float, single- 419 precision floating-point vectors, signed or unsigned 32-bit integer 420 vectors, or arrays of any these. It is a compile-time error to declare any 421 double-precision type, 64-bit integer type, matrix, or structure as an 422 output. 423 424 425Additions to Chapter 5 of the OpenGL Shading Language Specification 426(Operators and Expressions) 427 428 Modify Section 5.4.1, Conversion and Scalar Constructors 429 430 (add after first list of constructor examples on p. 91) 431 432 int64_t(double) // converts a double value to a 64-bit signed integer 433 uint64_t(bool) // converts a Boolean value to a 64-bit unsigned integer 434 435 (modify second sentence of first paragraph on p. 92) 436 437 ... is dropped. It is undefined to convert a negative floating-point value 438 to an uint or uint64_t. 439 440 (replace third paragraph on p. 92) 441 442 The constructors int(uint) and int64_t(uint64_t) preserve the bit pattern 443 in the argument, which will change the argument's value if its sign bit is 444 set. The constructor uint(int) and uint64_t(int64_t) preserve the bit 445 pattern in the argument, which will change its value if it is negative. 446 447 448Additions to Chapter 6 of the OpenGL Shading Language Specification 449(Statements and Structure) 450 451 Modify Section 6.1, Function Defintions 452 453 (replace second rule in third paragraph on p. 106) 454 455 2. A match involving a conversion from a signed integer, unsigned 456 integer, or floating-point type to a similar type having a larger 457 number of bits is better than a match involving any other implicit 458 conversion. 459 460 461Additions to Chapter 8 of the OpenGL Shading Language Specification 462(Built-in Functions) 463 464 (insert after third sentence of last paragraph on p. 132) 465 466 ... genUType is used as the argument. Where the input arguments (and 467 corresponding output) can be int64_t, i64vec2, i64vec3, i64vec4, 468 genI64Type is used as the argument. Where the input arguments (and 469 corresponding output) can be uint64_t, u64vec2, u64vec3, u64vec4, 470 genU64Type is used as the argument. 471 472 473 Modify Section 8.3, Common Functions 474 475 (add to the table of common functions on p. 136) 476 477 +------------------------------------------------+----------------------------------------------------+ 478 | Syntax | Desciption | 479 +------------------------------------------------+----------------------------------------------------+ 480 | genI64Type abs(genI64Type x) | Returns x if x >= 0; otherwise it returns -x. | 481 +------------------------------------------------+----------------------------------------------------+ 482 | genI64Type sign(genI64Type x) | Returns 1 if x > 0, 0 if x = 0, or -1 if x < 0. | 483 +------------------------------------------------+----------------------------------------------------+ 484 | genI64Type min(genI64Type x, | Returns y if y < x; otherwise it returns x. | 485 | genI64Type y) | | 486 | genI64Type min(genI64Type x, | | 487 | int64_t y) | | 488 | genU64Type min(genU64Type x, | | 489 | genU64Type y) | | 490 | genU64Type min(genU64Type x, | | 491 | uint64_t y) | | 492 +------------------------------------------------+----------------------------------------------------+ 493 | genI64Type max(genI64Type x, | Returns y if x < y; otherwise it returns x. | 494 | genI64Type y) | | 495 | genI64Type max(genI64Type x, | | 496 | int64_t y) | | 497 | genU64Type max(genU64Type x, | | 498 | genU64Type y) | | 499 | genU64Type max(genU64Type x, | | 500 | uint64_t y) | | 501 +------------------------------------------------+----------------------------------------------------+ 502 | genI64Type clamp(genI64Type x, | Returns min(max(x, minVal), maxVal). | 503 | genI64Type minVal, | | 504 | genI64Type maxVal) | Results are undefined if minVal > maxVal. | 505 | genI64Type clamp(genI64Type x, | | 506 | int64_t minVal, | | 507 | int64_t maxVal) | | 508 | genU64Type clamp(genU64Type x, | | 509 | genU64Type minVal, | | 510 | genU64Type maxVal) | | 511 | genU64Type clamp(genU64Type x, | | 512 | uint64_t minVal, | | 513 | uint64_t maxVal) | | 514 +------------------------------------------------+----------------------------------------------------+ 515 | genI64Type mix(genI64Type x, | Selects which vector each returned component comes | 516 | genI64Type y, | from. For a component of a that is false, the | 517 | genBType a) | corresponding component of x is returned. For a | 518 | genU64Type mix(genU64Type x, | component of a that is true, the corresponding | 519 | genU64Type y, | component of y is returned. | 520 | genBType a) | | 521 +------------------------------------------------+----------------------------------------------------+ 522 | genI64Type doubleBitsToInt64(genDType value) | Returns a signed or unsigned 64-bit integer value | 523 | genU64Type doubleBitsToUint64(genDType value) | representing the encoding of a double. The double | 524 | | value's bit-level representation is preserved | 525 +------------------------------------------------+----------------------------------------------------+ 526 | genDType int64BitsToDouble(genI64Type value) | Returns a double value corresponding to a signed | 527 | genDType uint64BitsToDouble(genU64Type value) | or unsigned integer encoding of a double. If a NaN | 528 | | is passed in, it will not signal, and the | 529 | | resulting value is unspecified. If an Inf is | 530 | | passed in, the resulting value is the | 531 | | corresponding Inf. | 532 +------------------------------------------------+----------------------------------------------------+ 533 534 535 Rename Section 8.4, Floating-Point Pack and Unpack Functions to 536 8.4, Floating-Point and Integer Pack and Unpack Functions 537 538 539 Modify Section 8.4, Floating-Point and Integer Pack and Unpack Functions 540 541 (add to the table of pack and unpack functions on p. 141) 542 543 +-----------------------------------+------------------------------------------------------+ 544 | Syntax | Desciption | 545 +-----------------------------------+------------------------------------------------------+ 546 | int64_t packInt2x32(ivec2 v) | Returns a signed or unsigned 64-bit integer obtained | 547 | uint64_t packUint2x32(uvec2 v) | by packing the components of a two-component signed | 548 | | or unsigned integer vector, respectively. The first | 549 | | vector component specifies the 32 least significant | 550 | | bits; the second component specifies the 32 most | 551 | | significant bits. | 552 +-----------------------------------+------------------------------------------------------+ 553 | ivec2 unpackInt2x32(int64_t v) | Returns a signed or unsigned integer vector built | 554 | uvec2 unpackUint2x32(uint64_t v) | from a 64-bit signed or unsigned integer scalar, | 555 | | respectively. The first component of the vector | 556 | | contains the 32 least significant bits of the input; | 557 | | the second component contains the 32 most | 558 | | significant bits. | 559 +-----------------------------------+------------------------------------------------------+ 560 561 562 Modify Section, 8.7, Vector Relational Functions 563 564 (add to the table of placeholders at the top of p. 147) 565 566 +-------------+-----------------------------+ 567 | Placeholder | Specific Types Allowed | 568 +-------------+-----------------------------+ 569 | i64vec | i64vec2, i64vec3, i64vec4 | 570 | u64vec | u64vec2, u64vec3, u64vec4 | 571 +-------------+-----------------------------+ 572 573 (add to the table of vector relational functions at the bottom of p. 147) 574 575 +-------------------------------------------+-----------------------------------------------+ 576 | Syntax | Desciption | 577 +-------------------------------------------+-----------------------------------------------+ 578 | bvec lessThan(i64vec x, i64vec y) | Returns the component-wise compare of x < y. | 579 | bvec lessThan(u64vec x, u64vec y) | | 580 +-------------------------------------------+-----------------------------------------------+ 581 | bvec lessThanEqual(i64vec x, i64vec y) | Returns the component-wise compare of x <= y. | 582 | bvec lessThanEqual(u64vec x, u64vec y) | | 583 +-------------------------------------------+-----------------------------------------------+ 584 | bvec greaterThan(i64vec x, i64vec y) | Returns the component-wise compare of x > y. | 585 | bvec greaterThan(u64vec x, u64vec y) | | 586 +-------------------------------------------+-----------------------------------------------+ 587 | bvec greaterThanEqual(i64vec x, i64vec y) | Returns the component-wise compare of x >= y. | 588 | bvec greaterThanEqual(u64vec x, u64vec y) | | 589 +-------------------------------------------+-----------------------------------------------+ 590 | bvec equal(i64vec x, i64vec y) | Returns the component-wise compare of x == y. | 591 | bvec equal(u64vec x, u64vec y) | | 592 +-------------------------------------------+-----------------------------------------------+ 593 | bvec notEqual(i64vec x, i64vec y) | Returns the component-wise compare of x != y. | 594 | bvec notEqual(u64vec x, u64vec y) | | 595 +-------------------------------------------+-----------------------------------------------+ 596 597 598 Modify Section 9, Shading Language Grammar for Core Profile 599 600 (add to the list of tokens on p. 180) 601 602 ... 603 INT64 UINT64 I64VEC2 I64VEC3 I64VEC4 U64VEC2 U64VEC3 U64VEC4 604 ... 605 INT64CONSTANT UINT64CONSTANT 606 607 (add to the rule of "primary_expression" on p. 181) 608 609 primary_expression: 610 ... 611 INT64CONSTANT 612 UINT64CONSTANT 613 ... 614 615 (add to the rule of "type_specifier_nonarray" on p. 188) 616 617 type_specifier_nonarray: 618 ... 619 INT64 620 UINT64 621 ... 622 I64VEC2 623 I64VEC3 624 I64VEC4 625 U64VEC2 626 U64VEC3 627 U64VEC4 628 ... 629 630 631Dependencies on NV_gpu_shader5 632 633 If the shader enables only NV_gpu_shader5, but not AMD_gpu_shader_int64 634 then implicit conversions from int and uint types to int64_t and uint64_t 635 types are not allowed. Also, the overloaded built-in functions abs, 636 sign, min, max, clamp, and mix are not available. 637 638 639Dependencies on NV_shader_buffer_load 640 641 If NV_shader_buffer_load is supported, that specification should be edited 642 as follows, to allow pointers to dereference the new data types added by 643 this extension. 644 645 Modify "Section 2.20.X, Shader Memory Access" from NV_shader_buffer_load. 646 647 (add rules for loads of variables having the new data types from this 648 extension to the list of bullets following "When a shader dereferences a 649 pointer variable") 650 651 - Data of type int64_t and uint64_t are read from or written to memory as 652 a signel 64-bit signed and unsigned integer value, respectively, at the 653 specified GPU address. 654 655 656Dependencies on EXT_direct_state_access 657 658 If EXT_direct_state_access is supported, that specification should be 659 edited as follows to include new ProgramUniform* functions. 660 661 (add to the list of ProgramUniform* commands) 662 663 void ProgramUniform{1,2,3,4}{i64,ui64}NV 664 (uint program int location, T value); 665 void ProgramUniform{1,2,3,4}{i64,ui64}vNV 666 (uint program, int location, const T *value); 667 668Dependencies on NV_vertex_attrib_integer_64bit 669 670 This extension only provides the ability to specify 64-bit integer input 671 variables in a GLSL vertex shader, but does not provide a way to specify 672 the values of the corresponding vertex attributes via the OpenGL API. 673 The NV_vertex_attrib_integer_64bit extension exactly provides that 674 functionality. 675 676 677Dependencies on EXT_shader_integer_mix 678 679 If EXT_shader_integer_mix is not supported remove all references to the 680 new overloaded built-in functions of mix. 681 682 683Errors 684 685 None. 686 687New State 688 689 None. 690 691New Implementation Dependent State 692 693 None. 694 695Issues 696 697 (1) How the functionality in this extension different than the 64-bit 698 integer support introduced by NV_gpu_shader5? 699 700 RESOLVED: This extension is designed to be source code compatible with 701 the 64-bit integer support in NV_gpu_shader5. However, it is a 702 functional superset of that, as it adds the following additional 703 features: 704 705 * support for overloaded versions of the functions abs, sign, min, 706 max, clamp, and mix that accept 64-bit integers as parameters. 707 708 (2) How do the implicit conversions impact binary operators? 709 710 RESOLVED: For binary operators, we prefer converting to a common type 711 that is as close as possible in size and type to the original 712 expression. 713 714 (3) How do the implicit conversions impact function overloading rules? 715 716 RESOLVED: We extend the preference rules in core OpenGL to account 717 for the new data types, adding a rule to favor conversion from 32-bit 718 integers to 64-bit integers over coversions to floating-point values. 719 720 (4) What should be done to distinguish between 32- and 64-bit integer 721 constants? 722 723 RESOLVED: We will use "L" and "UL" to identify signed and unsigned 724 64-bit integer constants; the use of "L" matches a similar ("long") 725 suffix in the C programming language. C leaves the size of integer 726 types implementation-dependent, and many implementations require an "LL" 727 suffix to declare 64-bit integer constants. With our size definitions, 728 "L" will be considered sufficient to make an integer constant 64-bit. 729 730 (5) Should provide support for vertex attributes with 64-bit components, 731 and if so, how should the support be provided in the OpenGL API? 732 733 RESOLVED: Yes, but in order to specify 64-bit vertex attribute values 734 in the OpenGL API support for NV_vertex_attrib_integer_64bit or a 735 similar extension is also required. 736 737 (6) Should we support 64-bit integer uniforms in the default uniform 738 block? 739 740 DISCUSSION: There isn't much value in extending the standalone uniform 741 API, as uniform buffers provide a way more efficient way to feed 742 uniforms to the shaders, but in order to achieve feature parity with 743 the 64-bit integer support in NV_gpu_shader5 it might be favorable to 744 add support for it. 745 746 RESOLVED: Yes, for compatibility with NV_gpu_shader5. 747 748 (7) Should we support 64-bit integer types as members of uniform blocks, 749 shader storage buffer blocks, or as transform feedback varyings? 750 751 RESOLVED: Yes, support all of them. 64-bit integers will consume eight 752 basic machine units just like double-precision floating-point variables. 753 754 (8) How do the uniform loading commands introduced by this extension 755 interact similar commands added by NV_shader_buffer_load? 756 757 RESOLVED: NV_shader_buffer_load provided the command Uniformui64NV to 758 load pointer uniforms with a single 64-bit unsigned integer. This 759 extension provides vectors of 64-bit unsigned integers, so we needed 760 Uniform{2,3,4}ui64NV commands. We chose to provide a Uniform1ui64NV 761 command, which will be functionally equivalent to Uniformui64NV. 762 763 (9) Should we provide distinct sized types for 32-bit integers, floats, 764 and doubles? 765 766 RESOLVED: No. While NV_gpu_shader5 does add such types, it seems there 767 isn't much value in adding those in this extension, especially because 768 this extension strictly focuses on supporting 64-bit integers. 769 770 (10) Can the 64-bit uniform APIs be used to load values for uniforms of 771 type "bool", "bvec2", "bvec3", or "bvec4"? 772 773 RESOLVED: No. OpenGL 2.0 and beyond did allow "bool" variable to be 774 set with Uniform*i* and Uniform*f APIs, and OpenGL 3.0 extended that 775 support to Uniform*ui* for orthogonality. But it seems pointless to 776 extended this capability forward to 64-bit Uniform APIs as well. 777 778 (11) There exists both an UNSIGNED_INT64_AMD and UNSIGNED_INT64_NV token 779 with different values (the former existed earlier) so which one 780 this extension should use? 781 782 DISCUSSION: No functions in this extension accept these values as 783 inputs, they only should return one of these in various scenarios. 784 785 RESOLVED: This extension will return the value of UNSIGNED_INT64_NV to 786 stay source code compatible with NV_gpu_shader5. However, future 787 extensions that should accept any of these tokens as inputs should 788 accept both of them. 789 790Revision History 791 792 Rev. Date Author Changes 793 ---- -------- -------- ------------------------------------------------- 794 3 07/07/14 drakos Fixed inconsistency in implicit conversion rules. 795 2 31/04/14 gsellers Ready to post. 796 1 10/09/13 drakos Initial revision. 797