1Name 2 3 AMD_gpu_shader_int16 4 5Name Strings 6 7 GL_AMD_gpu_shader_int16 8 9Contact 10 11 Dominik Witczak, AMD (dominik.witczak 'at' amd.com) 12 13Contributors 14 15 Daniel Rakos, AMD 16 Matthaeus G. Chajdas, AMD 17 Quentin Lin, AMD 18 Rex Xu, AMD 19 Timothy Lottes, AMD 20 Zhi Cai, AMD 21 22Status 23 24 Shipping. 25 26Version 27 28 Last Modified Date: 03/28/2018 29 Author Revision: #2 30 31Number 32 33 OpenGL Extension #507 34 35Dependencies 36 37 This extension is written against version 4.50 of the OpenGL Shading 38 Language Specification. 39 40 GLSL 4.00 is required. 41 42 This extension interacts with AMD_gpu_shader_half_float. 43 This extension interacts with ARB_gpu_shader_int64. 44 This extension interacts with KHR_vulkan_glsl. 45 46Overview 47 48 This extension was developed to allow implementations supporting 16-bit 49 integers to expose the feature in GLSL. 50 51 The extension introduces the following features for all shader types: 52 53 * new built-in functions to pack and unpack 32-bit integer types into a 54 two-component 16-bit integer vector; 55 56 * new built-in functions to convert half-precision floating-point 57 values to or from their 16-bit integer bit encodings; 58 59 * vector relational functions supporting comparisons of vectors of 60 16-bit integer types; and 61 62 * common functions abs, frexp, ldexp, sign, min, max, clamp, and mix 63 supporting arguments of 16-bit integer types. 64 65 66New Procedures and Functions 67 68 NONE 69 70 71New Tokens 72 73 NONE 74 75 76Modifications to the OpenGL Shading Language Specification, Version 4.50 77 78 Including the following line in a shader can be used to control the 79 language features described in this extension: 80 81 #extension GL_AMD_gpu_shader_int16 : <behavior> 82 83 where <behavior> is as specified in section 3.3. 84 85 New preprocessor #defines are added to the OpenGL Shading Language: 86 87 #define GL_AMD_gpu_shader_int16 1 88 89 90Additions to Chapter 3 of the OpenGL Shading Language Specification (Basics) 91 92 Modify Section 3.6, Keywords 93 94 (add the following to the list of reserved keywords at p. 18) 95 96 int16_t i16vec2 i16vec3 i16vec4 uint16_t u16vec2 u16vec3 u16vec4 97 98 99Additions to Chapter 4 of the OpenGL Shading Language Specification 100(Variables and Types) 101 102 Modify Section 4.1, Basic Types 103 104 (add to the basic "Transparent Types" table, p. 19) 105 106 +-----------+------------------------------------------------------------+ 107 | Type | Meaning | 108 +-----------+------------------------------------------------------------+ 109 | int16_t | a 16-bit signed integer | 110 | uint16_t | a 16-bit unsigned integer | 111 | i16vec2 | a two-component 16-bit signed integer vector | 112 | i16vec3 | a three-component 16-bit signed integer vector | 113 | i16vec4 | a four-component 16-bit signed integer vector | 114 | u16vec2 | a two-component 16-bit unsigned integer vector | 115 | u16vec3 | a three-component 16-bit unsigned integer vector | 116 | u16vec4 | a four-component 16-bit unsigned integer vector | 117 +-----------+------------------------------------------------------------+ 118 119 120 Modify Section 4.1.3, Integers 121 122 (replace first paragraph of the section, p. 26) 123 124 Signed and unsigned integer variables are fully supported. In this 125 document, the term integer is meant to generally include both signed and 126 unsigned integers, including both 16-bit and 32-bit integers. Unsigned 127 integers of type uint16_t, u16vec2, u16vec3, and u16vec4 have exactly 16 bits 128 of precision, while unsigned integers of type uint, uvec2, uvec3, and 129 uvec4 have exactly 32 bits of precision. Signed integers of type int16_t, 130 i16vec2, i16vec3, and i16vec4 have exactly 16 bits of precision, while signed 131 integers of type int, ivec2, ivec3, and ivec4 have exactly 32 bits of precision. 132 Addition, subtraction, and shift operations resulting in overflow or underflow 133 will not cause any exceptions, nor will they saturate, rather they will "wrap" 134 to yield the low-order bits of the result. Divison and multiplication operations 135 resulting in overflow or underflow will not cause any exception but will result in 136 an undefined value. 137 138 Change "integer-suffix" definition: 139 140 "integer-suffix: 141 unsigned-suffix short-suffixopt 142 short-suffix 143 144 unsigned-suffix: one of 145 u U 146 short-suffix: one of 147 s S 148 149 Modify the next paragraph to say: 150 "No white space is allowed between the digits of an integer constant, 151 including after the leading 0 or after the leading 0x or 0X of a constant, 152 or before the integer-suffix. When tokenizing, the maximal token matching 153 the above will be recognized before a new token is started. 154 When the suffix is present, the literal type is determined as follows: 155 ------------------------------------- 156 | suffix | type | 157 ------------------------------------- 158 | no suffix | int | 159 | u or U | uint | 160 | s or S | int16_t | 161 | both u/U and s/S | uint16_t | 162 ------------------------------------- 163 A leading unary minus sign (-) is interpreted as an arithmetic 164 unary negation, not as part of the constant. Hence, literals themselves 165 are always expressed with non-negative syntax, though they could result 166 in a negative value." 167 168 Modify subsection 4.1.10 Implicit Conversions to say: 169 "In some situations, an expression and its type will be implicitly 170 converted to a different type. Such conversion are classified into the 171 following types: integral promotions, floating-point promotions, 172 integral conversions, floating-point conversions, and 173 floating-integral conversions. 174 175 The following table shows allowed integral promotions: 176 -------------------------------------------------------- 177 | Type of | Can be implicitly promoted to | 178 | expression | | 179 -------------------------------------------------------- 180 | int16_t | int, int64_t, uint16_t | 181 | uint16_t | uint, uint64_t | 182 -------------------------------------------------------- 183 | i16vec2 | ivec2, i64vec2, u64vec2 | 184 | u16vec2 | uvec2, u64vec2 | 185 -------------------------------------------------------- 186 | i16vec3 | ivec3, i64vec3, u64vec3 | 187 | u16vec3 | uvec3, u64vec3 | 188 -------------------------------------------------------- 189 | i16vec4 | ivec4, i64vec4, u64vec4 | 190 | u16vec4 | uvec4, u64vec4 | 191 -------------------------------------------------------- 192 193 The following table shows allowed integral conversions: 194 ------------------------------------------------------------------------- 195 | Type of | Can be implicitly converted to | 196 | expression | | 197 ------------------------------------------------------------------------- 198 | int16_t | uint16_t, uint, uint64_t | 199 | i16vec2 | u16vec2, uvec2, u64vec2 | 200 | i16vec3 | u16vec3, uvec3, u64vec3 | 201 | i16vec4 | u16vec4, uvec4, u64vec4 | 202 | uint16_t | uint, uint64_t | 203 | u16vec2 | uvec2, u64vec2 | 204 | u16vec3 | uvec3, u64vec3 | 205 | u16vec4 | uvec4, u64vec4 | 206 | int | uint, uint64_t | 207 ------------------------------------------------------------------------- 208 209 The following table shows allowed floating-integral conversions: 210 -------------------------------------------------------- 211 | Type of | Can be implicitly converted to | 212 | expression | | 213 -------------------------------------------------------- 214 | int16_t | double, float16_t, float | 215 | i16vec2 | dvec2, f16vec2, vec2 | 216 | i16vec3 | dvec3, f16vec3, vec3 | 217 | i16vec4 | dvec4, f16vec4, vec4 | 218 | uint16_t | double, float16_t, float | 219 | u16vec2 | dvec2, f16vec2, vec2 | 220 | u16vec3 | dvec3, f16vec3, vec3 | 221 | u16vec4 | dvec4, f16vec4, vec4 | 222 | int | float | 223 | ivec2 | vec2 | 224 | ivec3 | vec3 | 225 | ivec4 | vec4 | 226 | uint | float | 227 | uvec2 | vec2 | 228 | uvec3 | vec3 | 229 | uvec4 | vec4 | 230 -------------------------------------------------------- 231 232 When performing implicit conversion for binary operators, there may be 233 multiple data types to which the two operands can be converted. For 234 example, when adding an int32_t value to a uint32_t value, both values 235 can be implicitly converted to uint32_t, float32_t, and double. In such 236 cases conversion happens as defined as follows: 237 (Note: In this paragraph vector and matrix types are referred to as 238 types derived from scalar types with the same bit width and bit 239 interpretation) 240 - If either operand has type double or derived from double, 241 the other shall be converted to double or derived type. 242 - Otherwise, if either operand has type float32_t or derived from 243 float32_t, the other shall be converted to float32_t or derived type. 244 - Otherwise, if either operand has type float16_t or derived from 245 float16_t, the other shall be converted to float16_t or derived type. 246 - Otherwise, the integral promotions shall be performed on both 247 operands. Then the following rules shall be applied to the promoted 248 operands: 249 - If both operands have the same type, no further conversion 250 is needed. 251 - Otherwise, if both operands have signed integer types or both 252 have unsigned integer types, the operand with the type of lesser 253 integer conversion rank shall be converted to the type of the 254 operand with greater rank. 255 - Otherwise, if the operand that has unsigned integer type has rank 256 greater than or equal to the rank of the type of the other 257 operand, the operand with signed integer type shall be converted 258 to the type of the operand with unsigned integer type. 259 - Otherwise, if the type of the operand with signed integer type can 260 represent all of the values of the type of the operand with 261 unsigned integer type, the operand with unsigned integer type 262 shall be converted to the type of the operand with signed 263 integer type. 264 - Otherwise, both operands shall be converted to the unsigned 265 integer type corresponding to the type of the operand with signed 266 integer type. 267 268 The conversions listed in the following subsections are done only as 269 indicated by other sections of this specification. 270 271 Every integer type has an integer conversion rank defined as follows: 272 - No two signed integer types have the same rank. 273 - The rank of a scalar signed integer type shall be greater than the rank 274 of any scalar signed integer type with a smaller size. 275 - The rank of any vector signed integer type is equal to the rank of the 276 base scalar signed integer type. 277 - The rank of int64_t shall be greater than the rank of int32_t, which 278 shall be greater than the rank of int16_t. 279 - The rank of any scalar unsigned integer type shall equal the rank of 280 the corresponding scalar signed integer type. 281 - The rank of any vector unsigned integer type is equal to the rank of 282 the respective scalar unsigned integer type. 283 284Additions to Chapter 5 of the OpenGL Shading Language Specification 285(Operators and Expressions) 286 287 Modify Section 5.4.1, Conversion and Scalar Constructors 288 289 (add after first list of constructor examples on p. 97) 290 291 bool(int16_t) // converts a 16-bit signed integer value to a Boolean 292 // value. 293 bool(uint16_t) // converts a 16-bit unsigned integer value to a Boolean 294 // value. 295 double(int16_t) // converts a 16-bit signed integer value to a double 296 // value. 297 double(uint16_t) // converts a 16-bit unsigned integer value to a double 298 // value. 299 float(int16_t) // converts a 16-bit signed integer value to a float 300 // value. 301 float(uint16_t) // converts a 16-bit unsigned integer value to a float 302 // value. 303 float16_t(int16_t) // converts a 16-bit signed integer value to a 16-bit 304 // float value. 305 float16_t(uint16_t) // converts a 16-bit unsigned integer value to a 16-bit 306 // float value. 307 int16_t(bool) // converts a Boolean value to a 16-bit signed integer 308 // value. 309 int16_t(double) // converts a double value to a 16-bit signed integer 310 // value. 311 int16_t(float) // converts a float value to a 16-bit signed integer 312 // value. 313 int16_t(float16_t) // converts a 16-bit float value to a 16-bit signed 314 // integer value. 315 int16_t(int64_t) // converts a 64-bit signed integer value to a 16-bit 316 // signed integer value. 317 int16_t(int) // converts a signed integer value to a 16-bit signed 318 // integer value. 319 int16_t(uint) // converts an unsigned integer value to a 16-bit signed 320 // integer value. 321 int16_t(uint16_t) // converts a 16-bit unsigned integer value to a 16-bit 322 // signed integer value. 323 int16_t(uint64_t) // converts a 64-bit unsigned integer value to a 16-bit 324 // signed integer value. 325 int(int16_t) // converts a 16-bit signed integer value to a signed 326 // integer value. 327 int(uint16_t) // converts a 16-bit unsigned integer value to a signed 328 // integer value. 329 int64_t(int16_t) // converts a 16-bit signed integer value to a 64-bit 330 // signed integer value. 331 int64_t(uint16_t) // converts a 16-bit unsigned integer value to a 64-bit 332 // signed integer value. 333 uint16_t(bool) // converts a Boolean value to a 16-bit unsigned integer 334 // value. 335 uint16_t(double) // converts a double value to a 16-bit unsigned integer 336 // value. 337 uint16_t(float) // converts a float value to a 16-bit unsigned integer 338 // value. 339 uint16_t(float16_t) // converts a 16-bit float value to a 16-bit unsigned 340 // integer value. 341 uint16_t(int) // converts a signed integer value to a 16-bit unsigned 342 // integer value. 343 uint16_t(int16_t) // converts a 16-bit signed integer value to a 16-bit 344 // unsigned integer value. 345 uint16_t(uint) // converts an unsigned integer value to a 16-bit unsigned 346 // integer value. 347 uint16_t(int64_t) // converts a 64-bit signed integer value to a 16-bit 348 // unsigned integer value. 349 uint16_t(uint64_t) // converts a 64-bit unsigned integer value to a 16-bit 350 // unsigned integer value. 351 uint(int16_t) // converts a 16-bit signed integer value to an unsigned 352 // integer value. 353 uint(uint16_t) // converts a 16-bit unsigned integer value to an unsigned 354 // integer value. 355 uint64_t(int16_t) // converts a 16-bit signed integer value to a 64-bit 356 // unsigned integer value. 357 uint64_t(uint16_t) // converts a 16-bit unsigned integer value to a 64-bit 358 // unsigned integer value. 359 360 (modify second sentence of first paragraph on p. 98) 361 362 ... is dropped. It is undefined to convert a negative floating-point value 363 to an uint or uint16_t. 364 365 (replace third paragraph on p. 98) 366 367 The constructors int(uint) and int16_t(uint16_t) preserve the bit pattern 368 in the argument, which will change the argument's value if its sign bit is 369 set. The constructor uint(int) and uint16_t(int16_t) preserve the bit 370 pattern in the argument, which will change its value if it is negative. 371 372 373Additions to Chapter 6 of the OpenGL Shading Language Specification 374(Statements and Structure) 375 376 Modify Section 6.1, Function Defintions 377 378 (replace second rule in third paragraph on p. 113) 379 380 2. A match involving a conversion from a signed integer, unsigned 381 integer, or floating-point type to a similar type having a larger 382 number of bits is better than a match involving any other implicit 383 conversion. 384 385 386Additions to Chapter 8 of the OpenGL Shading Language Specification 387(Built-in Functions) 388 389 (insert after third sentence of last paragraph on p. 132) 390 391 ... genUType is used as the argument. Where the input arguments (and 392 corresponding output) can be int16_t, i16vec2, i16vec3, i16vec4, 393 genI16Type is used as the argument. Where the input arguments (and 394 corresponding output) can be uint16_t, u16vec2, u16vec3, u16vec4, 395 genU16Type is used as the argument. 396 397 398 Modify Section 8.3, Common Functions 399 400 (add to the table of common functions on p. 136) 401 402 +-------------------------------------------------+----------------------------------------------------+ 403 | Syntax | Desciption | 404 +-------------------------------------------------+----------------------------------------------------+ 405 | genI16Type abs(genI16Type x) | Returns x if x >= 0; otherwise it returns -x. | 406 +-------------------------------------------------+----------------------------------------------------+ 407 | genI16Type sign(genI16Type x) | Returns 1 if x > 0, 0 if x = 0, or -1 if x < 0. | 408 +-------------------------------------------------+----------------------------------------------------+ 409 | genI16Type min(genI16Type x, | Returns y if y < x; otherwise it returns x. | 410 | genI16Type y) | | 411 | genI16Type min(genI16Type x, | | 412 | int16_t y) | | 413 | genU16Type min(genU16Type x, | | 414 | genU16Type y) | | 415 | genU16Type min(genU16Type x, | | 416 | uint16_t y) | | 417 +-------------------------------------------------+----------------------------------------------------+ 418 | genI16Type max(genI16Type x, | Returns y if x < y; otherwise it returns x. | 419 | genI16Type y) | | 420 | genI16Type max(genI16Type x, | | 421 | int16_t y) | | 422 | genU16Type max(genU16Type x, | | 423 | genU16Type y) | | 424 | genU16Type max(genU16Type x, | | 425 | uint16_t y) | | 426 +-------------------------------------------------+----------------------------------------------------+ 427 | genI16Type clamp(genI16Type x, | Returns min(max(x, minVal), maxVal). | 428 | genI16Type minVal, | | 429 | genI16Type maxVal) | Results are undefined if minVal > maxVal. | 430 | genI16Type clamp(genI16Type x, | | 431 | int16_t minVal, | | 432 | int16_t maxVal) | | 433 | genU16Type clamp(genU16Type x, | | 434 | genU16Type minVal, | | 435 | genU16Type maxVal) | | 436 | genU16Type clamp(genU16Type x, | | 437 | uint16_t minVal, | | 438 | uint16_t maxVal) | | 439 +-------------------------------------------------+----------------------------------------------------+ 440 | genI16Type mix(genI16Type x, | Selects which vector each returned component comes | 441 | genI16Type y, | from. For a component of a that is false, the | 442 | genBType a) | corresponding component of x is returned. For a | 443 | genU16Type mix(genU16Type x, | component of a that is true, the corresponding | 444 | genU16Type y, | component of y is returned. | 445 | genBType a) | | 446 +-------------------------------------------------+----------------------------------------------------+ 447 | genI16Type float16BitsToInt16(genF16Type value) | Returns a signed or unsigned 16-bit integer value | 448 | genU16Type float16BitsToUint16(genF16Type value)| representing the encoding of a 16-bit float. The | 449 | | half floating-point value's bit-level | 450 | | representation is preserved | 451 +-------------------------------------------------+----------------------------------------------------+ 452 | genF16Type int16BitsToFloat16(genI16Type value) | Returns a half-floating point value corresponding | 453 | genF16Type uint16BitsToFloat16(genU16Type value)| to a signed or unsigned 16-bit integer encoding of | 454 | | a 16-bit float. If a NaN is passed in, it will not | 455 | | signal, and the resulting value is unspecified. If | 456 | | an Inf is passed in, the resulting value is the | 457 | | corresponding Inf. | 458 +-------------------------------------------------+----------------------------------------------------+ 459 | genF16Type frexp(genF16Type x, | Splits x into a floating-point significand in the | 460 | out genI16Type exp) | range [0.5, 1.0) and an integral exponent of two, | 461 | | such that: | 462 | | | 463 | | x = significand * 2 ** exponent | 464 | | | 465 | | The significand is returned by the function and | 466 | | the exponent is returned in the parameter exp. For | 467 | | a floating-point value of zero, the significand | 468 | | and exponent are both zero. For a floating-point | 469 | | value that is an infinity or is not a number, the | 470 | | results are undefined. | 471 | | | 472 | | If an implementation supports negative 0, | 473 | | frexp(-0) should return -0; otherwise it will | 474 | | return 0. | 475 +-------------------------------------------------+----------------------------------------------------+ 476 | genF16Type ldexp(genF16Type x, | Returns x * (2 ** exp). | 477 | genI16Type exp) | | 478 +-------------------------------------------------+----------------------------------------------------+ 479 480 481 Modify Section 8.4, Floating-Point and Integer Pack and Unpack Functions 482 483 (add to the table of pack and unpack functions on p. 149 484 485 +-----------------------------------+------------------------------------------------------+ 486 | Syntax | Desciption | 487 +-----------------------------------+------------------------------------------------------+ 488 | | Returns an unsigned 32- or 64-bit integer obtained | 489 | int packInt2x16 (i16vec2 v) | by packing the components of a two- or | 490 | int64_t packInt4x16 (i16vec4 v) | four-component 16-bit signed or unsigned integer | 491 | uint packUint2x16(u16vec2 v) | vector, respectively. The first vector component | 492 | uint64_t packUint4x16(u16vec4 v) | specifies the 16 least significant bits; the | 493 | | last component specifies the 16 most significant | 494 | | bits. | 495 +-----------------------------------+------------------------------------------------------+ 496 | | Returns a signed or unsigned integer vector built | 497 | i16vec2 unpackInt2x16 (int v)| from a 32- or 64-bit signed or unsigned integer | 498 | i16vec4 unpackInt4x16 (int64_t v)| scalar, respectively. The first component of the | 499 | u16vec2 unpackUint2x16(uint v)| vector contains the 16 least significant bits of the | 500 | u16vec4 unpackUint4x16(uint64_t v)| input; the last component specifies the 16 most | 501 | | significant bits. | 502 | | | 503 +-----------------------------------+------------------------------------------------------+ 504 505 506 Modify Section, 8.7, Vector Relational Functions 507 508 Modify the first table to state: 509 510 +-------------+-----------------------------+ 511 | Placeholder | Specific Types Allowed | 512 +-------------+-----------------------------+ 513 | i16vec | i16vec2, i16vec3, i16vec4 | 514 | u16vec | u16vec2, u16vec3, u16vec4 | 515 +-------------+-----------------------------+ 516 517 (add to the table of vector relational functions at the bottom of p. 147) 518 519 +-------------------------------------------+-----------------------------------------------+ 520 | Syntax | Desciption | 521 +-------------------------------------------+-----------------------------------------------+ 522 | bvec lessThan(i16vec x, i16vec y) | Returns the component-wise compare of x < y. | 523 | bvec lessThan(u16vec x, u16vec y) | | 524 +-------------------------------------------+-----------------------------------------------+ 525 | bvec lessThanEqual(i16vec x, i16vec y) | Returns the component-wise compare of x <= y. | 526 | bvec lessThanEqual(u16vec x, u16vec y) | | 527 +-------------------------------------------+-----------------------------------------------+ 528 | bvec greaterThan(i16vec x, i16vec y) | Returns the component-wise compare of x > y. | 529 | bvec greaterThan(u16vec x, u16vec y) | | 530 +-------------------------------------------+-----------------------------------------------+ 531 | bvec greaterThanEqual(i16vec x, i16vec y) | Returns the component-wise compare of x >= y. | 532 | bvec greaterThanEqual(u16vec x, u16vec y) | | 533 +-------------------------------------------+-----------------------------------------------+ 534 | bvec equal(i16vec x, i16vec y) | Returns the component-wise compare of x == y. | 535 | bvec equal(u16vec x, u16vec y) | | 536 +-------------------------------------------+-----------------------------------------------+ 537 | bvec notEqual(i16vec x, i16vec y) | Returns the component-wise compare of x != y. | 538 | bvec notEqual(u16vec x, u16vec y) | | 539 +-------------------------------------------+-----------------------------------------------+ 540 541 542 Modify language in the Overview section of GL_KHR_vulkan_glsl 543 544 Replace the following sentence: 545 546 The constant_id can only be applied to a scalar *int*, a scalar *float* 547 or a scalar *bool*. 548 549 with: 550 551 The constant_id can only be applied to a scalar *int* (incl. 16-bit signed 552 and unsigned integers), a scalar *float* or a scalar *bool*. 553 554 555Dependencies on AMD_gpu_shader_half_float 556 557 If the shader enables only AMD_gpu_shader_int16, but not AMD_gpu_shader_half_float 558 then: 559 560 * the table describing floating-integral conversions is discarded. 561 * the float16BitsTo{Int, Uint}16(), {int, uint}16BitsToFloat16(), frexp() 562 and ldexp() functions are unavailable. 563 564 565Dependencies on ARB_gpu_shader_int64: 566 567 If the shader enables only AMD_gpu_shader_int16, but not ARB_gpu_shader_int64 568 then: 569 570 * all references to int64_t and uint64_t should be ignored. 571 572Dependencies on KHR_vulkan_glsl: 573 574 If the shader only enables AMD_gpu_shader_int16, but not KHR_vulkan_glsl, 575 then any changes to the language of the latter specification should be discarded. 576 577Dependencies on AMD_shader_trinary_minmax 578 579 If the shader enables AMD_shader_trinary_minmax, this extension adds 580 additional common functions. 581 582 Modify Section 8.3, Common Functions 583 584 (add to the table of common functions on p. 144) 585 586 +-------------------------------------------+-----------------------------------------------+ 587 | Syntax | Description | 588 +-------------------------------------------+-----------------------------------------------+ 589 | genI16Type min3(genI16Type x, | Returns the per-component minimum value of x, | 590 | genI16Type y, | y, and z. | 591 | genI16Type z) | | 592 | genU16Type min3(genU16Type x, | | 593 | genU16Type y, | | 594 | genU16Type z) | | 595 +-------------------------------------------+-----------------------------------------------+ 596 | genI16Type max3(genI16Type x, | Returns the per-component maximum value of x, | 597 | genI16Type y, | y, and z. | 598 | genI16Type z) | | 599 | genU16Type max3(genU16Type x, | | 600 | genU16Type y, | | 601 | genU16Type z) | | 602 +-------------------------------------------+-----------------------------------------------+ 603 | genI16Type mid3(genI16Type x, | Returns the per-component median value of x, | 604 | genI16Type y, | y, and z. | 605 | genI16Type z) | | 606 | genU16Type mid3(genU16Type x, | | 607 | genU16Type y, | | 608 | genU16Type z) | | 609 +-------------------------------------------+-----------------------------------------------+ 610 611Errors 612 613 None. 614 615New State 616 617 None. 618 619New Implementation Dependent State 620 621 None. 622 623Issues 624 625 (1) Should the new int16_t and uint16_t types support types as members of 626 uniform blocks and shader storage buffer blocks? 627 628 RESOLVED: Yes, both types can be used in both SSBOs and UBOs, each consuming 629 2 basic machine units. 630 631 632 (2) Should we support int16_t and uint16_t types as members of uniform blocks, 633 shader storage buffer blocks, or as transform feedback varyings? 634 635 RESOLVED: Yes, support all of them. both types consume two basic machine 636 units. Some examples: 637 638 struct S { 639 640 uint16_t x; // rule 1: align = 2, takes offsets 0-1 641 u16vec2 y; // rule 2: align = 4, takes offsets 4-7 642 u16vec3 z; // rule 3: align = 8, takes offsets 8-13 643 }; 644 645 layout(std140) uniform B1 { 646 647 uint16_t a; // rule 1: align = 2, takes offsets 0-1 648 u16vec2 b; // rule 2: align = 4, takes offsets 4-7 649 u16vec3 c; // rule 3: align = 8, takes offsets 8-13 650 uint16_t d[2]; // rule 4: align = 16, array stride = 16, 651 // takes offsets 16-47 652 S g; // rule 9: align = 16, g.x takes offsets 653 // 48-49, g.y takes offsets 52-55, 654 // g.z takes offsets 56-63 655 S h[2]; // rule 10: align = 16, array stride = 16, h[0] 656 // takes offsets 64-77, h[1] takes 657 // offsets 78-93 658 }; 659 660 layout(std430) buffer B2 { 661 662 uint16_t o; // rule 1: align = 2, takes offsets 0-1 663 u16vec2 p; // rule 2: align = 4, takes offsets 4-7 664 u16vec3 q; // rule 3: align = 8, takes offsets 8-13 665 uint16_t r[2]; // rule 4: align = 2, array stride = 2, takes 666 // offsets 14-17 667 S u; // rule 9: align = 8, u.x takes offsets 668 // 24-25, u.y takes offsets 28-31, u.z 669 // takes offsets 32-37 670 S v[2]; // rule 10: align = 8, array stride = 16, v[0] 671 // takes offsets 40-55, v[1] takes 672 // offsets 56-71 673 }; 674 675 (3) Are interactions with GL_AMD_shader_ballot supported? 676 (4) Are interactions with GL_AMD_shader_explicit_vertex_parameter supported? 677 (5) Are interactions with GL_AMD_shader_trinary_minmax supported? 678 679 RESOLVED: Not yet. These will be resolved at a later time. 680 681 (6) Does this extension provide a new subpassLoad() function prototype which 682 returns a(n) {u}int16 vector value? 683 684 RESOLVED: No. This functionality may be added at a later time in a separate 685 extension. 686 687 (7) Can the new int16 and uint16 types be used as array indexes? 688 689 RESOLVED: No. 690 691 692Revision History 693 694 Rev. Date Author Changes 695 ---- -------- -------- ----------------------------------------- 696 2 03/28/2018 rexu Add interactions with AMD_shader_trinary_minmax. 697 New common functions are added to support 698 16-bit integer type in these trinary operations. 699 700 1 06/08/2017 dwitczak First release.