15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_enhanced_layouts 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_enhanced_layouts 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 (pbrown 'at' nvidia.com) 165bd8deadSopenharmony_ci Christophe Riccio, AMD 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciNotice 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Copyright (c) 2013 The Khronos Group Inc. Copyright terms at 215bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciSpecification Update Policy 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 265bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 275bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 285bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 295bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 305bd8deadSopenharmony_ci described in more detail at 315bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciStatus 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci Complete. Approved by the ARB on June 3, 2013. 365bd8deadSopenharmony_ci Ratified by the Khronos Board of Promoters on July 19, 2013. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciVersion 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Last Modified Date: January 10, 2019 415bd8deadSopenharmony_ci Revision: 28 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciNumber 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci ARB Extension #146 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ciDependencies 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci This extension is written against the OpenGL 4.3 (Compatibility Profile) 505bd8deadSopenharmony_ci Specification, dated February 14, 2013. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci This extension is written against the GLSL 4.30 Specification. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci OpenGL 3.1 and GLSL 1.40 or later are required. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci This extension interacts with OpenGL 3.3 and ARB_explicit_attrib_location. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci This extension interacts with OpenGL 4.0 and ARB_vertex_attrib_64bit. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci This extension interacts with OpenGL 4.0 and ARB_transform_feedback3. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci This extension interacts with OpenGL 4.1 and ARB_separate_shader_objects. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci This extension interacts with OpenGL 4.3 and 655bd8deadSopenharmony_ci ARB_shader_storage_buffer_object. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci This extension interacts with OpenGL 4.3 and ARB_program_interface_query. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciOverview 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci This extension adds the following functionality to layout qualifiers, 725bd8deadSopenharmony_ci including broadening the API where this functionality is reflected. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci The following are added: 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci 1) Use compile-time constant expressions. E.g., 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci const int start = 6; 795bd8deadSopenharmony_ci layout(location = start + 2) int vec4 v; 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci 2) Specify explicit byte offsets within a uniform or shader storage block. 825bd8deadSopenharmony_ci For example, if you want two vec4 variables "batman" and "robin" to 835bd8deadSopenharmony_ci appear at byte offsets 0 and 64 in your block, you can say: 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci uniform Block { 865bd8deadSopenharmony_ci layout(offset = 0) vec4 batman; 875bd8deadSopenharmony_ci layout(offset = 64) vec4 robin; 885bd8deadSopenharmony_ci }; 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci 3) Force alignment within a uniform or shader storage block. The previous 915bd8deadSopenharmony_ci example could also be expressed: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci uniform Block { 945bd8deadSopenharmony_ci vec4 batman; 955bd8deadSopenharmony_ci layout(align = 64) vec4 robin; 965bd8deadSopenharmony_ci }; 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci This says the member 'robin' must start at the next address that is a 995bd8deadSopenharmony_ci multiple of 64. It allows constructing the same layout in C and in GLSL 1005bd8deadSopenharmony_ci without inventing explicit offsets. 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci Explicit offsets and aligned offsets can be combined: 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci uniform Block { 1055bd8deadSopenharmony_ci vec4 batman; 1065bd8deadSopenharmony_ci layout(offset = 44, align = 8) vec4 robin; 1075bd8deadSopenharmony_ci }; 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci would make 'robin' be at the first 8-byte aligned address, starting at 1105bd8deadSopenharmony_ci 44, which is 48. This is more useful when using the *align* at 1115bd8deadSopenharmony_ci the block level, which will apply to all members. 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci 4) Specify component numbers to more fully utilize the vec4-slot interfaces 1145bd8deadSopenharmony_ci between shader outputs and shader inputs. 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci For example, you could fit the following 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ci - an array of 32 vec3 1195bd8deadSopenharmony_ci - a single float 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci into the space of 32 vec4 slots using the following code: 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci // consume X/Y/Z components of 32 vectors 1245bd8deadSopenharmony_ci layout(location = 0) in vec3 batman[32]; 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci // consumes W component of first vector 1275bd8deadSopenharmony_ci layout(location = 0, component = 3) in float robin; 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci Further, an array of vec3 and an array of float can be stored 1305bd8deadSopenharmony_ci interleaved, using the following. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci // consumes W component of 32 vectors 1335bd8deadSopenharmony_ci layout(location = 0, component = 3) in float robin[32]; 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci // consume X/Y/Z components of 32 vectors 1365bd8deadSopenharmony_ci layout(location = 0) in vec3 batman[32]; 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci 5) Specify transform/feedback buffers, locations, and widths. For example: 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci layout(xfb_buffer = 0, xfb_offset = 0) out vec3 var1; 1415bd8deadSopenharmony_ci layout(xfb_buffer = 0, xfb_offset = 24) out vec3 var2; 1425bd8deadSopenharmony_ci layout(xfb_buffer = 1, xfb_offset = 0) out vec4 var3; 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci The second line above says to write var2 out to byte offset 24 of 1455bd8deadSopenharmony_ci transform/feedback buffer 0. (When doing this, output are only 1465bd8deadSopenharmony_ci captured when xfb_offset is used.) 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci To specify the total number of bytes per entry in a buffer: 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci layout(xfb_buffer = 1, xfb_stride = 32) out; 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci This is necessary if, say, var3 above, which uses bytes 0-11, 1535bd8deadSopenharmony_ci does not fully fill the buffer, which in this case takes 32 bytes. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci Use of this feature effectively eliminates the need to use previously 1565bd8deadSopenharmony_ci existing API commands to describe the transform feedback layout. 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci 6) Allow locations on input and output blocks for SSO interface matching. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci For example: 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci layout(location = 4) in block { 1635bd8deadSopenharmony_ci vec4 batman; // gets location 4 1645bd8deadSopenharmony_ci vec4 robin; // gets location 5 1655bd8deadSopenharmony_ci layout(location = 7) vec4 joker; // gets location 7 1665bd8deadSopenharmony_ci vec4 riddler; // location 8 1675bd8deadSopenharmony_ci }; 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ciIP Status 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci No known IP claims. 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ciNew Procedures and Functions 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci None. 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ciNew Tokens 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci Accepted in the <props> array of GetProgramResourceiv: 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci LOCATION_COMPONENT 0x934A 1825bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B 1835bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci Accepted by the <programInterface> parameter of GetProgramInterfaceiv, 1865bd8deadSopenharmony_ci GetProgramResourceIndex, GetProgramResourceName, and 1875bd8deadSopenharmony_ci GetProgramResourceiv: 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER // reuse from core 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ciModifications to the OpenGL 4.3 (Compatibility Profile) Specification 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci Modify Section 7.3.1, Program Interfaces, p. 84 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci (insert after the TRANSFORM_FEEDBACK_VARYING bullet, p. 86) 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci * TRANSFORM_FEEDBACK_BUFFER corresponds to the set of active buffer 1985bd8deadSopenharmony_ci binding points to which output variables in the 1995bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_VARYING interface are written. 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci (modify next-to-last paragraph, p. 87, to indicate that variables in the 2025bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_VARYING interface need not be sorted if specified via 2035bd8deadSopenharmony_ci layout qualifiers) 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci The order of the active resource list is implementation-dependent for all 2065bd8deadSopenharmony_ci interfaces except for TRANSFORM_FEEDBACK_VARYING. If variables in the 2075bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_VARYING interface were specified using the 2085bd8deadSopenharmony_ci TransformFeedbackVaryings command, the active resource list will be 2095bd8deadSopenharmony_ci arranged in the variable order specified in the most recent call to 2105bd8deadSopenharmony_ci TransformFeedbackVaryings before the last call to LinkProgram. If 2115bd8deadSopenharmony_ci variables in the TRANSFORM_FEEDBACK_VARYING interface were specified using 2125bd8deadSopenharmony_ci layout qualifiers in shader code, the order of the active resource list is 2135bd8deadSopenharmony_ci implementation-dependent. 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci (insert after the first paragraph, p. 88) 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci For the TRANSFORM_FEEDBACK_BUFFER interface, the list of active buffer 2185bd8deadSopenharmony_ci binding points is built by identifying each unique binding point to which 2195bd8deadSopenharmony_ci one or more active output variables will be written in transform feedback 2205bd8deadSopenharmony_ci mode. Active transform feedback buffers do not have an associated name 2215bd8deadSopenharmony_ci string. 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci (modify "Errors" section at the bottom of p. 89, for 2245bd8deadSopenharmony_ci GetProgramInterfaceiv, handling the new TRANSFORM_FEEDBACK_BUFFER 2255bd8deadSopenharmony_ci interface) 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if pname is MAX_NAME_LENGTH and 2285bd8deadSopenharmony_ci <programInterface> is ATOMIC_COUNTER_BUFFER or TRANSFORM_FEEDBACK_BUFFER, 2295bd8deadSopenharmony_ci since active atomic counter and transform feedback buffer resources are 2305bd8deadSopenharmony_ci not assigned name strings. 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if pname is 2335bd8deadSopenharmony_ci MAX_NUM_ACTIVE_VARIABLES and programInterface is not UNIFORM_BLOCK, 2345bd8deadSopenharmony_ci SHADER_STORAGE_BLOCK, ATOMIC_COUNTER_BUFFER, or 2355bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER. 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci (modify the "Errors" section in the middle of p. 90, for 2385bd8deadSopenharmony_ci GetProgramResourceIndex, handling the new TRANSFORM_FEEDBACK_BUFFER 2395bd8deadSopenharmony_ci interface) 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci An INVALID_ENUM error is generated if <programInterface> is 2425bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER or TRANSFORM_FEEDBACK_BUFFER, since active atomic 2435bd8deadSopenharmony_ci counter and transform feedback buffer resources are not assigned name 2445bd8deadSopenharmony_ci strings. 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci (modify the "Errors" section in the middle of p. 90, for 2475bd8deadSopenharmony_ci GetProgramResourceName, handling the new TRANSFORM_FEEDBACK_BUFFER 2485bd8deadSopenharmony_ci interface) 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci An INVALID_ENUM error is generated if <programInterface> is 2515bd8deadSopenharmony_ci ATOMIC_COUNTER_BUFFER or TRANSFORM_FEEDBACK_BUFFER, since active atomic 2525bd8deadSopenharmony_ci counter and transform feedback buffer resources are not assigned name 2535bd8deadSopenharmony_ci strings. 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci (modify existing entries in table 7.2, "GetProgramResourceiv properties 2565bd8deadSopenharmony_ci and supported interfaces", pp. 92-93) 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci Property Supported Interfaces 2595bd8deadSopenharmony_ci ------------------- ---------------------------------------- 2605bd8deadSopenharmony_ci NAME_LENGTH all but ATOMIC_COUNTER_BUFFER and 2615bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci OFFSET UNIFORM, BUFFER_VARIABLE, 2645bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_VARYING 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci BLOCK_INDEX, UNIFORM, BUFFER_VARIABLE 2675bd8deadSopenharmony_ci ARRAY_STRIDE, 2685bd8deadSopenharmony_ci MATRIX_STRIDE, 2695bd8deadSopenharmony_ci IS_ROW_MAJOR 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci BUFFER_BINDING UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER, 2725bd8deadSopenharmony_ci NUM_ACTIVE_VARIABLES, SHADER_STORAGE_BLOCK, 2735bd8deadSopenharmony_ci ACTIVE_VARIABLES TRANSFORM_FEEDBACK_BUFFER 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci BUFFER_DATA_SIZE UNIFORM_BLOCK, ATOMIC_COUNTER_BUFFER, 2765bd8deadSopenharmony_ci SHADER_STORAGE_BLOCK 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci (add to table 7.2, "GetProgramResourceiv properties and supported 2795bd8deadSopenharmony_ci interfaces", pp. 92-93) 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ci Property Supported Interfaces 2825bd8deadSopenharmony_ci ------------------- ---------------------------------------- 2835bd8deadSopenharmony_ci LOCATION_COMPONENT PROGRAM_INPUT, PROGRAM_OUTPUT 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_ TRANSFORM_FEEDBACK_VARYING 2865bd8deadSopenharmony_ci BUFFER_INDEX 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_ TRANSFORM_FEEDBACK_BUFFER 2895bd8deadSopenharmony_ci BUFFER_STRIDE 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci (modify the third paragraph, p. 98) 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci For the property OFFSET, a single integer identifying the offset of an 2945bd8deadSopenharmony_ci active variable is written to <params>. For variables in the UNIFORM and 2955bd8deadSopenharmony_ci BUFFER_VARIABLE interfaces that are backed by a buffer object, the value 2965bd8deadSopenharmony_ci written is the offset of that variable relative to the base of the buffer 2975bd8deadSopenharmony_ci range holding its value. For variables in the TRANSFORM_FEEDBACK_VARYING 2985bd8deadSopenharmony_ci interface, the value written is the offset in the transform feedback 2995bd8deadSopenharmony_ci buffer storage assigned to each vertex captured in transform feedback mode 3005bd8deadSopenharmony_ci where the value of the variable will be stored. Such offsets are 3015bd8deadSopenharmony_ci specified via the /xfb_offset/ layout qualifier or assigned according to 3025bd8deadSopenharmony_ci the variables position in the list of strings passed to 3035bd8deadSopenharmony_ci TransformFeedbackVaryings. Offsets are expressed in basic machine units. 3045bd8deadSopenharmony_ci For all variables not recorded in transform feedback mode, including the 3055bd8deadSopenharmony_ci special names "gl_NextBuffer", "gl_SkipComponents1", "gl_SkipComponents2", 3065bd8deadSopenharmony_ci "gl_SkipComponents3", and "gl_SkipComponents4", -1 is written to <params>. 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci (modify the next-to-last paragraph, p. 98) 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci For the property BUFFER_BINDING, the index of the buffer binding point 3115bd8deadSopenharmony_ci associated with the active uniform block, shader storage block, atomic 3125bd8deadSopenharmony_ci counter buffer, or transform feedback buffer is written to <params>. 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci (modify the second and third paragraphs, p. 99) 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci For the property NUM_ACTIVE_VARIABLES, the number of active variables 3175bd8deadSopenharmony_ci associated with an active uniform block, shader storage block, atomic 3185bd8deadSopenharmony_ci counter buffer, or transform feedback buffer is written to <params>. 3195bd8deadSopenharmony_ci 3205bd8deadSopenharmony_ci For the property ACTIVE_VARIABLES, an array of active variable indices 3215bd8deadSopenharmony_ci associated with an active uniform block, shader storage block, atomic 3225bd8deadSopenharmony_ci counter buffer, or transform feedback buffer is written to <params>. The 3235bd8deadSopenharmony_ci number of values written to params for an active resource is given by the 3245bd8deadSopenharmony_ci value of the property NUM_ACTIVE_VARIABLES for the resource. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci (insert after the first paragraph, p. 100) 3275bd8deadSopenharmony_ci 3285bd8deadSopenharmony_ci For the property LOCATION_COMPONENT, a single integer indicating the first 3295bd8deadSopenharmony_ci component of the location assigned to an active input or output variable 3305bd8deadSopenharmony_ci is written to <params>. For input and output variables with a component 3315bd8deadSopenharmony_ci specified by a <layout> qualifier, the specified component is written. 3325bd8deadSopenharmony_ci For all other input and output variables, the value zero is written. 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci (insert after the second paragraph, p. 100) 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci For the property TRANSFORM_FEEDBACK_BUFFER_INDEX, a single integer 3375bd8deadSopenharmony_ci identifying the index of the active transform feedback buffer associated 3385bd8deadSopenharmony_ci with an active variable is written to <params>. For variables 3395bd8deadSopenharmony_ci corresponding to the special names "gl_NextBuffer", "gl_SkipComponents1", 3405bd8deadSopenharmony_ci "gl_SkipComponents2", "gl_SkipComponents3", and "gl_SkipComponents4", -1 3415bd8deadSopenharmony_ci is written to <params>. 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci For the property TRANSFORM_FEEDBACK_BUFFER_STRIDE, a single integer 3445bd8deadSopenharmony_ci identifying the stride, in basic machine units, between consecutive 3455bd8deadSopenharmony_ci vertices written to the transform feedback buffer is written to <params>. 3465bd8deadSopenharmony_ci 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci Modify Section 7.4.1, Shader Interface Matching, p. 105 3495bd8deadSopenharmony_ci 3505bd8deadSopenharmony_ci (modify the last bullet of "An output variable is considered to match", 3515bd8deadSopenharmony_ci adding the 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ci - the two variables are declared with the same location and component 3545bd8deadSopenharmony_ci layout qualifiers and match in type and qualification 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci (insert a new sentence to the beginning of the last paragraph, p. 105) 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci For the purposes of interface matching, variables declared with a location 3595bd8deadSopenharmony_ci layout qualifier but without a component layout qualifier are considered 3605bd8deadSopenharmony_ci to have declared a component layout qualifier of zero. Variables or block 3615bd8deadSopenharmony_ci members declared as structures... 3625bd8deadSopenharmony_ci 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci Modify Section 11.1.1, Vertex Attributes, p. 377 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci (replace the first two paragraphs, p. 378) 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci When an attribute variable declared using one of the scalar or vector data 3695bd8deadSopenharmony_ci types enumerated in table 11.1 is bound to a generic attribute index <i>, 3705bd8deadSopenharmony_ci its value(s) are taken from the components of generic attribute <i>. The 3715bd8deadSopenharmony_ci generic attribute components used depend on the type of the variable and 3725bd8deadSopenharmony_ci value of the "component" layout qualifier (if any) specified in the 3735bd8deadSopenharmony_ci variable declaration, as identified in table X.1. An attribute variable 3745bd8deadSopenharmony_ci declared using a combination of data type and "component" layout qualifier 3755bd8deadSopenharmony_ci not listed in this table is not supported and will result in shader 3765bd8deadSopenharmony_ci compilation errors. 3775bd8deadSopenharmony_ci 3785bd8deadSopenharmony_ci "component" 3795bd8deadSopenharmony_ci Data type layout qualifier Components used 3805bd8deadSopenharmony_ci ---------------------- ---------------- --------------- 3815bd8deadSopenharmony_ci scalar 0 or unspecified x 3825bd8deadSopenharmony_ci scalar 1 y 3835bd8deadSopenharmony_ci scalar 2 z 3845bd8deadSopenharmony_ci scalar 3 w 3855bd8deadSopenharmony_ci two-component vector 0 or unspecified (x,y) 3865bd8deadSopenharmony_ci two-component vector 1 (y,z) 3875bd8deadSopenharmony_ci two-component vector 2 (z,w) 3885bd8deadSopenharmony_ci three-component vector 0 or unspecified (x,y,z) 3895bd8deadSopenharmony_ci three-component vector 1 (y,z,w) 3905bd8deadSopenharmony_ci four-component vector 0 or unspecified (x,y,z,w) 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci Table X.1: Generic attribute components accessed by attribute variables 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci When an attribute variable declared using a matrix type is bound to a 3955bd8deadSopenharmony_ci generic attribute index <i>, its values are taken from consecutive generic 3965bd8deadSopenharmony_ci attributes beginning with generic attribute <i>. Such matrices are 3975bd8deadSopenharmony_ci treated as an array of column vectors with values taken from the generic 3985bd8deadSopenharmony_ci attributes identified in table X.2. Individual column vectors are taken 3995bd8deadSopenharmony_ci from generic attribute components according table X.1, using the vector 4005bd8deadSopenharmony_ci type from Table X.2 and the "component" layout qualifier (if any) 4015bd8deadSopenharmony_ci specified in the variable declaration. 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci Data type Column vector type Generic attributes used 4045bd8deadSopenharmony_ci --------------- -------------------- ------------------------ 4055bd8deadSopenharmony_ci mat2 dmat2 two-component vector i, i+1 4065bd8deadSopenharmony_ci mat2x3 dmat2x3 three-component vector i, i+1 4075bd8deadSopenharmony_ci mat2x4 dmat2x4 four-component vector i, i+1 4085bd8deadSopenharmony_ci mat3x2 dmat3x2 two-component vector i, i+1, i+2 4095bd8deadSopenharmony_ci mat3 dmat3 three-component vector i, i+1, i+2 4105bd8deadSopenharmony_ci mat3x4 dmat3x4 four-component vector i, i+1, i+2 4115bd8deadSopenharmony_ci mat4x2 dmat4x2 two-component vector i, i+1, i+2, i+3 4125bd8deadSopenharmony_ci mat4x3 dmat4x3 three-component vector i, i+1, i+2, i+3 4135bd8deadSopenharmony_ci mat4 dmat4 four-component vector i, i+1, i+2, i+3 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci Table X.2: Generic attributes and vector types used by column vectors 4165bd8deadSopenharmony_ci of matrix variables bound to generic attribute index <i>. 4175bd8deadSopenharmony_ci 4185bd8deadSopenharmony_ci When an attribute variable declared using an array type is bound to 4195bd8deadSopenharmony_ci generic attribute index <i>, the active array elements are assigned to 4205bd8deadSopenharmony_ci consecutive generic attributes beginning with generic attribute <i>. The 4215bd8deadSopenharmony_ci number of attributes and components assigned to each element are 4225bd8deadSopenharmony_ci determined according to the data type of array elements and "component" 4235bd8deadSopenharmony_ci layout qualifier (if any) specified in the declaration of the array, as 4245bd8deadSopenharmony_ci described above. 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci Modify Section 11.1.2.1, Output Variables (Vertex Shaders), p. 383 4285bd8deadSopenharmony_ci 4295bd8deadSopenharmony_ci (insert before the third paragraph, p. 384) 4305bd8deadSopenharmony_ci 4315bd8deadSopenharmony_ci The set of variables to record can be specified in shader text using the 4325bd8deadSopenharmony_ci "xfb_buffer", "xfb_offset", or "xfb_stride" layout qualifiers. When 4335bd8deadSopenharmony_ci recording output variables of each vertex in transform feedback mode, a 4345bd8deadSopenharmony_ci fixed amount of memory is reserved in the buffer bound to each transform 4355bd8deadSopenharmony_ci feedback buffer binding point. Each output variable recorded is 4365bd8deadSopenharmony_ci associated with a binding point, specified by the "xfb_buffer" layout 4375bd8deadSopenharmony_ci qualifier. Each output variable is written to its associated transform 4385bd8deadSopenharmony_ci feedback binding point at an offset specified by the "xfb_offset" layout 4395bd8deadSopenharmony_ci qualifier, in basic machine units, relative to the base of the memory 4405bd8deadSopenharmony_ci reserved for its vertex. The amount of memory reserved in each transform 4415bd8deadSopenharmony_ci feedback binding point for a single vertex can be specified using the 4425bd8deadSopenharmony_ci "xfb_stride" layout qualifier. If no "xfb_stride" qualifier is specified 4435bd8deadSopenharmony_ci for a binding point, the stride is derived by identifying the variable 4445bd8deadSopenharmony_ci associated with the binding point having the largest offset, and then 4455bd8deadSopenharmony_ci adding the offset and the size of the variable, in basic machine units. 4465bd8deadSopenharmony_ci If any variable associated with the binding point contains 4475bd8deadSopenharmony_ci double-precision floating-point components, the derived stride is aligned 4485bd8deadSopenharmony_ci to the next multiple of eight basic machine units. If a binding point has 4495bd8deadSopenharmony_ci no "xfb_stride" qualifier and no associated output variables, its stride 4505bd8deadSopenharmony_ci is zero. 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci (modify third paragraph, p. 384) 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci When no "xfb_buffer", "xfb_offset", or "xfb_stride" layout qualifiers are 4555bd8deadSopenharmony_ci specified, the set of variables to record is specified with the command 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci void TransformFeedbackVaryings(uint program, ... 4585bd8deadSopenharmony_ci 4595bd8deadSopenharmony_ci (replace last paragraph, p. 384) 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci The variables in <varyings> are assigned binding points and offsets 4625bd8deadSopenharmony_ci sequentially, as though each were specified using the "xfb_buffer" and 4635bd8deadSopenharmony_ci "xfb_offset" layout qualifiers. The strides associated with each binding 4645bd8deadSopenharmony_ci point are derived by adding the offset and size of the last variable 4655bd8deadSopenharmony_ci associated with that binding point. The first variable in <varyings> is 4665bd8deadSopenharmony_ci assigned a binding point and offset of zero. When <bufferMode> is 4675bd8deadSopenharmony_ci INTERLEAVED_ATTRIBS, each subsequent variable is assigned to the same 4685bd8deadSopenharmony_ci binding point as the previous variable and an offset equal to the sum of 4695bd8deadSopenharmony_ci the offset and size of of the previous variable. When <bufferMode> is 4705bd8deadSopenharmony_ci SEPARATE_ATTRIBS, each subsequent variable is assigned to the binding 4715bd8deadSopenharmony_ci point following the binding point of the previous variable with an offset 4725bd8deadSopenharmony_ci of zero. 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci Several special identifiers are supported when <bufferMode> is 4755bd8deadSopenharmony_ci INTERLEAVED_ATTRIBS. These identifiers do not identify output variables 4765bd8deadSopenharmony_ci captured in transform feedback mode, but can be used to modify the binding 4775bd8deadSopenharmony_ci point and offsets assigned to subsequent variables. If a string in 4785bd8deadSopenharmony_ci <varyings> is "gl_NextBuffer", the next variable in <varyings> will be 4795bd8deadSopenharmony_ci assigned to the next binding point, with an offset of zero. If a string 4805bd8deadSopenharmony_ci in <varyings> is "gl_SkipComponents1", "gl_SkipComponents2", 4815bd8deadSopenharmony_ci "gl_SkipComponents3", or "gl_SkipComponents4", the variable is treated as 4825bd8deadSopenharmony_ci as specifying a one- to four-component floating-point output variable with 4835bd8deadSopenharmony_ci undefined values. No data will be recorded for such strings, but the 4845bd8deadSopenharmony_ci offset assigned to the next variable in <varyings> and the stride of the 4855bd8deadSopenharmony_ci assigned binding point will be affected. 4865bd8deadSopenharmony_ci 4875bd8deadSopenharmony_ci (modify first paragraph after the errors section, p. 385) 4885bd8deadSopenharmony_ci 4895bd8deadSopenharmony_ci The state set by TransformFeedbackVaryings or using transform feedback 4905bd8deadSopenharmony_ci layout qualifiers has no effect on the execution of the program until 4915bd8deadSopenharmony_ci program is subsequently linked. When LinkProgram is called, the program 4925bd8deadSopenharmony_ci is linked so that the values of the specified outputs for the vertices of 4935bd8deadSopenharmony_ci each primitive generated by the GL are written to one or more buffer 4945bd8deadSopenharmony_ci objects. If the set of output variables to record in transform feedback 4955bd8deadSopenharmony_ci mode is specified by TransformFeedbackVaryings, a program will fail to 4965bd8deadSopenharmony_ci link if: 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci (insert after the first set of bullets, p. 386) 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci If the set of output variables to record in transform feedback mode is 5015bd8deadSopenharmony_ci specified using layout qualifiers, a program will fail to link if: 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci * any pair of variables associated with the same binding point overlap 5045bd8deadSopenharmony_ci in memory (where the offset of the first variable is less than or 5055bd8deadSopenharmony_ci equal to the offset of the second, but the sum of the offset and size 5065bd8deadSopenharmony_ci of the first variable is greater than the offset of the second); 5075bd8deadSopenharmony_ci 5085bd8deadSopenharmony_ci * any binding point has a stride declared using the "xfb_stride" layout 5095bd8deadSopenharmony_ci qualifier and the sum of the offset and size of any variable 5105bd8deadSopenharmony_ci associated with that binding point exceeds the value of this stride; 5115bd8deadSopenharmony_ci 5125bd8deadSopenharmony_ci * any variable containing double-precision floating-point components 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci * has an "xfb_offset" layout qualifier that is not a multiple of 5155bd8deadSopenharmony_ci eight; or 5165bd8deadSopenharmony_ci 5175bd8deadSopenharmony_ci * is associated with a binding point with an "xfb_stride" layout 5185bd8deadSopenharmony_ci qualifier that is not a multiple of eight; 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ci * the sum of the offset and size of any variable exceeds the maximum 5215bd8deadSopenharmony_ci stride supported by the implementation (four times the value 5225bd8deadSopenharmony_ci of MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS); or 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci * the "xfb_stride" layout qualifier for any binding point exceeds the 5255bd8deadSopenharmony_ci maximum stride supported by the implementation. 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci (modify the two paragraphs following the bullets, p. 386) 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci For transform feedback purposes, each component of outputs declared as 5305bd8deadSopenharmony_ci double-precision floating-point scalars, vectors, or matrices are 5315bd8deadSopenharmony_ci considered to consume eight basic machine units, and each component of any 5325bd8deadSopenharmony_ci other type is considered to consume four basic machine units. 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ci To determine the set of output variables in a linked program object that 5355bd8deadSopenharmony_ci will be captured in transform feedback mode and the binding points to 5365bd8deadSopenharmony_ci which those variables are written, applications can query the properties 5375bd8deadSopenharmony_ci and active resources of the TRANSFORM_FEEDBACK_VARYING and 5385bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER interfaces. 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci (insert before the fourth paragraph, starting with "Additionally, the 5415bd8deadSopenharmony_ci command" on p. 386) 5425bd8deadSopenharmony_ci 5435bd8deadSopenharmony_ci If the shader used to record output variables for transform feedback 5445bd8deadSopenharmony_ci varyings uses the "xfb_buffer", "xfb_offset", or "xfb_stride" layout 5455bd8deadSopenharmony_ci qualifiers, the values specified by TransformFeedbackVaryings are 5465bd8deadSopenharmony_ci ignored, and the set of variables captured for transform feedback is 5475bd8deadSopenharmony_ci instead derived from the specified layout qualifiers. 5485bd8deadSopenharmony_ci 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ci Modify Section 13.2.2, Transform Feedback Primitive Capture, p. 457 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci (split the first paragraph, p. 459, and replace the second half of the 5535bd8deadSopenharmony_ci paragraph with the following language) 5545bd8deadSopenharmony_ci 5555bd8deadSopenharmony_ci ... attributes of the subsequent vertices. 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci When capturing vertices, the stride associated with each transform 5585bd8deadSopenharmony_ci feedback binding point indicates the number of basic machine units of 5595bd8deadSopenharmony_ci storage reserved for each vertex in the bound buffer object. For every 5605bd8deadSopenharmony_ci vertex captured, each output variable with an assigned transform feedback 5615bd8deadSopenharmony_ci offset will be written to the storage reserved for the vertex at the 5625bd8deadSopenharmony_ci associated binding point. When writing output variables that are arrays 5635bd8deadSopenharmony_ci or structures, individual array elements or structure members are written 5645bd8deadSopenharmony_ci in order. For vector types, individual components are written in order. 5655bd8deadSopenharmony_ci For matrix types, outputs are written as an array of column vectors. If 5665bd8deadSopenharmony_ci any component of an output with an assigned transform feedback offset was 5675bd8deadSopenharmony_ci not written to by its shader, the value recorded for that component is 5685bd8deadSopenharmony_ci undefined. The results of writing an output variable to a transform 5695bd8deadSopenharmony_ci feedback buffer are undefined if any component of that variable would be 5705bd8deadSopenharmony_ci written at an offset not aligned to the size of the component. When 5715bd8deadSopenharmony_ci capturing a vertex, any portion of the reserved storage not associated 5725bd8deadSopenharmony_ci with an output variable with an assigned transform feedback offset will be 5735bd8deadSopenharmony_ci unmodified. 5745bd8deadSopenharmony_ci 5755bd8deadSopenharmony_ci (delete the last three paragraphs, p. 459, which describe 5765bd8deadSopenharmony_ci INTERLEAVED_ATTRIBS and SEPARATE_ATTRIBS mode; this is already handled by 5775bd8deadSopenharmony_ci the language defining TransformFeedbackAttribs in terms of offsets and 5785bd8deadSopenharmony_ci strides) 5795bd8deadSopenharmony_ci 5805bd8deadSopenharmony_ci (modify the first paragraph, p. 460, removing the incorrect reference to 5815bd8deadSopenharmony_ci "geometry program") 5825bd8deadSopenharmony_ci 5835bd8deadSopenharmony_ci When using a geometry shader that writes vertices to multiple ... 5845bd8deadSopenharmony_ci 5855bd8deadSopenharmony_ci (modify the third paragraph, p. 460) 5865bd8deadSopenharmony_ci 5875bd8deadSopenharmony_ci Any transform feedback binding point used for capturing vertices must have 5885bd8deadSopenharmony_ci buffer objects bound when BeginTransformFeedback is called. A binding 5895bd8deadSopenharmony_ci point requires a bound buffer object if and only if its associated stride 5905bd8deadSopenharmony_ci in the program object used for transform feedback primitive capture is 5915bd8deadSopenharmony_ci non-zero and the transform feedback buffer is associated with output 5925bd8deadSopenharmony_ci variables, blocks or block members in the program object. 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci Modify Section 15.2.3, Shader Outputs (Fragment Shader Variables), p. 514 5955bd8deadSopenharmony_ci 5965bd8deadSopenharmony_ci (modify the fifth paragraph, p. 515, making an output variable binding 5975bd8deadSopenharmony_ci refer to "components of a fragment color") 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci The binding of a user-defined output variable to components of a fragment 6005bd8deadSopenharmony_ci color number can be specified explicitly in shader text or using the 6015bd8deadSopenharmony_ci command... 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci (modify the third paragraph, p. 516) 6045bd8deadSopenharmony_ci 6055bd8deadSopenharmony_ci When a program is linked, each active user-defined fragment shader output 6065bd8deadSopenharmony_ci variable will have a binding consisting of a fragment color number, a 6075bd8deadSopenharmony_ci fragment color index, and a component index. Output variables declared 6085bd8deadSopenharmony_ci with "location", "component", or "index" layout qualifiers will use the 6095bd8deadSopenharmony_ci values specified in the shader text. Output variables without such layout 6105bd8deadSopenharmony_ci qualifiers will use bindings specified by BindFragDataLocationIndexed or 6115bd8deadSopenharmony_ci BindFragDataLocation, if any. Otherwise, the linker will automatically 6125bd8deadSopenharmony_ci assign a fragment color number, using any color number not already 6135bd8deadSopenharmony_ci assigned to another active fragment shader output variable. The fragment 6145bd8deadSopenharmony_ci color index and component index of an output variable binding will default 6155bd8deadSopenharmony_ci to zero unless values are explicitly specified by a layout qualifer or 6165bd8deadSopenharmony_ci BindFragDataLocationIndexed. The properties of an active fragment shader 6175bd8deadSopenharmony_ci output variable binding can be queried using the command 6185bd8deadSopenharmony_ci GetProgramResourceiv with a <programInterface> of PROGRAM_OUTPUT and 6195bd8deadSopenharmony_ci <props> values of LOCATION, LOCATION_INDEX, and LOCATION_COMPONENT. 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci When a fragment shader terminates, the value of each active user-defined 6225bd8deadSopenharmony_ci output variable is written to components of the fragment color output to 6235bd8deadSopenharmony_ci which it is bound. The set of fragment color components written is 6245bd8deadSopenharmony_ci determined according to the variable's data type and component index 6255bd8deadSopenharmony_ci binding, using the mappings in table X.1. For an output variable declared 6265bd8deadSopenharmony_ci as an array bound to fragment color number <i>, individual active array 6275bd8deadSopenharmony_ci elements are written to consecutive fragment color numbers beginning with 6285bd8deadSopenharmony_ci <i>, with the components written determined from the array element's data 6295bd8deadSopenharmony_ci type and the array variable's component index binding. 6305bd8deadSopenharmony_ci 6315bd8deadSopenharmony_ci Output binding assignments will cause LinkProgram to fail: 6325bd8deadSopenharmony_ci 6335bd8deadSopenharmony_ci (modify the third bullet immediately below the previous edit, p. 516, and 6345bd8deadSopenharmony_ci add a new bullet immediately after it) 6355bd8deadSopenharmony_ci 6365bd8deadSopenharmony_ci * if two output variables are bound to the same output number and index 6375bd8deadSopenharmony_ci with overlapping components selected; 6385bd8deadSopenharmony_ci 6395bd8deadSopenharmony_ci * if two output variables with different component types (signed 6405bd8deadSopenharmony_ci integer, unsigned integer, or floating-point) are bound to the same 6415bd8deadSopenharmony_ci output number, even if selected components do not overlap; or 6425bd8deadSopenharmony_ci 6435bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language 6445bd8deadSopenharmony_ci 6455bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 6465bd8deadSopenharmony_ci language features described in this extension: 6475bd8deadSopenharmony_ci 6485bd8deadSopenharmony_ci #extension GL_ARB_enhanced_layouts : <behavior> 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 6515bd8deadSopenharmony_ci 6525bd8deadSopenharmony_ci New preprocessor #defines are added to the OpenGL Shading Language: 6535bd8deadSopenharmony_ci 6545bd8deadSopenharmony_ci #define GL_ARB_enhanced_layouts 1 6555bd8deadSopenharmony_ci 6565bd8deadSopenharmony_ciAdditions to Chapter 4 "Variables and Types" of the OpenGL Shading Language 6575bd8deadSopenharmony_ci 6585bd8deadSopenharmony_ci Section 4.4 "Layout Qualifiers" 6595bd8deadSopenharmony_ci 6605bd8deadSopenharmony_ci The existing last paragraph already says: 6615bd8deadSopenharmony_ci 6625bd8deadSopenharmony_ci "More than one layout qualifier may appear in a single declaration. If 6635bd8deadSopenharmony_ci the same layout-qualifier-name occurs in multiple layout qualifiers 6645bd8deadSopenharmony_ci for the same declaration, the last one overrides the former ones." 6655bd8deadSopenharmony_ci 6665bd8deadSopenharmony_ci Expand it to say: 6675bd8deadSopenharmony_ci 6685bd8deadSopenharmony_ci "More than one layout qualifier may appear in a single declaration. 6695bd8deadSopenharmony_ci Additionally, the same layout-qualifier-name can occur multiple times 6705bd8deadSopenharmony_ci within a layout qualifier or across multiple layout qualifiers in the 6715bd8deadSopenharmony_ci same declaration. When the same layout-qualifier-name occurs 6725bd8deadSopenharmony_ci multiple times, in a single declaration, the last occurrence overrides 6735bd8deadSopenharmony_ci the former occurrence(s). Further, if such a layout-qualifier-name 6745bd8deadSopenharmony_ci will effect subsequent declarations or other observable behavior, it 6755bd8deadSopenharmony_ci is only the last occurrence that will have any effect, behaving as if 6765bd8deadSopenharmony_ci the earlier occurrence(s) within the declaration are not present. 6775bd8deadSopenharmony_ci This is also true for overriding layout-qualifier-names, where one 6785bd8deadSopenharmony_ci overrides the other (e.g., row_major vs. column_major); only the last 6795bd8deadSopenharmony_ci occurrence has any effect." 6805bd8deadSopenharmony_ci 6815bd8deadSopenharmony_ci Section 4.4.1 "Input Layout Qualifiers" 6825bd8deadSopenharmony_ci 6835bd8deadSopenharmony_ci Change 6845bd8deadSopenharmony_ci 6855bd8deadSopenharmony_ci "All shaders, except compute shaders, allow input layout location 6865bd8deadSopenharmony_ci qualifiers on input variable declarations." 6875bd8deadSopenharmony_ci 6885bd8deadSopenharmony_ci To 6895bd8deadSopenharmony_ci 6905bd8deadSopenharmony_ci "All shaders, except compute shaders, allow *location* layout qualifiers 6915bd8deadSopenharmony_ci on input variable declarations, input block declarations, and input 6925bd8deadSopenharmony_ci block member declarations. Of these, variables and block members 6935bd8deadSopenharmony_ci (but not blocks) additionally allow the *component* layout qualifier." 6945bd8deadSopenharmony_ci 6955bd8deadSopenharmony_ci Change 6965bd8deadSopenharmony_ci 6975bd8deadSopenharmony_ci "The layout qualifier identifier for inputs is 6985bd8deadSopenharmony_ci 6995bd8deadSopenharmony_ci "layout-qualifier-id 7005bd8deadSopenharmony_ci location = integer-constant 7015bd8deadSopenharmony_ci 7025bd8deadSopenharmony_ci "Only one argument is accepted. For example," 7035bd8deadSopenharmony_ci 7045bd8deadSopenharmony_ci to 7055bd8deadSopenharmony_ci 7065bd8deadSopenharmony_ci "The layout qualifier identifiers for inputs are 7075bd8deadSopenharmony_ci 7085bd8deadSopenharmony_ci "layout-qualifier-id 7095bd8deadSopenharmony_ci location = integral-constant-expression 7105bd8deadSopenharmony_ci component = integral-constant-expression 7115bd8deadSopenharmony_ci 7125bd8deadSopenharmony_ci "where integral-constant-expression is defined in Section 4.3.3 7135bd8deadSopenharmony_ci Constant Expressions as /integral constant expression/" 7145bd8deadSopenharmony_ci 7155bd8deadSopenharmony_ci "For example," 7165bd8deadSopenharmony_ci 7175bd8deadSopenharmony_ci Add more examples: 7185bd8deadSopenharmony_ci 7195bd8deadSopenharmony_ci const int start = 6; 7205bd8deadSopenharmony_ci layout(location = start + 2) int vec4 v; 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci and change the first sentence describing them to 7235bd8deadSopenharmony_ci 7245bd8deadSopenharmony_ci "will establish that the shader input normal is assigned to vector 7255bd8deadSopenharmony_ci location number 3 and v is assigned location number 8." 7265bd8deadSopenharmony_ci 7275bd8deadSopenharmony_ci About 18 other occurrences of "integer-constant" all need to be changed per 7285bd8deadSopenharmony_ci above to "integral-constant-expression", throughout Sections 4.4.1.2 7295bd8deadSopenharmony_ci through 4.4.6.2. 7305bd8deadSopenharmony_ci 7315bd8deadSopenharmony_ci Change 7325bd8deadSopenharmony_ci 7335bd8deadSopenharmony_ci "If the declared input is a structure, its members will be 7345bd8deadSopenharmony_ci assigned consecutive locations in the order of declaration, with the 7355bd8deadSopenharmony_ci first member assigned the location specified for the structure." 7365bd8deadSopenharmony_ci 7375bd8deadSopenharmony_ci To 7385bd8deadSopenharmony_ci 7395bd8deadSopenharmony_ci "If the declared input is a structure or block, its members will be 7405bd8deadSopenharmony_ci assigned consecutive locations in their order of declaration, with the 7415bd8deadSopenharmony_ci first member assigned the location provided in the layout qualifier. 7425bd8deadSopenharmony_ci For a structure. It is a compile-time error to use a location 7435bd8deadSopenharmony_ci qualifier on a member of a structure. For a block, this process 7445bd8deadSopenharmony_ci applies to the entire block, or until the first member is reached 7455bd8deadSopenharmony_ci that has a location layout qualifier. When a block member is declared 7465bd8deadSopenharmony_ci with a location qualifier, its location comes from that qualifier: The 7475bd8deadSopenharmony_ci member's location qualifier overrides the block-level declaration. 7485bd8deadSopenharmony_ci Subsequent members are again assigned consecutive locations, based 7495bd8deadSopenharmony_ci on the newest location, until the next member declared with a *location* 7505bd8deadSopenharmony_ci layout qualifier. The values used for locations do not have to be 7515bd8deadSopenharmony_ci declared in increasing order. 7525bd8deadSopenharmony_ci 7535bd8deadSopenharmony_ci "It is a compile-time error to declare a block with some of its members 7545bd8deadSopenharmony_ci having a location, but not all. Thus, if a block has no 7555bd8deadSopenharmony_ci block-level *location* layout qualifier, it is required that either all 7565bd8deadSopenharmony_ci or none of its members have a *location* layout qualifier." 7575bd8deadSopenharmony_ci 7585bd8deadSopenharmony_ci Change the next paragraph so it reads 7595bd8deadSopenharmony_ci 7605bd8deadSopenharmony_ci "The locations consumed by block and structure members are 7615bd8deadSopenharmony_ci determined..." 7625bd8deadSopenharmony_ci 7635bd8deadSopenharmony_ci Change the subsequent examples to 7645bd8deadSopenharmony_ci 7655bd8deadSopenharmony_ci layout(location = 3) in struct S { 7665bd8deadSopenharmony_ci vec3 a; // gets location 3 7675bd8deadSopenharmony_ci mat2 b; // gets locations 4 and 5 7685bd8deadSopenharmony_ci vec4 c[2]; // gets locations 6 and 7 7695bd8deadSopenharmony_ci layout (location = 8) vec2 A; // ERROR, can't use on struct member 7705bd8deadSopenharmony_ci } s; 7715bd8deadSopenharmony_ci 7725bd8deadSopenharmony_ci layout(location = 4) in block { 7735bd8deadSopenharmony_ci vec4 d; // gets location 4 7745bd8deadSopenharmony_ci vec4 e; // gets location 5 7755bd8deadSopenharmony_ci layout(location = 7) vec4 f; // gets location 7 7765bd8deadSopenharmony_ci vec4 g; // gets location 8 7775bd8deadSopenharmony_ci layout (location = 1) vec4 h; // gets location 1 7785bd8deadSopenharmony_ci vec4 i; // gets location 2 7795bd8deadSopenharmony_ci vec4 j; // gets location 3 7805bd8deadSopenharmony_ci vec4 k; // ERROR, location 4 already used 7815bd8deadSopenharmony_ci }; 7825bd8deadSopenharmony_ci 7835bd8deadSopenharmony_ci Remove the paragraph 7845bd8deadSopenharmony_ci 7855bd8deadSopenharmony_ci "Location layout qualifiers may be used on input variables declared as 7865bd8deadSopenharmony_ci structures, but not on individual members. Location layout qualifiers 7875bd8deadSopenharmony_ci may not be used on input blocks or input block members. Compile-time 7885bd8deadSopenharmony_ci errors result if these rules are not followed." 7895bd8deadSopenharmony_ci 7905bd8deadSopenharmony_ci Replace the paragraph (parts of it show up again at the end of this section) 7915bd8deadSopenharmony_ci 7925bd8deadSopenharmony_ci "A program will fail to link if any two non-vertex shader input 7935bd8deadSopenharmony_ci variables or block members are assigned to the same location...." 7945bd8deadSopenharmony_ci 7955bd8deadSopenharmony_ci with part of it's last sentence (keep this here): 7965bd8deadSopenharmony_ci 7975bd8deadSopenharmony_ci "A program will fail to link if explicit location assignments leave the 7985bd8deadSopenharmony_ci linker unable to find space for other variables without explicit 7995bd8deadSopenharmony_ci assignments." 8005bd8deadSopenharmony_ci 8015bd8deadSopenharmony_ci Add, after the specification for 'location', the following: 8025bd8deadSopenharmony_ci 8035bd8deadSopenharmony_ci "The *component* qualifier allows the location to be more finely 8045bd8deadSopenharmony_ci specified for scalars and vectors, down to the individual components 8055bd8deadSopenharmony_ci within a location that are 8065bd8deadSopenharmony_ci consumed. It is a compile-time error to use *component* without 8075bd8deadSopenharmony_ci also specifying *location* (order does not matter). The components 8085bd8deadSopenharmony_ci within a location are 0, 1, 2, and 3. A variable or block member 8095bd8deadSopenharmony_ci starting at component N will consume components N, N+1, N+2, ... up 8105bd8deadSopenharmony_ci through its size. For example: 8115bd8deadSopenharmony_ci 8125bd8deadSopenharmony_ci // a consumes components 2 and 3 of location 4 8135bd8deadSopenharmony_ci layout(location = 4, component = 2) vec2 a; 8145bd8deadSopenharmony_ci 8155bd8deadSopenharmony_ci // b consumes component 1 of location 4 8165bd8deadSopenharmony_ci layout(location = 4, component = 1) float b; 8175bd8deadSopenharmony_ci 8185bd8deadSopenharmony_ci // ERROR: c overflows components 2 and 3 8195bd8deadSopenharmony_ci layout(location = 3, component = 2) vec3 c; 8205bd8deadSopenharmony_ci 8215bd8deadSopenharmony_ci "If the variable is an array, each element of the array, in order, is 8225bd8deadSopenharmony_ci assigned to consecutive locations, but all at the same specified 8235bd8deadSopenharmony_ci component within each location. For example: 8245bd8deadSopenharmony_ci 8255bd8deadSopenharmony_ci // component 3 in 6 locations are consumed 8265bd8deadSopenharmony_ci layout(location = 2, component = 3) float d[6]; 8275bd8deadSopenharmony_ci 8285bd8deadSopenharmony_ci "That is, location 2 component 3 will hold d[0], location 3 component 3 8295bd8deadSopenharmony_ci will hold d[1], ..., up through location 7 component 3 holding d[5]. 8305bd8deadSopenharmony_ci 8315bd8deadSopenharmony_ci "This allows packing of two arrays into the same set of locations: 8325bd8deadSopenharmony_ci 8335bd8deadSopenharmony_ci // e consumes beginning (components 0, 1 and 2) of each of 6 slots 8345bd8deadSopenharmony_ci layout(location = 0, component = 0) vec3 e[6]; 8355bd8deadSopenharmony_ci 8365bd8deadSopenharmony_ci // f consumes last component of the same 6 slots 8375bd8deadSopenharmony_ci layout(location = 0, component = 3) float f[6]; 8385bd8deadSopenharmony_ci 8395bd8deadSopenharmony_ci "If applying this to an array of arrays, all levels of arrayness are 8405bd8deadSopenharmony_ci removed to get to the elements that are assigned per location to the 8415bd8deadSopenharmony_ci specified component. These non-arrayed elements will fill the locations 8425bd8deadSopenharmony_ci in the order specified for arrays of arrays in section 4.1.9 "Arrays". 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci "It is a compile-time error to apply the *component* qualifier to a 8455bd8deadSopenharmony_ci matrix, a structure, a block, or an array containing any of these. 8465bd8deadSopenharmony_ci It is a link-time error to specify different components for the same 8475bd8deadSopenharmony_ci variable within a program. 8485bd8deadSopenharmony_ci 8495bd8deadSopenharmony_ci "/Location aliasing/ is causing two variables or block members to have 8505bd8deadSopenharmony_ci the same location number. /Component aliasing/ is assigning the same 8515bd8deadSopenharmony_ci (or overlapping) component numbers for two location aliases. (Recall 8525bd8deadSopenharmony_ci if component is not used, component's are assigned starting with 0.) 8535bd8deadSopenharmony_ci With one exception, location aliasing is allowed only if it does not 8545bd8deadSopenharmony_ci cause component aliasing; it is a compile-time or link-time error to 8555bd8deadSopenharmony_ci cause component aliasing. Further, when location aliasing, the aliases 8565bd8deadSopenharmony_ci sharing the location must have the same underlying numerical type 8575bd8deadSopenharmony_ci (floating-point or integer) and the same auxiliary storage and 8585bd8deadSopenharmony_ci interpolation qualification. The one exception where component aliasing 8595bd8deadSopenharmony_ci is permitted is for two input variables (not block members) to a vertex 8605bd8deadSopenharmony_ci shader, which are allowed to have component aliasing. This 8615bd8deadSopenharmony_ci vertex-variable component aliasing is intended only to support vertex 8625bd8deadSopenharmony_ci shaders where each execution path accesses at most one input per each 8635bd8deadSopenharmony_ci aliased component. Implementations are permitted, but not required, to 8645bd8deadSopenharmony_ci generate link-time errors if they detect that every path through the 8655bd8deadSopenharmony_ci vertex shader executable accesses multiple inputs aliased to any single 8665bd8deadSopenharmony_ci component." 8675bd8deadSopenharmony_ci 8685bd8deadSopenharmony_ci Section 4.4.2 "Output Qualifiers" 8695bd8deadSopenharmony_ci 8705bd8deadSopenharmony_ci Change 8715bd8deadSopenharmony_ci 8725bd8deadSopenharmony_ci "All shaders, except compute shaders, allow location output layout 8735bd8deadSopenharmony_ci qualfiers on output variable declarations." 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ci To 8765bd8deadSopenharmony_ci 8775bd8deadSopenharmony_ci "As with input layout qualifiers, all shaders except compute shaders 8785bd8deadSopenharmony_ci allow *location* layout qualifiers on output variable declarations, 8795bd8deadSopenharmony_ci output block declarations, and output block member declarations. Of 8805bd8deadSopenharmony_ci these, variables and block members (but not blocks) additionally 8815bd8deadSopenharmony_ci allow the *component* layout qualifier." 8825bd8deadSopenharmony_ci 8835bd8deadSopenharmony_ci And add the layout-qualifier-id: 8845bd8deadSopenharmony_ci 8855bd8deadSopenharmony_ci component = integer-constant-expression 8865bd8deadSopenharmony_ci 8875bd8deadSopenharmony_ci Following that, add this new paragraph: 8885bd8deadSopenharmony_ci 8895bd8deadSopenharmony_ci "The usage and rules for using the *component* qualifier, and applying 8905bd8deadSopenharmony_ci *location* qualifier to blocks and structures, are as described in 8915bd8deadSopenharmony_ci section 4.4.1 "Input Layout Qualifiers". Additionally, for fragment 8925bd8deadSopenharmony_ci shader outputs, if two variables are placed within the same location, 8935bd8deadSopenharmony_ci they must have the same underlying type (floating-point or integer). 8945bd8deadSopenharmony_ci No component aliasing of output variables or members is allowed." 8955bd8deadSopenharmony_ci 8965bd8deadSopenharmony_ci Remove the second (redundant) 8975bd8deadSopenharmony_ci 8985bd8deadSopenharmony_ci location = integer-constant 8995bd8deadSopenharmony_ci 9005bd8deadSopenharmony_ci Add a new section 4.4.2.1 "Transform Feedback Layout Qualifiers" 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ci "The vertex, tessellation, and geometry stages allow shaders to control 9035bd8deadSopenharmony_ci transform feedback. When doing this, shaders will dictate which 9045bd8deadSopenharmony_ci transform feedback buffers are in use, which output variables will be 9055bd8deadSopenharmony_ci written to which buffers, and how each buffer is laid out. To 9065bd8deadSopenharmony_ci accomplish this, shaders allow the following layout qualifier identifiers 9075bd8deadSopenharmony_ci on output declarations: 9085bd8deadSopenharmony_ci 9095bd8deadSopenharmony_ci layout-qualifier-id 9105bd8deadSopenharmony_ci xfb_buffer = integral-constant-expression 9115bd8deadSopenharmony_ci xfb_offset = integral-constant-expression 9125bd8deadSopenharmony_ci xfb_stride = integral-constant-expression 9135bd8deadSopenharmony_ci 9145bd8deadSopenharmony_ci "Any shader making any static use (after preprocessing) of any of these 9155bd8deadSopenharmony_ci *xfb_* qualifiers will cause the shader to be in a transform feedback 9165bd8deadSopenharmony_ci capturing mode and hence responsible for describing the transform feedback 9175bd8deadSopenharmony_ci setup. This mode will capture any output selected by 9185bd8deadSopenharmony_ci *xfb_offset*, directly or indirectly, to a transform feedback buffer. 9195bd8deadSopenharmony_ci 9205bd8deadSopenharmony_ci "The *xfb_buffer* qualifier specifies which transform feedback buffer will 9215bd8deadSopenharmony_ci capture those outputs selected with *xfb_offset*. The *xfb_buffer* 9225bd8deadSopenharmony_ci qualifier can be applied to the qualifier out, to output variables, to 9235bd8deadSopenharmony_ci output blocks, and to output block members. Shaders in the transform 9245bd8deadSopenharmony_ci feedback capturing mode have an initial global default of 9255bd8deadSopenharmony_ci 9265bd8deadSopenharmony_ci layout(xfb_buffer = 0) out; 9275bd8deadSopenharmony_ci 9285bd8deadSopenharmony_ci "This default can be changed by declaring a different buffer with xfb_buffer 9295bd8deadSopenharmony_ci on the interface qualifier out. This is the only way the global default can 9305bd8deadSopenharmony_ci be changed. When a variable or output block is declared without an 9315bd8deadSopenharmony_ci xfb_buffer qualifier, it inherits the global default buffer. When a variable 9325bd8deadSopenharmony_ci or output block is declared with an xfb_buffer qualifier, it has that 9335bd8deadSopenharmony_ci declared buffer. All members of a block inherit the block's buffer. A 9345bd8deadSopenharmony_ci member is allowed to declare an xfb_buffer, but it must match the buffer 9355bd8deadSopenharmony_ci inherited from its block, or a compile-time error results. 9365bd8deadSopenharmony_ci 9375bd8deadSopenharmony_ci "The *xfb_buffer* qualifier follows the same conventions, behavior, 9385bd8deadSopenharmony_ci defaults, and inheritance rules as the qualifier stream, and the examples 9395bd8deadSopenharmony_ci for stream apply here as well. This includes a block's inheritance of the 9405bd8deadSopenharmony_ci current global default buffer, a block member's inheritance of the block's 9415bd8deadSopenharmony_ci buffer, and the requirement that any *xfb_buffer* declared on a block 9425bd8deadSopenharmony_ci member must match the buffer inherited from the block. 9435bd8deadSopenharmony_ci 9445bd8deadSopenharmony_ci layout(xfb_buffer=2, xfb_offset=0) out block { // block's buffer is 2 9455bd8deadSopenharmony_ci layout(xfb_buffer = 2) vec4 v; // okay, matches the inherited 2 9465bd8deadSopenharmony_ci layout(xfb_buffer = 3) vec4 u; // ERROR, mismatched buffer 9475bd8deadSopenharmony_ci vec4 w; // inherited 9485bd8deadSopenharmony_ci }; 9495bd8deadSopenharmony_ci layout (xfb_offset=16) out vec4 t; // initial default is buffer 0 9505bd8deadSopenharmony_ci layout (xfb_buffer=1) out; // new global default of 1 9515bd8deadSopenharmony_ci out block { // block has buffer 1 9525bd8deadSopenharmony_ci vec4 x; // x has buffer 1 (not captured) 9535bd8deadSopenharmony_ci layout(xfb_buffer = 1) vec4 y; // okay (not captured) 9545bd8deadSopenharmony_ci layout(xfb_buffer = 0) vec4 z; // ERROR, mismatched buffer 9555bd8deadSopenharmony_ci }; 9565bd8deadSopenharmony_ci layout(xfb_offset=0) out vec4 g; // g has buffer 1 9575bd8deadSopenharmony_ci layout(xfb_buffer=2) out vec4 h; // does not change global default 9585bd8deadSopenharmony_ci layout(xfb_offset=16) out vec4 j; // j has buffer 1 9595bd8deadSopenharmony_ci 9605bd8deadSopenharmony_ci "Note this means all members of a block that go to a transform feedback 9615bd8deadSopenharmony_ci buffer will go to the same buffer. 9625bd8deadSopenharmony_ci 9635bd8deadSopenharmony_ci "It is a compile-time error to specify an *xfb_buffer* that is greater than 9645bd8deadSopenharmony_ci the implementation-dependent constant gl_MaxTransformFeedbackBuffers. 9655bd8deadSopenharmony_ci 9665bd8deadSopenharmony_ci "The *xfb_offset* qualifier assigns a byte offset within a transform 9675bd8deadSopenharmony_ci feedback buffer. Only variables, block members, or blocks can be qualified 9685bd8deadSopenharmony_ci with *xfb_offset*. If a block is qualified with *xfb_offset*, all its 9695bd8deadSopenharmony_ci members are assigned transform feedback buffer offsets. If a block is 9705bd8deadSopenharmony_ci not qualified with *xfb_offset*, any members of that block not qualified 9715bd8deadSopenharmony_ci with an *xfb_offset* will not be assigned transform feedback buffer 9725bd8deadSopenharmony_ci offsets. Only variables and block members that are assigned offsets will 9735bd8deadSopenharmony_ci be captured (thus, a proper subset of a block can be captured). Each time 9745bd8deadSopenharmony_ci such a variable or block member is written in a shader, the written value 9755bd8deadSopenharmony_ci is captured at the assigned offset. If such a block member or variable is 9765bd8deadSopenharmony_ci not written during a shader invocation, the buffer contents at the assigned 9775bd8deadSopenharmony_ci offset will be undefined. Even if there are no static writes to a variable 9785bd8deadSopenharmony_ci or member that is assigned a transform feedback offset, the space is still 9795bd8deadSopenharmony_ci allocated in the buffer and still affects the stride. 9805bd8deadSopenharmony_ci 9815bd8deadSopenharmony_ci "Variables and block members qualified with *xfb_offset* can be scalars, 9825bd8deadSopenharmony_ci vectors, matrices, structures, and (sized) arrays of these. The offset must be 9835bd8deadSopenharmony_ci a multiple of the size of the first component of the first qualified variable 9845bd8deadSopenharmony_ci or block member, or a compile-time error results. Further, if applied to 9855bd8deadSopenharmony_ci an aggregate containing a double, the offset must also be a multiple of 8, 9865bd8deadSopenharmony_ci and the space taken in the buffer will be a multiple of 8. The given 9875bd8deadSopenharmony_ci offset applies to the first component of the first member of the qualified 9885bd8deadSopenharmony_ci entity. Then, within the qualified entity, subsequent components are each 9895bd8deadSopenharmony_ci assigned, in order, to the next available offset aligned to a multiple of 9905bd8deadSopenharmony_ci that component's size. Aggregate types are flattened down to the component 9915bd8deadSopenharmony_ci level to get this sequence of components. It is a compile-time error to 9925bd8deadSopenharmony_ci apply xfb_offset to the declaration of an unsized array. 9935bd8deadSopenharmony_ci 9945bd8deadSopenharmony_ci "The *xfb_stride* qualifier specifies how many bytes are consumed by each 9955bd8deadSopenharmony_ci captured vertex. It applies to the transform feedback buffer for that 9965bd8deadSopenharmony_ci declaration, whether it is inherited or explicitly declared. It can be 9975bd8deadSopenharmony_ci applied to variables, 9985bd8deadSopenharmony_ci blocks, block members, or just the qualifier out. If the buffer is 9995bd8deadSopenharmony_ci capturing any double-typed outputs, the stride must be a multiple of 8, 10005bd8deadSopenharmony_ci otherwise it must be a multiple of 4, or a compile-time or link-time error 10015bd8deadSopenharmony_ci results. It is a compile-time or link-time error to have any *xfb_offset* 10025bd8deadSopenharmony_ci that overflows *xfb_stride*, whether stated on declarations before or 10035bd8deadSopenharmony_ci after the *xfb_stride*, or in different compilation units. While 10045bd8deadSopenharmony_ci *xfb_stride* can be declared multiple times for the same buffer, it is a 10055bd8deadSopenharmony_ci compile-time or link-time error to have different values specified for the 10065bd8deadSopenharmony_ci stride for the same buffer. 10075bd8deadSopenharmony_ci 10085bd8deadSopenharmony_ci "For example: 10095bd8deadSopenharmony_ci 10105bd8deadSopenharmony_ci // buffer 1 has 32-byte stride 10115bd8deadSopenharmony_ci layout (xfb_buffer = 1, xfb_stride = 32) out; 10125bd8deadSopenharmony_ci 10135bd8deadSopenharmony_ci // same as previous example; order within layout does not matter 10145bd8deadSopenharmony_ci layout (xfb_stride = 32, xfb_buffer = 1) out; 10155bd8deadSopenharmony_ci 10165bd8deadSopenharmony_ci // everything in this block goes to buffer 0 10175bd8deadSopenharmony_ci layout (xfb_buffer = 0, xfb_stride = 32) out block1 { 10185bd8deadSopenharmony_ci layout (xfb_offset = 0) vec4 a; // a goes to byte offset 0 of buffer 0 10195bd8deadSopenharmony_ci layout (xfb_offset = 16) vec4 b; // b goes to offset 16 of buffer 0 10205bd8deadSopenharmony_ci }; 10215bd8deadSopenharmony_ci 10225bd8deadSopenharmony_ci layout (xfb_buffer = 1, xfb_offset = 12) out block2 { 10235bd8deadSopenharmony_ci vec4 v; // v will be written to byte offsets 12 through 27 of buffer 1 10245bd8deadSopenharmony_ci float u; // u will be written to offset 28 10255bd8deadSopenharmony_ci layout(xfb_offset = 40) vec4 w; 10265bd8deadSopenharmony_ci vec4 x; // x will be written to offset 56, the next available offset 10275bd8deadSopenharmony_ci }; 10285bd8deadSopenharmony_ci 10295bd8deadSopenharmony_ci layout (xfb_buffer = 2, xfb_stride = 32) out block3 { 10305bd8deadSopenharmony_ci layout (xfb_offset = 12) vec3 c; 10315bd8deadSopenharmony_ci layout (xfb_offset = 24) vec3 d; // ERROR, requires stride of 36 10325bd8deadSopenharmony_ci layout (xfb_offset = 0) vec3 g; // okay, increasing order not required 10335bd8deadSopenharmony_ci }; 10345bd8deadSopenharmony_ci 10355bd8deadSopenharmony_ci "When no *xfb_stride* is specified for a buffer, the stride of a buffer will 10365bd8deadSopenharmony_ci be the smallest needed to hold the variable placed at the highest offset, 10375bd8deadSopenharmony_ci including any required padding. For example: 10385bd8deadSopenharmony_ci 10395bd8deadSopenharmony_ci // if there no other declarations for buffer 3, it has stride 32 10405bd8deadSopenharmony_ci layout (xfb_buffer = 3) out block4 { 10415bd8deadSopenharmony_ci layout (xfb_offset = 0) vec4 e; 10425bd8deadSopenharmony_ci layout (xfb_offset = 16) vec4 f; 10435bd8deadSopenharmony_ci }; 10445bd8deadSopenharmony_ci 10455bd8deadSopenharmony_ci "The resulting stride (implicit or explicit) must be less than or equal to 10465bd8deadSopenharmony_ci the implementation-dependent constant 10475bd8deadSopenharmony_ci gl_MaxTransformFeedbackInterleavedComponents." 10485bd8deadSopenharmony_ci 10495bd8deadSopenharmony_ci Section 4.4.2.1 Tessellation Control Outputs 10505bd8deadSopenharmony_ci 10515bd8deadSopenharmony_ci Insert in front of the first sentence: 10525bd8deadSopenharmony_ci 10535bd8deadSopenharmony_ci "Other than for the transform feedback layout qualifiers, 10545bd8deadSopenharmony_ci 10555bd8deadSopenharmony_ci Section 4.4.5 "Uniform and Shader Storage Blocks" 10565bd8deadSopenharmony_ci 10575bd8deadSopenharmony_ci Add offset and align to the list, making it be 10585bd8deadSopenharmony_ci 10595bd8deadSopenharmony_ci layout-qualifier-id 10605bd8deadSopenharmony_ci shared 10615bd8deadSopenharmony_ci packed 10625bd8deadSopenharmony_ci std140 10635bd8deadSopenharmony_ci std430 10645bd8deadSopenharmony_ci row_major 10655bd8deadSopenharmony_ci column_major 10665bd8deadSopenharmony_ci binding = integral-constant-expression 10675bd8deadSopenharmony_ci offset = integral-constant-expression 10685bd8deadSopenharmony_ci align = integral-constant-expression 10695bd8deadSopenharmony_ci 10705bd8deadSopenharmony_ci Modify the paragraph starting soon after as "Default layouts..." to read: 10715bd8deadSopenharmony_ci 10725bd8deadSopenharmony_ci "Default layouts for shared, packed, std140, std430, row_major, and 10735bd8deadSopenharmony_ci column_major are established at global scope for uniform blocks as" 10745bd8deadSopenharmony_ci 10755bd8deadSopenharmony_ci At the end of the section, add descriptions of these: 10765bd8deadSopenharmony_ci 10775bd8deadSopenharmony_ci "The *offset* qualifier can only be used on block members of blocks 10785bd8deadSopenharmony_ci declared with *std140* or *std430* layouts. 10795bd8deadSopenharmony_ci The *offset* qualifier forces the qualified member to start at or after the 10805bd8deadSopenharmony_ci specified integral-constant-expression, which will be its byte offset 10815bd8deadSopenharmony_ci from the beginning of the buffer. It is a compile-time error to 10825bd8deadSopenharmony_ci specify an *offset* that is smaller than the offset of the previous 10835bd8deadSopenharmony_ci member in the block or that lies within the previous member of the 10845bd8deadSopenharmony_ci block. Two blocks linked together in the same program with the same 10855bd8deadSopenharmony_ci block name must have the exact same set of members qualified with 10865bd8deadSopenharmony_ci *offset* and their integral-constant-expression values must be the 10875bd8deadSopenharmony_ci same, or a link-time error results. The specified offset must be a 10885bd8deadSopenharmony_ci multiple of the base alignment of the type of the block member it 10895bd8deadSopenharmony_ci qualifies, or a compile-time error results. 10905bd8deadSopenharmony_ci 10915bd8deadSopenharmony_ci "The *align* qualifier can only be used on blocks or block members, and 10925bd8deadSopenharmony_ci only for blocks declared with *std140* or *std430* layouts. The *align* 10935bd8deadSopenharmony_ci qualifier makes the start of each block member have a minimum byte 10945bd8deadSopenharmony_ci alignment. It does not affect the internal layout within each member, 10955bd8deadSopenharmony_ci which will still follow the std140 or std430 rules. The specified 10965bd8deadSopenharmony_ci alignment must be a power of 2, or a compile-time error results. 10975bd8deadSopenharmony_ci 10985bd8deadSopenharmony_ci "The /actual alignment/ of a member will be the greater of the specified 10995bd8deadSopenharmony_ci *align* alignment and the standard (e.g., *std140*) base alignment for the 11005bd8deadSopenharmony_ci member's type. The /actual offset/ of a member is computed as follows: 11015bd8deadSopenharmony_ci If *offset* was declared, start with that offset, otherwise start with the 11025bd8deadSopenharmony_ci next available offset. If the resulting offset is not a multiple of the 11035bd8deadSopenharmony_ci /actual alignment/, increase it to the first offset that is a multiple of 11045bd8deadSopenharmony_ci the /actual alignment/. This results in the /actual offset/ the member 11055bd8deadSopenharmony_ci will have. 11065bd8deadSopenharmony_ci 11075bd8deadSopenharmony_ci "When *align* is applied to an array, it effects only the start of the 11085bd8deadSopenharmony_ci array, not the array's internal stride. Both an *offset* and an *align* 11095bd8deadSopenharmony_ci qualifier can be specified on a declaration. 11105bd8deadSopenharmony_ci 11115bd8deadSopenharmony_ci "The *align* qualifier, when used on a block, has the same effect as 11125bd8deadSopenharmony_ci qualifying each member with the same *align* value as declared on the 11135bd8deadSopenharmony_ci block, and gets the same compile-time results and errors as if this had 11145bd8deadSopenharmony_ci been done. As described in general earlier, an individual member can 11155bd8deadSopenharmony_ci specify its own *align*, which overrides the block-level *align*, but 11165bd8deadSopenharmony_ci just for that member." 11175bd8deadSopenharmony_ci 11185bd8deadSopenharmony_ci Section 4.5.1 "4.5.1 Redeclaring Built-in Interpolation Variables in the Compatibility Profile" 11195bd8deadSopenharmony_ci 11205bd8deadSopenharmony_ci Modify the paragraph starting "Ideally, these are redeclared..." to read 11215bd8deadSopenharmony_ci 11225bd8deadSopenharmony_ci "Ideally, these are redeclared as part of the redeclaration of an interface 11235bd8deadSopenharmony_ci block, as described in section 7.1.1 `Compatibility Profile Built-In Language 11245bd8deadSopenharmony_ci Variables'. However, for the above purpose, they can be redeclared as 11255bd8deadSopenharmony_ci individual variables at global scope, outside an interface block. Such 11265bd8deadSopenharmony_ci redeclarations also allow adding the transform-feedback qualifiers 11275bd8deadSopenharmony_ci xfb_buffer, xfb_stride, and xfb_offset to output variables. (Using 11285bd8deadSopenharmony_ci xfb_buffer on a variable does not change the global default buffer.)... 11295bd8deadSopenharmony_ci <rest of paragraph>." 11305bd8deadSopenharmony_ci 11315bd8deadSopenharmony_ci Section 7.1 "Built-In Language Variables" 11325bd8deadSopenharmony_ci 11335bd8deadSopenharmony_ci Near the end of this section, around 2nd to last paragraph, which is: 11345bd8deadSopenharmony_ci 11355bd8deadSopenharmony_ci "This establishes the output interface the shader will use with the 11365bd8deadSopenharmony_ci subsequent pipeline stage. It must be a subset of the built-in 11375bd8deadSopenharmony_ci members of gl_PerVertex." 11385bd8deadSopenharmony_ci 11395bd8deadSopenharmony_ci Add the following: 11405bd8deadSopenharmony_ci 11415bd8deadSopenharmony_ci "Such a redeclaration can also add the invariant qualifier, interpolation 11425bd8deadSopenharmony_ci qualifiers, and the layout qualifiers xfb_offset, xfb_buffer, and xfb_stride. 11435bd8deadSopenharmony_ci It can also add an array size for unsized arrays. For example: 11445bd8deadSopenharmony_ci 11455bd8deadSopenharmony_ci out layout(xfb_buffer = 1, xfb_stride = 16) gl_PerVertex { 11465bd8deadSopenharmony_ci vec4 gl_Position; 11475bd8deadSopenharmony_ci layout(xfb_offset = 0) float gl_ClipDistance[4]; 11485bd8deadSopenharmony_ci }; 11495bd8deadSopenharmony_ci 11505bd8deadSopenharmony_ci "Other layout qualifiers, like location, cannot be added to such a 11515bd8deadSopenharmony_ci redeclaration, unless specifically stated." 11525bd8deadSopenharmony_ci 11535bd8deadSopenharmony_ciExamples: 11545bd8deadSopenharmony_ci 11555bd8deadSopenharmony_ci layout(std140) uniform block { 11565bd8deadSopenharmony_ci vec4 a; 11575bd8deadSopenharmony_ci layout(offset = 20) vec3 b; // b takes offsets 20-31 11585bd8deadSopenharmony_ci layout(offset = 28) vec2 c; // ERROR, lies within previous member 11595bd8deadSopenharmony_ci layout(offset = 36) vec2 d; // d takes offsets 36-43 11605bd8deadSopenharmony_ci layout(align = 16) float e; // e takes offsets 48-51 11615bd8deadSopenharmony_ci layout(align = 2) double f; // f takes offsets 56-63 11625bd8deadSopenharmony_ci layout(align = 6) double g; // ERROR, 6 is not a power of 2 11635bd8deadSopenharmony_ci layout(offset = 68) float h; // h takes offsets 64-71 11645bd8deadSopenharmony_ci layout(align = 16) dvec3 i; // i takes offsets 80-103 11655bd8deadSopenharmony_ci layout(offset = 105, align = 4) float i; // i takes offsets 108-111 11665bd8deadSopenharmony_ci };" 11675bd8deadSopenharmony_ci 11685bd8deadSopenharmony_ci 11695bd8deadSopenharmony_ciAdditions to Chapter 7.3 "Built-In Constants" of the OpenGL Shading Language 11705bd8deadSopenharmony_ci 11715bd8deadSopenharmony_ci Add 11725bd8deadSopenharmony_ci 11735bd8deadSopenharmony_ci const int gl_MaxTransformFeedbackBuffers = 4; 11745bd8deadSopenharmony_ci const int gl_MaxTransformFeedbackInterleavedComponents = 64; 11755bd8deadSopenharmony_ci 11765bd8deadSopenharmony_ciAdditions to Chapter 9 "Shading Language Grammar for Core Profile" of the OpenGL Shading Language 11775bd8deadSopenharmony_ci 11785bd8deadSopenharmony_ci Change 11795bd8deadSopenharmony_ci 11805bd8deadSopenharmony_ci IDENTIFIER EQUAL INTCONSTANT 11815bd8deadSopenharmony_ci 11825bd8deadSopenharmony_ci to 11835bd8deadSopenharmony_ci IDENTIFIER EQUAL constant_expression 11845bd8deadSopenharmony_ci 11855bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications 11865bd8deadSopenharmony_ci 11875bd8deadSopenharmony_ci None 11885bd8deadSopenharmony_ci 11895bd8deadSopenharmony_ciGLX Protocol 11905bd8deadSopenharmony_ci 11915bd8deadSopenharmony_ci None 11925bd8deadSopenharmony_ci 11935bd8deadSopenharmony_ciDependencies on OpenGL 3.3 and ARB_explicit_attrib_location 11945bd8deadSopenharmony_ci 11955bd8deadSopenharmony_ci If neither OpenGL 3.3 nor ARB_explicit_attrib_location are supported, new 11965bd8deadSopenharmony_ci "location" and "component" layout qualifier support for vertex shader 11975bd8deadSopenharmony_ci inputs and fragment shader outputs is not supported. 11985bd8deadSopenharmony_ci 11995bd8deadSopenharmony_ciDependencies on OpenGL 4.0 and ARB_vertex_attrib_64bit 12005bd8deadSopenharmony_ci 12015bd8deadSopenharmony_ci If neither OpenGL 4.0 nor ARB_vertex_attrib_64bit is supported, references 12025bd8deadSopenharmony_ci to double-precision attribute variables should be removed. 12035bd8deadSopenharmony_ci 12045bd8deadSopenharmony_ciDependencies on OpenGL 4.0 and ARB_transform_feedback3 12055bd8deadSopenharmony_ci 12065bd8deadSopenharmony_ci If neither OpenGL 4.0 nor ARB_transform_feedback3 are supported, only a 12075bd8deadSopenharmony_ci single binding point can be used for transform feedback using 12085bd8deadSopenharmony_ci INTERLEAVED_ATTRIBS, including the new layout qualifier approach. It will 12095bd8deadSopenharmony_ci be a compile-time error to use an "xfb_buffer" layout qualifier with a 12105bd8deadSopenharmony_ci value other than zero and the value of the implementation-dependent GLSL 12115bd8deadSopenharmony_ci constant gl_MaxTransformFeedbackBuffers will be 1. 12125bd8deadSopenharmony_ci 12135bd8deadSopenharmony_ciDependencies on OpenGL 4.1 and ARB_separate_shader_objects 12145bd8deadSopenharmony_ci 12155bd8deadSopenharmony_ci If neither OpenGL 4.1 nor ARB_separate_shader_objects are supported, new 12165bd8deadSopenharmony_ci "location" and "component" layout qualifier support for inputs and outputs 12175bd8deadSopenharmony_ci other than vertex shader inputs and fragment shader outputs is not 12185bd8deadSopenharmony_ci supported. 12195bd8deadSopenharmony_ci 12205bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_shader_storage_buffer_object 12215bd8deadSopenharmony_ci 12225bd8deadSopenharmony_ci If neither OpenGL 4.3 nor ARB_shader_storage_buffer_object is supported, 12235bd8deadSopenharmony_ci references to shader storage blocks should be removed. 12245bd8deadSopenharmony_ci 12255bd8deadSopenharmony_ciDependencies on OpenGL 4.3 and ARB_program_interface_query 12265bd8deadSopenharmony_ci 12275bd8deadSopenharmony_ci If neither OpenGL 4.3 nor ARB_program_interface_query is supported, edits 12285bd8deadSopenharmony_ci to section 7.3.1 and the corresponding tokens should be removed. Add an 12295bd8deadSopenharmony_ci edit to the spec language describing GetTransformFeedbackVarying to 12305bd8deadSopenharmony_ci indicate that when layout qualifiers are used to specify transform 12315bd8deadSopenharmony_ci feedback offsets, the set of active transform feedback variables 12325bd8deadSopenharmony_ci enumerated by GetTransformFeedbackVarying and related APIs appears in 12335bd8deadSopenharmony_ci arbitrary order. 12345bd8deadSopenharmony_ci 12355bd8deadSopenharmony_ci 12365bd8deadSopenharmony_ciErrors 12375bd8deadSopenharmony_ci 12385bd8deadSopenharmony_ci No new API errors. 12395bd8deadSopenharmony_ci 12405bd8deadSopenharmony_ciNew State 12415bd8deadSopenharmony_ci 12425bd8deadSopenharmony_ci Modify Table 23.53, Program Object Resource State (cont'd) 12435bd8deadSopenharmony_ci 12445bd8deadSopenharmony_ci Initial 12455bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. 12465bd8deadSopenharmony_ci ----------------------- ---- ----------- ------- ------------------------ ----- 12475bd8deadSopenharmony_ci LOCATION_COMPONENT Z+ GetProgram- - location component 7.3.1 12485bd8deadSopenharmony_ci Resourceiv assigned to active 12495bd8deadSopenharmony_ci resource 12505bd8deadSopenharmony_ci 12515bd8deadSopenharmony_ciNew Implementation Dependent State 12525bd8deadSopenharmony_ci 12535bd8deadSopenharmony_ci None. 12545bd8deadSopenharmony_ci 12555bd8deadSopenharmony_ciConformance Tests 12565bd8deadSopenharmony_ci 12575bd8deadSopenharmony_ci TBD 12585bd8deadSopenharmony_ci 12595bd8deadSopenharmony_ciIssues 12605bd8deadSopenharmony_ci 12615bd8deadSopenharmony_ci 1) Do we need a sizeof() operator to aid in assigning layout locations? 12625bd8deadSopenharmony_ci Would it need to be queried from the app as well? 12635bd8deadSopenharmony_ci 12645bd8deadSopenharmony_ci Aligning based on the size of previous member is what the system already 12655bd8deadSopenharmony_ci does. Do we have a use case that needs custom packing following a 12665bd8deadSopenharmony_ci structure, which cannot be handled by an *align* layout identifier? 12675bd8deadSopenharmony_ci 12685bd8deadSopenharmony_ci RESOLUTION: No. 12695bd8deadSopenharmony_ci 12705bd8deadSopenharmony_ci 2) Do we need to allow layout locations to be placed on blocks? 12715bd8deadSopenharmony_ci 12725bd8deadSopenharmony_ci Discussion: Yes, for SSO matching by location. But, do we still 12735bd8deadSopenharmony_ci need them on members? A block could still be a well-defined block 12745bd8deadSopenharmony_ci of memory, and if an interface is mixing/matching content of a block 12755bd8deadSopenharmony_ci it seems they put the wrong things together in a block. 12765bd8deadSopenharmony_ci 12775bd8deadSopenharmony_ci RESOLUTION: Add for members for symmetry with UBOs and some utility 12785bd8deadSopenharmony_ci as well. Order doesn't matter. 12795bd8deadSopenharmony_ci 12805bd8deadSopenharmony_ci 3) Do we need to support discovery of the current offset? E.g., 12815bd8deadSopenharmony_ci 12825bd8deadSopenharmony_ci layout(offset = currentOffset + 3) 12835bd8deadSopenharmony_ci 12845bd8deadSopenharmony_ci RESOLUTION: No. 12855bd8deadSopenharmony_ci 12865bd8deadSopenharmony_ci 4) Should we add a component-space for layout locations, which is no longer 12875bd8deadSopenharmony_ci vec4 centric, but purely component centric? This is perhaps difficult 12885bd8deadSopenharmony_ci as an add-on feature, but rather needs the specs as a whole to drop the 12895bd8deadSopenharmony_ci vec4 nature of inputs/outputs. 12905bd8deadSopenharmony_ci 12915bd8deadSopenharmony_ci RESOLUTION: No. This is deferred until a future release that can make 12925bd8deadSopenharmony_ci a larger change in this area, e.g., wholly drop the vec4 slot nature of 12935bd8deadSopenharmony_ci inputs/outputs. 12945bd8deadSopenharmony_ci 12955bd8deadSopenharmony_ci 5) Instead of dynamic selection of outputs for transform/feedback, use 12965bd8deadSopenharmony_ci locations. 12975bd8deadSopenharmony_ci 12985bd8deadSopenharmony_ci RESOLUTION: Use syntax in the shader layout blocks, not an entry point 12995bd8deadSopenharmony_ci in the API. Either "layout(transformfeedback: var1, var2 var3) out;" 13005bd8deadSopenharmony_ci or tag individual members. Applies to both inside and outside blocks. 13015bd8deadSopenharmony_ci 13025bd8deadSopenharmony_ci 6) Is it an error to specify an *offset* that is not naturally aligned? 13035bd8deadSopenharmony_ci 13045bd8deadSopenharmony_ci RESOLUTION: Yes, all offsets should be naturally aligned, but see 13055bd8deadSopenharmony_ci issue 10: it is natural alignment of the type, not the component. 13065bd8deadSopenharmony_ci 13075bd8deadSopenharmony_ci 7) Is there an error at some point if an xfb_buffer is not valid? There 13085bd8deadSopenharmony_ci are two cases here A) the buffer number is valid, B) the buffer number 13095bd8deadSopenharmony_ci is out of range. 13105bd8deadSopenharmony_ci 13115bd8deadSopenharmony_ci RESOLVED A) No, there is no error, it is valid because the shader said so. 13125bd8deadSopenharmony_ci 13135bd8deadSopenharmony_ci RESOLVED B) This should be a compile-time or link-time error. 13145bd8deadSopenharmony_ci 13155bd8deadSopenharmony_ci 8) What API changes are needed to support component locations? There is 13165bd8deadSopenharmony_ci currently no mention of stages in the specification language above, 13175bd8deadSopenharmony_ci implying all stages' inputs and outputs can specify component 13185bd8deadSopenharmony_ci locations. Probably, we either need to drop input components to 13195bd8deadSopenharmony_ci the vertex stage and output components from the fragment stage, or 13205bd8deadSopenharmony_ci consider API changes needed to support them. 13215bd8deadSopenharmony_ci 13225bd8deadSopenharmony_ci RESOLUTION: Behavior is well-defined for all stages. Need to broaden 13235bd8deadSopenharmony_ci query functions to include component numbers. 13245bd8deadSopenharmony_ci 13255bd8deadSopenharmony_ci 9) How do we keep xfb buffers within implementation-dependent widths? 13265bd8deadSopenharmony_ci Is this known at compile time? 13275bd8deadSopenharmony_ci 13285bd8deadSopenharmony_ci RESOLUTION: The actual stride of the buffer is determined by the stride in 13295bd8deadSopenharmony_ci the shader, overriding any API settings. However, it is a link-time 13305bd8deadSopenharmony_ci error to go over the limits of either 13315bd8deadSopenharmony_ci 13325bd8deadSopenharmony_ci MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 13335bd8deadSopenharmony_ci 13345bd8deadSopenharmony_ci GLSL only needs to include the limits for interleaved components. 13355bd8deadSopenharmony_ci 13365bd8deadSopenharmony_ci 10) For uniform-like buffers only: might want offset of a vec3 to be vec4 13375bd8deadSopenharmony_ci aligned, not just component-sized aligned. Is there a portable rule? 13385bd8deadSopenharmony_ci Or implementation-dependent rule? 13395bd8deadSopenharmony_ci 13405bd8deadSopenharmony_ci RESOLUTION: Alignments will be multiples of the base alignment of the 13415bd8deadSopenharmony_ci member's type. 13425bd8deadSopenharmony_ci 13435bd8deadSopenharmony_ci 11) The location associated with a vertex shader input variable or fragment 13445bd8deadSopenharmony_ci shader output variable can be specified in the shader using a location 13455bd8deadSopenharmony_ci layout qualifier or in the OpenGL API using commands such as 13465bd8deadSopenharmony_ci BindAttribLocation and BindFragDataLocation. Should we provide new 13475bd8deadSopenharmony_ci variants of the OpenGL API commands (e.g., BindAttribLocationComponent) 13485bd8deadSopenharmony_ci allowing applications to specify components with locations? 13495bd8deadSopenharmony_ci 13505bd8deadSopenharmony_ci RESOLVED: No. 13515bd8deadSopenharmony_ci 13525bd8deadSopenharmony_ci 12) Vertex shader input and fragment shader output variables declared 13535bd8deadSopenharmony_ci without a location layout qualifier will have a location assigned by 13545bd8deadSopenharmony_ci the compiler. What components will be assigned to such variables? 13555bd8deadSopenharmony_ci 13565bd8deadSopenharmony_ci RESOLVED: All variables declared without a 'location' layout 13575bd8deadSopenharmony_ci qualifier will be assigned a 'component' value of zero. The first 13585bd8deadSopenharmony_ci component of any such vertex input variable will be taken from the 13595bd8deadSopenharmony_ci first component of the corresponding generic attribute. The first 13605bd8deadSopenharmony_ci component of any such fragment output variable will be written to the 13615bd8deadSopenharmony_ci first component of corresponding fragment color. 13625bd8deadSopenharmony_ci 13635bd8deadSopenharmony_ci If we allowed to compiler to automatically assign vertex input or 13645bd8deadSopenharmony_ci fragment output variables to components other than zero, it could 13655bd8deadSopenharmony_ci avoid link errors in cases where a shader requires more locations than 13665bd8deadSopenharmony_ci the implementation supports. However, such a change would break 13675bd8deadSopenharmony_ci existing applications that query the locations of their input or 13685bd8deadSopenharmony_ci output variables, since they wouldn't be expecting component 13695bd8deadSopenharmony_ci assignments other than zero. If we really wanted to support this, 13705bd8deadSopenharmony_ci we'd probably need a directive in the shader indicating that the 13715bd8deadSopenharmony_ci compiler can assign to arbitrary components. 13725bd8deadSopenharmony_ci 13735bd8deadSopenharmony_ci 13) How should we allow applications to query the components associated 13745bd8deadSopenharmony_ci with shader input and output variables? 13755bd8deadSopenharmony_ci 13765bd8deadSopenharmony_ci RESOLVED: Extend the generic ARB_program_interface_query (OpenGL 13775bd8deadSopenharmony_ci 4.3) active resource query API GetProgramResourceiv by providing a new 13785bd8deadSopenharmony_ci property LOCATION_COMPONENT. This will query the component associated 13795bd8deadSopenharmony_ci with a location assignment, in the same way that the existing LOCATION 13805bd8deadSopenharmony_ci and LOCATION_INDEX properties query the location and location index 13815bd8deadSopenharmony_ci numbers. 13825bd8deadSopenharmony_ci 13835bd8deadSopenharmony_ci 14) OpenGL 4.3 also includes the queries GetProgramResourceLocation and 13845bd8deadSopenharmony_ci GetProgramResourceLocationIndex to directly query the location and 13855bd8deadSopenharmony_ci location index of a named variable. Should we provide a similar query 13865bd8deadSopenharmony_ci GetProgramResourceLocationComponent for location components? 13875bd8deadSopenharmony_ci 13885bd8deadSopenharmony_ci RESOLVED: No. 13895bd8deadSopenharmony_ci 13905bd8deadSopenharmony_ci ARB_program_interface_query provided the GetProgramResourceLocation 13915bd8deadSopenharmony_ci entry point to serve as a generic version of pre-4.3 entry points such 13925bd8deadSopenharmony_ci as GetUniformLocation, and to a lesser extent GetActiveAttrib and 13935bd8deadSopenharmony_ci GetFragDataLocation. These entry points, particularly 13945bd8deadSopenharmony_ci GetUniformLocation, are commonly used. We also provided 13955bd8deadSopenharmony_ci GetProgramResourceLocationIndex to query the much less commonly-used 13965bd8deadSopenharmony_ci location index, mostly for completeness. Both commands are simply 13975bd8deadSopenharmony_ci short-cuts; it's possible for an application to perform such queries 13985bd8deadSopenharmony_ci by calling GetProgramResourceIndex to map a variable name to an active 13995bd8deadSopenharmony_ci resource index and then calling GetProgramResourceiv to query the 14005bd8deadSopenharmony_ci location or location index. If we care about full orthogonality, we 14015bd8deadSopenharmony_ci should add a new GetProgramResourceComponent command. If not, 14025bd8deadSopenharmony_ci applications could still query component bindings with the sequence 14035bd8deadSopenharmony_ci above. 14045bd8deadSopenharmony_ci 14055bd8deadSopenharmony_ci Since the only way to assign non-zero component indices to input or 14065bd8deadSopenharmony_ci output variables is via explicit shader text, these queries seem less 14075bd8deadSopenharmony_ci important. In earlier versions of OpenGL, the compiler always 14085bd8deadSopenharmony_ci assigned the locations of uniforms, and it was always necessary to 14095bd8deadSopenharmony_ci query their locations to perform an update. 14105bd8deadSopenharmony_ci 14115bd8deadSopenharmony_ci 15) OpenGL 4.3 also includes older APIs to query the locations of vertex 14125bd8deadSopenharmony_ci shader inputs and fragment shader outputs (GetActiveAttrib, 14135bd8deadSopenharmony_ci GetFragDataLocation, GetFragDataIndex). Should we provide similar 14145bd8deadSopenharmony_ci queries for location components? 14155bd8deadSopenharmony_ci 14165bd8deadSopenharmony_ci RESOLVED: No. We added the generic ARB_program_interface_query 14175bd8deadSopenharmony_ci feature to OpenGL 4.3 so we didn't have to keep adding new APIs and 14185bd8deadSopenharmony_ci tokens for every combination of resource type and property. 14195bd8deadSopenharmony_ci 14205bd8deadSopenharmony_ci 16) For active vertex shader inputs and fragment shader outputs, what 14215bd8deadSopenharmony_ci happens if two variables with different basic component types are 14225bd8deadSopenharmony_ci bound to different components of the same generic attribute or 14235bd8deadSopenharmony_ci fragment color output? 14245bd8deadSopenharmony_ci 14255bd8deadSopenharmony_ci RESOLVED: For fragment shader outputs, generate a link error. For 14265bd8deadSopenharmony_ci vertex shader inputs, no link error occurs. However, the values of 14275bd8deadSopenharmony_ci any vertex shader input not matching the attribute type programmed in 14285bd8deadSopenharmony_ci the API (via VertexAttrib* or VertexAttrib*Pointer) will be undefined. 14295bd8deadSopenharmony_ci 14305bd8deadSopenharmony_ci In unextended OpenGL 4.3, we already require that the generic 14315bd8deadSopenharmony_ci attribute associated with a vertex shader input variable be specified 14325bd8deadSopenharmony_ci using the same component type as the variable. Additionally, we 14335bd8deadSopenharmony_ci require that the framebuffer attachments receiving a fragment output 14345bd8deadSopenharmony_ci color must have the same component type as the output variable. In 14355bd8deadSopenharmony_ci either case, values are undefined to avoid the overhead of a mandatory 14365bd8deadSopenharmony_ci draw-time error check based on frequently-changed vertex attribute 14375bd8deadSopenharmony_ci values. In code like the following: 14385bd8deadSopenharmony_ci 14395bd8deadSopenharmony_ci layout(location=3) in float var1; 14405bd8deadSopenharmony_ci layout(location=4) in int var2; 14415bd8deadSopenharmony_ci 14425bd8deadSopenharmony_ci the value of <var1> is undefined if generic attribute 3 isn't 14435bd8deadSopenharmony_ci specified with floating-point values and the value of <var2> is 14445bd8deadSopenharmony_ci undefined if generic attribute 4 isn't specified with integer values. 14455bd8deadSopenharmony_ci But it's always possible for an application to specify correct 14465bd8deadSopenharmony_ci attribute values for each type. 14475bd8deadSopenharmony_ci 14485bd8deadSopenharmony_ci Mismatches due to component layout qualifers have similar problems. 14495bd8deadSopenharmony_ci In a vertex shader with the following declarations: 14505bd8deadSopenharmony_ci 14515bd8deadSopenharmony_ci layout(location=3, component=0) in float var1; 14525bd8deadSopenharmony_ci layout(location=3, component=1) in int var2; 14535bd8deadSopenharmony_ci 14545bd8deadSopenharmony_ci the vertex shader would want to read the <x> component of generic 14555bd8deadSopenharmony_ci attribute 3 as a floating-point value and the <y> component of that 14565bd8deadSopenharmony_ci attribute as a signed integer. We provide no way to specify separate 14575bd8deadSopenharmony_ci components of a single attribute with a different type, so one of the 14585bd8deadSopenharmony_ci values must be undefined if the shader is considered legal. 14595bd8deadSopenharmony_ci 14605bd8deadSopenharmony_ci We chose to make this illegal for fragment shader outputs, since it 14615bd8deadSopenharmony_ci can't possibly do the right thing without relying on undefined raw 14625bd8deadSopenharmony_ci bit-cast behavior. We do allow this for vertex shader inputs, because 14635bd8deadSopenharmony_ci we've supported "aliasing" behavior since OpenGL 2.0. This allows for 14645bd8deadSopenharmony_ci an "uber-shader" with variables like: 14655bd8deadSopenharmony_ci 14665bd8deadSopenharmony_ci layout(location=3) in float var1; 14675bd8deadSopenharmony_ci layout(location=3) in int var2; 14685bd8deadSopenharmony_ci 14695bd8deadSopenharmony_ci where sometimes it uses <var1> and sometimes <var2>. Since we don't 14705bd8deadSopenharmony_ci treat the code above (with overlapping components) as an error, it 14715bd8deadSopenharmony_ci would be strange to treat non-overlapping component assignments as an 14725bd8deadSopenharmony_ci error. 14735bd8deadSopenharmony_ci 14745bd8deadSopenharmony_ci 17) How will applications be able to query the layout of transform 14755bd8deadSopenharmony_ci feedback varyings if they are specified in the shader? 14765bd8deadSopenharmony_ci 14775bd8deadSopenharmony_ci RESOLVED: Add the ability to query offset and active buffer 14785bd8deadSopenharmony_ci associations for each variable in the TRANSFORM_FEEDBACK_VARYING 14795bd8deadSopenharmony_ci interface, which can now be specified by layout qualifier. 14805bd8deadSopenharmony_ci Additionally, add a new interface TRANSFORM_FEEDBACK_BUFFER, which 14815bd8deadSopenharmony_ci enumerates the set of active binding points used in transform feedback 14825bd8deadSopenharmony_ci (similar to the ATOMIC_COUNTER_BUFFER interface for atomic counter 14835bd8deadSopenharmony_ci uniforms). 14845bd8deadSopenharmony_ci 14855bd8deadSopenharmony_ci In unextended OpenGL 4.3, transform feedback varyings are specified by 14865bd8deadSopenharmony_ci passing a list of name strings to TransformFeedbackVaryings() before 14875bd8deadSopenharmony_ci linking, where those name strings include both real variables and 14885bd8deadSopenharmony_ci special "marker" variables like "gl_SkipComponents1" and 14895bd8deadSopenharmony_ci "gl_NextBuffer". The application can then query back the list of 14905bd8deadSopenharmony_ci transform feedback varyings and their properties, including markers, 14915bd8deadSopenharmony_ci using the TRANSFORM_FEEDBACK_VARYING interface with the 14925bd8deadSopenharmony_ci GetProgramResourceName and GetProgramResourceiv APIs. Additionally, 14935bd8deadSopenharmony_ci applications can use the legacy OpenGL 3.0 API 14945bd8deadSopenharmony_ci GetTransformFeedbackVarying(). The varyings are enumerated in the 14955bd8deadSopenharmony_ci order specified in TransformFeedbackVaryings(), and it's up to the 14965bd8deadSopenharmony_ci application to figure out the offsets/buffers assigned to each. 14975bd8deadSopenharmony_ci ("Figuring" this out is often unnecessary, since applications have 14985bd8deadSopenharmony_ci already specified the variable list.) The special markers need to be 14995bd8deadSopenharmony_ci enumerated as variables in this API to allow the applications 15005bd8deadSopenharmony_ci applications can figure out the storage. 15015bd8deadSopenharmony_ci 15025bd8deadSopenharmony_ci When using the existing enumeration API with variables with transform 15035bd8deadSopenharmony_ci feedback layout qualifiers, the active variables are enumerated in 15045bd8deadSopenharmony_ci arbitrary order and offsets/bindings can be queried explicitly. No 15055bd8deadSopenharmony_ci special markers like "gl_NextBuffer" are enumerated. 15065bd8deadSopenharmony_ci 15075bd8deadSopenharmony_ci One other option considered was specifying that the linker 15085bd8deadSopenharmony_ci reverse-engineer a list of outputs for TransformFeedbackVaryings based 15095bd8deadSopenharmony_ci on layout qualifiers and then operate as if that list were provided 15105bd8deadSopenharmony_ci directly. For example, if you specified something like: 15115bd8deadSopenharmony_ci 15125bd8deadSopenharmony_ci layout(xfb_buffer=0, xfb_stride=48) out; 15135bd8deadSopenharmony_ci layout(xfb_buffer=0, xfb_offset=4) out vec4 batman; 15145bd8deadSopenharmony_ci layout(xfb_buffer=2, xfb_offset=0) out vec4 robin; 15155bd8deadSopenharmony_ci layout(xfb_buffer=2, xfb_offset=16) out vec3 joker; 15165bd8deadSopenharmony_ci 15175bd8deadSopenharmony_ci this reverse-engineering would build the following list: 15185bd8deadSopenharmony_ci 15195bd8deadSopenharmony_ci gl_SkipComponents1 // first 4 bytes 15205bd8deadSopenharmony_ci batman // next 16 bytes 15215bd8deadSopenharmony_ci gl_SkipComponents4 // another 16 bytes, still in buffer 0 15225bd8deadSopenharmony_ci gl_SkipComponents3 // final 12 bytes, per xfb_stride 15235bd8deadSopenharmony_ci gl_NextBuffer 15245bd8deadSopenharmony_ci gl_NextBuffer 15255bd8deadSopenharmony_ci robin // first 16 bytes in buffer 2 15265bd8deadSopenharmony_ci joker // last 12 bytes in buffer 2 15275bd8deadSopenharmony_ci 15285bd8deadSopenharmony_ci Having an API to query offsets and buffers more directly seemed 15295bd8deadSopenharmony_ci preferable. 15305bd8deadSopenharmony_ci 15315bd8deadSopenharmony_ci The new API is patterned after the ATOMIC_COUNTER_BUFFER interface, 15325bd8deadSopenharmony_ci which also has variables associated with a collection of numbered 15335bd8deadSopenharmony_ci binding points. Consider the code above and an implementation that 15345bd8deadSopenharmony_ci sorts active binding points and variables by declaration order. The 15355bd8deadSopenharmony_ci commands 15365bd8deadSopenharmony_ci 15375bd8deadSopenharmony_ci GetProgramInterface(program, TRANSFORM_FEEDBACK_BUFFER, 15385bd8deadSopenharmony_ci ACTIVE_RESOURCES, &value); 15395bd8deadSopenharmony_ci GetProgramInterface(program, TRANSFORM_FEEDBACK_VARYING, 15405bd8deadSopenharmony_ci ACTIVE_RESOURCES, &value); 15415bd8deadSopenharmony_ci 15425bd8deadSopenharmony_ci return 2 (binding points 0 and 2) and 3 ("batman", "robin", and 15435bd8deadSopenharmony_ci "joker"). 15445bd8deadSopenharmony_ci 15455bd8deadSopenharmony_ci GetProgramInterface(program, TRANSFORM_FEEDBACK_BUFFER, 15465bd8deadSopenharmony_ci MAX_NUM_ACTIVE_VARIABLES, &value); 15475bd8deadSopenharmony_ci 15485bd8deadSopenharmony_ci returns 2 (the two variables "robin" and "joker" associated with 15495bd8deadSopenharmony_ci binding point 2). GetProgramResourceiv for the two active binding 15505bd8deadSopenharmony_ci points in the TRANSFORM_FEEDBACK_BUFFER interface would return: 15515bd8deadSopenharmony_ci 15525bd8deadSopenharmony_ci property index 0 (binding 0) index 1 (binding 2) 15535bd8deadSopenharmony_ci -------------------- -------------------- -------------------- 15545bd8deadSopenharmony_ci BUFFER_BINDING 0 2 15555bd8deadSopenharmony_ci NUM_ACTIVE_VARIABLES 1 2 15565bd8deadSopenharmony_ci ACTIVE_VARIABLES { 0 } { 1, 2 } 15575bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_ 48 28 15585bd8deadSopenharmony_ci BUFFER_STRIDE 15595bd8deadSopenharmony_ci 15605bd8deadSopenharmony_ci GetProgramResourceiv for the three active variables in the 15615bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_VARYING interface would return: 15625bd8deadSopenharmony_ci 15635bd8deadSopenharmony_ci (batman) (robin) (joker) 15645bd8deadSopenharmony_ci property index 0 index 1 index 2 15655bd8deadSopenharmony_ci -------------------- ------------ ------------ ------------ 15665bd8deadSopenharmony_ci NAME_LENGTH 7 6 6 15675bd8deadSopenharmony_ci TYPE FLOAT_VEC4 FLOAT_VEC4 FLOAT_VEC3 15685bd8deadSopenharmony_ci ARRAY_SIZE 0 0 0 15695bd8deadSopenharmony_ci OFFSET 4 0 16 15705bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_ 0 1 1 15715bd8deadSopenharmony_ci BUFFER_INDEX 15725bd8deadSopenharmony_ci 15735bd8deadSopenharmony_ci 18) If you have a program where transform feedback layout qualifiers are 15745bd8deadSopenharmony_ci specified both in the shader text and via TransformFeedbackVaryings, 15755bd8deadSopenharmony_ci what happens? 15765bd8deadSopenharmony_ci 15775bd8deadSopenharmony_ci RESOLVED: To be consistent with other features where similar things 15785bd8deadSopenharmony_ci can happen (e.g., BindAttribLocation), we should allow the 15795bd8deadSopenharmony_ci declarations in the shader text to "win". When LinkProgram is called, 15805bd8deadSopenharmony_ci transform feedback state specified via TransformFeedbackVaryings() is 15815bd8deadSopenharmony_ci ignored if the shader used for transform feedback specifies an 15825bd8deadSopenharmony_ci "xfb_offset" layout qualifier on any of its variables. 15835bd8deadSopenharmony_ci 15845bd8deadSopenharmony_ci 19) Do we need #extension support for this feature? 15855bd8deadSopenharmony_ci 15865bd8deadSopenharmony_ci RESOLVED: Yes. There is no reason we couldn't support some of the 15875bd8deadSopenharmony_ci features (e.g, UBO offset) on OpenGL 3.X hardware. We will require 15885bd8deadSopenharmony_ci OpenGL 3.1 / GLSL 1.40, since this is where layout qualifiers were 15895bd8deadSopenharmony_ci first supported. For each extended feature, we will require the 15905bd8deadSopenharmony_ci relevant core version or extension: 15915bd8deadSopenharmony_ci 15925bd8deadSopenharmony_ci * OpenGL 3.3 and ARB_explicit_attrib_location for location and 15935bd8deadSopenharmony_ci component qualifiers on vertex shader inputs and fragment shader 15945bd8deadSopenharmony_ci outputs. 15955bd8deadSopenharmony_ci 15965bd8deadSopenharmony_ci * OpenGL 4.1 and ARB_separate_shader_objects for location and 15975bd8deadSopenharmony_ci component qualifiers all other shader inputs and outputs. 15985bd8deadSopenharmony_ci 15995bd8deadSopenharmony_ci * OpenGL 4.0 and ARB_transform_feedback3 on multiple output buffers in 16005bd8deadSopenharmony_ci interleaved mode (i.e., "xfb_buffer" values other than zero). 16015bd8deadSopenharmony_ci 16025bd8deadSopenharmony_ci * OpenGL 4.3 and ARB_shader_storage_buffer_object for extended layout 16035bd8deadSopenharmony_ci qualifiers on shader storage blocks. 16045bd8deadSopenharmony_ci 16055bd8deadSopenharmony_ci * OpenGL 4.3 and ARB_program_interface_query to query offsets assigned 16065bd8deadSopenharmony_ci to transform feedback varyings. 16075bd8deadSopenharmony_ci 16085bd8deadSopenharmony_ci 20) For "varyings" (e.g., vertex shader outputs, fragment shader inputs), 16095bd8deadSopenharmony_ci component selection via layout qualifiers allow you to store two 16105bd8deadSopenharmony_ci different variables in a single vector "location". Those variables 16115bd8deadSopenharmony_ci might have different data types or interpolation qualifiers? Is this 16125bd8deadSopenharmony_ci a problem for any implemenations of this extension? 16135bd8deadSopenharmony_ci 16145bd8deadSopenharmony_ci RESOLVED: We will have a compile-time or link-time error for 16155bd8deadSopenharmony_ci differing types or different interpolation qualifiers assigned to the 16165bd8deadSopenharmony_ci same location. 16175bd8deadSopenharmony_ci 16185bd8deadSopenharmony_ci 21) Is the new ability to query offsets and active buffers for each 16195bd8deadSopenharmony_ci variable in the TRANSFORM_FEEDBACK_VARYING interface supported for 16205bd8deadSopenharmony_ci programs whose transform feedback outputs are specified via 16215bd8deadSopenharmony_ci TransformFeedbackVaryings? 16225bd8deadSopenharmony_ci 16235bd8deadSopenharmony_ci RESOLVED: Yes. The implementation will build a list of 16245bd8deadSopenharmony_ci offsets/bindings during linking. 16255bd8deadSopenharmony_ci 16265bd8deadSopenharmony_ci 22) We do need to precisely define what it means to have transform 16275bd8deadSopenharmony_ci feedback layout declared in the shader text (e.g., the XFB layout 16285bd8deadSopenharmony_ci qualifiers are declared anywhere), and how various corner cases work. 16295bd8deadSopenharmony_ci Examples: 16305bd8deadSopenharmony_ci 16315bd8deadSopenharmony_ci A) What qualifiers can be used globally on "out", on block 16325bd8deadSopenharmony_ci declarations, and individual variables? 16335bd8deadSopenharmony_ci 16345bd8deadSopenharmony_ci B) If a shader has an "xfb_stride" qualifier for a buffer, but doesn't 16355bd8deadSopenharmony_ci declare "xfb_offset" for any variable associated with that buffer, 16365bd8deadSopenharmony_ci what happens? 16375bd8deadSopenharmony_ci 16385bd8deadSopenharmony_ci C) If the shader has an "xfb_buffer" qualifier identifying a buffer, 16395bd8deadSopenharmony_ci but doesn't declare "xfb_offset" on anything associated with it, 16405bd8deadSopenharmony_ci what happens? 16415bd8deadSopenharmony_ci 16425bd8deadSopenharmony_ci D) If we have variables with "xfb_offset" associated with buffers 0 and 16435bd8deadSopenharmony_ci 2, what happens with buffer 1? 16445bd8deadSopenharmony_ci 16455bd8deadSopenharmony_ci E) If the shader declares "xfb_offset" on some but not all block 16465bd8deadSopenharmony_ci members, what happens with the ones without an offset? Are they not 16475bd8deadSopenharmony_ci captured? 16485bd8deadSopenharmony_ci 16495bd8deadSopenharmony_ci F) If a shader variable is qualified with "xfb_offset" but is not 16505bd8deadSopenharmony_ci statically referenced, what happens? 16515bd8deadSopenharmony_ci 16525bd8deadSopenharmony_ci RESOLVED: For issue (A), we allow "xfb_offset" on blocks, block 16535bd8deadSopenharmony_ci members, and variables. When using "xfb_offset" on a block, all 16545bd8deadSopenharmony_ci members are assigned consecutive offsets. For issue (B), the buffer 16555bd8deadSopenharmony_ci has N bytes reserved for each vertex, but nothing will be written to 16565bd8deadSopenharmony_ci it. For issue (C), variables not qualified with "xfb_offset" are not 16575bd8deadSopenharmony_ci captured, which makes the associated "xfb_buffer" qualifier 16585bd8deadSopenharmony_ci irrelevant. For issue (D), nothing is captured to buffer 1, and if no 16595bd8deadSopenharmony_ci "xfb_stride" qualifier is specified for buffer 1, no storage will be 16605bd8deadSopenharmony_ci reserved there. For issue (E), block members without an offset are 16615bd8deadSopenharmony_ci not captured. For issue (F), all variables with an assigned offset 16625bd8deadSopenharmony_ci will have storage reserved (possibly affecting the stride) whether or 16635bd8deadSopenharmony_ci not they are statically referenced. Unreferenced variables, as well 16645bd8deadSopenharmony_ci as referenced variables not written for a given shader invocation, 16655bd8deadSopenharmony_ci will be treated as having undefined values. 16665bd8deadSopenharmony_ci 16675bd8deadSopenharmony_ci 23) This is related to issues 16 and 20. Its resolution was that we 16685bd8deadSopenharmony_ci would have an error if two fragment shader outputs with different 16695bd8deadSopenharmony_ci component types were assigned to different components of the same 16705bd8deadSopenharmony_ci location. We wouldn't have an error for vertex shader inputs 16715bd8deadSopenharmony_ci because of the aliasing allowed in the spec since 2.0. 16725bd8deadSopenharmony_ci 16735bd8deadSopenharmony_ci What should we do for "varyings", which don't interface with 16745bd8deadSopenharmony_ci resources in the API (vertex shader inputs, fragment shader outputs). 16755bd8deadSopenharmony_ci Would implementations have a problem with the following pair of 16765bd8deadSopenharmony_ci vertex shader outputs/fragment shader inputs? 16775bd8deadSopenharmony_ci 16785bd8deadSopenharmony_ci // different types, different components, same vector 16795bd8deadSopenharmony_ci layout(location=2,component=1) out float f; 16805bd8deadSopenharmony_ci layout(location=2,component=2) out int g; 16815bd8deadSopenharmony_ci 16825bd8deadSopenharmony_ci Further, for the "mixed component types in a vector", do we need 16835bd8deadSopenharmony_ci language related to the automatic assignment of variables without a 16845bd8deadSopenharmony_ci location? For example, let's say we had fragment outputs like: 16855bd8deadSopenharmony_ci 16865bd8deadSopenharmony_ci layout(location=0,component=3) out int f; 16875bd8deadSopenharmony_ci layout(location=0,component=0) out vec3 g; 16885bd8deadSopenharmony_ci 16895bd8deadSopenharmony_ci we'd have an error due to the component type mismatch. But what if we 16905bd8deadSopenharmony_ci had this? 16915bd8deadSopenharmony_ci 16925bd8deadSopenharmony_ci layout(location=0,component=3) out int f; 16935bd8deadSopenharmony_ci out vec3 g; // location assigned by compiler 16945bd8deadSopenharmony_ci 16955bd8deadSopenharmony_ci Should the compiler would be required to avoid location 0 in this 16965bd8deadSopenharmony_ci case, even though it could "fit" into the first three components? 16975bd8deadSopenharmony_ci 16985bd8deadSopenharmony_ci RESOLVED: For fragment outputs, no mixing is allowed, while 16995bd8deadSopenharmony_ci for varyings between stages, the compiler is free to assign locations 17005bd8deadSopenharmony_ci as it sees fit. If the underlying hardware is vector-based and 17015bd8deadSopenharmony_ci requires all components of a vector to have identical 17025bd8deadSopenharmony_ci types/qualifiers, it may need to avoid certain locations. If there is 17035bd8deadSopenharmony_ci no such limitation, the compiler is free to pack variables of 17045bd8deadSopenharmony_ci different types into a single location. 17055bd8deadSopenharmony_ci 17065bd8deadSopenharmony_ci 24) Should we allow "xfb_stride" layout qualifiers on block declations? 17075bd8deadSopenharmony_ci Strides must be associated with a binding point ("xfb_binding"), but 17085bd8deadSopenharmony_ci there is not a 1:1 correspondence between blocks and binding points. 17095bd8deadSopenharmony_ci 17105bd8deadSopenharmony_ci UNRESOLVED: TBD 17115bd8deadSopenharmony_ci 17125bd8deadSopenharmony_ci 25) Should we allow "xfb_offset" on block declarations to specify that all 17135bd8deadSopenharmony_ci block members are captured with increasing offset? If so, should we 17145bd8deadSopenharmony_ci allow the "xfb_offset" qualifier on block members to override the 17155bd8deadSopenharmony_ci offset for that member and subsequent ones? Also, if we allow it, 17165bd8deadSopenharmony_ci what happens if you try to qualfy a block member with a different 17175bd8deadSopenharmony_ci value for "xfb_buffer"? 17185bd8deadSopenharmony_ci 17195bd8deadSopenharmony_ci UNRESOLVED: TBD 17205bd8deadSopenharmony_ci 17215bd8deadSopenharmony_ci 26) How should we handle "xfb_offset" and "xfb_stride" layout qualifiers 17225bd8deadSopenharmony_ci when the shader specifies that it wants to capture double-precision 17235bd8deadSopenharmony_ci scalars, vectors, matrices, as well as arrays and structures 17245bd8deadSopenharmony_ci containing these types? 17255bd8deadSopenharmony_ci 17265bd8deadSopenharmony_ci UNRESOLVED: In unextended OpenGL 4.3, we specify undefined behavior 17275bd8deadSopenharmony_ci if we attempt to capture any double-precision component that doesn't 17285bd8deadSopenharmony_ci have an offset aligned to a multiple of 8 bytes. This is discussed in 17295bd8deadSopenharmony_ci issue (4) of the ARB_gpu_shader_fp64 extension, which notes that to 17305bd8deadSopenharmony_ci align all doubles captured, three things must happen: 17315bd8deadSopenharmony_ci 17325bd8deadSopenharmony_ci (a) the offset of the base of a buffer object must be a multiple of 17335bd8deadSopenharmony_ci eight bytes; 17345bd8deadSopenharmony_ci 17355bd8deadSopenharmony_ci (b) the amount of data captured per vertex must be a multiple of 17365bd8deadSopenharmony_ci eight bytes; and 17375bd8deadSopenharmony_ci 17385bd8deadSopenharmony_ci (c) each double-precision variable captured must be aligned to a 17395bd8deadSopenharmony_ci multiple of eight bytes relative to the beginning of a vertex. 17405bd8deadSopenharmony_ci 17415bd8deadSopenharmony_ci We could have enforced restrictions (b) and (c) in LinkProgram in 17425bd8deadSopenharmony_ci ARB_gpu_shader_fp64, but chose not to because we couldn't conveniently 17435bd8deadSopenharmony_ci enforce (a). Applications can always work around issues (b) and (c) 17445bd8deadSopenharmony_ci by injecting padding via "gl_SkipComponents1" markers in their list of 17455bd8deadSopenharmony_ci varyings. We also could have (but didn't) specified that the linker 17465bd8deadSopenharmony_ci would insert such padding automatically. 17475bd8deadSopenharmony_ci 17485bd8deadSopenharmony_ci It might have been a good idea to have enforced (b) and (c) anyway to 17495bd8deadSopenharmony_ci reduce the cases where undefined behavior occurs. Since this 17505bd8deadSopenharmony_ci extension provides a new way to specify output layout, we can choose 17515bd8deadSopenharmony_ci to specify a new behavior when using the new method, without changing 17525bd8deadSopenharmony_ci the handling of the old method. We are choosing to specify a link 17535bd8deadSopenharmony_ci error if "xfb_offset" or "xfb_stride" is specified but incorrectly 17545bd8deadSopenharmony_ci aligned, and to specify that the linker injects padding if the 17555bd8deadSopenharmony_ci offset/stride are derived automatically. 17565bd8deadSopenharmony_ci 17575bd8deadSopenharmony_ci 17585bd8deadSopenharmony_ciRevision History 17595bd8deadSopenharmony_ci 17605bd8deadSopenharmony_ci Revision 1, 19-Dec-2012 (JohnK) 17615bd8deadSopenharmony_ci - Create overview. 17625bd8deadSopenharmony_ci Revision 2, 21-Jan-2013 (JohnK) 17635bd8deadSopenharmony_ci - Pin down a specific proposal in the overview, and add first 17645bd8deadSopenharmony_ci 5 issues. 17655bd8deadSopenharmony_ci Revision 3, 23-Jan-2013 (JohnK) 17665bd8deadSopenharmony_ci - Allow locations on input/output blocks/members 17675bd8deadSopenharmony_ci - Add details about alignment rules, aliasing, number ranges, etc. 17685bd8deadSopenharmony_ci - Resolve issues 1, 2, 3, and 5. 17695bd8deadSopenharmony_ci Revision 4, 14-Feb-2013 (JohnK) 17705bd8deadSopenharmony_ci - Update from ARB meeting 17715bd8deadSopenharmony_ci - Resolve issue 4 17725bd8deadSopenharmony_ci - Incorporate resolution of issue 5 17735bd8deadSopenharmony_ci Revision 5, 13-Mar-2013 (JohnK) 17745bd8deadSopenharmony_ci - Simplify overview 17755bd8deadSopenharmony_ci - First draft specification language for features 1-5 (not 6). 17765bd8deadSopenharmony_ci Revision 6, 28-Mar-2013 (JohnK) 17775bd8deadSopenharmony_ci - Change xfb streams and components to buffers and offsets 17785bd8deadSopenharmony_ci (aligned and non aliasing) 17795bd8deadSopenharmony_ci - Uniform buffer-like offsets must be naturally aligned. 17805bd8deadSopenharmony_ci - Updated issues 6-9 17815bd8deadSopenharmony_ci Revision 7, 28-Mar-2013 (JohnK) 17825bd8deadSopenharmony_ci - xfb_width -> xfb_stride, order doesn't matter 17835bd8deadSopenharmony_ci - resolve issues 2, 7, 8, and 9 17845bd8deadSopenharmony_ci - add issue 10 17855bd8deadSopenharmony_ci Revision 8, 18-Apr-2013 (pbrown) 17865bd8deadSopenharmony_ci - Add API specification language to query components assigned to 17875bd8deadSopenharmony_ci input/output variables. 17885bd8deadSopenharmony_ci - Add spec language describing the effects of component assignments 17895bd8deadSopenharmony_ci to vertex shader inputs and fragment shader outputs, which interface 17905bd8deadSopenharmony_ci with other API resources (generic attributes, FBO attachments). 17915bd8deadSopenharmony_ci - Add stub spec language describing how transform feedback layout 17925bd8deadSopenharmony_ci qualifiers operate in the API; we have issues to resolve before 17935bd8deadSopenharmony_ci attempting the final language. 17945bd8deadSopenharmony_ci - Add issues 11-18. 17955bd8deadSopenharmony_ci Revision 9, 18-Apr-2013 (pbrown) 17965bd8deadSopenharmony_ci - Add more issues, including issue 19. 17975bd8deadSopenharmony_ci Revision 10, 3-May-2013 (pbrown) 17985bd8deadSopenharmony_ci - Add new program interface query support for transform feedback 17995bd8deadSopenharmony_ci varyings (to query offsets and binding points for each variable) 18005bd8deadSopenharmony_ci and transform feedback buffers (to query stride). 18015bd8deadSopenharmony_ci - Add an example of the enumeration API in issue 17. 18025bd8deadSopenharmony_ci - Start reworking the transform feedback section to use a collection 18035bd8deadSopenharmony_ci of variables with offsets and strides instead of a list of 18045bd8deadSopenharmony_ci consecutive variables. 18055bd8deadSopenharmony_ci - Add errors if a fragment shader output location is shared between 18065bd8deadSopenharmony_ci variables with differetn component types. 18075bd8deadSopenharmony_ci - Add clarifications on the process of assigning locations to fragment 18085bd8deadSopenharmony_ci shader outputs (avoiding locations used by any explicit assignments). 18095bd8deadSopenharmony_ci - Close a number of previously unresolved issues. 18105bd8deadSopenharmony_ci - Add issues 20 and 21, and fork issue 22 from issue 18. 18115bd8deadSopenharmony_ci Revision 11, 6-May-2013 (JohnK) 18125bd8deadSopenharmony_ci - Resolve bug 10132, which includes doing the following: 18135bd8deadSopenharmony_ci - Expand on the rules for repeated layout qualifiers, ordering, effect 18145bd8deadSopenharmony_ci - Don't allow /component/ on structs 18155bd8deadSopenharmony_ci - Initial statef of "layout(xfb_buffer = 0) out;" 18165bd8deadSopenharmony_ci - rules for applying xfb_offset to a block, array, or matrix 18175bd8deadSopenharmony_ci - add gl_MaxTransformFeedbackInterleavedComponents 18185bd8deadSopenharmony_ci - restrict *align* to blocks and block members 18195bd8deadSopenharmony_ci - unresolve issue 7 18205bd8deadSopenharmony_ci - update issue 9 18215bd8deadSopenharmony_ci - add issue 23 18225bd8deadSopenharmony_ci Revision 12, 7-May-2013 (JohnK) 18235bd8deadSopenharmony_ci - Resolve bug 10130, which means the following: 18245bd8deadSopenharmony_ci - Resolve issue 10 18255bd8deadSopenharmony_ci - alignments from the align qualifier will be a multiple of the base 18265bd8deadSopenharmony_ci alignment of the type 18275bd8deadSopenharmony_ci - offset qualifier ids must be a multiple of the base alignment of the 18285bd8deadSopenharmony_ci type 18295bd8deadSopenharmony_ci - minor typo fixes 18305bd8deadSopenharmony_ci Revision 13, 9-May-2013 (JohnK) 18315bd8deadSopenharmony_ci - Allow location layout qualifiers on input/output blocks 18325bd8deadSopenharmony_ci - This incorporates the resolution of issue 2 18335bd8deadSopenharmony_ci Revision 14, 9-May-2013 (JohnK) 18345bd8deadSopenharmony_ci - Resolved issues 7, 19, 20, 21, and 23. 18355bd8deadSopenharmony_ci Revision 15, 10-May-2013 (JohnK) 18365bd8deadSopenharmony_ci - Address feedback from pbrown review cycle 18375bd8deadSopenharmony_ci Revision 16, 13-May-2013 (JohnK) 18385bd8deadSopenharmony_ci - Add #extension (issue 19) 18395bd8deadSopenharmony_ci - Add gl_MaxTransformFeedbackInterleavedComponents = 64; 18405bd8deadSopenharmony_ci - Incorporated issues 7, 20, and 23 18415bd8deadSopenharmony_ci - Update issue 22 18425bd8deadSopenharmony_ci - Break out xfb_ stuff into its own section 18435bd8deadSopenharmony_ci - Flesh out output location/component qualifier specification 18445bd8deadSopenharmony_ci - Lots of editorial changes, including moving to bold for layout qualifier names 18455bd8deadSopenharmony_ci Revision 17, 16-May-2013 (JohnK) 18465bd8deadSopenharmony_ci - Resolve and incorporate issue 22. 18475bd8deadSopenharmony_ci Revision 18, 18-May-2013 (pbrown) 18485bd8deadSopenharmony_ci - Add API specification language for transform feedback-related link 18495bd8deadSopenharmony_ci errors to cover cases of variables overflowing the specified stride 18505bd8deadSopenharmony_ci of their associated binding. 18515bd8deadSopenharmony_ci - Rework the API specification language describing how primitives are 18525bd8deadSopenharmony_ci captured in transform feedback mode to deal in offsets and strides 18535bd8deadSopenharmony_ci instead of ordered lists of variables. Revision 10 had already 18545bd8deadSopenharmony_ci re-defined TransformFeedbackVaryings as specifying offsets and 18555bd8deadSopenharmony_ci strides. 18565bd8deadSopenharmony_ci - Clarify that the OFFSET property of the TRANSFORM_FEEDBACK_VARYING 18575bd8deadSopenharmony_ci returns the actual offset used for the variable, whether it was 18585bd8deadSopenharmony_ci specified directly using a layout qualifier or indirectly using 18595bd8deadSopenharmony_ci TransformFeedbackVaryings (issue 21). 18605bd8deadSopenharmony_ci - Remove reference to MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS in 18615bd8deadSopenharmony_ci issue 9; when using layout qualifiers, we always capture in 18625bd8deadSopenharmony_ci INTERLEAVED_ATTRIBS mode. 18635bd8deadSopenharmony_ci - Cleaned up issue 22, added resolutions for each of the sub-issues. 18645bd8deadSopenharmony_ci - Add issues 24 and 25. 18655bd8deadSopenharmony_ci - Minor cleanups for a few other issues. 18665bd8deadSopenharmony_ci Revision 19, 18-May-2013 (pbrown) 18675bd8deadSopenharmony_ci - Add dependencies for use of ARB_enhanced_layouts as an extension. 18685bd8deadSopenharmony_ci Require OpenGL 3.1 / GLSL 1.40, since that's where layout qualifiers 18695bd8deadSopenharmony_ci were first added. For various features involving layout qualifers, 18705bd8deadSopenharmony_ci require the extension or core version where those layout qualifiers 18715bd8deadSopenharmony_ci were first supported. 18725bd8deadSopenharmony_ci - Fix a typo involving MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS. 18735bd8deadSopenharmony_ci - Close issue 19. 18745bd8deadSopenharmony_ci Revision 20, 21-May-2013 (JohnK) 18755bd8deadSopenharmony_ci - Remove erroneous disembodied xfb_stride example 18765bd8deadSopenharmony_ci Revision 21, 21-May-2013 (pdaniell) 18775bd8deadSopenharmony_ci - Assign enum token values 18785bd8deadSopenharmony_ci Revision 22, 28-May-2013 (JohnK) 18795bd8deadSopenharmony_ci - Fix bugs 10249 and 10267: Expand on (stream's) rules of inheritance for 18805bd8deadSopenharmony_ci xfb_buffer, allow xbf_offset to be on both a block its members, and 18815bd8deadSopenharmony_ci xfb_stride can appear an anything. Other clarifications. 18825bd8deadSopenharmony_ci - Fix bug 10266: xfb_stride must be a multiple of 8 if capturing doubles, 18835bd8deadSopenharmony_ci and offsets are aligned to multiples of the component's size. 18845bd8deadSopenharmony_ci - Fix bug 10247: Describe how actual offsets are computed based on offset 18855bd8deadSopenharmony_ci and align. 18865bd8deadSopenharmony_ci - Fix bug 10248: Either a whole block has location layout qualification or 18875bd8deadSopenharmony_ci none of it does. 18885bd8deadSopenharmony_ci - Other minor editorial changes. 18895bd8deadSopenharmony_ci Revision 23, 28-May-2013 (pbrown) 18905bd8deadSopenharmony_ci - Add API language specifying that automatically derived transform 18915bd8deadSopenharmony_ci feedback strides (when xfb_stride is not used) will be padded out to a 18925bd8deadSopenharmony_ci multiple of 8 when the buffer captures one or more doubles. 18935bd8deadSopenharmony_ci - Add API language specifying a link error if the "xfb_offset" set for 18945bd8deadSopenharmony_ci any variable containing doubles is not a multiple of 8, or if the 18955bd8deadSopenharmony_ci "xfb_stride" set for any binding point with an associated variable 18965bd8deadSopenharmony_ci containing doubles is not a multiple of 8. 18975bd8deadSopenharmony_ci - Add issue 26. 18985bd8deadSopenharmony_ci Revision 24, 30-May-2013 (pbrown) 18995bd8deadSopenharmony_ci - Fixed a typo in the dependencies section for OpenGL 4.1 and 19005bd8deadSopenharmony_ci ARB_separate_shader_objects. 19015bd8deadSopenharmony_ci Revision 25, 31-May-2013 (JohnK) 19025bd8deadSopenharmony_ci - Bug 10248: Redo aliasing language regarding location and component 19035bd8deadSopenharmony_ci aliasing. 19045bd8deadSopenharmony_ci - Bug 10318: More strongly state that align operates at the member 19055bd8deadSopenharmony_ci level and not internally within members. 19065bd8deadSopenharmony_ci - Bug 10321: More strongly state that xfb_offset applied to aggregates 19075bd8deadSopenharmony_ci (arrays, structures, nesting,...) operates by flattening the aggregate 19085bd8deadSopenharmony_ci down to a sequence of components. 19095bd8deadSopenharmony_ci Revision 26, 3-July-2013 (JohnK) 19105bd8deadSopenharmony_ci - Include mention of API changes in the overview, and fix the offset example. 19115bd8deadSopenharmony_ci - Bug 10371: Be explicit that when the gl_PerVertex block is redeclared, 19125bd8deadSopenharmony_ci the declaration can add on invariant, xfb_offset, xfb_buffer, and 19135bd8deadSopenharmony_ci xfb_strideto its members, as well as array size for gl_ClipDistance. 19145bd8deadSopenharmony_ci - Bug 10327: Editorial: Expanded the introduction to the transform-feedback 19155bd8deadSopenharmony_ci section. Described inheritance for xfb_bufferwithout referring to stream. 19165bd8deadSopenharmony_ci - A few minor editorial corrections. 19175bd8deadSopenharmony_ci Revision 27, June 13, 2014 (Jon Leech) 19185bd8deadSopenharmony_ci - Remove GetProgramResourceLocation* as commands accepting the 19195bd8deadSopenharmony_ci TRANSFORM_FEEDBACK_BUFFER interface from the New Tokens section (Bug 19205bd8deadSopenharmony_ci 10588). 19215bd8deadSopenharmony_ci Revision 28, January 10, 2019 (Jon Leech) 19225bd8deadSopenharmony_ci - Clarify that a transform feedback buffer only needs to be bound if 19235bd8deadSopenharmony_ci the buffer is active (gitlab #38). 1924