• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_gpu_shader_int64
4
5Name Strings
6
7    GL_ARB_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
18Notice
19
20    Copyright (c) 2015 The Khronos Group Inc. Copyright terms at
21        http://www.khronos.org/registry/speccopyright.html
22
23Specification Update Policy
24
25    Khronos-approved extension specifications are updated in response to
26    issues and bugs prioritized by the Khronos OpenGL Working Group. For
27    extensions which have been promoted to a core Specification, fixes will
28    first appear in the latest version of that core Specification, and will
29    eventually be backported to the extension document. This policy is
30    described in more detail at
31        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
32
33Status
34
35    Complete. Approved by the ARB on June 26, 2015.
36    Ratified by the Khronos Board of Promoters on August 7, 2015.
37
38Version
39
40    Last Modified Date:         02/03/2015
41    Author Revision:            1
42
43Number
44
45    ARB Extension #178
46
47Dependencies
48
49    This extension is written against the OpenGL 4.5 (Core Profile)
50    Specification.
51
52    This extension is written against version 4.50 of the OpenGL Shading
53    Language Specification.
54
55    OpenGL 4.0 and GLSL 4.00 are required.
56
57    This extension interacts with AMD_gpu_shader_int64.
58
59    This extension interacts with NV_gpu_shader5.
60
61    This extension interacts with NV_shader_buffer_load.
62
63    This extension interacts with NV_vertex_attrib_integer_64bit.
64
65
66Overview
67
68    The extension introduces the following features for all shader types:
69
70      * support for 64-bit scalar and vector integer data types, including
71        uniform API, uniform buffer object, transform feedback, and shader
72        input and output support;
73
74      * new built-in functions to pack and unpack 64-bit integer types into a
75        two-component 32-bit integer vector;
76
77      * new built-in functions to convert double-precision floating-point
78        values to or from their 64-bit integer bit encodings;
79
80      * vector relational functions supporting comparisons of vectors of
81        64-bit integer types; and
82
83      * common functions abs, sign, min, max, clamp, and mix supporting
84        arguments of 64-bit integer types.
85
86
87New Procedures and Functions
88
89    void Uniform1i64ARB(int location, int64 x);
90    void Uniform2i64ARB(int location, int64 x, int64 y);
91    void Uniform3i64ARB(int location, int64 x, int64 y, int64 z);
92    void Uniform4i64ARB(int location, int64 x, int64 y, int64 z, int64 w);
93    void Uniform1i64vARB(int location, sizei count, const int64 *value);
94    void Uniform2i64vARB(int location, sizei count, const int64 *value);
95    void Uniform3i64vARB(int location, sizei count, const int64 *value);
96    void Uniform4i64vARB(int location, sizei count, const int64 *value);
97
98    void Uniform1ui64ARB(int location, uint64 x);
99    void Uniform2ui64ARB(int location, uint64 x, uint64 y);
100    void Uniform3ui64ARB(int location, uint64 x, uint64 y, uint64 z);
101    void Uniform4ui64ARB(int location, uint64 x, uint64 y, uint64 z, uint64 w);
102    void Uniform1ui64vARB(int location, sizei count, const uint64 *value);
103    void Uniform2ui64vARB(int location, sizei count, const uint64 *value);
104    void Uniform3ui64vARB(int location, sizei count, const uint64 *value);
105    void Uniform4ui64vARB(int location, sizei count, const uint64 *value);
106
107    void GetUniformi64vARB(uint program, int location, int64 *params);
108    void GetUniformui64vARB(uint program, int location, uint64 *params);
109    void GetnUniformi64vARB(uint program, int location, sizei bufSize,
110                            int64 *params);
111    void GetnUniformui64vARB(uint program, int location, sizei bufSize,
112                             uint64 *params);
113
114    void ProgramUniform1i64ARB(uint program, int location, int64 x);
115    void ProgramUniform2i64ARB(uint program, int location, int64 x, int64 y);
116    void ProgramUniform3i64ARB(uint program, int location, int64 x, int64 y,
117                               int64 z);
118    void ProgramUniform4i64ARB(uint program, int location, int64 x, int64 y,
119                               int64 z, int64 w);
120    void ProgramUniform1i64vARB(uint program, int location, sizei count,
121                                const int64 *value);
122    void ProgramUniform2i64vARB(uint program, int location, sizei count,
123                                const int64 *value);
124    void ProgramUniform3i64vARB(uint program, int location, sizei count,
125                                const int64 *value);
126    void ProgramUniform4i64vARB(uint program, int location, sizei count,
127                                const int64 *value);
128
129    void ProgramUniform1ui64ARB(uint program, int location, uint64 x);
130    void ProgramUniform2ui64ARB(uint program, int location, uint64 x, uint64 y);
131    void ProgramUniform3ui64ARB(uint program, int location, uint64 x, uint64 y,
132                                uint64 z);
133    void ProgramUniform4ui64ARB(uint program, int location, uint64 x, uint64 y,
134                                uint64 z, uint64 w);
135    void ProgramUniform1ui64vARB(uint program, int location, sizei count,
136                                 const uint64 *value);
137    void ProgramUniform2ui64vARB(uint program, int location, sizei count,
138                                 const uint64 *value);
139    void ProgramUniform3ui64vARB(uint program, int location, sizei count,
140                                 const uint64 *value);
141    void ProgramUniform4ui64vARB(uint program, int location, sizei count,
142                                 const uint64 *value);
143
144
145New Tokens
146
147    Returned by the <type> parameter of GetActiveAttrib, GetActiveUniform, and
148    GetTransformFeedbackVarying:
149
150        INT64_ARB                                       0x140E
151        UNSIGNED_INT64_ARB                              0x140F
152
153        INT64_VEC2_ARB                                  0x8FE9
154        INT64_VEC3_ARB                                  0x8FEA
155        INT64_VEC4_ARB                                  0x8FEB
156        UNSIGNED_INT64_VEC2_ARB                         0x8FF5
157        UNSIGNED_INT64_VEC3_ARB                         0x8FF6
158        UNSIGNED_INT64_VEC4_ARB                         0x8FF7
159
160
161Additions to Chapter 7 of the OpenGL 4.5 (Core Profile) Specification
162(Program Objects)
163
164    Modify Section 7.3.1, Program Interfaces
165
166    (add to Table 7.3, OpenGL Shading Language type tokens, p. 112)
167
168    +----------------------------+--------------+--------+--------+--------+
169    | Type Name Token            | Keyword      | Attrib |  Xfb   | Buffer |
170    +----------------------------+--------------+--------+--------+--------+
171    | INT64_ARB                  | int64_t      |   *    |   *    |   *    |
172    | INT64_VEC2_ARB             | i64vec2      |   *    |   *    |   *    |
173    | INT64_VEC3_ARB             | i64vec3      |   *    |   *    |   *    |
174    | INT64_VEC4_ARB             | i64vec4      |   *    |   *    |   *    |
175    | UNSIGNED_INT64_ARB         | uint64_t     |   *    |   *    |   *    |
176    | UNSIGNED_INT64_VEC2_ARB    | u64vec2      |   *    |   *    |   *    |
177    | UNSIGNED_INT64_VEC3_ARB    | u64vec3      |   *    |   *    |   *    |
178    | UNSIGNED_INT64_VEC4_ARB    | u64vec4      |   *    |   *    |   *    |
179    +----------------------------+--------------+--------+--------+--------+
180
181    Modify Section 7.6, Uniform Variables
182
183    (modify second paragraph on p. 125)
184
185        Scalar, vector, and matrix uniforms with double-precision components,
186    and scalar and vector uniforms with 64-bit integer components will consume
187    no more than twice the number of components of equivalent uniforms with
188    single-precision components.
189
190
191    Modify Section 7.6.1, Loading Uniform Variables
192
193    (add to the list of commands in first paragraph on p. 132)
194
195      void Uniform{1,2,3,4}{i64,ui64}ARB(int location, T value);
196      void Uniform{1,2,3,4}{i64,ui64}vARB(int location, const T *value);
197
198    (insert after sixth paragraph on p. 132)
199
200      The Uniform*i64{v}ARB and Uniform*ui{v}ARB commands will load count sets
201    of one to four 64-bit signed or unsigned integer values into a uniform
202    location defined as a 64-bit signed or unsigned integer scalar or vector
203    types.
204
205    (add to the list of commands in first paragraph on p. 134)
206
207      void ProgramUniform{1,2,3,4}{i64,ui64}ARB(uint program, int location,
208                                                T value);
209      void ProgramUniform{1,2,3,4}{i64,ui64}vARB(uint program, int location,
210                                                 const T *value);
211
212
213    Modify Section 7.6.2.1, Uniform Buffer Object Storage
214
215    (modify the first two bullets of the first paragraph on p. 136)
216
217      * Members of type bool int, uint, float, double, int64_t, and uint64_t
218        are respectively extracted from a buffer object by reading a single
219        uint, int, uint, float, double, int64_t, or uint64_t value at the
220        specified offset.
221
222      * Vectors with N elements with basic data types of bool, int, uint,
223        float, double, int64_t, or uint64_t are extracted as N values in
224        consecutive memory locations beginning at the specified offset, with
225        components stored in order with the first (X) component at the
226        lowest offset. The GL data type used for component extraction is
227        derived according to the rules for scalar members above.
228
229
230    Modify Section 7.13, Shader, Program, and Program Pipeline Queries
231
232    (add to the list of commands in last paragraph on p. 162)
233
234      void GetUniformi64vARB(uint program, int location, int64 *params);
235      void GetUniformui64vARB(uint program, int location, uint64 *params);
236      void GetnUniformi64vARB(uint program, int location, sizei bufSize,
237                              int64 *params);
238      void GetnUniformui64vARB(uint program, int location, sizei bufSize,
239                               uint64 *params);
240
241
242Additions to Chapter 11 of the OpenGL 4.5 (Core Profile) Specification
243(Programmable Vertex Processing)
244
245    Modify Section 11.1.1, Vertex Attributes
246
247    (modify third sentence of second paragraph on p. 368)
248
249    ... hardware resources. For the purposes of this test, attribute variables
250    of the type dvec3, dvec4, dmat2x3, dmat2x3, dmat3, dmat3x4, dmat4x3,
251    dmat4, i64vec3, i64vec4, u64vec3, and u64vec4 may count as consuming twice
252    as many attributes as equivalent single-precision types. While these types
253    use the same number of generic attributes as their single-precision
254    vectors of internal storage for each three- or four-component
255    double-precision or 64-bit integer vector.
256
257
258    Modify Section 11.1.2.1, Output Variables
259
260    (modify last sentence of fourth paragraph on p. 369)
261
262    ... multiple components. Each component of variables declared as double-
263    precision floating point scalars, vectors, or matrices, or declared as
264    64-bit integer scalars or vectors may be counted as consuming two
265    components.
266
267    (modify third bullet of the first paragraph on p. 373)
268
269      * any variable containing double-precision floating-point or 64-bit
270        integer components
271
272        - has an xfb_offset layout qualifier that is not a multiple of eight;
273          or
274        - is associated with a binding point with an xfb_stride layout
275          qualifier that is not a multiple of eight;
276
277    (modify second paragraph on p. 373)
278
279      For transform feedback purposes, each component of outputs declared as
280    double-precision floating-point scalars, vectors, or matrices, or 64-bit
281    integer scalars or vectors are considered to consume eight basic machine
282    units, and each component of any other type is considered to consume four
283    basic machine units.
284
285
286Modifications to the OpenGL Shading Language Specification, Version 4.50
287
288    Including the following line in a shader can be used to control the
289    language features described in this extension:
290
291      #extension GL_ARB_gpu_shader_int64 : <behavior>
292
293    where <behavior> is as specified in section 3.3.
294
295    New preprocessor #defines are added to the OpenGL Shading Language:
296
297      #define GL_ARB_gpu_shader_int64       1
298
299
300Additions to Chapter 3 of the OpenGL Shading Language Specification (Basics)
301
302    Modify Section 3.6, Keywords
303
304    (add the following to the list of reserved keywords at p. 17)
305
306    int64_t  i64vec2  i64vec3  i64vec4  uint64_t  u64vec2  u64vec3  u64vec4
307
308
309Additions to Chapter 4 of the OpenGL Shading Language Specification
310(Variables and Types)
311
312    Modify Section 4.1, Basic Types
313
314    (add to the basic "Transparent Types" table, p. 21)
315
316    +-----------+------------------------------------------------------------+
317    | Type      | Meaning                                                    |
318    +-----------+------------------------------------------------------------+
319    | int64_t   | a 64-bit signed integer                                    |
320    | uint64_t  | a 64-bit unsigned integer                                  |
321    | i64vec2   | a two-component 64-bit signed integer vector               |
322    | i64vec3   | a three-component 64-bit signed integer vector             |
323    | i64vec4   | a four-component 64-bit signed integer vector              |
324    | u64vec2   | a two-component 64-bit unsigned integer vector             |
325    | u64vec3   | a three-component 64-bit unsigned integer vector           |
326    | u64vec4   | a four-component 64-bit unsigned integer vector            |
327    +-----------+------------------------------------------------------------+
328
329
330    Modify Section 4.1.3, Integers
331
332    (replace first paragraph of the section, p. 25)
333
334    Signed and unsigned integer variables are fully supported. In this
335    document, the term integer is meant to generally include both signed and
336    unsigned integers, including both 32-bit and 64-bit integers. Unsigned
337    integers of type uint, uvec2, uvec3, and uvec4 have exactly 32 bits of
338    precision, while unsigned integers of type uint64_t, u64vec2, u64vec3, and
339    u64vec4 have exactly 64 bits of precision. Signed integers of type int,
340    ivec2, ivec3, and ivec4 have exactly 32 bits of precision, while signed
341    integers of type int64_t, i64vec2, i64vec3, and i64vec4 have exactly
342    64 bits of precision. Addition, subtraction, and shift operations
343    resulting in overflow or underflow will not cause any exceptions, nor
344    will they saturate, rather they will "wrap" to yield the low-order bits
345    of the result. Divison and multiplication operations resulting in overflow
346    or underflow will not cause any exception but will result in an undefined
347    value.
348
349    (add after the first paragraph of the section, p. 25)
350
351    Variables with the types "int64_t" and "uint64_t" represent signed and
352    unsigned integer values, respectively, with exactly 64 bits of precision.
353
354    (modify grammar rule for "integer-suffix", p. 26)
355
356      integer-suffix: one of
357        u U l L ul UL
358
359    (modify first sentence of second paragraph on p. 26)
360
361    No white space is allowed between the digits of an integer constant,
362    including after the leading 0 or after the leading 0x or 0X of a constant,
363    or before the suffix u, U, l, L, ul, or UL.
364
365    (modify third sentence of second paragraph on p. 26)
366
367    When the suffix u or U is present, the literal has type uint. When the
368    suffix l or L is present, the literal has type int64_t. When the suffix
369    ul or UL is present, the literal has type uint64_t. Otherwise, the type is
370    int.
371
372
373    Modify Section 4.1.10, Implicit Conversions
374
375    (modify table of implicit conversions on p. 35)
376
377    +----------------------+-------------------------------------------------+
378    | Type of expression   | Can be implicitly converted to                  |
379    +----------------------+-------------------------------------------------+
380    | int                  | uint, int64_t, uint64_t, float, double          |
381    | uint                 | uint64_t, float, double                         |
382    | int64_t              | uint64_t, double                                |
383    | uint64_t             | double                                          |
384    | ivec2                | uvec2, i64vec2, u64vec2, vec2, dvec2            |
385    | ivec3                | uvec3, i64vec3, u64vec3, vec3, dvec3            |
386    | ivec4                | uvec4, i64vec4, u64vec4, vec4, dvec4            |
387    | uvec2                | u64vec2, vec2, dvec2                            |
388    | uvec3                | u64vec3, vec3, dvec3                            |
389    | uvec4                | u64vec4, vec4, dvec4                            |
390    | i64vec2              | u64vec2, dvec2                                  |
391    | i64vec3              | u64vec3, dvec3                                  |
392    | i64vec4              | u64vec4, dvec4                                  |
393    | u64vec2              | dvec2                                           |
394    | u64vec3              | dvec3                                           |
395    | u64vec4              | dvec4                                           |
396    +----------------------+-------------------------------------------------+
397
398
399    Modify Section 4.3.6, Output Variables
400
401    (add new bullet to the list in the second paragraph on p. 49)
402
403      * A 64-bit integer scalar or vector (int64_t, uint64_t, i64vec2, i64vec3,
404        i64vec4, u64vec2, u64vec3, u64vec4)
405
406
407Additions to Chapter 5 of the OpenGL Shading Language Specification
408(Operators and Expressions)
409
410    Modify Section 5.4.1, Conversion and Scalar Constructors
411
412    (add to the constructor propotype list on p. 95)
413
414      int(int64_t)      // converts a 64-bit signed integer to a 32-bit signed integer
415      int(uint64_t)     // converts a 64-bit unsigned integer to a 32-bit signed integer
416      uint(int64_t)     // converts a 64-bit signed integer to a 32-bit unsigned integer
417      uint(uint64_t)    // converts a 64-bit unsigned integer to a 32-bit unsigned integer
418      bool(int64_t)     // converts a 64-bit signed integer to a Boolean
419      bool(uint64_t)    // converts a 64-bit unsigned integer to a Boolean
420      float(int64_t)    // converts a 64-bit signed integer to a float
421      float(uint64_t)   // converts a 64-bit unsigned integer to a float
422      double(int64_t)   // converts a 64-bit signed integer to a double
423      double(uint64_t)  // converts a 64-bit unsigned integer to a double
424      int64_t(int)      // converts a 32-bit signed integer to a 64-bit signed integer
425      int64_t(uint)     // converts a 32-bit unsigned integer to a 64-bit signed integer
426      int64_t(bool)     // converts a Boolean to a 64-bit signed integer
427      int64_t(float)    // converts a float to a 64-bit signed integer
428      int64_t(double)   // converts a double to a 64-bit signed integer
429      uint64_t(int)     // converts a 32-bit signed integer to a 64-bit unsigned integer
430      uint64_t(uint)    // converts a 32-bit unsigned integer to a 64-bit unsigned integer
431      uint64_t(bool)    // converts a Boolean to a 64-bit unsigned integer
432      uint64_t(float)   // converts a float to a 64-bit unsigned integer
433      uint64_t(double)  // converts a double to a 64-bit unsigned integer
434
435    (modify second sentence of first paragraph on p. 96)
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. 96)
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. 111)
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. 138)
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. 142)
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. 147)
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. 154)
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. 154)
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. 187)
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. 188)
608
609      primary_expression:
610        ...
611        INT64CONSTANT
612        UINT64CONSTANT
613        ...
614
615    (add to the rule of "type_specifier_nonarray" on p. 195)
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 ARB_gpu_shader_int64
634    then the overloaded built-in functions abs, sign, min, max, clamp, and mix
635    are not available.
636
637
638Dependencies on NV_shader_buffer_load
639
640    If NV_shader_buffer_load is supported, that specification should be edited
641    as follows, to allow pointers to dereference the new data types added by
642    this extension.
643
644    Modify "Section 2.20.X, Shader Memory Access" from NV_shader_buffer_load.
645
646    (add rules for loads of variables having the new data types from this
647    extension to the list of bullets following "When a shader dereferences a
648    pointer variable")
649
650    - Data of type int64_t and uint64_t are read from or written to memory as
651      a signel 64-bit signed and unsigned integer value, respectively, at the
652      specified GPU address.
653
654
655Dependencies on NV_vertex_attrib_integer_64bit
656
657    This extension only provides the ability to specify 64-bit integer input
658    variables in a GLSL vertex shader, but does not provide a way to specify
659    the values of the corresponding vertex attributes via the OpenGL API.
660    The NV_vertex_attrib_integer_64bit extension exactly provides that
661    functionality.
662
663
664Errors
665
666    None.
667
668New State
669
670    None.
671
672New Implementation Dependent State
673
674    None.
675
676Issues
677
678    (1) How the functionality in this extension is different than the 64-bit
679        integer support introduced by NV_gpu_shader5 and AMD_gpu_shader_int64?
680
681      RESOLVED: This extension is a functional superset of the 64-bit integer
682      support in NV_gpu_shader5 with the following additions:
683
684        * support for overloaded versions of the functions abs, sign, min,
685          max, clamp, and mix that accept 64-bit integers as parameters.
686
687      Also, this extension is equivalent with AMD_gpu_shader_int64, except that
688      the entry points now have an ARB suffix.
689
690    (2) How do the implicit conversions impact binary operators?
691
692      RESOLVED: For binary operators, we prefer converting to a common type
693      that is as close as possible in size and type to the original
694      expression.
695
696    (3) How do the implicit conversions impact function overloading rules?
697
698      RESOLVED: We extend the preference rules in core OpenGL to account
699      for the new data types, adding a rule to favor conversion from 32-bit
700      integers to 64-bit integers over coversions to floating-point values.
701
702    (4) What should be done to distinguish between 32- and 64-bit integer
703        constants?
704
705      RESOLVED: We will use "L" and "UL" to identify signed and unsigned
706      64-bit integer constants; the use of "L" matches a similar ("long")
707      suffix in the C programming language.  C leaves the size of integer
708      types implementation-dependent, and many implementations require an "LL"
709      suffix to declare 64-bit integer constants.  With our size definitions,
710      "L" will be considered sufficient to make an integer constant 64-bit.
711
712    (5) Should provide support for vertex attributes with 64-bit components,
713        and if so, how should the support be provided in the OpenGL API?
714
715      RESOLVED: Yes, but in order to specify 64-bit vertex attribute values
716      in the OpenGL API support for NV_vertex_attrib_integer_64bit or a
717      similar extension is also required.
718
719    (6) Should we support 64-bit integer uniforms in the default uniform
720        block?
721
722      RESOLVED: Yes, for completeness.
723
724    (7) Should we support 64-bit integer types as members of uniform blocks,
725        shader storage buffer blocks, or as transform feedback varyings?
726
727      RESOLVED: Yes, support all of them. 64-bit integers will consume eight
728      basic machine units just like double-precision floating-point variables.
729
730    (8) How do the uniform loading commands introduced by this extension
731        interact similar commands added by NV_shader_buffer_load?
732
733      RESOLVED: NV_shader_buffer_load provided the command Uniformui64NV to
734      load pointer uniforms with a single 64-bit unsigned integer.  This
735      extension provides vectors of 64-bit unsigned integers, so we needed
736      Uniform{2,3,4}ui64NV commands.  We chose to provide a Uniform1ui64NV
737      command, which will be functionally equivalent to Uniformui64NV.
738
739    (9) Should we provide distinct sized types for 32-bit integers, floats,
740        and doubles?
741
742      RESOLVED: No. While NV_gpu_shader5 does add such types, it seems there
743      isn't much value in adding those in this extension, especially because
744      this extension strictly focuses on supporting 64-bit integers.
745
746    (10) Can the 64-bit uniform APIs be used to load values for uniforms of
747         type "bool", "bvec2", "bvec3", or "bvec4"?
748
749      RESOLVED: No. OpenGL 2.0 and beyond did allow "bool" variable to be
750      set with Uniform*i* and Uniform*f APIs, and OpenGL 3.0 extended that
751      support to Uniform*ui* for orthogonality.  But it seems pointless to
752      extended this capability forward to 64-bit Uniform APIs as well.
753
754    (11) There exists both an UNSIGNED_INT64_AMD and UNSIGNED_INT64_NV token
755         with different values (the former existed earlier) so which token
756         value this extension should reuse?
757
758      DISCUSSION: No functions in this extension accept these values as
759      inputs, they only should return one of these in various scenarios.
760
761      RESOLVED: This extension will reuse the value of UNSIGNED_INT64_NV to
762      stay source code compatible with NV_gpu_shader5 and AMD_gpu_shader_int64.
763
764Revision History
765
766    Rev.    Date    Author    Changes
767    ----  --------  --------  -------------------------------------------------
768     1    02/03/15  drakos    Draft based on AMD_gpu_shader_int64.
769                              Rebased language for GL 4.5 and GLSL 4.50.
770