15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_shading_language_420pack 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_shading_language_420pack 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci John Kessenich (cepheus 'at' frii.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Pat Brown, NVIDIA 165bd8deadSopenharmony_ci Jeff Bolz, NVIDIA 175bd8deadSopenharmony_ci Pierre Boudier, AMD 185bd8deadSopenharmony_ci Piers Daniell, NVIDIA 195bd8deadSopenharmony_ci Patrick Doane, Blizzard 205bd8deadSopenharmony_ci John Kessenich 215bd8deadSopenharmony_ci Daniel Koch, Transgaming 225bd8deadSopenharmony_ci Bill Licea-Kane, AMD 235bd8deadSopenharmony_ci Barthold Lichtenbelt, NVIDIA 245bd8deadSopenharmony_ci Ian Romanick, Intel 255bd8deadSopenharmony_ci Bruce Merry, ARM 265bd8deadSopenharmony_ci Graham Sellers, AMD 275bd8deadSopenharmony_ci Robert Simpson, Qualcomm 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciNotice 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci Copyright (c) 2011-2013 The Khronos Group Inc. Copyright terms at 325bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciSpecification Update Policy 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 375bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 385bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 395bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 405bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 415bd8deadSopenharmony_ci described in more detail at 425bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciStatus 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci Complete. 475bd8deadSopenharmony_ci Approved by the ARB 25-Jul-2011. 485bd8deadSopenharmony_ci Approved by the Khronos Promoters on 2011/07/29. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciVersion 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci Last Modified Date: 11-Sep-2014 535bd8deadSopenharmony_ci Revision: 4 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ciNumber 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci ARB Extension #108 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ciDependencies 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci GLSL 1.3 is required for all features. GLSL 1.4 is required 625bd8deadSopenharmony_ci declaring a binding for a uniform block, as uniform blocks were not 635bd8deadSopenharmony_ci present until version 1.4. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci This extension interacts with the ARB_shader_image_load_store 665bd8deadSopenharmony_ci extension, for assigning locations to image variables. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci References to *patch* are not valid unless tessellation stages are 695bd8deadSopenharmony_ci present and enabled. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci While this document is self-contained, clarifying context for how to 725bd8deadSopenharmony_ci add the following changes can be seen by looking at version 4.20 of 735bd8deadSopenharmony_ci the GLSL specification. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciOverview 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci This is a language feature only extension formed from changes made 785bd8deadSopenharmony_ci to version 4.20 of GLSL. It includes: 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci * Add line-continuation using '\', as in C++. 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci * Change from ASCII to UTF-8 for the language character set and also 835bd8deadSopenharmony_ci allow any characters inside comments. 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci * Allow implicit conversions of return values to the declared type of 865bd8deadSopenharmony_ci the function. 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci * The *const* keyword can be used to declare variables within a function 895bd8deadSopenharmony_ci body with initializer expressions that are not constant expressions. 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci * Qualifiers on variable declarations no longer have to follow a strict 925bd8deadSopenharmony_ci order. The layout qualifier can be used multiple times, and multiple 935bd8deadSopenharmony_ci parameter qualifiers can be used. However, this is not as 945bd8deadSopenharmony_ci straightforward as saying declarations have arbitrary lists of 955bd8deadSopenharmony_ci initializers. Typically, one qualifier from each class of qualifiers 965bd8deadSopenharmony_ci is allowed, so care is now taken to classify them and say so. Then, 975bd8deadSopenharmony_ci of these, order restrictions are removed. 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci * Add layout qualifier identifier "binding" to bind the location of a 1005bd8deadSopenharmony_ci uniform block. This requires version 1.4 of GLSL. If this extension 1015bd8deadSopenharmony_ci is used with an earlier version than 1.4, this feature is not present. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci * Add layout qualifier identifier "binding" to bind units to sampler 1045bd8deadSopenharmony_ci and image variable declarations. 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci * Add C-style curly brace initializer lists syntax for initializers. 1075bd8deadSopenharmony_ci Full initialization of aggregates is required when these are used. 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci * Allow ".length()" to be applied to vectors and matrices, returning 1105bd8deadSopenharmony_ci the number of components or columns. 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci * Allow swizzle operations on scalars. 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci * Built-in constants for gl_MinProgramTexelOffset and 1155bd8deadSopenharmony_ci gl_MaxProgramTexelOffset. 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ciIP Status 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci No known IP claims. 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL Shading Language 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci Change the opening of 3.1 Character Set to 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci "The source character set used for the OpenGL shading languages, outside of 1265bd8deadSopenharmony_ci comments, is a subset of UTF-8. It includes the following characters: 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci "The backslash ( \ ) as the line-continuation character when used as 1295bd8deadSopenharmony_ci the last character of a line, just before a new line." 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci and after the list, referring to all the characters: 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci "An error will be given if any other character is used outside a comment. 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci "There are no trigraphs. There are no escape sequences or other uses of the 1365bd8deadSopenharmony_ci backslash beyond use as the line-continuation character." 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci At the end of section 3.2, add 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci "Line numbers are one more than the number of new lines that have been 1415bd8deadSopenharmony_ci processed, including counting the new lines that will be removed by the 1425bd8deadSopenharmony_ci line-continuation character ( \ ). 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci "Lines separated by the line-continuation character preceding a new line 1455bd8deadSopenharmony_ci are concatenated together before either comment processing or preprocessing. 1465bd8deadSopenharmony_ci No white space is substituted for the line-continuation character. That is, 1475bd8deadSopenharmony_ci a single token could be formed by the concatenation by taking the characters 1485bd8deadSopenharmony_ci at the end of one line concatenating them with the characters at the 1495bd8deadSopenharmony_ci beginning of the next line." 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci float f\ 1525bd8deadSopenharmony_ci oo; 1535bd8deadSopenharmony_ci // forms a single line equivalent to "float foo;" 1545bd8deadSopenharmony_ci // (assuming '\' is the last character before the new line and "oo" are 1555bd8deadSopenharmony_ci // the first two characters of the next line) 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci Add to the preprocessor: 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci "Preprocessing takes places after new lines have been removed by the 1605bd8deadSopenharmony_ci line-continuation character." 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci "Including the following line in a shader will enable module import and 1635bd8deadSopenharmony_ci related extended language features described in this extension: 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack : <behavior> 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3 for the #extension 1685bd8deadSopenharmony_ci directive." 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci A new preprocessor macro is added to the OpenGL Shading Language: 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci #define GL_ARB_shading_language_420pack 1 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci Add to the section on comments 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci "Inside comments, any byte values may be used, except a byte whose value 1775bd8deadSopenharmony_ci is 0. No errors will be given for the content of comments and no validation 1785bd8deadSopenharmony_ci on the content of comments need be done. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci "Removal of new lines by the line-continuation character ( \ ) logically 1815bd8deadSopenharmony_ci occurs before comments are processed. That is, a single-line comment ending 1825bd8deadSopenharmony_ci in the line-continuation character ( \ ) includes the next line in the 1835bd8deadSopenharmony_ci comment." 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci // a single-line comment containing the next line \ 1865bd8deadSopenharmony_ci a = b; // this is still in the first comment 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL Shading Language 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci Add to the syntax description of integer literals: 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci "When tokenizing, the maximal token matching the above will be recognized 1935bd8deadSopenharmony_ci before a new token is started." 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci Add to the syntax description of floating-point literals: 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci "When tokenizing, the maximal token matching the above will be recognized 1985bd8deadSopenharmony_ci before a new token is started." 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci Add to the description of .length(): 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci "This returns a type int." 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci Add a new section for initializers 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci "Initializers 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci "At declaration, an initial value for an aggregate variable may be provided, 2095bd8deadSopenharmony_ci specified as an equals (=) followed by an initializer. The initializer is 2105bd8deadSopenharmony_ci either an assignment-expression or a list of initializers enclosed in curly 2115bd8deadSopenharmony_ci braces. The grammar for the initializer is: 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci initializer : 2145bd8deadSopenharmony_ci assignment-expression 2155bd8deadSopenharmony_ci { initializer-list } 2165bd8deadSopenharmony_ci { initializer-list , } 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci initializer-list : 2195bd8deadSopenharmony_ci initializer 2205bd8deadSopenharmony_ci initializer-list , initializer 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci "The assignment-expression is a normal expression except that a comma ( , ) 2235bd8deadSopenharmony_ci outside parentheses is interpreted as the end of the initializer, not as the 2245bd8deadSopenharmony_ci sequence operator. As explained in more detail below, this allows creation 2255bd8deadSopenharmony_ci of nested initializers: The aggregate and its initializer must exactly match 2265bd8deadSopenharmony_ci in terms of nesting, number of components/elements/members present at each 2275bd8deadSopenharmony_ci level, and types of components/elements/members. 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci "An assignment-expression in an initializer must be either the same type as 2305bd8deadSopenharmony_ci the object it initializes or be a type that can be converted to the object's 2315bd8deadSopenharmony_ci type according to section 4.1.10 "Implicit Conversions". Since these include 2325bd8deadSopenharmony_ci constructors, an aggregate can be initialized by either a constructor or an 2335bd8deadSopenharmony_ci initializer list; an element in an initializer list can be a constructor. 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci "If an initializer is a list of initializers enclosed in curly braces, the 2365bd8deadSopenharmony_ci variable being declared must be a vector, a matrix, an array, or a 2375bd8deadSopenharmony_ci structure. 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci int i = { 1 }; // illegal, i is not an aggregate 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci "A list of initializers enclosed in a matching set of curly braces is 2425bd8deadSopenharmony_ci applied to one aggregate. This may be the variable being declared or an 2435bd8deadSopenharmony_ci aggregate contained in the variable being declared. Individual 2445bd8deadSopenharmony_ci initializers from the initializer list are applied to the elements/members 2455bd8deadSopenharmony_ci of the aggregate, in order. 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci "If the aggregate has a vector type, initializers from the list are applied 2485bd8deadSopenharmony_ci to the components of the vector, in order, starting with component 0. The 2495bd8deadSopenharmony_ci number of initializers must match the number of components. 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci "If the aggregate has a matrix type, initializers from the list must be 2525bd8deadSopenharmony_ci vector initializers and are applied to the columns of the matrix, in order, 2535bd8deadSopenharmony_ci starting with column 0. The number of initializers must match the number of 2545bd8deadSopenharmony_ci columns. 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci "If the aggregate has a structure type, initializers from the list are 2575bd8deadSopenharmony_ci applied to the members of the structure, in the order declared in the 2585bd8deadSopenharmony_ci structure, starting with the first member. The number of initializers must 2595bd8deadSopenharmony_ci match the number of members. 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci "Applying these rules, the following matrix declarations are equivalent: 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci mat2x2 a = mat2( vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) ); 2645bd8deadSopenharmony_ci mat2x2 b = { vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) }; 2655bd8deadSopenharmony_ci mat2x2 c = { { 1.0, 0.0 }, { 0.0, 1.0 } }; 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci "All of the following declarations are illegal. 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ci float a[2] = { 3.4, 4.2, 5.0 }; // illegal 2705bd8deadSopenharmony_ci vec2 b = { 1.0, 2.0, 3.0 }; // illegal 2715bd8deadSopenharmony_ci mat3x3 c = { vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0) }; // illegal 2725bd8deadSopenharmony_ci mat2x2 d = { 1.0, 0.0, 0.0, 1.0 }; // illegal, can't flatten nesting 2735bd8deadSopenharmony_ci struct { 2745bd8deadSopenharmony_ci float a; 2755bd8deadSopenharmony_ci int b; 2765bd8deadSopenharmony_ci } e = { 1.2, 2, 3 }; // illegal 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci "In all cases, the innermost initializer (i.e., not a list of initializers 2795bd8deadSopenharmony_ci enclosed in curly braces) applied to an object must have the same type as 2805bd8deadSopenharmony_ci the object being initialized or be a type that can be converted to the 2815bd8deadSopenharmony_ci object's type according to section 4.1.10 "Implicit Conversions". In the 2825bd8deadSopenharmony_ci latter case, an implicit conversion will be done on the initializer before 2835bd8deadSopenharmony_ci the assignment is done. All of the following declarations are illegal. 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci int a = true; // illegal 2865bd8deadSopenharmony_ci vec4 b[2] = { vec4(0.0), 1.0 }; // illegal 2875bd8deadSopenharmony_ci mat4x2 c = { vec3(0.0), vec3(1.0) }; // illegal 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci struct S1 { 2905bd8deadSopenharmony_ci vec4 a; 2915bd8deadSopenharmony_ci vec4 b; 2925bd8deadSopenharmony_ci }; 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci struct { 2955bd8deadSopenharmony_ci float s; 2965bd8deadSopenharmony_ci float t; 2975bd8deadSopenharmony_ci } d[] = { S1(vec4(0.0), vec4(1.1)) }; // illegal 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci "If an initializer (of either form) is provided for an unsized array, the 3005bd8deadSopenharmony_ci size of the array is determined by the number of top-level (non-nested) 3015bd8deadSopenharmony_ci initializers within the initializer. All of the following declarations 3025bd8deadSopenharmony_ci create arrays explicitly sized with five elements: 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci float a[] = float[](3.4, 4.2, 5.0, 5.2, 1.1); 3055bd8deadSopenharmony_ci float b[] = { 3.4, 4.2, 5.0, 5.2, 1.1 }; 3065bd8deadSopenharmony_ci float c[] = a; // c is explicitly size 5 3075bd8deadSopenharmony_ci float d[5] = b; // means the same thing 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci "It is an error to have too few or too many initializers in an initializer 3105bd8deadSopenharmony_ci list for the aggregate being initialized. That is, all elements of an array, 3115bd8deadSopenharmony_ci all members of a structure, all columns of a matrix, and all components of a 3125bd8deadSopenharmony_ci vector must have exactly one initializer expression present, with no 3135bd8deadSopenharmony_ci unconsumed initializers. 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci Change the definition of the storage qualifier *const* in the table: 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ci const | a variable whose value cannot be changed 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci Change the definition of storage qualifiers to only include the following 3205bd8deadSopenharmony_ci rows 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci const 3235bd8deadSopenharmony_ci in 3245bd8deadSopenharmony_ci out 3255bd8deadSopenharmony_ci attribute 3265bd8deadSopenharmony_ci uniform 3275bd8deadSopenharmony_ci varying 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci (Removing "centroid in", "sample in", "centroid out", "sample out", 3305bd8deadSopenharmony_ci "centroid varying", "patch in", and "patch out".) 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci and with this introduction: 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci "Variable declarations may have at most one storage qualifier specified in 3355bd8deadSopenharmony_ci front of the type." 3365bd8deadSopenharmony_ci 3375bd8deadSopenharmony_ci and make a new class "Auxiliary Storage Qualifier" to contain 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci Auxiliary Storage | Meaning 3405bd8deadSopenharmony_ci Qualifier | 3415bd8deadSopenharmony_ci ----------------- ------- 3425bd8deadSopenharmony_ci centroid | centroid-based interpolation 3435bd8deadSopenharmony_ci sample | per-sample interpolation 3445bd8deadSopenharmony_ci patch | per-tessellation-patch attributes 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci add that 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci "Some input and output qualified variables can be qualified with at most one 3495bd8deadSopenharmony_ci additional auxiliary storage qualifier. 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci "Not all combinations of qualification are allowed. Which variable types can 3525bd8deadSopenharmony_ci have which qualifiers are specifically defined in upcoming sections." 3535bd8deadSopenharmony_ci 3545bd8deadSopenharmony_ci Removing 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci "These interpolation qualifiers may only precede the qualifiers in, 3575bd8deadSopenharmony_ci centroid in, sample in, out, centroid out, or sample out in a 3585bd8deadSopenharmony_ci declaration." 3595bd8deadSopenharmony_ci 3605bd8deadSopenharmony_ci Change the last paragraph in this section to say 3615bd8deadSopenharmony_ci 3625bd8deadSopenharmony_ci "Initializers in global declarations may only be used in declarations of 3635bd8deadSopenharmony_ci global variables with no storage qualifier, with a *const* qualifier or 3645bd8deadSopenharmony_ci with a uniform qualifier...." 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci Change the Constant Qualifier section to instead say 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci "Named compile-time constants or read-only variables can be declared using 3695bd8deadSopenharmony_ci the const qualifier. The const qualifier can be used with any of the 3705bd8deadSopenharmony_ci non-void transparent basic data types, as well as with structures and arrays 3715bd8deadSopenharmony_ci of these. It is an error to write to a const variable outside of its 3725bd8deadSopenharmony_ci declaration, so they must be initialized when declared. For example, 3735bd8deadSopenharmony_ci 3745bd8deadSopenharmony_ci const vec3 zAxis = vec3 (0.0, 0.0, 1.0); 3755bd8deadSopenharmony_ci const float ceiling = a + b; // a and b not necessarily constants 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci "Structure members may not be qualified with *const*. Structure variables 3785bd8deadSopenharmony_ci can be declared as *const*, and initialized with a structure constructor or 3795bd8deadSopenharmony_ci initializer. 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ci "Initializers for *const* declarations at global scope must be 3825bd8deadSopenharmony_ci constant expressions..." 3835bd8deadSopenharmony_ci 3845bd8deadSopenharmony_ci In the Constant Expressions section, change the *const* bullet to say 3855bd8deadSopenharmony_ci 3865bd8deadSopenharmony_ci * a variable declared with the const qualifier and an initializer, 3875bd8deadSopenharmony_ci where the initializer is a constant expression 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci and add the bullet 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ci * valid use of the length() method on a sized object, whether or not the 3925bd8deadSopenharmony_ci object itself is constant 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci Add to "Inputs" section 3955bd8deadSopenharmony_ci 3965bd8deadSopenharmony_ci "It is an error to use any auxiliary or interpolation qualifiers on a vertex 3975bd8deadSopenharmony_ci shader input." 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci "Applying the *patch* qualifier to inputs can only be done in tessellation 4005bd8deadSopenharmony_ci evaluation shaders." 4015bd8deadSopenharmony_ci 4025bd8deadSopenharmony_ci "The auxiliary storage qualifiers *centroid* and *sample* can also be 4035bd8deadSopenharmony_ci applied, as well as the interpolation qualifiers *flat*, *noperspective*, 4045bd8deadSopenharmony_ci and *smooth*." 4055bd8deadSopenharmony_ci 4065bd8deadSopenharmony_ci Change all occurances of "patch in qualifier" to "patch qualifier" or 4075bd8deadSopenharmony_ci "patch in qualifiers". Similarly for any occurances of "patch out", 4085bd8deadSopenharmony_ci "centroid in", "sample in", "centroid out", and "sample out", through-out 4095bd8deadSopenharmony_ci the specification. 4105bd8deadSopenharmony_ci 4115bd8deadSopenharmony_ci Also change 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci "Fragment shader inputs get per-fragment values, typically interpolated 4145bd8deadSopenharmony_ci from a previous stage's outputs. They are declared in fragment shaders 4155bd8deadSopenharmony_ci with the in storage qualifier, the centroid in storage qualifier, ..." 4165bd8deadSopenharmony_ci 4175bd8deadSopenharmony_ci to 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci "Fragment shader inputs get per-fragment values, typically interpolated 4205bd8deadSopenharmony_ci from a previous stage's outputs. They are declared in fragment shaders 4215bd8deadSopenharmony_ci with the in storage qualifier. The auxiliary storage qualifiers centroid 4225bd8deadSopenharmony_ci and sample can also be applied, as well as the interpolation qualifiers 4235bd8deadSopenharmony_ci flat, noperspective, and smooth..." 4245bd8deadSopenharmony_ci 4255bd8deadSopenharmony_ci Change 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci "They are declared in fragment shaders with the in storage qualifier, the 4285bd8deadSopenharmony_ci centroid in storage qualifier, or the deprecated varying and centroid 4295bd8deadSopenharmony_ci varying storage qualifiers." 4305bd8deadSopenharmony_ci 4315bd8deadSopenharmony_ci to 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ci "They are declared in fragment shaders with the in storage qualifier or the 4345bd8deadSopenharmony_ci deprecated varying storage qualifier." 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci Add to the "Outputs" section 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci "A variable also cannot be declared with both the *in* and the *out* 4395bd8deadSopenharmony_ci qualifiers." 4405bd8deadSopenharmony_ci 4415bd8deadSopenharmony_ci Change 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ci "Vertex, tessellation evaluation, and geometry output variables output 4445bd8deadSopenharmony_ci per-vertex data and are declared using the out, centroid out, or sample out 4455bd8deadSopenharmony_ci storage qualifiers" 4465bd8deadSopenharmony_ci 4475bd8deadSopenharmony_ci to 4485bd8deadSopenharmony_ci 4495bd8deadSopenharmony_ci "Vertex, tessellation evaluation, and geometry output variables output 4505bd8deadSopenharmony_ci per-vertex data and are declared using the out storage qualifier" 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci Change 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci "It is an error to use patch out in a vertex, tessellation evaluation, 4555bd8deadSopenharmony_ci or geometry shader." 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci to 4585bd8deadSopenharmony_ci 4595bd8deadSopenharmony_ci "Applying *patch* to an output can only be done in a tessellation control 4605bd8deadSopenharmony_ci shader." 4615bd8deadSopenharmony_ci 4625bd8deadSopenharmony_ci Change 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ci "Per vertex output variables are arrayed (see arrayed under 4.3.4 Inputs) 4655bd8deadSopenharmony_ci and declared using out or centroid out storage qualifiers." 4665bd8deadSopenharmony_ci 4675bd8deadSopenharmony_ci to 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci "Per-vertex output variables are arrayed and declared using the *out* 4705bd8deadSopenharmony_ci qualifier without the *patch* qualifier. Per-patch output variables are 4715bd8deadSopenharmony_ci declared using the *patch* and *out* storage qualifiers." 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci Add 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci "It is an error to use auxiliary storage qualifiers or interpolation 4765bd8deadSopenharmony_ci qualifiers on an output in a fragment shader." 4775bd8deadSopenharmony_ci 4785bd8deadSopenharmony_ci Modify Interface Blocks with new relaxed qualifier rules: 4795bd8deadSopenharmony_ci 4805bd8deadSopenharmony_ci "If optional qualifiers are used, they can include interpolation qualifiers, 4815bd8deadSopenharmony_ci auxiliary storage qualifiers, and storage qualifiers..." 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci Add to Layout Qualifiers: 4845bd8deadSopenharmony_ci 4855bd8deadSopenharmony_ci "More than one layout qualifier may appear in a single declaration. If the 4865bd8deadSopenharmony_ci same layout-qualifier-name occurs in multiple layout qualifiers for the same 4875bd8deadSopenharmony_ci declaration, the last one overrides the former ones." 4885bd8deadSopenharmony_ci 4895bd8deadSopenharmony_ci Add to Uniform Block Layout Qualifiers, if the base language version is 1.4 4905bd8deadSopenharmony_ci or above: 4915bd8deadSopenharmony_ci 4925bd8deadSopenharmony_ci layout-qualifier-id 4935bd8deadSopenharmony_ci binding = integer-constant 4945bd8deadSopenharmony_ci 4955bd8deadSopenharmony_ci "The binding identifier specifies the uniform buffer binding point 4965bd8deadSopenharmony_ci corresponding to the uniform block, which will be used to obtain the 4975bd8deadSopenharmony_ci values of the member variables of the block. It is an error to specify the 4985bd8deadSopenharmony_ci binding identifier for the global scope or for block member declarations. 4995bd8deadSopenharmony_ci Any uniform block declared without a binding identifier is initially 5005bd8deadSopenharmony_ci assigned to block binding point zero. After a program is linked, the 5015bd8deadSopenharmony_ci binding points used for uniform blocks declared with or without a binding 5025bd8deadSopenharmony_ci identifier can be updated by the OpenGL API. 5035bd8deadSopenharmony_ci 5045bd8deadSopenharmony_ci "If the binding identifier is used with a uniform block instanced as an 5055bd8deadSopenharmony_ci array then the first element of the array takes the specified block binding 5065bd8deadSopenharmony_ci and each subsequent element takes the next consecutive uniform block 5075bd8deadSopenharmony_ci binding point. 5085bd8deadSopenharmony_ci 5095bd8deadSopenharmony_ci "If the binding point for any uniform block instance is less than zero, or 5105bd8deadSopenharmony_ci greater than or equal to the implementation-dependent maximum number of 5115bd8deadSopenharmony_ci uniform buffer bindings, a compilation error will occur. When the binding 5125bd8deadSopenharmony_ci identifier is used with a uniform block instanced as an array of size N, 5135bd8deadSopenharmony_ci all elements of the array from binding through binding + N - 1 must be 5145bd8deadSopenharmony_ci within this range." 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci Add for sampler and image layout qualifiers: 5175bd8deadSopenharmony_ci 5185bd8deadSopenharmony_ci Note: The "image" variable aspect of this interacts with 5195bd8deadSopenharmony_ci ARB_shader_image_load_store and only applies if the extension 5205bd8deadSopenharmony_ci ARB_shader_image_load_store is enabled. 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci "Uniform layout qualifiers can be used to bind opaque uniform variables to 5235bd8deadSopenharmony_ci specific buffers or units. Texture image units can be bound to samplers 5245bd8deadSopenharmony_ci and image units can be bound to images. 5255bd8deadSopenharmony_ci 5265bd8deadSopenharmony_ci layout-qualifier-id 5275bd8deadSopenharmony_ci binding = integer-constant 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci "The identifier binding specifies which unit will be bound. Any uniform 5305bd8deadSopenharmony_ci sampler or image variable declared without a binding qualifier is 5315bd8deadSopenharmony_ci initially bound to unit zero. After a program is linked, the unit 5325bd8deadSopenharmony_ci referenced by a sampler or image uniform variable declared with or 5335bd8deadSopenharmony_ci without a binding identifier can be updated by the OpenGL API. 5345bd8deadSopenharmony_ci 5355bd8deadSopenharmony_ci "If the binding identifier is used with an array, the first element of the 5365bd8deadSopenharmony_ci array takes the specified unit and each subsequent element takes the next 5375bd8deadSopenharmony_ci consecutive unit. 5385bd8deadSopenharmony_ci 5395bd8deadSopenharmony_ci If the binding is less than zero, or greater than or equal to the 5405bd8deadSopenharmony_ci implementation-dependent maximum supported number of units, a compilation 5415bd8deadSopenharmony_ci error will occur. When the binding identifier is used with an array of size 5425bd8deadSopenharmony_ci N, all elements of the array from binding through binding + N - 1 must be 5435bd8deadSopenharmony_ci within this range." 5445bd8deadSopenharmony_ci 5455bd8deadSopenharmony_ci Change the "Interpolation" section to be the "Interplotation Qualifiers" 5465bd8deadSopenharmony_ci section and change the first paragraph to now be the following. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci "Inputs and outputs that could be interpolated can be further qualified by 5495bd8deadSopenharmony_ci at most one of the following interpolation qualifiers: 5505bd8deadSopenharmony_ci 5515bd8deadSopenharmony_ci Qualifier Meaning 5525bd8deadSopenharmony_ci --------- ------- 5535bd8deadSopenharmony_ci smooth perspective correct interpolation 5545bd8deadSopenharmony_ci flat no interpolation 5555bd8deadSopenharmony_ci noperspective linear interpolation 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci "The presence of and type of interpolation is controlled by the above 5585bd8deadSopenharmony_ci interpolation qualifiers as well as the auxiliary storage qualifiers 5595bd8deadSopenharmony_ci *centroid* and *sample*. The auxiliary storage qualifier *patch* is not 5605bd8deadSopenharmony_ci used for interpolation; it is an error to use interpolation qualifiers with 5615bd8deadSopenharmony_ci *patch*. 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ci Add the following parameter qualifier 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci Qualifier Meaning 5665bd8deadSopenharmony_ci --------- ------- 5675bd8deadSopenharmony_ci const for function parameters that cannot be written to 5685bd8deadSopenharmony_ci 5695bd8deadSopenharmony_ci and note that precision qualifiers are also allowed on parameters. 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci Delete the following sentence in the "Invariant Qualifier" section: 5725bd8deadSopenharmony_ci 5735bd8deadSopenharmony_ci "The invariant qualifier must appear before any interpolation qualifiers 5745bd8deadSopenharmony_ci or storage qualifiers when combined with a declaration." 5755bd8deadSopenharmony_ci 5765bd8deadSopenharmony_ci Replace the "Order of Qualification" section with the following 5775bd8deadSopenharmony_ci 5785bd8deadSopenharmony_ci 4.11 "Order and Repetition of Qualification" 5795bd8deadSopenharmony_ci 5805bd8deadSopenharmony_ci "When multiple qualifiers are present in a variable or parameter 5815bd8deadSopenharmony_ci declaration, they may appear in any order, but they must all appear before 5825bd8deadSopenharmony_ci the type. The layout qualifier is the only qualifier that can appear more 5835bd8deadSopenharmony_ci than once. Further, a declaration can have at most one storage qualifier, 5845bd8deadSopenharmony_ci at most one auxiliary storage qualifier, and at most one interpolation 5855bd8deadSopenharmony_ci qualifier. If inout is used, neither in nor out may be used. Multiple 5865bd8deadSopenharmony_ci memory qualifiers can be used. Any violation of these rules will cause a 5875bd8deadSopenharmony_ci compile-time error." 5885bd8deadSopenharmony_ci 5895bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL Shading Language 5905bd8deadSopenharmony_ci 5915bd8deadSopenharmony_ci Change the section title "Vector Components" to be "Vector and Scalar 5925bd8deadSopenharmony_ci Components and Length". In that section do the following. 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci Change first sentence to "The names of the components of a vector or 5955bd8deadSopenharmony_ci scalar are denoted by a single letter." 5965bd8deadSopenharmony_ci 5975bd8deadSopenharmony_ci Add the following last sentence to its paragraph: 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci "The component names x, r, and s are, for example, synonyms for the same 6005bd8deadSopenharmony_ci (first) component in a vector. They are also the names of the only 6015bd8deadSopenharmony_ci component in a scalar." 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci Add to the example 6045bd8deadSopenharmony_ci 6055bd8deadSopenharmony_ci float height; 6065bd8deadSopenharmony_ci height.x // is legal 6075bd8deadSopenharmony_ci height.y // is illegal 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci and to the third example 6105bd8deadSopenharmony_ci 6115bd8deadSopenharmony_ci float f = 1.2; 6125bd8deadSopenharmony_ci vec4 dup = f.xxxx; // dup = (1.2, 1.2, 1.2, 1.2) 6135bd8deadSopenharmony_ci 6145bd8deadSopenharmony_ci "This notation is more concise than the constructor syntax. To form an 6155bd8deadSopenharmony_ci r-value, it can be applied to any expression that results in a vector or 6165bd8deadSopenharmony_ci scalar r-value. Any resulting vector of any operation must be a valid 6175bd8deadSopenharmony_ci vector in the language; hence the following is illegal:" 6185bd8deadSopenharmony_ci 6195bd8deadSopenharmony_ci vec4 f; 6205bd8deadSopenharmony_ci vec4 g = pos.xyzwxy.xyzw; // illegal; pos.xyzwxy is non-existent "vec6" 6215bd8deadSopenharmony_ci 6225bd8deadSopenharmony_ci Add to the end of this section: 6235bd8deadSopenharmony_ci 6245bd8deadSopenharmony_ci "The *length* method may be applied to vectors (but not scalars). The 6255bd8deadSopenharmony_ci result is the number of components in the vector. For example, 6265bd8deadSopenharmony_ci 6275bd8deadSopenharmony_ci vec3 v; 6285bd8deadSopenharmony_ci const int L = v.length(); 6295bd8deadSopenharmony_ci 6305bd8deadSopenharmony_ci "sets the constant L to 3. The type returned by .length() on a vector is 6315bd8deadSopenharmony_ci *int*." 6325bd8deadSopenharmony_ci 6335bd8deadSopenharmony_ci Add to the Matrix Components section: 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci "The length method may be applied to matrices. The result is the number 6365bd8deadSopenharmony_ci of columns of the matrix. For example, 6375bd8deadSopenharmony_ci 6385bd8deadSopenharmony_ci mat3x4 v; 6395bd8deadSopenharmony_ci const int L = v.length(); 6405bd8deadSopenharmony_ci 6415bd8deadSopenharmony_ci "sets the constant L to 3. The type returned by .length() on a matrix 6425bd8deadSopenharmony_ci is *int*." 6435bd8deadSopenharmony_ci 6445bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL Shading Language 6455bd8deadSopenharmony_ci 6465bd8deadSopenharmony_ci Add to the "Function Definitions" section the following functionality 6475bd8deadSopenharmony_ci regarding function return values: 6485bd8deadSopenharmony_ci 6495bd8deadSopenharmony_ci "If the type of returnValue does not match returnType, there must be an 6505bd8deadSopenharmony_ci implicit conversion in section 4.1.10 "Implicit Conversions" that 6515bd8deadSopenharmony_ci converts the type of returnValue to returnType, or a compile error will 6525bd8deadSopenharmony_ci result." 6535bd8deadSopenharmony_ci 6545bd8deadSopenharmony_ci and the clarifations: 6555bd8deadSopenharmony_ci 6565bd8deadSopenharmony_ci "A void function can only use return without a return argument, even if 6575bd8deadSopenharmony_ci the return argument has void type. Return statements only accept values: 6585bd8deadSopenharmony_ci 6595bd8deadSopenharmony_ci void func1() { } 6605bd8deadSopenharmony_ci void func2() { return func1(); } // illegal return statement 6615bd8deadSopenharmony_ci 6625bd8deadSopenharmony_ci "Only a precision qualifier is allowed on the return type of a function. 6635bd8deadSopenharmony_ci Formal parameters can have parameter, precision, and memory qualifiers, 6645bd8deadSopenharmony_ci but no other qualifiers." 6655bd8deadSopenharmony_ci 6665bd8deadSopenharmony_ci Under the section "Function Calling Conventions" change to the *inout* 6675bd8deadSopenharmony_ci bullet: 6685bd8deadSopenharmony_ci 6695bd8deadSopenharmony_ci * "The keyword *inout* is used as a qualifier to denote the parameter 6705bd8deadSopenharmony_ci is to be both copied in and copied out. It means the same thing as 6715bd8deadSopenharmony_ci specifying both in and out." 6725bd8deadSopenharmony_ci 6735bd8deadSopenharmony_ci and the following grammar changes: Delete the const-qualifier parts of 6745bd8deadSopenharmony_ci the existing grammar and instead use 6755bd8deadSopenharmony_ci 6765bd8deadSopenharmony_ci parameter-qualifiers : 6775bd8deadSopenharmony_ci empty 6785bd8deadSopenharmony_ci list of parameter-qualifier 6795bd8deadSopenharmony_ci 6805bd8deadSopenharmony_ci parameter-qualifier : 6815bd8deadSopenharmony_ci empty 6825bd8deadSopenharmony_ci const 6835bd8deadSopenharmony_ci in 6845bd8deadSopenharmony_ci out 6855bd8deadSopenharmony_ci inout 6865bd8deadSopenharmony_ci memory qualifier 6875bd8deadSopenharmony_ci precision qualifier 6885bd8deadSopenharmony_ci 6895bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL Shading Language 6905bd8deadSopenharmony_ci 6915bd8deadSopenharmony_ci Add to the built-in constants 6925bd8deadSopenharmony_ci 6935bd8deadSopenharmony_ci const int gl_MinProgramTexelOffset = -7; 6945bd8deadSopenharmony_ci const int gl_MaxProgramTexelOffset = 8; 6955bd8deadSopenharmony_ci 6965bd8deadSopenharmony_ciAdditions to Chapter 9 of the OpenGL Shading Language 6975bd8deadSopenharmony_ci 6985bd8deadSopenharmony_ci TBD. 6995bd8deadSopenharmony_ci 7005bd8deadSopenharmony_ciConformance Tests 7015bd8deadSopenharmony_ci 7025bd8deadSopenharmony_ci Verify that the following two vectors are identical: 7035bd8deadSopenharmony_ci 7045bd8deadSopenharmony_ci vec4 a = vec4(1.0); 7055bd8deadSopenharmony_ci vec4 b = (1.0).xxxx; 7065bd8deadSopenharmony_ci 7075bd8deadSopenharmony_ci Verify that the following generates a compilation error: 7085bd8deadSopenharmony_ci 7095bd8deadSopenharmony_ci vec2 a = 1.xx; 7105bd8deadSopenharmony_ci 7115bd8deadSopenharmony_ci Verify that the following two vectors are identical: 7125bd8deadSopenharmony_ci 7135bd8deadSopenharmony_ci vec2 a = (1).xx; 7145bd8deadSopenharmony_ci vec2 b = vec2(1.0); 7155bd8deadSopenharmony_ci 7165bd8deadSopenharmony_ci Verify that the following two arrays are identical: 7175bd8deadSopenharmony_ci 7185bd8deadSopenharmony_ci vec4 a[] = vec4 [] (vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0), 7195bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4), 7205bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0), 7215bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(3.6)); 7225bd8deadSopenharmony_ci vec4 b[] = { vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0), 7235bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4), 7245bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0), 7255bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(3.6) }; 7265bd8deadSopenharmony_ci 7275bd8deadSopenharmony_ci Verify that the following two arrays are identical: 7285bd8deadSopenharmony_ci 7295bd8deadSopenharmony_ci vec4 a[12] = vec4 [] (vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0), 7305bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4), 7315bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); 7325bd8deadSopenharmony_ci vec4 b[12] = { vec4(1.2), vec4(0.0), vec4(0.0), vec4(0.0), 7335bd8deadSopenharmony_ci vec4(0.0), vec4(0.0), vec4(0.0), vec4(2.4) }; 7345bd8deadSopenharmony_ci 7355bd8deadSopenharmony_ci Verify that the following three matrices are identical: 7365bd8deadSopenharmony_ci 7375bd8deadSopenharmony_ci mat2x2 a = mat2( vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) ); 7385bd8deadSopenharmony_ci mat2x2 b = { vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) }; 7395bd8deadSopenharmony_ci mat2x2 c = { { 1.0, 0.0 }, { 0.0, 1.0 } }; 7405bd8deadSopenharmony_ci 7415bd8deadSopenharmony_ci Verify that the following generates a compliation error: 7425bd8deadSopenharmony_ci 7435bd8deadSopenharmony_ci float a[2] = { 1.0, 2.0, 3.0 }; 7445bd8deadSopenharmony_ci 7455bd8deadSopenharmony_ci Verify that the following generates a compliation error: 7465bd8deadSopenharmony_ci 7475bd8deadSopenharmony_ci mat2x2 d = { 1.0, 0.0, 0.0, 1.0 }; 7485bd8deadSopenharmony_ci 7495bd8deadSopenharmony_ci 7505bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci #version 410 7535bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 7545bd8deadSopenharmony_ci out vec4 color; 7555bd8deadSopenharmony_ci void main() 7565bd8deadSopenharmony_ci { 7575bd8deadSopenharmony_ci color = (vec2(0).length() == 2) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 7585bd8deadSopenharmony_ci } 7595bd8deadSopenharmony_ci 7605bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by ivec2(0).length(). 7615bd8deadSopenharmony_ci 7625bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by uvec2(0).length(). 7635bd8deadSopenharmony_ci 7645bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by bvec2(0).length(). 7655bd8deadSopenharmony_ci 7665bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dvec2(0).length(). 7675bd8deadSopenharmony_ci 7685bd8deadSopenharmony_ci 7695bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 7705bd8deadSopenharmony_ci 7715bd8deadSopenharmony_ci #version 410 7725bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 7735bd8deadSopenharmony_ci out vec4 color; 7745bd8deadSopenharmony_ci void main() 7755bd8deadSopenharmony_ci { 7765bd8deadSopenharmony_ci color = (vec3(0).length() == 3) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 7775bd8deadSopenharmony_ci } 7785bd8deadSopenharmony_ci 7795bd8deadSopenharmony_ci Repeat the above test with vec3(0).length() replaced by ivec3(0).length(). 7805bd8deadSopenharmony_ci 7815bd8deadSopenharmony_ci Repeat the above test with vec3(0).length() replaced by uvec3(0).length(). 7825bd8deadSopenharmony_ci 7835bd8deadSopenharmony_ci Repeat the above test with vec3(0).length() replaced by bvec3(0).length(). 7845bd8deadSopenharmony_ci 7855bd8deadSopenharmony_ci Repeat the above test with vec3(0).length() replaced by dvec3(0).length(). 7865bd8deadSopenharmony_ci 7875bd8deadSopenharmony_ci 7885bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 7895bd8deadSopenharmony_ci 7905bd8deadSopenharmony_ci #version 410 7915bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 7925bd8deadSopenharmony_ci out vec4 color; 7935bd8deadSopenharmony_ci void main() 7945bd8deadSopenharmony_ci { 7955bd8deadSopenharmony_ci color = (vec4(0).length() == 4) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 7965bd8deadSopenharmony_ci } 7975bd8deadSopenharmony_ci 7985bd8deadSopenharmony_ci Repeat the above test with vec4(0).length() replaced by ivec4(0).length(). 7995bd8deadSopenharmony_ci 8005bd8deadSopenharmony_ci Repeat the above test with vec4(0).length() replaced by uvec4(0).length(). 8015bd8deadSopenharmony_ci 8025bd8deadSopenharmony_ci Repeat the above test with vec4(0).length() replaced by bvec4(0).length(). 8035bd8deadSopenharmony_ci 8045bd8deadSopenharmony_ci Repeat the above test with vec4(0).length() replaced by dvec4(0).length(). 8055bd8deadSopenharmony_ci 8065bd8deadSopenharmony_ci 8075bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 8085bd8deadSopenharmony_ci 8095bd8deadSopenharmony_ci #version 410 8105bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 8115bd8deadSopenharmony_ci out vec4 color; 8125bd8deadSopenharmony_ci void main() 8135bd8deadSopenharmony_ci { 8145bd8deadSopenharmony_ci color = (mat2(0).length() == 2) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 8155bd8deadSopenharmony_ci } 8165bd8deadSopenharmony_ci 8175bd8deadSopenharmony_ci Repeat the above test with mat2(0).length() replaced by mat2x2(0).length(). 8185bd8deadSopenharmony_ci 8195bd8deadSopenharmony_ci Repeat the above test with mat2(0).length() replaced by dmat2x2(0).length(). 8205bd8deadSopenharmony_ci 8215bd8deadSopenharmony_ci Repeat the above test with mat2(0).length() replaced by mat2x3(0).length(). 8225bd8deadSopenharmony_ci 8235bd8deadSopenharmony_ci Repeat the above test with mat2(0).length() replaced by dmat2x3(0).length(). 8245bd8deadSopenharmony_ci 8255bd8deadSopenharmony_ci Repeat the above test with mat2(0).length() replaced by mat2x4(0).length(). 8265bd8deadSopenharmony_ci 8275bd8deadSopenharmony_ci Repeat the above test with mat2(0).length() replaced by dmat2x4(0).length(). 8285bd8deadSopenharmony_ci 8295bd8deadSopenharmony_ci 8305bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 8315bd8deadSopenharmony_ci 8325bd8deadSopenharmony_ci #version 410 8335bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 8345bd8deadSopenharmony_ci out vec4 color; 8355bd8deadSopenharmony_ci void main() 8365bd8deadSopenharmony_ci { 8375bd8deadSopenharmony_ci color = (mat3(0).length() == 3) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 8385bd8deadSopenharmony_ci } 8395bd8deadSopenharmony_ci 8405bd8deadSopenharmony_ci Repeat the above test with mat3(0).length() replaced by mat3x2(0).length(). 8415bd8deadSopenharmony_ci 8425bd8deadSopenharmony_ci Repeat the above test with mat3(0).length() replaced by dmat3x2(0).length(). 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci Repeat the above test with mat3(0).length() replaced by mat3x3(0).length(). 8455bd8deadSopenharmony_ci 8465bd8deadSopenharmony_ci Repeat the above test with mat3(0).length() replaced by dmat3x3(0).length(). 8475bd8deadSopenharmony_ci 8485bd8deadSopenharmony_ci Repeat the above test with mat3(0).length() replaced by mat3x4(0).length(). 8495bd8deadSopenharmony_ci 8505bd8deadSopenharmony_ci Repeat the above test with mat3(0).length() replaced by dmat3x4(0).length(). 8515bd8deadSopenharmony_ci 8525bd8deadSopenharmony_ci 8535bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 8545bd8deadSopenharmony_ci 8555bd8deadSopenharmony_ci #version 410 8565bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 8575bd8deadSopenharmony_ci out vec4 color; 8585bd8deadSopenharmony_ci void main() 8595bd8deadSopenharmony_ci { 8605bd8deadSopenharmony_ci color = (mat4(0).length() == 4) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 8615bd8deadSopenharmony_ci } 8625bd8deadSopenharmony_ci 8635bd8deadSopenharmony_ci Repeat the above test with mat4(0).length() replaced by mat4x2(0).length(). 8645bd8deadSopenharmony_ci 8655bd8deadSopenharmony_ci Repeat the above test with mat4(0).length() replaced by dmat4x2(0).length(). 8665bd8deadSopenharmony_ci 8675bd8deadSopenharmony_ci Repeat the above test with mat4(0).length() replaced by mat4x3(0).length(). 8685bd8deadSopenharmony_ci 8695bd8deadSopenharmony_ci Repeat the above test with mat4(0).length() replaced by dmat4x3(0).length(). 8705bd8deadSopenharmony_ci 8715bd8deadSopenharmony_ci Repeat the above test with mat4(0).length() replaced by mat4x4(0).length(). 8725bd8deadSopenharmony_ci 8735bd8deadSopenharmony_ci Repeat the above test with mat4(0).length() replaced by dmat4x4(0).length(). 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ci 8765bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 8775bd8deadSopenharmony_ci 8785bd8deadSopenharmony_ci #version 410 8795bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 8805bd8deadSopenharmony_ci out vec4 color; 8815bd8deadSopenharmony_ci void main() 8825bd8deadSopenharmony_ci { 8835bd8deadSopenharmony_ci color = (mat2(0)[0].length() == 2) 8845bd8deadSopenharmony_ci ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 8855bd8deadSopenharmony_ci } 8865bd8deadSopenharmony_ci 8875bd8deadSopenharmony_ci Repeat the above test with mat2(0)[0].length() replaced by 8885bd8deadSopenharmony_ci mat2x2(0)[0].length(). 8895bd8deadSopenharmony_ci 8905bd8deadSopenharmony_ci Repeat the above test with mat2(0)[0].length() replaced by 8915bd8deadSopenharmony_ci dmat2x2(0)[0].length(). 8925bd8deadSopenharmony_ci 8935bd8deadSopenharmony_ci Repeat the above test with mat2(0)[0].length() replaced by 8945bd8deadSopenharmony_ci mat3x2(0)[0].length(). 8955bd8deadSopenharmony_ci 8965bd8deadSopenharmony_ci Repeat the above test with mat2(0)[0].length() replaced by 8975bd8deadSopenharmony_ci dmat3x2(0)[0].length(). 8985bd8deadSopenharmony_ci 8995bd8deadSopenharmony_ci Repeat the above test with mat2(0)[0].length() replaced by 9005bd8deadSopenharmony_ci mat4x2(0)[0].length(). 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ci Repeat the above test with mat2(0)[0].length() replaced by 9035bd8deadSopenharmony_ci dmat4x2(0)[0].length(). 9045bd8deadSopenharmony_ci 9055bd8deadSopenharmony_ci 9065bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 9075bd8deadSopenharmony_ci 9085bd8deadSopenharmony_ci #version 410 9095bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 9105bd8deadSopenharmony_ci out vec4 color; 9115bd8deadSopenharmony_ci void main() 9125bd8deadSopenharmony_ci { 9135bd8deadSopenharmony_ci color = (mat3(0)[0].length() == 3) 9145bd8deadSopenharmony_ci ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 9155bd8deadSopenharmony_ci } 9165bd8deadSopenharmony_ci 9175bd8deadSopenharmony_ci Repeat the above test with mat3(0)[0].length() replaced by 9185bd8deadSopenharmony_ci mat2x3(0)[0].length(). 9195bd8deadSopenharmony_ci 9205bd8deadSopenharmony_ci Repeat the above test with mat3(0)[0].length() replaced by 9215bd8deadSopenharmony_ci dmat2x3(0)[0].length(). 9225bd8deadSopenharmony_ci 9235bd8deadSopenharmony_ci Repeat the above test with mat3(0)[0].length() replaced by 9245bd8deadSopenharmony_ci mat3x3(0)[0].length(). 9255bd8deadSopenharmony_ci 9265bd8deadSopenharmony_ci Repeat the above test with mat3(0)[0].length() replaced by 9275bd8deadSopenharmony_ci dmat3x3(0)[0].length(). 9285bd8deadSopenharmony_ci 9295bd8deadSopenharmony_ci Repeat the above test with mat3(0)[0].length() replaced by 9305bd8deadSopenharmony_ci mat4x3(0)[0].length(). 9315bd8deadSopenharmony_ci 9325bd8deadSopenharmony_ci Repeat the above test with mat3(0)[0].length() replaced by 9335bd8deadSopenharmony_ci dmat4x3(0)[0].length(). 9345bd8deadSopenharmony_ci 9355bd8deadSopenharmony_ci 9365bd8deadSopenharmony_ci Verify that the output of the following fragment shader is (0, 1, 0, 1): 9375bd8deadSopenharmony_ci 9385bd8deadSopenharmony_ci #version 410 9395bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 9405bd8deadSopenharmony_ci out vec4 color; 9415bd8deadSopenharmony_ci void main() 9425bd8deadSopenharmony_ci { 9435bd8deadSopenharmony_ci color = (mat4(0)[0].length() == 4) 9445bd8deadSopenharmony_ci ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1); 9455bd8deadSopenharmony_ci } 9465bd8deadSopenharmony_ci 9475bd8deadSopenharmony_ci Repeat the above test with mat4(0)[0].length() replaced by 9485bd8deadSopenharmony_ci mat2x4(0)[0].length(). 9495bd8deadSopenharmony_ci 9505bd8deadSopenharmony_ci Repeat the above test with mat4(0)[0].length() replaced by 9515bd8deadSopenharmony_ci dmat2x4(0)[0].length(). 9525bd8deadSopenharmony_ci 9535bd8deadSopenharmony_ci Repeat the above test with mat4(0)[0].length() replaced by 9545bd8deadSopenharmony_ci mat3x4(0)[0].length(). 9555bd8deadSopenharmony_ci 9565bd8deadSopenharmony_ci Repeat the above test with mat4(0)[0].length() replaced by 9575bd8deadSopenharmony_ci dmat3x4(0)[0].length(). 9585bd8deadSopenharmony_ci 9595bd8deadSopenharmony_ci Repeat the above test with mat4(0)[0].length() replaced by 9605bd8deadSopenharmony_ci mat4x4(0)[0].length(). 9615bd8deadSopenharmony_ci 9625bd8deadSopenharmony_ci Repeat the above test with mat4(0)[0].length() replaced by 9635bd8deadSopenharmony_ci dmat4x4(0)[0].length(). 9645bd8deadSopenharmony_ci 9655bd8deadSopenharmony_ci 9665bd8deadSopenharmony_ci Verify that the following shader generates a compilation error: 9675bd8deadSopenharmony_ci 9685bd8deadSopenharmony_ci #version 410 9695bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 9705bd8deadSopenharmony_ci out vec4 color; 9715bd8deadSopenharmony_ci void main() 9725bd8deadSopenharmony_ci { 9735bd8deadSopenharmony_ci float v; 9745bd8deadSopenharmony_ci int l = v.length(); 9755bd8deadSopenharmony_ci color = vec4(1, 0, 0, 1); 9765bd8deadSopenharmony_ci } 9775bd8deadSopenharmony_ci 9785bd8deadSopenharmony_ci Repeat the above test with "float v" replaced by "int v". 9795bd8deadSopenharmony_ci 9805bd8deadSopenharmony_ci Repeat the above test with "float v" replaced by "uint v". 9815bd8deadSopenharmony_ci 9825bd8deadSopenharmony_ci Repeat the above test with "float v" replaced by "bool v". 9835bd8deadSopenharmony_ci 9845bd8deadSopenharmony_ci Repeat the above test with "float v" replaced by "double v". 9855bd8deadSopenharmony_ci 9865bd8deadSopenharmony_ci 9875bd8deadSopenharmony_ci Verify that the following shader compiles without error: 9885bd8deadSopenharmony_ci 9895bd8deadSopenharmony_ci #version 410 9905bd8deadSopenharmony_ci #extension GL_ARB_shading_language_420pack: require 9915bd8deadSopenharmony_ci void main() 9925bd8deadSopenharmony_ci { 9935bd8deadSopenharmony_ci float b[vec2(0).length()]; 9945bd8deadSopenharmony_ci } 9955bd8deadSopenharmony_ci 9965bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by ivec2(0).length(). 9975bd8deadSopenharmony_ci 9985bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by uvec2(0).length(). 9995bd8deadSopenharmony_ci 10005bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by bvec2(0).length(). 10015bd8deadSopenharmony_ci 10025bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dvec2(0).length(). 10035bd8deadSopenharmony_ci 10045bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by ivec3(0).length(). 10055bd8deadSopenharmony_ci 10065bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by uvec3(0).length(). 10075bd8deadSopenharmony_ci 10085bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by bvec3(0).length(). 10095bd8deadSopenharmony_ci 10105bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dvec3(0).length(). 10115bd8deadSopenharmony_ci 10125bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by ivec4(0).length(). 10135bd8deadSopenharmony_ci 10145bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by uvec4(0).length(). 10155bd8deadSopenharmony_ci 10165bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by bvec4(0).length(). 10175bd8deadSopenharmony_ci 10185bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dvec4(0).length(). 10195bd8deadSopenharmony_ci 10205bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat2(0).length(). 10215bd8deadSopenharmony_ci 10225bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat2x2(0).length(). 10235bd8deadSopenharmony_ci 10245bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat2x3(0).length(). 10255bd8deadSopenharmony_ci 10265bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat2x4(0).length(). 10275bd8deadSopenharmony_ci 10285bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat3(0).length(). 10295bd8deadSopenharmony_ci 10305bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat3x2(0).length(). 10315bd8deadSopenharmony_ci 10325bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat3x3(0).length(). 10335bd8deadSopenharmony_ci 10345bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat3x4(0).length(). 10355bd8deadSopenharmony_ci 10365bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat4(0).length(). 10375bd8deadSopenharmony_ci 10385bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat4x2(0).length(). 10395bd8deadSopenharmony_ci 10405bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat4x3(0).length(). 10415bd8deadSopenharmony_ci 10425bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by mat4x4(0).length(). 10435bd8deadSopenharmony_ci 10445bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat2(0).length(). 10455bd8deadSopenharmony_ci 10465bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat2x2(0).length(). 10475bd8deadSopenharmony_ci 10485bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat2x3(0).length(). 10495bd8deadSopenharmony_ci 10505bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat2x4(0).length(). 10515bd8deadSopenharmony_ci 10525bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat3(0).length(). 10535bd8deadSopenharmony_ci 10545bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat3x2(0).length(). 10555bd8deadSopenharmony_ci 10565bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat3x3(0).length(). 10575bd8deadSopenharmony_ci 10585bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat3x4(0).length(). 10595bd8deadSopenharmony_ci 10605bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat4(0).length(). 10615bd8deadSopenharmony_ci 10625bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat4x2(0).length(). 10635bd8deadSopenharmony_ci 10645bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat4x3(0).length(). 10655bd8deadSopenharmony_ci 10665bd8deadSopenharmony_ci Repeat the above test with vec2(0).length() replaced by dmat4x4(0).length(). 10675bd8deadSopenharmony_ci 10685bd8deadSopenharmony_ci More TBD. 10695bd8deadSopenharmony_ci 10705bd8deadSopenharmony_ciIssues 10715bd8deadSopenharmony_ci 10725bd8deadSopenharmony_ci 1) How is the ambiguity of swizzling an integer literal resolved? 10735bd8deadSopenharmony_ci 10745bd8deadSopenharmony_ci RESOLVED: Greedy lexing. The sequence "5.x" will be interpreted 10755bd8deadSopenharmony_ci as the floating-point literal 5.0 followed by the identifier "x". 10765bd8deadSopenharmony_ci 10775bd8deadSopenharmony_ci 2) Should the array subscript operator be applicable to scalars as it is 10785bd8deadSopenharmony_ci to vectors? 10795bd8deadSopenharmony_ci 10805bd8deadSopenharmony_ci RESOLVED: NO. In conduction with the rest of the features of this 10815bd8deadSopenharmony_ci extension, this would allow writing generic code such as: 10825bd8deadSopenharmony_ci 10835bd8deadSopenharmony_ci #define SUM_COMPONENTS(value, result) \ 10845bd8deadSopenharmony_ci do { 10855bd8deadSopenharmony_ci for (int i = 0; i < (value).length(); i++) 10865bd8deadSopenharmony_ci result += (value)[i]; 10875bd8deadSopenharmony_ci } while (0) 10885bd8deadSopenharmony_ci 10895bd8deadSopenharmony_ci However, using macros in this fashion is a poor approximation 10905bd8deadSopenharmony_ci of generic functions. Until a better mechanism is added to 10915bd8deadSopenharmony_ci GLSL, there is little utility in array accesses to scalars or 10925bd8deadSopenharmony_ci single component vectors. 10935bd8deadSopenharmony_ci 10945bd8deadSopenharmony_ci 3) Should vectors and matrices also be able to use initializer lists? 10955bd8deadSopenharmony_ci 10965bd8deadSopenharmony_ci RESOLVED: YES. Many places in the language treat vectors as 2, 3, or 10975bd8deadSopenharmony_ci 4 element arrays of a scalar type. Matrices are often treated as 10985bd8deadSopenharmony_ci arrays of vector types. Continuing that treatment here is logical. 10995bd8deadSopenharmony_ci 11005bd8deadSopenharmony_ci 4) What happens when an explicitly sized array is initialized with too few 11015bd8deadSopenharmony_ci elements? Is it allowed? 11025bd8deadSopenharmony_ci 11035bd8deadSopenharmony_ci RESOLVED: DISALLOWED. In C/C++ this is allowed. The uninitialized 11045bd8deadSopenharmony_ci elements are implicitly initialized to the appropriate reprensentation 11055bd8deadSopenharmony_ci of zero. However, the belief is that this enables a variety of 11065bd8deadSopenharmony_ci programming errors that are difficult to debug on a GPU. 11075bd8deadSopenharmony_ci 11085bd8deadSopenharmony_ci 5) Can scalars be initialized using an initializer list? 11095bd8deadSopenharmony_ci 11105bd8deadSopenharmony_ci RESOLVED: NO. In C/C++ this is allowed. The ISO C99 specification 11115bd8deadSopenharmony_ci specifically say, "The initializer for a scalar shall be a single 11125bd8deadSopenharmony_ci expression, optionally enclosed in braces." However, this may 11135bd8deadSopenharmony_ci pose problems if / when a vec1 type is added. 11145bd8deadSopenharmony_ci 11155bd8deadSopenharmony_ci 6) Are initializer lists for vectors flexible in the same way that vector 11165bd8deadSopenharmony_ci constructors are? Specifically, is the initialzier list for 'c', 11175bd8deadSopenharmony_ci below, legal? 11185bd8deadSopenharmony_ci 11195bd8deadSopenharmony_ci vec2 a = vec2(2, 3); 11205bd8deadSopenharmony_ci vec4 b = vec4(1, a, 4); // b = { 1, 2, 3, 4 } 11215bd8deadSopenharmony_ci vec4 c = { 1, a, 4 }; // Legal? 11225bd8deadSopenharmony_ci 11235bd8deadSopenharmony_ci RESOLVED: NO. In C++ there is a distinction between a constructor 11245bd8deadSopenharmony_ci and an initializer list. If you had vec2 and vec4 classes in C++, a 11255bd8deadSopenharmony_ci constructor 'vec4(float, vec2, float)' might exist, but the 11265bd8deadSopenharmony_ci initializer list for 'c' would not be legal. 11275bd8deadSopenharmony_ci 11285bd8deadSopenharmony_ci 7) Does adding *const* for read-only variables effect array sizing? 11295bd8deadSopenharmony_ci 11305bd8deadSopenharmony_ci RESOLVED. No. Array sizing changes are not part of this proposal. Array 11315bd8deadSopenharmony_ci sizing rules stay the same, where sizes must be compile-time constants, 11325bd8deadSopenharmony_ci whether or not the keyword 'const' was involved, just like it always has 11335bd8deadSopenharmony_ci been. The following was and still is disallowed: 11345bd8deadSopenharmony_ci 11355bd8deadSopenharmony_ci "void foo(const s) { int a[s]; }", 11365bd8deadSopenharmony_ci 11375bd8deadSopenharmony_ci as will be 11385bd8deadSopenharmony_ci 11395bd8deadSopenharmony_ci "void foo() { const s = exp; int a[s]; }". 11405bd8deadSopenharmony_ci 11415bd8deadSopenharmony_ci 8) Should we allow non-compile-time constant initializers for const at 11425bd8deadSopenharmony_ci global scope as well? 11435bd8deadSopenharmony_ci 11445bd8deadSopenharmony_ci RESOLVED. No. Would make linking more difficult. 11455bd8deadSopenharmony_ci 11465bd8deadSopenharmony_ci 9) Do we want to add the new C++ constexpr for declaring constant 11475bd8deadSopenharmony_ci functions? 11485bd8deadSopenharmony_ci 11495bd8deadSopenharmony_ci RESOLVED. No, not yet, could be a potential performance benefit in the 11505bd8deadSopenharmony_ci future, but treat as a separate extension. Note that most built-in 11515bd8deadSopenharmony_ci functions are already understood to be "constexpr". This has been 11525bd8deadSopenharmony_ci submitted into bugzilla. 11535bd8deadSopenharmony_ci 11545bd8deadSopenharmony_ci 10) What combinations of interpolation qualifiers are allowed? Before, 11555bd8deadSopenharmony_ci you could take one of smooth, flat, and noperspective and combine that with 11565bd8deadSopenharmony_ci one of centroid, sample, or patch. What do combinations do we actually 11575bd8deadSopenharmony_ci want? Do we want multiple intances of a single qualifier allowed? 11585bd8deadSopenharmony_ci (E.g. two layout qualifiers, or "in out"?) 11595bd8deadSopenharmony_ci 11605bd8deadSopenharmony_ci RESOLVED. Allow multiple "layout". Not anything else. 11615bd8deadSopenharmony_ci 11625bd8deadSopenharmony_ci 11) Should we allow multiple block declarations to use the same 11635bd8deadSopenharmony_ci binding point? For example: 11645bd8deadSopenharmony_ci layout(binding = 3) uniform Block1 { ... }; 11655bd8deadSopenharmony_ci layout(binding = 3) uniform Block2 { ... }; 11665bd8deadSopenharmony_ci 11675bd8deadSopenharmony_ci RESOLVED: There is no reason to disallow this usage; in particular, 11685bd8deadSopenharmony_ci existing UBO shaders effectively declare all blocks with 11695bd8deadSopenharmony_ci "layout(block = 0)". 11705bd8deadSopenharmony_ci 11715bd8deadSopenharmony_ci 12) Should the qualifier be called "location", "block" or "binding"? 11725bd8deadSopenharmony_ci 11735bd8deadSopenharmony_ci RESOLVED: The qualifier is called "binding" because it makes it more 11745bd8deadSopenharmony_ci clear what parameter of UniformBlockBinding that this qualifier 11755bd8deadSopenharmony_ci affects. "block" could be confused with either the 11765bd8deadSopenharmony_ci <uniformBlockIndex> or <uniformBlockBinding> and "location" might be 11775bd8deadSopenharmony_ci confused with the current uses of the qualifier "location" for 11785bd8deadSopenharmony_ci attribute locations or it could be confused with uses of "location" 11795bd8deadSopenharmony_ci for uniform variable location, which blocks don't have. 11805bd8deadSopenharmony_ci 11815bd8deadSopenharmony_ci 13) Should sampler initialization use a layout(binding) qualifier 11825bd8deadSopenharmony_ci instead of specifying a uniform initializer? 11835bd8deadSopenharmony_ci 11845bd8deadSopenharmony_ci RESOLVED: Revision #4 of the sampler initialization spec uses a 11855bd8deadSopenharmony_ci layout(binding) qualifier for sampler uniforms. This is more 11865bd8deadSopenharmony_ci forward looking and makes the spec more consistent with 11875bd8deadSopenharmony_ci ARB_uniform_block_binding_initialization and 11885bd8deadSopenharmony_ci ARB_shader_atomic_counters. 11895bd8deadSopenharmony_ci 11905bd8deadSopenharmony_ciRevision History 11915bd8deadSopenharmony_ci 11925bd8deadSopenharmony_ci Revision 4, 11-Sep-2014 (pbrown) 11935bd8deadSopenharmony_ci - Fix minor typo. 11945bd8deadSopenharmony_ci Revision 3, 13-May-2014 (John Kessenich) 11955bd8deadSopenharmony_ci - Resolve bug 10593. 11965bd8deadSopenharmony_ci Revision 2, 25-Jul-2011 (John Kessenich) 11975bd8deadSopenharmony_ci - Mark as complete and approved. 11985bd8deadSopenharmony_ci - Tidy up some formating and non-raw-text quote marks. 11995bd8deadSopenharmony_ci - Pull in the initializers for images, to completely subsume 12005bd8deadSopenharmony_ci GL_ARB_uniform_sampler_initialization. 12015bd8deadSopenharmony_ci - Point out image and patch dependencies. 12025bd8deadSopenharmony_ci Revision 1, 5-Jul-2011 (John Kessenich) 12035bd8deadSopenharmony_ci - Initial version. Formed by combing the content of the 12045bd8deadSopenharmony_ci 4.20 draft specification and the content of draft 12055bd8deadSopenharmony_ci extensions: 12065bd8deadSopenharmony_ci * ARB_shading_language_vec1 12075bd8deadSopenharmony_ci * ARB_shading_language_relaxed_qualifiers 12085bd8deadSopenharmony_ci * ARB_shading_language_length 12095bd8deadSopenharmony_ci * ARB_shading_language_initializer_list 12105bd8deadSopenharmony_ci * GL_ARB_uniform_block_binding_initialization 12115bd8deadSopenharmony_ci * GL_ARB_uniform_sampler_initialization (just sampler binding) 12125bd8deadSopenharmony_ci Issues were carried across and renumbered. 12135bd8deadSopenharmony_ci Conformance tests were carried over. 12145bd8deadSopenharmony_ci 1215