15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_uniform_buffer_object 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_uniform_buffer_object 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Benj Lipchak, APPLE (lipchak 'at' apple.com) 125bd8deadSopenharmony_ci John Rosasco, APPLE (jdr 'at' apple.com) 135bd8deadSopenharmony_ci Jeremy Sandmel, APPLE (jsandmel 'at' apple.com) 145bd8deadSopenharmony_ci Pat Brown, NVIDIA (pbrown 'at' nvidia.com) 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ciContributors 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ci Rob Barris 195bd8deadSopenharmony_ci Keith Bauer 205bd8deadSopenharmony_ci Bob Beretta 215bd8deadSopenharmony_ci Pat Brown 225bd8deadSopenharmony_ci Nick Burns 235bd8deadSopenharmony_ci Matt Collins 245bd8deadSopenharmony_ci Michael Gold 255bd8deadSopenharmony_ci John Kessenich 265bd8deadSopenharmony_ci Jon Leech 275bd8deadSopenharmony_ci Barthold Lichtenbelt 285bd8deadSopenharmony_ci Benj Lipchak 295bd8deadSopenharmony_ci Bruce Merry 305bd8deadSopenharmony_ci John Rosasco 315bd8deadSopenharmony_ci Jeremy Sandmel 325bd8deadSopenharmony_ci Geoff Stahl 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciNotice 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 375bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ciSpecification Update Policy 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 425bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 435bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 445bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 455bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 465bd8deadSopenharmony_ci described in more detail at 475bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciStatus 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci Complete. Approved by the ARB on February 17, 2009. 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ciVersion 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci Last Modified Date: 2015/06/23 565bd8deadSopenharmony_ci Author revision: 68 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ciNumber 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci ARB Extension #57 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ciDependencies 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci The OpenGL Shading Language (GLSL) is required. OpenGL 2.0 or the 655bd8deadSopenharmony_ci ARB_shader_objects extension is required. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci OpenGL 1.5 or ARB_vertex_buffer_object is required. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci This extension is written against the OpenGL 2.1 specification and 705bd8deadSopenharmony_ci version 1.20-8 of the OpenGL Shading Language specification. 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci This extension interacts with OpenGL 3.0, ARB_geometry_shader4, 735bd8deadSopenharmony_ci ARB_texture_rectangle, EXT_gpu_shader4, EXT_texture_array, 745bd8deadSopenharmony_ci EXT_texture_integer, and EXT_texture_buffer_object. 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ciOverview 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci This extension introduces the concept of a group of GLSL uniforms 795bd8deadSopenharmony_ci known as a "uniform block", and the API mechanisms to store "uniform 805bd8deadSopenharmony_ci blocks" in GL buffer objects. 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci The extension also defines both a standard cross-platform layout in 835bd8deadSopenharmony_ci memory for uniform block data, as well as mechanisms to allow the GL 845bd8deadSopenharmony_ci to optimize the data layout in an implementation-defined manner. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci Prior to this extension, the existing interface for modification of 875bd8deadSopenharmony_ci uniform values allowed modification of large numbers of values using 885bd8deadSopenharmony_ci glUniform* calls, but only for a single uniform name (or a uniform 895bd8deadSopenharmony_ci array) at a time. However, updating uniforms in this manner may not 905bd8deadSopenharmony_ci map well to heterogenous uniform data structures defined for a GL 915bd8deadSopenharmony_ci application and in these cases, the application is forced to either: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci A) restructure their uniform data definitions into arrays 945bd8deadSopenharmony_ci or 955bd8deadSopenharmony_ci B) make an excessive number of calls through the GL interface 965bd8deadSopenharmony_ci to one of the Uniform* variants. 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci These solutions have their disadvantages. Solution A imposes 995bd8deadSopenharmony_ci considerable development overhead on the application developer. 1005bd8deadSopenharmony_ci Solution B may impose considerable run-time overhead on the 1015bd8deadSopenharmony_ci application if the number of uniforms modified in a given frame of 1025bd8deadSopenharmony_ci rendering is sufficiently large. 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci This extension provides a better alternative to either (A) or (B) by 1055bd8deadSopenharmony_ci allowing buffer object backing for the storage associated with all 1065bd8deadSopenharmony_ci uniforms of a given GLSL program. 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Storing uniform blocks in buffer objects enables several key use 1095bd8deadSopenharmony_ci cases: 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci - sharing of uniform data storage between program objects and 1125bd8deadSopenharmony_ci between program stages 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci - rapid swapping of sets of previously defined uniforms by storing 1155bd8deadSopenharmony_ci sets of uniform data on the GL server 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci - rapid updates of uniform data from both the client and the server 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci The data storage for a uniform block can be declared to use one of 1205bd8deadSopenharmony_ci three layouts in memory: packed, shared, or std140. 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci - "packed" uniform blocks have an implementation-dependent data 1235bd8deadSopenharmony_ci layout for efficiency, and unused uniforms may be eliminated by 1245bd8deadSopenharmony_ci the compiler to save space. 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci - "shared" uniform blocks, the default layout, have an implementation- 1275bd8deadSopenharmony_ci dependent data layout for efficiency, but the layout will be uniquely 1285bd8deadSopenharmony_ci determined by the structure of the block, allowing data storage to be 1295bd8deadSopenharmony_ci shared across programs. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci - "std140" uniform blocks have a standard cross-platform cross-vendor 1325bd8deadSopenharmony_ci layout (see below). Unused uniforms will not be eliminated. 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Any uniforms not declared in a named uniform block are said to 1355bd8deadSopenharmony_ci be part of the "default uniform block". 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci While uniforms in the default uniform block are updated with 1385bd8deadSopenharmony_ci glUniform* entry points and can have static initializers, uniforms 1395bd8deadSopenharmony_ci in named uniform blocks are not. Instead, uniform block data is updated 1405bd8deadSopenharmony_ci using the routines that update buffer objects and can not use static 1415bd8deadSopenharmony_ci initializers. 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci Rules and Concepts Guiding this Specification: 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci For reference, a uniform has a "uniform index" (subsequently 1465bd8deadSopenharmony_ci referred to as "u_index) and also a "uniform location" to 1475bd8deadSopenharmony_ci efficiently identify it in the uniform data store of the 1485bd8deadSopenharmony_ci implementation. We subsequently refer to this uniform data store of 1495bd8deadSopenharmony_ci the implementation as the "uniform database". 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci A "uniform block" only has a "uniform block index" used for queries 1525bd8deadSopenharmony_ci and connecting the "uniform block" to a buffer object. A "uniform 1535bd8deadSopenharmony_ci block" has no "location" because "uniform blocks" are not updated 1545bd8deadSopenharmony_ci directly. The buffer object APIs are used instead. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci Properties of Uniforms and uniform blocks: 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci a) A uniform is "active" if it exists in the database and has a valid 1595bd8deadSopenharmony_ci u_index. 1605bd8deadSopenharmony_ci b) A "uniform block" is "active" if it exists in the database and 1615bd8deadSopenharmony_ci has a valid ub_index. 1625bd8deadSopenharmony_ci c) Uniforms and "uniform blocks" can be inactive because they don't 1635bd8deadSopenharmony_ci exist in the source, or because they have been removed by dead 1645bd8deadSopenharmony_ci code elimination. 1655bd8deadSopenharmony_ci d) An inactive uniform has u_index == INVALID_INDEX. 1665bd8deadSopenharmony_ci e) An inactive uniform block has ub_index == INVALID_INDEX. 1675bd8deadSopenharmony_ci f) A u_index or ub_index of INVALID_INDEX generates the 1685bd8deadSopenharmony_ci INVALID_VALUE error if given as a function argument. 1695bd8deadSopenharmony_ci g) The default uniform block, which is not assigned any ub_index, uses a 1705bd8deadSopenharmony_ci private, internal data storage, and does not have any buffer object 1715bd8deadSopenharmony_ci associated with it. 1725bd8deadSopenharmony_ci h) An active uniform that is a member of the default uniform block has 1735bd8deadSopenharmony_ci location >= 0 and it has offset == stride == -1. 1745bd8deadSopenharmony_ci i) An active uniform that is a member of a named uniform block has 1755bd8deadSopenharmony_ci location == -1. 1765bd8deadSopenharmony_ci j) A uniform location of -1 is silently ignored if given as a function 1775bd8deadSopenharmony_ci argument. 1785bd8deadSopenharmony_ci k) Uniform block declarations may not be nested 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ciIP Status 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci No known IP claims. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ciNew Procedures and Functions 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci void GetUniformIndices(uint program, 1875bd8deadSopenharmony_ci sizei uniformCount, 1885bd8deadSopenharmony_ci const char* const * uniformNames, 1895bd8deadSopenharmony_ci uint* uniformIndices); 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci void GetActiveUniformsiv(uint program, 1925bd8deadSopenharmony_ci sizei uniformCount, 1935bd8deadSopenharmony_ci const uint* uniformIndices, 1945bd8deadSopenharmony_ci enum pname, 1955bd8deadSopenharmony_ci int* params); 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci void GetActiveUniformName(uint program, 1985bd8deadSopenharmony_ci uint uniformIndex, 1995bd8deadSopenharmony_ci sizei bufSize, 2005bd8deadSopenharmony_ci sizei* length, 2015bd8deadSopenharmony_ci char* uniformName); 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci uint GetUniformBlockIndex(uint program, 2045bd8deadSopenharmony_ci const char* uniformBlockName); 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci void GetActiveUniformBlockiv(uint program, 2075bd8deadSopenharmony_ci uint uniformBlockIndex, 2085bd8deadSopenharmony_ci enum pname, 2095bd8deadSopenharmony_ci int* params); 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci void GetActiveUniformBlockName(uint program, 2125bd8deadSopenharmony_ci uint uniformBlockIndex, 2135bd8deadSopenharmony_ci sizei bufSize, 2145bd8deadSopenharmony_ci sizei* length, 2155bd8deadSopenharmony_ci char* uniformBlockName); 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci void BindBufferRange(enum target, 2185bd8deadSopenharmony_ci uint index, 2195bd8deadSopenharmony_ci uint buffer, 2205bd8deadSopenharmony_ci intptr offset, 2215bd8deadSopenharmony_ci sizeiptr size); 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci void BindBufferBase(enum target, 2245bd8deadSopenharmony_ci uint index, 2255bd8deadSopenharmony_ci uint buffer); 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci void GetIntegeri_v(enum target, uint index, int* data); 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci void UniformBlockBinding(uint program, 2305bd8deadSopenharmony_ci uint uniformBlockIndex, 2315bd8deadSopenharmony_ci uint uniformBlockBinding); 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ciNew Types 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci None. 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ciNew Tokens 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci Accepted by the <target> parameters of BindBuffer, BufferData, 2405bd8deadSopenharmony_ci BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and 2415bd8deadSopenharmony_ci GetBufferPointerv: 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci UNIFORM_BUFFER 0x8A11 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetIntegeri_v, GetBooleanv, 2465bd8deadSopenharmony_ci GetIntegerv, GetFloatv, and GetDoublev: 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci UNIFORM_BUFFER_BINDING 0x8A28 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetIntegeri_v: 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci UNIFORM_BUFFER_START 0x8A29 2535bd8deadSopenharmony_ci UNIFORM_BUFFER_SIZE 0x8A2A 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 2565bd8deadSopenharmony_ci GetFloatv, and GetDoublev: 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B 2595bd8deadSopenharmony_ci MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C 2605bd8deadSopenharmony_ci MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D 2615bd8deadSopenharmony_ci MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E 2625bd8deadSopenharmony_ci MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F 2635bd8deadSopenharmony_ci MAX_UNIFORM_BLOCK_SIZE 0x8A30 2645bd8deadSopenharmony_ci MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 2655bd8deadSopenharmony_ci MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 2665bd8deadSopenharmony_ci MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 2675bd8deadSopenharmony_ci UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramiv: 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 2725bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCKS 0x8A36 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetActiveUniformsiv: 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci UNIFORM_TYPE 0x8A37 2775bd8deadSopenharmony_ci UNIFORM_SIZE 0x8A38 2785bd8deadSopenharmony_ci UNIFORM_NAME_LENGTH 0x8A39 2795bd8deadSopenharmony_ci UNIFORM_BLOCK_INDEX 0x8A3A 2805bd8deadSopenharmony_ci UNIFORM_OFFSET 0x8A3B 2815bd8deadSopenharmony_ci UNIFORM_ARRAY_STRIDE 0x8A3C 2825bd8deadSopenharmony_ci UNIFORM_MATRIX_STRIDE 0x8A3D 2835bd8deadSopenharmony_ci UNIFORM_IS_ROW_MAJOR 0x8A3E 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetActiveUniformBlockiv: 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci UNIFORM_BLOCK_BINDING 0x8A3F 2885bd8deadSopenharmony_ci UNIFORM_BLOCK_DATA_SIZE 0x8A40 2895bd8deadSopenharmony_ci UNIFORM_BLOCK_NAME_LENGTH 0x8A41 2905bd8deadSopenharmony_ci UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 2915bd8deadSopenharmony_ci UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 2925bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 2935bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 2945bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 2955bd8deadSopenharmony_ci 2965bd8deadSopenharmony_ci Returned by GetActiveUniformsiv and GetUniformBlockIndex 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci INVALID_INDEX 0xFFFFFFFFu 2995bd8deadSopenharmony_ci 3005bd8deadSopenharmony_ci2.1 Specification Updates 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ciAdditions to Chapter 2 - OpenGL Operation 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci Section 2.9 - Buffer Objects 3055bd8deadSopenharmony_ci Add UNIFORM_BUFFER to list of buffer object targets on: 3065bd8deadSopenharmony_ci Pg 35, 2nd pgph 3075bd8deadSopenharmony_ci Pg 37, top of page 3085bd8deadSopenharmony_ci Pg 38, top of page 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci Section 2.15 - Vertex Shaders 3115bd8deadSopenharmony_ci Pg 79, bump Uniform Variables up to a numbered section since there 3125bd8deadSopenharmony_ci will now be hierarchy under it; replace all but first paragraph of 3135bd8deadSopenharmony_ci Uniform Variables section on this page, through to the start of the 3145bd8deadSopenharmony_ci first full paragraph on p. 80 (beginning "A valid <name>...") under 3155bd8deadSopenharmony_ci the description of GetUniformLocation: 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ci Sets of uniforms can be grouped into "uniform blocks". The values of each 3185bd8deadSopenharmony_ci uniform in such a set are extracted from the data store of a buffer object 3195bd8deadSopenharmony_ci corresponding to the uniform block. 3205bd8deadSopenharmony_ci OpenGL Shading Language syntax serves to delimit named blocks of 3215bd8deadSopenharmony_ci uniforms that can be backed by a buffer object. These are referred to as 3225bd8deadSopenharmony_ci "named uniform blocks," and are assigned a uniform block index. Uniforms 3235bd8deadSopenharmony_ci that are declared outside of a named uniform block are said to be part of 3245bd8deadSopenharmony_ci the "default uniform block." Default uniform blocks have no name or uniform 3255bd8deadSopenharmony_ci block index. Like uniforms, uniform blocks can be active or inactive. Active 3265bd8deadSopenharmony_ci uniform blocks are those that contain active uniforms after a program has 3275bd8deadSopenharmony_ci been compiled and linked. 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci The amount of storage available for uniform variables in the default uniform 3305bd8deadSopenharmony_ci block accessed by a vertex shader is specified by the value of the 3315bd8deadSopenharmony_ci implementation-dependent constant MAX_VERTEX_UNIFORM_COMPONENTS. The total 3325bd8deadSopenharmony_ci amount of combined storage available for uniform variables in all uniform 3335bd8deadSopenharmony_ci blocks accessed by a vertex shader (including the default uniform block) 3345bd8deadSopenharmony_ci is specified by the value of the implementation-dependent 3355bd8deadSopenharmony_ci constant MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS. These values 3365bd8deadSopenharmony_ci represent the numbers of individual floating-point, integer, or boolean 3375bd8deadSopenharmony_ci values that can be held in uniform variable storage for a vertex shader. 3385bd8deadSopenharmony_ci A link error is generated if an attempt is made to utilize more than 3395bd8deadSopenharmony_ci the space available for vertex shader uniform variables. 3405bd8deadSopenharmony_ci 3415bd8deadSopenharmony_ci When a program is successfully linked, all active uniforms belonging to 3425bd8deadSopenharmony_ci the program object's default uniform block are initialized to zero (FALSE 3435bd8deadSopenharmony_ci for booleans). A successful link will also generate a location for each 3445bd8deadSopenharmony_ci active uniform in the default uniform block. The values of active uniforms 3455bd8deadSopenharmony_ci in the default uniform block can be changed using this location and the 3465bd8deadSopenharmony_ci appropriate Uniform* command (see below). These locations are invalidated 3475bd8deadSopenharmony_ci and new ones assigned after each successful re-link. 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci Similarly, when a program is successfully linked, all active uniforms 3505bd8deadSopenharmony_ci belonging to the program's named uniform blocks are assigned offsets 3515bd8deadSopenharmony_ci (and strides for array and matrix type uniforms) within the uniform block 3525bd8deadSopenharmony_ci according to layout rules described below. Uniform buffer objects provide 3535bd8deadSopenharmony_ci the storage for named uniform blocks, so the values of active uniforms in 3545bd8deadSopenharmony_ci named uniform blocks may be changed by modifying the contents of the buffer 3555bd8deadSopenharmony_ci object using commands such as BufferData, BufferSubData, MapBuffer, and 3565bd8deadSopenharmony_ci UnmapBuffer. Uniforms in a named uniform block are not assigned a location 3575bd8deadSopenharmony_ci and may not be modified using the Uniform* commands. The offsets and strides 3585bd8deadSopenharmony_ci of all active uniforms belonging to named uniform blocks of a program object 3595bd8deadSopenharmony_ci are invalidated and new ones assigned after each successful re-link. 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ci To find the location within a program object of an active uniform 3625bd8deadSopenharmony_ci variable associated with the default uniform block, use the command 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci int GetUniformLocation(uint program, const char *name); 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci This command will return the location of uniform variable <name> if it 3675bd8deadSopenharmony_ci is associated with the default uniform block. <name> must be a 3685bd8deadSopenharmony_ci null-terminated string, without white space. The value -1 will be returned 3695bd8deadSopenharmony_ci if <name> does not correspond to an active uniform variable name in 3705bd8deadSopenharmony_ci <program>, if <name> is associated with a named uniform block, or if 3715bd8deadSopenharmony_ci <name> starts with the reserved prefix "gl_". 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci If <program> has not been successfully linked, the error INVALID_OPERATION 3745bd8deadSopenharmony_ci is generated. After a program is linked, the location of a uniform 3755bd8deadSopenharmony_ci variable will not change, unless the program is re-linked. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci A valid <name>... 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci Pg 80, insert before the description of GetActiveUniform: 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ci Named uniform blocks, like uniforms, are identified by name strings. 3825bd8deadSopenharmony_ci Uniform block indices corresponding to uniform block names can be queried 3835bd8deadSopenharmony_ci by calling 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci uint GetUniformBlockIndex(uint program, 3865bd8deadSopenharmony_ci const char* uniformBlockName); 3875bd8deadSopenharmony_ci 3885bd8deadSopenharmony_ci <program> is the name of a program object for which the command 3895bd8deadSopenharmony_ci LinkProgram has been issued in the past. It is not 3905bd8deadSopenharmony_ci necessary for <program> to have been linked successfully. The link 3915bd8deadSopenharmony_ci could have failed because the number of active uniforms exceeded the 3925bd8deadSopenharmony_ci limit. 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci <uniformBlockName> must contain a null-terminated string specifying 3955bd8deadSopenharmony_ci the name of a uniform block. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci GetUniformBlockIndex returns the uniform block index for the 3985bd8deadSopenharmony_ci uniform block named <uniformBlockName> of <program>. If 3995bd8deadSopenharmony_ci <uniformBlockName> does not identify an active uniform block of 4005bd8deadSopenharmony_ci <program>, or an error occurred, then INVALID_INDEX is returned. 4015bd8deadSopenharmony_ci The indices of the active uniform blocks of a program are assigned in 4025bd8deadSopenharmony_ci consecutive order, beginning with zero. 4035bd8deadSopenharmony_ci 4045bd8deadSopenharmony_ci An active uniform block's name string can be queried from its 4055bd8deadSopenharmony_ci uniform block index by calling 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci void GetActiveUniformBlockName(uint program, 4085bd8deadSopenharmony_ci uint uniformBlockIndex, 4095bd8deadSopenharmony_ci sizei bufSize, 4105bd8deadSopenharmony_ci sizei* length, 4115bd8deadSopenharmony_ci char* uniformBlockName); 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci <program> is the name of a program object for which the command 4145bd8deadSopenharmony_ci LinkProgram has been issued in the past. It is not 4155bd8deadSopenharmony_ci necessary for <program> to have been linked successfully. The link 4165bd8deadSopenharmony_ci could have failed because the number of active uniforms exceeded the 4175bd8deadSopenharmony_ci limit. 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci <uniformBlockIndex> must be an active uniform block index of 4205bd8deadSopenharmony_ci <program>, in the range zero to the value of 4215bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCKS - 1. The value of 4225bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCKS can be queried with GetProgramiv (see 4235bd8deadSopenharmony_ci section 6.1.14). If <uniformBlockIndex> is greater than or equal to 4245bd8deadSopenharmony_ci the value of ACTIVE_UNIFORM_BLOCKS, the error INVALID_VALUE is 4255bd8deadSopenharmony_ci generated. 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci The string name of the uniform block identified by <uniformBlockIndex> 4285bd8deadSopenharmony_ci is returned into <uniformBlockName>. The name is 4295bd8deadSopenharmony_ci null-terminated. The actual number of characters written into 4305bd8deadSopenharmony_ci <uniformBlockName>, excluding the null terminator, is returned in <length>. 4315bd8deadSopenharmony_ci If <length> is NULL, no length is returned. 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ci <bufSize> contains the maximum number of characters (including the 4345bd8deadSopenharmony_ci null terminator) that will be written back to <uniformBlockName>. 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci If an error occurs, nothing will be written to <uniformBlockName> or 4375bd8deadSopenharmony_ci <length>. 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci Information about an active uniform block can be queried by calling 4405bd8deadSopenharmony_ci 4415bd8deadSopenharmony_ci void GetActiveUniformBlockiv(uint program, 4425bd8deadSopenharmony_ci uint uniformBlockIndex, 4435bd8deadSopenharmony_ci enum pname, 4445bd8deadSopenharmony_ci int* params); 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci <program> is the name of a program object for which the command 4475bd8deadSopenharmony_ci LinkProgram has been issued in the past. It is not 4485bd8deadSopenharmony_ci necessary for <program> to have been linked successfully. The link 4495bd8deadSopenharmony_ci could have failed because the number of active uniforms exceeded the 4505bd8deadSopenharmony_ci limit. 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci <uniformBlockIndex> is an active uniform block index of <program>. 4535bd8deadSopenharmony_ci If <uniformBlockIndex> is greater than or equal to the value of 4545bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCKS, or is not the index of an active uniform 4555bd8deadSopenharmony_ci block in <program>, the error INVALID_VALUE is generated. 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci If no error occurs, the uniform block parameter(s) specified by 4585bd8deadSopenharmony_ci <pname> are returned in <params>. Otherwise, nothing will be written 4595bd8deadSopenharmony_ci to <params>. 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_BINDING, then 4625bd8deadSopenharmony_ci the index of the uniform buffer binding 4635bd8deadSopenharmony_ci point last selected by the uniform block specified by <uniformBlockIndex> 4645bd8deadSopenharmony_ci for <program> is returned. If no uniform block has been previously 4655bd8deadSopenharmony_ci specified, zero is returned. 4665bd8deadSopenharmony_ci 4675bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_DATA_SIZE, the value returned is the 4685bd8deadSopenharmony_ci implementation-dependent minimum total buffer object size, in 4695bd8deadSopenharmony_ci basic machine units, required to hold all active uniforms in the 4705bd8deadSopenharmony_ci uniform block identified by <uniformBlockIndex>. 4715bd8deadSopenharmony_ci It is neither guaranteed nor expected that a given implementation will 4725bd8deadSopenharmony_ci arrange uniform values as tightly packed in a buffer object. The exception 4735bd8deadSopenharmony_ci to this is the "std140" uniform block layout, which guarantees specific 4745bd8deadSopenharmony_ci packing behavior and does not require the application to query for offsets 4755bd8deadSopenharmony_ci and strides. In this case, the minimum size may still be queried, even 4765bd8deadSopenharmony_ci though it is determined in advance based only on the uniform block 4775bd8deadSopenharmony_ci declaration (see "Standard Uniform Block Layout" in section 2.15.3.1.2). 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ci The total amount of buffer object storage available for any given uniform 4805bd8deadSopenharmony_ci block is subject to an implementation-dependent limit; the maximum amount 4815bd8deadSopenharmony_ci of available space, in basic machine units, can be queried by calling 4825bd8deadSopenharmony_ci GetIntegerv with the constant MAX_UNIFORM_BLOCK_SIZE. If the amount 4835bd8deadSopenharmony_ci of storage required for a uniform block exceeds this limit, a program may 4845bd8deadSopenharmony_ci fail to link. 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_NAME_LENGTH, then the total length 4875bd8deadSopenharmony_ci (including the null terminator) of the name of the uniform block 4885bd8deadSopenharmony_ci identified by <uniformBlockIndex> is returned. 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_ACTIVE_UNIFORMS, then the number of 4915bd8deadSopenharmony_ci active uniforms in the uniform block identified by 4925bd8deadSopenharmony_ci <uniformBlockIndex> is returned. 4935bd8deadSopenharmony_ci 4945bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, then a list 4955bd8deadSopenharmony_ci of the active uniform indices for the uniform block identified by 4965bd8deadSopenharmony_ci <uniformBlockIndex> is returned. 4975bd8deadSopenharmony_ci The number of elements that will be written to <params> is the value 4985bd8deadSopenharmony_ci of UNIFORM_BLOCK_ACTIVE_UNIFORMS for <uniformBlockIndex>. 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, 5015bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, or 5025bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, then 5035bd8deadSopenharmony_ci a boolean value indicating whether the uniform block identified by 5045bd8deadSopenharmony_ci <uniformBlockIndex> is referenced by the vertex, geometry, or fragment 5055bd8deadSopenharmony_ci programming stage of <program>, respectively, is returned. 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci Each active uniform, whether in a named uniform block or in the default 5085bd8deadSopenharmony_ci block, is assigned an index when a program is linked. These indices are 5095bd8deadSopenharmony_ci assigned in consecutive order, beginning with zero. The indices assigned 5105bd8deadSopenharmony_ci to a set of uniforms in a program may be queried by calling 5115bd8deadSopenharmony_ci 5125bd8deadSopenharmony_ci void GetUniformIndices(uint program, 5135bd8deadSopenharmony_ci sizei uniformCount, 5145bd8deadSopenharmony_ci const char* const * uniformNames, 5155bd8deadSopenharmony_ci uint* uniformIndices); 5165bd8deadSopenharmony_ci 5175bd8deadSopenharmony_ci <program> is the name of a program object for which the command 5185bd8deadSopenharmony_ci LinkProgram has been issued in the past. It is not 5195bd8deadSopenharmony_ci necessary for <program> to have been linked successfully. The link 5205bd8deadSopenharmony_ci could have failed because the number of active uniforms exceeded the 5215bd8deadSopenharmony_ci limit. 5225bd8deadSopenharmony_ci 5235bd8deadSopenharmony_ci <uniformCount> indicates both the number of elements in the array of 5245bd8deadSopenharmony_ci names <uniformNames> and the number of indices that may be written to 5255bd8deadSopenharmony_ci <uniformIndices>. 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci <uniformNames> contains a list of <uniformCount> name strings 5285bd8deadSopenharmony_ci identifying the uniform names to be queried for indices. For each name 5295bd8deadSopenharmony_ci string in <uniformNames>, the index assigned to the active uniform of 5305bd8deadSopenharmony_ci that name will be written to the corresponding element of 5315bd8deadSopenharmony_ci <uniformIndices>. If a string in <uniformNames> is not the name of an 5325bd8deadSopenharmony_ci active uniform, the value INVALID_INDEX will be written to the 5335bd8deadSopenharmony_ci corresponding element of <uniformIndices>. 5345bd8deadSopenharmony_ci 5355bd8deadSopenharmony_ci If an error occurs, nothing is written to <uniformIndices>. 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci The name of an active uniform may be queried from the corresponding uniform 5385bd8deadSopenharmony_ci index by calling 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci void GetActiveUniformName(uint program, 5415bd8deadSopenharmony_ci uint uniformIndex, 5425bd8deadSopenharmony_ci sizei bufSize, 5435bd8deadSopenharmony_ci sizei* length, 5445bd8deadSopenharmony_ci char* uniformName); 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci <program> is the name of a program object for which the command 5475bd8deadSopenharmony_ci LinkProgram has been issued in the past. It is not 5485bd8deadSopenharmony_ci necessary for <program> to have been linked successfully. The link 5495bd8deadSopenharmony_ci could have failed because the number of active uniforms exceeded the 5505bd8deadSopenharmony_ci limit. 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci <uniformIndex> must be an active uniform index of the program 5535bd8deadSopenharmony_ci <program>, in the range zero to the value of ACTIVE_UNIFORMS - 1. 5545bd8deadSopenharmony_ci The value of ACTIVE_UNIFORMS can be queried with GetProgramiv. If 5555bd8deadSopenharmony_ci <uniformIndex> is greater than or equal to the value of 5565bd8deadSopenharmony_ci ACTIVE_UNIFORMS, the error INVALID_VALUE is generated. 5575bd8deadSopenharmony_ci 5585bd8deadSopenharmony_ci The name of the uniform identified by <uniformIndex> is 5595bd8deadSopenharmony_ci returned as a null-terminated string in <uniformName>. 5605bd8deadSopenharmony_ci The actual number of characters written into <uniformName>, excluding the 5615bd8deadSopenharmony_ci null terminator, is returned in <length>. If <length> is NULL, no length is 5625bd8deadSopenharmony_ci returned. The maximum number of characters that may be written into 5635bd8deadSopenharmony_ci <uniformName>, including the null terminator, is specified by <bufSize>. 5645bd8deadSopenharmony_ci The returned uniform name can be the name of built-in uniform state as 5655bd8deadSopenharmony_ci well. The complete list of built-in uniform state is described in section 5665bd8deadSopenharmony_ci 7.5 of the OpenGL Shading Language specification. The length of the 5675bd8deadSopenharmony_ci longest uniform name in <program> is given by the value of 5685bd8deadSopenharmony_ci ACTIVE_UNIFORM_MAX_LENGTH, which can be queried with GetProgramiv. 5695bd8deadSopenharmony_ci 5705bd8deadSopenharmony_ci If GetActiveUniformName is not successful, nothing is written to 5715bd8deadSopenharmony_ci <length> or <uniformName>. 5725bd8deadSopenharmony_ci 5735bd8deadSopenharmony_ci Each uniform variable, declared in a shader, is broken down into one or 5745bd8deadSopenharmony_ci more strings using the "." (dot) and "[]" operators, if necessary, to the 5755bd8deadSopenharmony_ci point that it is legal to pass each string back into GetUniformLocation, 5765bd8deadSopenharmony_ci for default uniform block uniform names, or GetUniformIndices, for 5775bd8deadSopenharmony_ci named uniform block uniform names. 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci Pg 80, replace description of GetActiveUniform 5805bd8deadSopenharmony_ci 5815bd8deadSopenharmony_ci Information about active uniforms can be obtained by calling either 5825bd8deadSopenharmony_ci 5835bd8deadSopenharmony_ci void GetActiveUniform(uint program, 5845bd8deadSopenharmony_ci uint index, 5855bd8deadSopenharmony_ci sizei bufSize, 5865bd8deadSopenharmony_ci sizei* length, 5875bd8deadSopenharmony_ci int* size, 5885bd8deadSopenharmony_ci enum* type, 5895bd8deadSopenharmony_ci char* name); 5905bd8deadSopenharmony_ci 5915bd8deadSopenharmony_ci or 5925bd8deadSopenharmony_ci 5935bd8deadSopenharmony_ci void GetActiveUniformsiv(uint program, 5945bd8deadSopenharmony_ci sizei uniformCount, 5955bd8deadSopenharmony_ci const uint* uniformIndices, 5965bd8deadSopenharmony_ci enum pname, 5975bd8deadSopenharmony_ci int* params); 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci <program> is the name of a program object for which the command 6005bd8deadSopenharmony_ci LinkProgram has been issued in the past. It is not 6015bd8deadSopenharmony_ci necessary for <program> to have been linked successfully. The link 6025bd8deadSopenharmony_ci could have failed because the number of active uniforms exceeded the 6035bd8deadSopenharmony_ci limit. 6045bd8deadSopenharmony_ci 6055bd8deadSopenharmony_ci These commands provide information about the uniform or uniforms selected 6065bd8deadSopenharmony_ci by <index> or <uniformIndices>, respectively. In GetActiveUniform, an 6075bd8deadSopenharmony_ci <index> of 0 selects the first active uniform, and an <index> of the value 6085bd8deadSopenharmony_ci of ACTIVE_UNIFORMS - 1 selects the last active uniform. In 6095bd8deadSopenharmony_ci GetActiveUniformsiv, <uniformIndices> is an array of such active uniform 6105bd8deadSopenharmony_ci indices. If any index is greater than or equal to the value of 6115bd8deadSopenharmony_ci ACTIVE_UNIFORMS, the error INVALID_VALUE is generated. 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci For the selected uniform, GetActiveUniform returns the uniform name as a 6145bd8deadSopenharmony_ci null-terminated string in <name>. The actual number of 6155bd8deadSopenharmony_ci characters written into <name>, excluding the null terminator, is returned 6165bd8deadSopenharmony_ci in <length>. If <length> is NULL, no length is returned. The maximum 6175bd8deadSopenharmony_ci number of characters that may be written into <name>, including the null 6185bd8deadSopenharmony_ci terminator, is specified by <bufSize>. The returned uniform name can be the 6195bd8deadSopenharmony_ci name of built-in uniform state as well. The complete list of built-in 6205bd8deadSopenharmony_ci uniform state is described in section 7.5 of the OpenGL Shading Language 6215bd8deadSopenharmony_ci specification. The length of the longest uniform name in <program> is given 6225bd8deadSopenharmony_ci by ACTIVE_UNIFORM_MAX_LENGTH. 6235bd8deadSopenharmony_ci 6245bd8deadSopenharmony_ci Each uniform variable, declared in a shader, is broken down into one or 6255bd8deadSopenharmony_ci more strings using the "." (dot) and "[]" operators, if necessary, to the 6265bd8deadSopenharmony_ci point that it is legal to pass each string back into GetUniformLocation, 6275bd8deadSopenharmony_ci for default uniform block uniform names, or GetUniformIndices, for 6285bd8deadSopenharmony_ci named uniform block uniform names. 6295bd8deadSopenharmony_ci 6305bd8deadSopenharmony_ci For the selected uniform, GetActiveUniform returns the type of the uniform 6315bd8deadSopenharmony_ci into <type> and the size of the uniform is into <size>. The value in 6325bd8deadSopenharmony_ci <size> is in units of the uniform type, which can be any of the 6335bd8deadSopenharmony_ci values in Table 2.utype. 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci If one or more elements of an array are active, GetActiveUniform will 6365bd8deadSopenharmony_ci return the name of the array in <name>, subject to the restrictions listed 6375bd8deadSopenharmony_ci above. The type of the array is returned in <type>. The <size> parameter 6385bd8deadSopenharmony_ci contains the highest array element index used, plus one. The compiler or 6395bd8deadSopenharmony_ci linker determines the highest index used. There will be only one active 6405bd8deadSopenharmony_ci uniform reported by the GL per uniform array. 6415bd8deadSopenharmony_ci 6425bd8deadSopenharmony_ci GetActiveUniform will return as much information about active uniforms as 6435bd8deadSopenharmony_ci possible. If no information is available, <length> will be set to zero and 6445bd8deadSopenharmony_ci <name> will be an empty string. This situation could arise if 6455bd8deadSopenharmony_ci GetActiveUniform is issued after a failed link. 6465bd8deadSopenharmony_ci 6475bd8deadSopenharmony_ci If an error occurs, nothing is written to <length>, <size>, <type>, 6485bd8deadSopenharmony_ci or <name>. 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ci 6515bd8deadSopenharmony_ci Type Name Token Keyword Type Name Token Keyword 6525bd8deadSopenharmony_ci --------------- ------- --------------- ------- 6535bd8deadSopenharmony_ci FLOAT float SAMPLER_1D sampler1D 6545bd8deadSopenharmony_ci FLOAT_VEC2 vec2 SAMPLER_2D sampler2D 6555bd8deadSopenharmony_ci FLOAT_VEC3 vec3 SAMPLER_3D sampler3D 6565bd8deadSopenharmony_ci FLOAT_VEC4 vec4 SAMPLER_CUBE samplerCube 6575bd8deadSopenharmony_ci INT int SAMPLER_1D_SHADOW sampler1DShadow 6585bd8deadSopenharmony_ci INT_VEC2 ivec2 SAMPLER_2D_SHADOW sampler2DShadow 6595bd8deadSopenharmony_ci INT_VEC3 ivec3 SAMPLER_1D_ARRAY_EXT sampler1DArray 6605bd8deadSopenharmony_ci INT_VEC4 ivec4 SAMPLER_2D_ARRAY_EXT sampler2DArray 6615bd8deadSopenharmony_ci UNSIGNED_INT unsigned int SAMPLER_1D_ARRAY_SHADOW_EXT sampler1DArrayShadow 6625bd8deadSopenharmony_ci UNSIGNED_INT_VEC2_EXT uvec2 SAMPLER_2D_ARRAY_SHADOW_EXT sampler2DArrayShadow 6635bd8deadSopenharmony_ci UNSIGNED_INT_VEC3_EXT uvec3 SAMPLER_CUBE_SHADOW_EXT samplerCubeShadow 6645bd8deadSopenharmony_ci UNSIGNED_INT_VEC4_EXT uvec4 SAMPLER_2D_RECT_ARB sampler2DRect 6655bd8deadSopenharmony_ci BOOL bool SAMPLER_2D_RECT_SHADOW_ARB sampler2DRectShadow 6665bd8deadSopenharmony_ci BOOL_VEC2 bvec2 INT_SAMPLER_1D_EXT isampler1D 6675bd8deadSopenharmony_ci BOOL_VEC3 bvec3 INT_SAMPLER_2D_EXT isampler2D 6685bd8deadSopenharmony_ci BOOL_VEC4 bvec4 INT_SAMPLER_3D_EXT isampler3D 6695bd8deadSopenharmony_ci FLOAT_MAT2 mat2 INT_SAMPLER_CUBE_EXT isamplerCube 6705bd8deadSopenharmony_ci FLOAT_MAT3 mat3 INT_SAMPLER_1D_ARRAY_EXT isampler1DArray 6715bd8deadSopenharmony_ci FLOAT_MAT4 mat4 INT_SAMPLER_2D_ARRAY_EXT isampler2DArray 6725bd8deadSopenharmony_ci FLOAT_MAT2x3 mat2x3 UNSIGNED_INT_SAMPLER_1D_EXT usampler1D 6735bd8deadSopenharmony_ci FLOAT_MAT2x4 mat2x4 UNSIGNED_INT_SAMPLER_2D_EXT usampler2D 6745bd8deadSopenharmony_ci FLOAT_MAT3x2 mat3x2 UNSIGNED_INT_SAMPLER_3D_EXT usampler3D 6755bd8deadSopenharmony_ci FLOAT_MAT3x4 mat3x4 UNSIGNED_INT_SAMPLER_CUBE_EXT usamplerCube 6765bd8deadSopenharmony_ci FLOAT_MAT4x2 mat4x2 UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT usampler1DArray 6775bd8deadSopenharmony_ci FLOAT_MAT4x3 mat4x3 UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT usampler2DArray 6785bd8deadSopenharmony_ci SAMPLER_BUFFER_EXT samplerBuffer 6795bd8deadSopenharmony_ci INT_SAMPLER_BUFFER_EXT isamplerBuffer 6805bd8deadSopenharmony_ci UNSIGNED_INT_SAMPLER_BUFFER_EXT usamplerBuffer 6815bd8deadSopenharmony_ci INT_SAMPLER_2D_RECT_EXT isampler2DRect 6825bd8deadSopenharmony_ci UNSIGNED_INT_SAMPLER_2D_RECT_EXT usampler2DRect 6835bd8deadSopenharmony_ci ----------------------------------------------------------------------- 6845bd8deadSopenharmony_ci Table 2.utype: OpenGL Shading Language type tokens returned by 6855bd8deadSopenharmony_ci GetActiveUniform and GetActiveUniformsiv, and corresponding shading 6865bd8deadSopenharmony_ci language keywords declaring each such type. 6875bd8deadSopenharmony_ci 6885bd8deadSopenharmony_ci 6895bd8deadSopenharmony_ci For GetActiveUniformsiv, <uniformCount> indicates both the number of 6905bd8deadSopenharmony_ci elements in the array of indices <uniformIndices> and the number of 6915bd8deadSopenharmony_ci parameters written to <params> upon successful return. <pname> identifies 6925bd8deadSopenharmony_ci a property of each uniform in <uniformIndices> that should be written into 6935bd8deadSopenharmony_ci the corresponding element of <params>. If an error occurs, nothing will 6945bd8deadSopenharmony_ci be written to <params>. 6955bd8deadSopenharmony_ci 6965bd8deadSopenharmony_ci If <pname> is UNIFORM_TYPE, then an array identifying the types 6975bd8deadSopenharmony_ci of the uniforms specified by the corresponding array of 6985bd8deadSopenharmony_ci <uniformIndices> is returned. The returned types can be any of the 6995bd8deadSopenharmony_ci values in Table 2.utype. 7005bd8deadSopenharmony_ci 7015bd8deadSopenharmony_ci If <pname> is UNIFORM_SIZE, then an array identifying the size 7025bd8deadSopenharmony_ci of the uniforms specified by the corresponding array of 7035bd8deadSopenharmony_ci <uniformIndices> is returned. The sizes returned are in units of the type 7045bd8deadSopenharmony_ci returned by a query of UNIFORM_TYPE. For active uniforms that are 7055bd8deadSopenharmony_ci arrays, the size is the number of active elements in the array; for 7065bd8deadSopenharmony_ci all other uniforms, the size is one. 7075bd8deadSopenharmony_ci 7085bd8deadSopenharmony_ci If <pname> is UNIFORM_NAME_LENGTH, then an array identifying the 7095bd8deadSopenharmony_ci length, including the terminating null character, of the uniform 7105bd8deadSopenharmony_ci name strings specified by the corresponding array of 7115bd8deadSopenharmony_ci <uniformIndices> is returned. 7125bd8deadSopenharmony_ci 7135bd8deadSopenharmony_ci If <pname> is UNIFORM_BLOCK_INDEX, then an array identifying the 7145bd8deadSopenharmony_ci uniform block index of each of the uniforms specified by the 7155bd8deadSopenharmony_ci corresponding array of <uniformIndices> is returned. The index of a 7165bd8deadSopenharmony_ci uniform associated with the default uniform block is -1. 7175bd8deadSopenharmony_ci 7185bd8deadSopenharmony_ci If <pname> is UNIFORM_OFFSET, then an array of uniform buffer offsets 7195bd8deadSopenharmony_ci is returned. For uniforms in a named uniform block, the returned value 7205bd8deadSopenharmony_ci will be its offset, in basic machine units, relative to the beginning of 7215bd8deadSopenharmony_ci the uniform block in the buffer object data store. For uniforms in the 7225bd8deadSopenharmony_ci default uniform block, -1 will be returned. 7235bd8deadSopenharmony_ci 7245bd8deadSopenharmony_ci If <pname> is UNIFORM_ARRAY_STRIDE, then an array identifying 7255bd8deadSopenharmony_ci the stride between elements, in basic machine units, of each of the 7265bd8deadSopenharmony_ci uniforms specified by the corresponding array of <uniformIndices> is 7275bd8deadSopenharmony_ci returned. The stride of a uniform associated with the default 7285bd8deadSopenharmony_ci uniform block is -1. Note that this information only makes sense for 7295bd8deadSopenharmony_ci uniforms that are arrays. For uniforms that are not arrays, but are 7305bd8deadSopenharmony_ci declared in a named uniform block, an array stride of zero is 7315bd8deadSopenharmony_ci returned. 7325bd8deadSopenharmony_ci 7335bd8deadSopenharmony_ci If <pname> is UNIFORM_MATRIX_STRIDE, then an array identifying 7345bd8deadSopenharmony_ci the stride between columns of a column-major matrix or rows of a 7355bd8deadSopenharmony_ci row-major matrix, in basic machine units, of each of the uniforms 7365bd8deadSopenharmony_ci specified by the corresponding array of <uniformIndices> is 7375bd8deadSopenharmony_ci returned. The matrix stride of a uniform associated with the default 7385bd8deadSopenharmony_ci uniform block is -1. Note that this information only makes sense for 7395bd8deadSopenharmony_ci uniforms that are matrices. For uniforms that are not matrices, but 7405bd8deadSopenharmony_ci are declared in a named uniform block, a matrix stride of zero is 7415bd8deadSopenharmony_ci returned. 7425bd8deadSopenharmony_ci 7435bd8deadSopenharmony_ci If <pname> is UNIFORM_IS_ROW_MAJOR, then 7445bd8deadSopenharmony_ci an array identifying whether each of the uniforms 7455bd8deadSopenharmony_ci specified by the corresponding array of <uniformIndices> is a row-major 7465bd8deadSopenharmony_ci matrix or not is returned. A value of one indicates a row-major 7475bd8deadSopenharmony_ci matrix, and a value of zero indicates a column-major matrix, a matrix 7485bd8deadSopenharmony_ci in the default uniform block, or a non-matrix. 7495bd8deadSopenharmony_ci 7505bd8deadSopenharmony_ci Pg 81, replace Uniform* description with: 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci To load values into the uniform variables of the default uniform block of 7535bd8deadSopenharmony_ci the program object that is currently in use, use the commands 7545bd8deadSopenharmony_ci 7555bd8deadSopenharmony_ci ... 7565bd8deadSopenharmony_ci 7575bd8deadSopenharmony_ci The given values are loaded into the default uniform block uniform 7585bd8deadSopenharmony_ci variable location identified by <location>. 7595bd8deadSopenharmony_ci 7605bd8deadSopenharmony_ci Sub-section 2.15.3.1 - Uniform Blocks 7615bd8deadSopenharmony_ci 7625bd8deadSopenharmony_ci The values of uniforms arranged in named uniform blocks are extracted from 7635bd8deadSopenharmony_ci buffer object storage. The mechanisms for placing individual uniforms in 7645bd8deadSopenharmony_ci a buffer object and connecting a uniform block to an individual buffer 7655bd8deadSopenharmony_ci object are described below. 7665bd8deadSopenharmony_ci 7675bd8deadSopenharmony_ci There is a set of implementation-dependent maximums for the number of 7685bd8deadSopenharmony_ci active uniform blocks used by each shader (vertex, fragment, geometry). 7695bd8deadSopenharmony_ci If the number of uniform blocks used by any shader in the program exceeds 7705bd8deadSopenharmony_ci its corresponding limit, the program will fail to link. The limits for 7715bd8deadSopenharmony_ci vertex, fragment, and geometry shaders can be obtained by calling 7725bd8deadSopenharmony_ci GetIntegerv with <pname> values of MAX_VERTEX_UNIFORM_BLOCKS, 7735bd8deadSopenharmony_ci MAX_FRAGMENT_UNIFORM_BLOCKS, and MAX_GEOMETRY_UNIFORM_BLOCKS, 7745bd8deadSopenharmony_ci respectively. 7755bd8deadSopenharmony_ci 7765bd8deadSopenharmony_ci Additionally, there is an implementation-dependent limit on the sum of the 7775bd8deadSopenharmony_ci number of active uniform blocks used by each shader of a program. If a 7785bd8deadSopenharmony_ci uniform block is used by multiple shaders, each such use counts separately 7795bd8deadSopenharmony_ci against this combined limit. The combined uniform block use limit can be 7805bd8deadSopenharmony_ci obtained by calling GetIntegerv with a <pname> of 7815bd8deadSopenharmony_ci MAX_COMBINED_UNIFORM_BLOCKS. 7825bd8deadSopenharmony_ci 7835bd8deadSopenharmony_ci When a named uniform block is declared by multiple shaders in a program, 7845bd8deadSopenharmony_ci it must be declared identically in each shader. The uniforms within the 7855bd8deadSopenharmony_ci block must be declared with the same names and types, and in the same 7865bd8deadSopenharmony_ci order. If a program contains multiple shaders with different declarations 7875bd8deadSopenharmony_ci for the same named uniform block differs between shader, the program will 7885bd8deadSopenharmony_ci fail to link. 7895bd8deadSopenharmony_ci 7905bd8deadSopenharmony_ci Sub-section 2.15.3.1.1 - Uniform Buffer Object Storage 7915bd8deadSopenharmony_ci 7925bd8deadSopenharmony_ci When stored in buffer objects associated with uniform blocks, uniforms are 7935bd8deadSopenharmony_ci represented in memory as follows: 7945bd8deadSopenharmony_ci 7955bd8deadSopenharmony_ci - Members of type "bool" are extracted from a buffer object by reading a 7965bd8deadSopenharmony_ci single uint-typed value at the specified offset. All non-zero 7975bd8deadSopenharmony_ci values correspond to true, and zero corresponds to false. 7985bd8deadSopenharmony_ci 7995bd8deadSopenharmony_ci - Members of type "int" are extracted from a buffer object by reading a 8005bd8deadSopenharmony_ci single int-typed value at the specified offset. 8015bd8deadSopenharmony_ci 8025bd8deadSopenharmony_ci - Members of type "uint" are extracted from a buffer object by reading a 8035bd8deadSopenharmony_ci single uint-typed value at the specified offset. 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ci - Members of type "float" are extracted from a buffer object by reading a 8065bd8deadSopenharmony_ci single float-typed value at the specified offset. 8075bd8deadSopenharmony_ci 8085bd8deadSopenharmony_ci - Vectors with <N> elements with basic data types of "bool", "int", 8095bd8deadSopenharmony_ci "uint", or "float" are extracted as <N> values in consecutive memory 8105bd8deadSopenharmony_ci locations beginning at the specified offset, with components stored in 8115bd8deadSopenharmony_ci order with the first (X) component at the lowest offset. The GL data 8125bd8deadSopenharmony_ci type used for component extraction is derived according to the rules for 8135bd8deadSopenharmony_ci scalar members above. 8145bd8deadSopenharmony_ci 8155bd8deadSopenharmony_ci - Column-major matrices with <C> columns and <R> rows (using the type 8165bd8deadSopenharmony_ci "mat<C>x<R>", or simply "mat<C>" if <C>==<R>) are treated as an array of 8175bd8deadSopenharmony_ci <C> floating-point column vectors, each consisting of <R> components. 8185bd8deadSopenharmony_ci The column vectors will be stored in order, with column zero at the 8195bd8deadSopenharmony_ci lowest offset. The difference in offsets between consecutive columns of 8205bd8deadSopenharmony_ci the matrix will be referred to as the column stride, and is constant 8215bd8deadSopenharmony_ci across the matrix. The column stride, UNIFORM_MATRIX_STRIDE, is an 8225bd8deadSopenharmony_ci implementation-dependent value and may be queried after a program is 8235bd8deadSopenharmony_ci linked. 8245bd8deadSopenharmony_ci 8255bd8deadSopenharmony_ci - Row-major matrices with <C> columns and <R> rows (using the type 8265bd8deadSopenharmony_ci "mat<C>x<R>", or simply "mat<C>" if <C>==<R>) are treated as an array of 8275bd8deadSopenharmony_ci <R> floating-point row vectors, each consisting of <C> components. The 8285bd8deadSopenharmony_ci row vectors will be stored in order, with row zero at the lowest offset. 8295bd8deadSopenharmony_ci The difference in offsets between consecutive rows of the matrix will be 8305bd8deadSopenharmony_ci referred to as the row stride, and is constant across the matrix. The 8315bd8deadSopenharmony_ci row stride, UNIFORM_MATRIX_STRIDE, is an implementation-dependent 8325bd8deadSopenharmony_ci value and may be queried after a program is linked. 8335bd8deadSopenharmony_ci 8345bd8deadSopenharmony_ci - Arrays of scalars, vectors, and matrices are stored in memory by element 8355bd8deadSopenharmony_ci order, with array member zero at the lowest offset. The difference in 8365bd8deadSopenharmony_ci offsets between each pair of elements in the array in basic machine 8375bd8deadSopenharmony_ci units is referred to as the array stride, and is constant across the 8385bd8deadSopenharmony_ci entire array. The array stride, UNIFORM_ARRAY_STRIDE, is an 8395bd8deadSopenharmony_ci implementation-dependent value and may be queried after a program is 8405bd8deadSopenharmony_ci linked. 8415bd8deadSopenharmony_ci 8425bd8deadSopenharmony_ci Sub-section 2.15.3.1.2 - Standard Uniform Block Layout 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci By default, uniforms contained within a uniform block are extracted from 8455bd8deadSopenharmony_ci buffer storage in an implementation-dependent manner. Applications may 8465bd8deadSopenharmony_ci query the offsets assigned to uniforms inside uniform blocks with query 8475bd8deadSopenharmony_ci functions provided by the GL. 8485bd8deadSopenharmony_ci 8495bd8deadSopenharmony_ci The "layout" qualifier provides shaders with control of the layout of 8505bd8deadSopenharmony_ci uniforms within a uniform block. When the "std140" layout is specified, 8515bd8deadSopenharmony_ci the offset of each uniform in a uniform block can be derived from the 8525bd8deadSopenharmony_ci definition of the uniform block by applying the set of rules described 8535bd8deadSopenharmony_ci below. 8545bd8deadSopenharmony_ci 8555bd8deadSopenharmony_ci If a uniform block is declared in multiple shaders linked together into a 8565bd8deadSopenharmony_ci single program, the link will fail unless the uniform block declaration, 8575bd8deadSopenharmony_ci including layout qualifier, are identical in all such shaders. 8585bd8deadSopenharmony_ci 8595bd8deadSopenharmony_ci When using the "std140" storage layout, structures will be laid out in 8605bd8deadSopenharmony_ci buffer storage with its members stored in monotonically increasing order 8615bd8deadSopenharmony_ci based on their location in the declaration. A structure and each 8625bd8deadSopenharmony_ci structure member have a base offset and a base alignment, from which an 8635bd8deadSopenharmony_ci aligned offset is computed by rounding the base offset up to a multiple of 8645bd8deadSopenharmony_ci the base alignment. The base offset of the first member of a structure is 8655bd8deadSopenharmony_ci taken from the aligned offset of the structure itself. The base offset of 8665bd8deadSopenharmony_ci all other structure members is derived by taking the offset of the last 8675bd8deadSopenharmony_ci basic machine unit consumed by the previous member and adding one. Each 8685bd8deadSopenharmony_ci structure member is stored in memory at its aligned offset. The members 8695bd8deadSopenharmony_ci of a top-level uniform block are laid out in buffer storage by treating 8705bd8deadSopenharmony_ci the uniform block as a structure with a base offset of zero. 8715bd8deadSopenharmony_ci 8725bd8deadSopenharmony_ci (1) If the member is a scalar consuming <N> basic machine units, the 8735bd8deadSopenharmony_ci base alignment is <N>. 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ci (2) If the member is a two- or four-component vector with components 8765bd8deadSopenharmony_ci consuming <N> basic machine units, the base alignment is 2<N> or 8775bd8deadSopenharmony_ci 4<N>, respectively. 8785bd8deadSopenharmony_ci 8795bd8deadSopenharmony_ci (3) If the member is a three-component vector with components consuming 8805bd8deadSopenharmony_ci <N> basic machine units, the base alignment is 4<N>. 8815bd8deadSopenharmony_ci 8825bd8deadSopenharmony_ci (4) If the member is an array of scalars or vectors, the base alignment 8835bd8deadSopenharmony_ci and array stride are set to match the base alignment of a single 8845bd8deadSopenharmony_ci array element, according to rules (1), (2), and (3), and rounded up 8855bd8deadSopenharmony_ci to the base alignment of a vec4. The array may have padding at the 8865bd8deadSopenharmony_ci end; the base offset of the member following the array is rounded up 8875bd8deadSopenharmony_ci to the next multiple of the base alignment. 8885bd8deadSopenharmony_ci 8895bd8deadSopenharmony_ci (5) If the member is a column-major matrix with <C> columns and <R> 8905bd8deadSopenharmony_ci rows, the matrix is stored identically to an array of <C> column 8915bd8deadSopenharmony_ci vectors with <R> components each, according to rule (4). 8925bd8deadSopenharmony_ci 8935bd8deadSopenharmony_ci (6) If the member is an array of <S> column-major matrices with <C> 8945bd8deadSopenharmony_ci columns and <R> rows, the matrix is stored identically to a row of 8955bd8deadSopenharmony_ci <S>*<C> column vectors with <R> components each, according to rule 8965bd8deadSopenharmony_ci (4). 8975bd8deadSopenharmony_ci 8985bd8deadSopenharmony_ci (7) If the member is a row-major matrix with <C> columns and <R> rows, 8995bd8deadSopenharmony_ci the matrix is stored identically to an array of <R> row vectors 9005bd8deadSopenharmony_ci with <C> components each, according to rule (4). 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ci (8) If the member is an array of <S> row-major matrices with <C> columns 9035bd8deadSopenharmony_ci and <R> rows, the matrix is stored identically to a row of <S>*<R> 9045bd8deadSopenharmony_ci row vectors with <C> components each, according to rule (4). 9055bd8deadSopenharmony_ci 9065bd8deadSopenharmony_ci (9) If the member is a structure, the base alignment of the structure is 9075bd8deadSopenharmony_ci <N>, where <N> is the largest base alignment value of any of its 9085bd8deadSopenharmony_ci members, and rounded up to the base alignment of a vec4. The 9095bd8deadSopenharmony_ci individual members of this sub-structure are then assigned offsets 9105bd8deadSopenharmony_ci by applying this set of rules recursively, where the base offset of 9115bd8deadSopenharmony_ci the first member of the sub-structure is equal to the aligned offset 9125bd8deadSopenharmony_ci of the structure. The structure may have padding at the end; the 9135bd8deadSopenharmony_ci base offset of the member following the sub-structure is rounded up 9145bd8deadSopenharmony_ci to the next multiple of the base alignment of the structure. 9155bd8deadSopenharmony_ci 9165bd8deadSopenharmony_ci (10) If the member is an array of <S> structures, the <S> elements of 9175bd8deadSopenharmony_ci the array are laid out in order, according to rule (9). 9185bd8deadSopenharmony_ci 9195bd8deadSopenharmony_ci For uniform blocks laid out according to these rules, the minimum buffer 9205bd8deadSopenharmony_ci object size returned by the UNIFORM_BLOCK_DATA_SIZE query is derived by 9215bd8deadSopenharmony_ci taking the offset of the last basic machine unit consumed by the last 9225bd8deadSopenharmony_ci uniform of the uniform block (including any end-of-array or 9235bd8deadSopenharmony_ci end-of-structure padding), adding one, and rounding up to the next 9245bd8deadSopenharmony_ci multiple of the base alignment required for a vec4. 9255bd8deadSopenharmony_ci 9265bd8deadSopenharmony_ci Sub-section 2.15.3.2 - Uniform Buffer Object Bindings 9275bd8deadSopenharmony_ci 9285bd8deadSopenharmony_ci The value an active uniform inside a named uniform block is extracted from 9295bd8deadSopenharmony_ci the data store of a buffer object bound to one of an array of uniform 9305bd8deadSopenharmony_ci buffer binding points. The number of binding points can be queried using 9315bd8deadSopenharmony_ci GetIntegerv with the constant MAX_UNIFORM_BUFFER_BINDINGS. 9325bd8deadSopenharmony_ci 9335bd8deadSopenharmony_ci Buffer objects are bound to uniform block binding points by calling one of 9345bd8deadSopenharmony_ci the commands 9355bd8deadSopenharmony_ci 9365bd8deadSopenharmony_ci void BindBufferRange(enum target, 9375bd8deadSopenharmony_ci uint index, 9385bd8deadSopenharmony_ci uint buffer, 9395bd8deadSopenharmony_ci intptr offset, 9405bd8deadSopenharmony_ci sizeiptr size); 9415bd8deadSopenharmony_ci 9425bd8deadSopenharmony_ci void BindBufferBase(enum target, 9435bd8deadSopenharmony_ci uint index, 9445bd8deadSopenharmony_ci uint buffer); 9455bd8deadSopenharmony_ci 9465bd8deadSopenharmony_ci with <target> set to UNIFORM_BUFFER. There is an array of buffer 9475bd8deadSopenharmony_ci object binding points with which uniform blocks can be associated via 9485bd8deadSopenharmony_ci UniformBlockBinding, plus a single general binding point that can be 9495bd8deadSopenharmony_ci used by other buffer object manipulation functions (e.g. BindBuffer, 9505bd8deadSopenharmony_ci MapBuffer). Both commands bind the buffer object named by <buffer> to the 9515bd8deadSopenharmony_ci general binding point, and additionally bind the buffer object to the 9525bd8deadSopenharmony_ci binding point in the array given by <index>. The error INVALID_VALUE is 9535bd8deadSopenharmony_ci generated if <index> is greater than or equal to the value of 9545bd8deadSopenharmony_ci MAX_UNIFORM_BUFFER_BINDINGS. 9555bd8deadSopenharmony_ci 9565bd8deadSopenharmony_ci For BindBufferRange, <offset> specifies a starting offset into the 9575bd8deadSopenharmony_ci buffer object <buffer>, and <size> specifies the amount of data that can 9585bd8deadSopenharmony_ci be read from the buffer object while used as the storage for a uniform 9595bd8deadSopenharmony_ci block. Both <offset> and <size> are in basic machine units. An 9605bd8deadSopenharmony_ci INVALID_VALUE error is generated if <size> is less than or equal to zero 9615bd8deadSopenharmony_ci or if <offset> is not a multiple of the implementation-dependent 9625bd8deadSopenharmony_ci required alignment (the value of UNIFORM_BUFFER_OFFSET_ALIGNMENT). 9635bd8deadSopenharmony_ci 9645bd8deadSopenharmony_ci BindBufferBase binds the entire buffer, even when the size of the buffer 9655bd8deadSopenharmony_ci is changed after the binding is established. It is equivalent to calling 9665bd8deadSopenharmony_ci BindBufferRange with <offset> zero, while <size> is determined by the 9675bd8deadSopenharmony_ci size of the bound buffer at the time the binding is used. 9685bd8deadSopenharmony_ci 9695bd8deadSopenharmony_ci Regardless of the size specified with BindBufferRange, or indirectly 9705bd8deadSopenharmony_ci with BindBufferBase, the GL will never read or write beyond the end of a 9715bd8deadSopenharmony_ci bound buffer. This may result in visibly different behavior when a 9725bd8deadSopenharmony_ci buffer overflow would otherwise result. 9735bd8deadSopenharmony_ci 9745bd8deadSopenharmony_ci Each of a program's active uniform blocks has a corresponding uniform buffer 9755bd8deadSopenharmony_ci object binding point. This binding point can be assigned by calling: 9765bd8deadSopenharmony_ci 9775bd8deadSopenharmony_ci void UniformBlockBinding(uint program, 9785bd8deadSopenharmony_ci uint uniformBlockIndex, 9795bd8deadSopenharmony_ci uint uniformBlockBinding); 9805bd8deadSopenharmony_ci 9815bd8deadSopenharmony_ci <program> is a name of a program object for which the command LinkProgram 9825bd8deadSopenharmony_ci has been issued in the past. 9835bd8deadSopenharmony_ci 9845bd8deadSopenharmony_ci <uniformBlockIndex> must be an active uniform block index of the program 9855bd8deadSopenharmony_ci <program>. Otherwise, INVALID_VALUE is generated. 9865bd8deadSopenharmony_ci 9875bd8deadSopenharmony_ci <uniformBlockBinding> must be less than MAX_UNIFORM_BUFFER_BINDINGS. 9885bd8deadSopenharmony_ci Otherwise, INVALID_VALUE is generated. 9895bd8deadSopenharmony_ci 9905bd8deadSopenharmony_ci If successful, UniformBlockBinding specifies that 9915bd8deadSopenharmony_ci <program> will use the data store of the buffer object bound to the 9925bd8deadSopenharmony_ci binding point <uniformBlockBinding> to extract the values of the uniforms 9935bd8deadSopenharmony_ci in the uniform block identified by <uniformBlockIndex>. 9945bd8deadSopenharmony_ci 9955bd8deadSopenharmony_ci The results of Begin or commands that perform an implicit Begin are 9965bd8deadSopenharmony_ci undefined when an active uniform block of the active program is assigned a 9975bd8deadSopenharmony_ci uniform buffer binding point where the <size> parameter to BindBufferRange 9985bd8deadSopenharmony_ci is less than the value of UNIFORM_BLOCK_DATA_SIZE for that uniform 9995bd8deadSopenharmony_ci block, or when no buffer object is bound to that binding point, and may 10005bd8deadSopenharmony_ci result in GL interruption or termination. 10015bd8deadSopenharmony_ci 10025bd8deadSopenharmony_ci When executing shaders that access uniform blocks, the binding point 10035bd8deadSopenharmony_ci corresponding to each active uniform block must be populated with a buffer 10045bd8deadSopenharmony_ci object with a size no smaller than the minimum required size of the 10055bd8deadSopenharmony_ci uniform block (UNIFORM_BLOCK_DATA_SIZE). For binding points populated 10065bd8deadSopenharmony_ci by BindBufferRange, the size in question is the value of the <size> 10075bd8deadSopenharmony_ci parameter. If any active uniform block is not backed by a sufficiently 10085bd8deadSopenharmony_ci large buffer object, the results of shader execution are undefined, and 10095bd8deadSopenharmony_ci may result in GL interruption or termination. Shaders may be executed to 10105bd8deadSopenharmony_ci process the primitives and vertices specified between Begin and End commands 10115bd8deadSopenharmony_ci or by Draw* or MultiDraw* commands (see section 2.8). Shaders may also 10125bd8deadSopenharmony_ci be executed as a result of DrawPixels, Bitmap, or RasterPos* commands. 10135bd8deadSopenharmony_ci 10145bd8deadSopenharmony_ci When a program object is linked or re-linked, the uniform buffer object 10155bd8deadSopenharmony_ci binding point assigned to each of its active uniform blocks is reset to 10165bd8deadSopenharmony_ci zero. 10175bd8deadSopenharmony_ci 10185bd8deadSopenharmony_ciAdditions to Chapter 3 - Rasterization 10195bd8deadSopenharmony_ci 10205bd8deadSopenharmony_ci 3.11.1 Shader Variables, p. 196 10215bd8deadSopenharmony_ci Replace the second two sentences with: 10225bd8deadSopenharmony_ci 10235bd8deadSopenharmony_ci The amount of storage available for fragment shader uniform variables in 10245bd8deadSopenharmony_ci the default uniform block is specified by the value of the implementation- 10255bd8deadSopenharmony_ci dependent constant MAX_FRAGMENT_UNIFORM_COMPONENTS. The total amount of 10265bd8deadSopenharmony_ci combined storage available for fragment shader uniform variables in all 10275bd8deadSopenharmony_ci uniform blocks (including the default uniform block) is specified by the 10285bd8deadSopenharmony_ci value of the implementation-dependent constant 10295bd8deadSopenharmony_ci MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS. These values represent the 10305bd8deadSopenharmony_ci numbers of individual floating-point, integer, or boolean values that can be 10315bd8deadSopenharmony_ci held in uniform variable storage for a fragment shader. 10325bd8deadSopenharmony_ci 10335bd8deadSopenharmony_ciAdditions to Chapter 4 - Per-Fragment Operations and the Framebuffer 10345bd8deadSopenharmony_ci 10355bd8deadSopenharmony_ci None 10365bd8deadSopenharmony_ci 10375bd8deadSopenharmony_ciAdditions to Chapter 5 - State and State Requests 10385bd8deadSopenharmony_ci 10395bd8deadSopenharmony_ci 5.4 Display Lists, p. 244 10405bd8deadSopenharmony_ci Add the following language to the list of commands excluded from 10415bd8deadSopenharmony_ci display list compilation: 10425bd8deadSopenharmony_ci 10435bd8deadSopenharmony_ci "Buffer objects: BindBufferRange, BindBufferBase" 10445bd8deadSopenharmony_ci 10455bd8deadSopenharmony_ci 10465bd8deadSopenharmony_ciAdditions to Chapter 6 - State and State Requests 10475bd8deadSopenharmony_ci 10485bd8deadSopenharmony_ci 6.1.1 Simple Queries, p. 247 10495bd8deadSopenharmony_ci Add the following paragraph: 10505bd8deadSopenharmony_ci 10515bd8deadSopenharmony_ci Indexed simple state variables are queried with the command 10525bd8deadSopenharmony_ci 10535bd8deadSopenharmony_ci void GetIntegeri_v(enum target, uint index, int* data); 10545bd8deadSopenharmony_ci 10555bd8deadSopenharmony_ci <target> is the name of the indexed state and <index> is the 10565bd8deadSopenharmony_ci index of the particular element being queried. <data> is a 10575bd8deadSopenharmony_ci pointer to a scalar or array of the indicated type in which 10585bd8deadSopenharmony_ci to place the returned data. An INVALID_VALUE error is generated 10595bd8deadSopenharmony_ci if <index> is outside the valid range for the indexed state 10605bd8deadSopenharmony_ci <target>. 10615bd8deadSopenharmony_ci 10625bd8deadSopenharmony_ci 6.1.13 Buffer Object Queries, p. 260 10635bd8deadSopenharmony_ci 10645bd8deadSopenharmony_ci Add after description of GetBufferPointerv: 10655bd8deadSopenharmony_ci 10665bd8deadSopenharmony_ci To query which buffer objects are bound to the array of uniform 10675bd8deadSopenharmony_ci buffer binding points and will be used as the storage for 10685bd8deadSopenharmony_ci active uniform blocks, call GetIntegeri_v with <param> set to 10695bd8deadSopenharmony_ci UNIFORM_BUFFER_BINDING. <index> must be in the range 10705bd8deadSopenharmony_ci zero to the value of MAX_UNIFORM_BUFFER_BINDINGS - 1. 10715bd8deadSopenharmony_ci The name of the buffer object bound to <index> is returned in 10725bd8deadSopenharmony_ci <values>. If no buffer object is bound for <index>, zero is 10735bd8deadSopenharmony_ci returned in <values>. 10745bd8deadSopenharmony_ci 10755bd8deadSopenharmony_ci To query the starting offset or size of the range of each buffer object 10765bd8deadSopenharmony_ci binding used for uniform buffers, call GetIntegeri_v with <param> set to 10775bd8deadSopenharmony_ci UNIFORM_BUFFER_START or UNIFORM_BUFFER_SIZE respectively. <index> must 10785bd8deadSopenharmony_ci be in the range zero to the value of MAX_UNIFORM_BUFFER_BINDINGS - 1. If 10795bd8deadSopenharmony_ci the parameter (starting offset or size) was not specified when the 10805bd8deadSopenharmony_ci buffer object was bound (e.g. if bound with BindBufferBase), or if no 10815bd8deadSopenharmony_ci buffer object is bound to <index>, zero is returned. 10825bd8deadSopenharmony_ci 10835bd8deadSopenharmony_ci 6.1.14 Shader and Program Queries 10845bd8deadSopenharmony_ci Pg 261, continuation of paragraph defining "GetProgramiv" 10855bd8deadSopenharmony_ci 10865bd8deadSopenharmony_ci If <pname> is ACTIVE_UNIFORM_BLOCKS the number of uniform 10875bd8deadSopenharmony_ci blocks for <program> containing active uniforms is returned. 10885bd8deadSopenharmony_ci 10895bd8deadSopenharmony_ci If <pname> is ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, the 10905bd8deadSopenharmony_ci length of the longest active uniform block name, including 10915bd8deadSopenharmony_ci the null terminator, is returned. 10925bd8deadSopenharmony_ci 10935bd8deadSopenharmony_ci Pg 263, replace GetUniform{f|i}v description with: 10945bd8deadSopenharmony_ci 10955bd8deadSopenharmony_ci ... return the value or values of the uniform at location <location> 10965bd8deadSopenharmony_ci of the default uniform block for program object <program>... 10975bd8deadSopenharmony_ci 10985bd8deadSopenharmony_ciGLX Protocol 10995bd8deadSopenharmony_ci 11005bd8deadSopenharmony_ci GLX protocol for BindBufferRange, BindBufferBase and GetIntegeri_v 11015bd8deadSopenharmony_ci was added through NV_transform_feedback and EXT_draw_buffers2 11025bd8deadSopenharmony_ci protocol specs. 11035bd8deadSopenharmony_ci 11045bd8deadSopenharmony_ci The following rendering commands are sent to the server as part of 11055bd8deadSopenharmony_ci a glXRender request: 11065bd8deadSopenharmony_ci 11075bd8deadSopenharmony_ci UniformBlockBinding 11085bd8deadSopenharmony_ci 11095bd8deadSopenharmony_ci 2 16 rendering command length 11105bd8deadSopenharmony_ci 2 366 rendering command opcode 11115bd8deadSopenharmony_ci 4 CARD32 program 11125bd8deadSopenharmony_ci 4 CARD32 uniformBlockIndex 11135bd8deadSopenharmony_ci 4 CARD32 uniformBlockBinding 11145bd8deadSopenharmony_ci 11155bd8deadSopenharmony_ci The following non-rendering commands are added: 11165bd8deadSopenharmony_ci 11175bd8deadSopenharmony_ci GetUniformIndices 11185bd8deadSopenharmony_ci 11195bd8deadSopenharmony_ci 1 CARD8 opcode(X assigned) 11205bd8deadSopenharmony_ci 1 215 GLX opcode 11215bd8deadSopenharmony_ci 2 4+n+(s+p)/4 request length 11225bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 11235bd8deadSopenharmony_ci 4 CARD32 program 11245bd8deadSopenharmony_ci 4 CARD32 uniformCount 11255bd8deadSopenharmony_ci n LISTofINT32 lengths[n], n = uniformCount, lengths[i] = strlen(uniformNames[i]) + 1, 0 <= i < n. 11265bd8deadSopenharmony_ci s LISTofCHAR uniformNames, s = length[0]+...+length[n-1]. 11275bd8deadSopenharmony_ci array 11285bd8deadSopenharmony_ci p unused, p = pad(s) 11295bd8deadSopenharmony_ci => 11305bd8deadSopenharmony_ci 1 1 reply 11315bd8deadSopenharmony_ci 1 unused 11325bd8deadSopenharmony_ci 2 CARD16 sequence number 11335bd8deadSopenharmony_ci 4 n reply length 11345bd8deadSopenharmony_ci 4 unused 11355bd8deadSopenharmony_ci 4 CARD32 n (number of uniform Indices) 11365bd8deadSopenharmony_ci 11375bd8deadSopenharmony_ci if (n == 1) this follows: 11385bd8deadSopenharmony_ci 11395bd8deadSopenharmony_ci 4 CARD32 uniformIndices 11405bd8deadSopenharmony_ci 12 unused 11415bd8deadSopenharmony_ci 11425bd8deadSopenharmony_ci otherwise this follows: 11435bd8deadSopenharmony_ci 11445bd8deadSopenharmony_ci 16 unused 11455bd8deadSopenharmony_ci 4*n LISTofCARD32 uniformIndices 11465bd8deadSopenharmony_ci 11475bd8deadSopenharmony_ci GetActiveUniformsiv 11485bd8deadSopenharmony_ci 11495bd8deadSopenharmony_ci 1 CARD8 opcode(X assigned) 11505bd8deadSopenharmony_ci 1 216 GLX opcode 11515bd8deadSopenharmony_ci 2 5+n request length 11525bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 11535bd8deadSopenharmony_ci 4 CARD32 program 11545bd8deadSopenharmony_ci 4 INT32 uniformCount(n) 11555bd8deadSopenharmony_ci 4 ENUM pname 11565bd8deadSopenharmony_ci n LISTofCARD32 uniformIndices 11575bd8deadSopenharmony_ci 11585bd8deadSopenharmony_ci => 11595bd8deadSopenharmony_ci 1 1 reply 11605bd8deadSopenharmony_ci 1 unused 11615bd8deadSopenharmony_ci 2 CARD16 sequence number 11625bd8deadSopenharmony_ci 4 n reply length 11635bd8deadSopenharmony_ci 4 unused 11645bd8deadSopenharmony_ci 11655bd8deadSopenharmony_ci if (n == 1) this follows: 11665bd8deadSopenharmony_ci 11675bd8deadSopenharmony_ci 4 INT32 params 11685bd8deadSopenharmony_ci 12 unused 11695bd8deadSopenharmony_ci 11705bd8deadSopenharmony_ci otherwise this follows: 11715bd8deadSopenharmony_ci 11725bd8deadSopenharmony_ci 16 unused 11735bd8deadSopenharmony_ci 4*n LISTofINT32 params 11745bd8deadSopenharmony_ci 11755bd8deadSopenharmony_ci GetActiveUniformName 11765bd8deadSopenharmony_ci 11775bd8deadSopenharmony_ci 1 CARD8 opcode(X assigned) 11785bd8deadSopenharmony_ci 1 217 GLX opcode 11795bd8deadSopenharmony_ci 2 5 request length 11805bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 11815bd8deadSopenharmony_ci 4 CARD32 program 11825bd8deadSopenharmony_ci 4 CARD32 uniformIndex 11835bd8deadSopenharmony_ci 4 INT32 bufsize 11845bd8deadSopenharmony_ci => 11855bd8deadSopenharmony_ci 1 1 reply 11865bd8deadSopenharmony_ci 1 unused 11875bd8deadSopenharmony_ci 2 CARD16 sequence number 11885bd8deadSopenharmony_ci 4 m reply length, m = (n+p)/4 11895bd8deadSopenharmony_ci 4 unused 11905bd8deadSopenharmony_ci 4 INT32 n 11915bd8deadSopenharmony_ci 16 unused 11925bd8deadSopenharmony_ci n LISTofCHAR uniformName, n = strlen(uniformName)+1 11935bd8deadSopenharmony_ci p unused, p=pad(n) 11945bd8deadSopenharmony_ci 11955bd8deadSopenharmony_ci GetUniformBlockIndex 11965bd8deadSopenharmony_ci 11975bd8deadSopenharmony_ci 1 CARD8 opcode(X assigned) 11985bd8deadSopenharmony_ci 1 218 GLX opcode 11995bd8deadSopenharmony_ci 2 3+(n+p)/4 request length 12005bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 12015bd8deadSopenharmony_ci 4 CARD32 program 12025bd8deadSopenharmony_ci n LISTofCHAR uniformBlockName, n = strlen(uniformBlockName)+1 12035bd8deadSopenharmony_ci p unused, p=pad(n) 12045bd8deadSopenharmony_ci => 12055bd8deadSopenharmony_ci 1 1 reply 12065bd8deadSopenharmony_ci 1 unused 12075bd8deadSopenharmony_ci 2 CARD16 sequence number 12085bd8deadSopenharmony_ci 4 0 reply length 12095bd8deadSopenharmony_ci 4 CARD32 return value 12105bd8deadSopenharmony_ci 20 unused 12115bd8deadSopenharmony_ci 12125bd8deadSopenharmony_ci GetActiveUniformBlockiv 12135bd8deadSopenharmony_ci 12145bd8deadSopenharmony_ci 1 CARD8 opcode(X assigned) 12155bd8deadSopenharmony_ci 1 219 GLX opcode 12165bd8deadSopenharmony_ci 2 5 request length 12175bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 12185bd8deadSopenharmony_ci 4 CARD32 program 12195bd8deadSopenharmony_ci 4 CARD32 uniformBlockIndex 12205bd8deadSopenharmony_ci 4 ENUM pname 12215bd8deadSopenharmony_ci => 12225bd8deadSopenharmony_ci 1 1 reply 12235bd8deadSopenharmony_ci 1 unused 12245bd8deadSopenharmony_ci 2 CARD16 sequence number 12255bd8deadSopenharmony_ci 4 n reply length 12265bd8deadSopenharmony_ci 4 unused 12275bd8deadSopenharmony_ci 12285bd8deadSopenharmony_ci if (n == 1) this follows: 12295bd8deadSopenharmony_ci 12305bd8deadSopenharmony_ci 4 INT32 params 12315bd8deadSopenharmony_ci 12 unused 12325bd8deadSopenharmony_ci 12335bd8deadSopenharmony_ci otherwise this follows: 12345bd8deadSopenharmony_ci 12355bd8deadSopenharmony_ci 16 unused 12365bd8deadSopenharmony_ci 4*n LISTofINT32 params 12375bd8deadSopenharmony_ci 12385bd8deadSopenharmony_ci GetActiveUniformBlockName 12395bd8deadSopenharmony_ci 12405bd8deadSopenharmony_ci 1 CARD8 opcode(X assigned) 12415bd8deadSopenharmony_ci 1 220 GLX opcode 12425bd8deadSopenharmony_ci 2 5 request length 12435bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 12445bd8deadSopenharmony_ci 4 CARD32 program 12455bd8deadSopenharmony_ci 4 CARD32 uniformBlockIndex 12465bd8deadSopenharmony_ci 4 INT32 bufsize 12475bd8deadSopenharmony_ci => 12485bd8deadSopenharmony_ci 1 1 reply 12495bd8deadSopenharmony_ci 1 unused 12505bd8deadSopenharmony_ci 2 CARD16 sequence number 12515bd8deadSopenharmony_ci 4 m reply length, m = (n+p)/4 12525bd8deadSopenharmony_ci 4 unused 12535bd8deadSopenharmony_ci 4 INT32 n 12545bd8deadSopenharmony_ci 16 unused 12555bd8deadSopenharmony_ci n LISTofCHAR uniformBlockName, n = strlen(uniformBlockName)+1 12565bd8deadSopenharmony_ci p unused, p=pad(n) 12575bd8deadSopenharmony_ci 12585bd8deadSopenharmony_ciOpenGL Shading Language Spec v1.20.8 Updates 12595bd8deadSopenharmony_ci 12605bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 12615bd8deadSopenharmony_ci language features described in this extension: 12625bd8deadSopenharmony_ci 12635bd8deadSopenharmony_ci #extension GL_ARB_uniform_buffer_object : <behavior> 12645bd8deadSopenharmony_ci 12655bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 12665bd8deadSopenharmony_ci 12675bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL Shading 12685bd8deadSopenharmony_ci Language: 12695bd8deadSopenharmony_ci 12705bd8deadSopenharmony_ci #define GL_ARB_uniform_buffer_object 1 12715bd8deadSopenharmony_ci 12725bd8deadSopenharmony_ci Add two new sections: 12735bd8deadSopenharmony_ci 12745bd8deadSopenharmony_ci 4.3.5.1 Uniform Blocks 12755bd8deadSopenharmony_ci 12765bd8deadSopenharmony_ci Variable declarations at global scope can be grouped into a named block to 12775bd8deadSopenharmony_ci provide coarser granularity for manipulation, sharing, or backing than is 12785bd8deadSopenharmony_ci achievable with individual declarations. This is currently only allowed for 12795bd8deadSopenharmony_ci uniform variables grouped into uniform blocks. All other uses are reserved. 12805bd8deadSopenharmony_ci 12815bd8deadSopenharmony_ci The application backs a uniform block with a buffer. This allows application 12825bd8deadSopenharmony_ci access to a set of uniform variables through a single buffer. The 12835bd8deadSopenharmony_ci application will need to query the offsets of the variables within the 12845bd8deadSopenharmony_ci block or follow standard rules for block layout in order to know how to 12855bd8deadSopenharmony_ci layout the contents of a buffer used to back the block. 12865bd8deadSopenharmony_ci 12875bd8deadSopenharmony_ci A uniform block (rather than a uniform variable) is created by the uniform 12885bd8deadSopenharmony_ci keyword, followed by a block name, followed by an open curly brace ( { ) as 12895bd8deadSopenharmony_ci follows: 12905bd8deadSopenharmony_ci 12915bd8deadSopenharmony_ci uniform-block : 12925bd8deadSopenharmony_ci layout-qualifieropt uniform block-name { member-list } ; 12935bd8deadSopenharmony_ci 12945bd8deadSopenharmony_ci layout-qualifier : 12955bd8deadSopenharmony_ci layout ( layout-qualifier-id-list ) 12965bd8deadSopenharmony_ci 12975bd8deadSopenharmony_ci member-list : 12985bd8deadSopenharmony_ci member-declaration 12995bd8deadSopenharmony_ci member-declaration member-list 13005bd8deadSopenharmony_ci 13015bd8deadSopenharmony_ci member-declaration : 13025bd8deadSopenharmony_ci layout-qualifieropt uniformopt basic-type declarators ; 13035bd8deadSopenharmony_ci 13045bd8deadSopenharmony_ci Where declarators are the same as for other uniform variable declarations, 13055bd8deadSopenharmony_ci except initializers are not allowed. Layout qualifiers are defined in the 13065bd8deadSopenharmony_ci next section. 13075bd8deadSopenharmony_ci 13085bd8deadSopenharmony_ci For example, 13095bd8deadSopenharmony_ci 13105bd8deadSopenharmony_ci uniform Transform { 13115bd8deadSopenharmony_ci mat4 ModelViewMatrix; 13125bd8deadSopenharmony_ci mat4 ModelViewProjectionMatrix; 13135bd8deadSopenharmony_ci uniform mat3 NormalMatrix; // reuse of uniform is optional 13145bd8deadSopenharmony_ci float Deformation; 13155bd8deadSopenharmony_ci }; 13165bd8deadSopenharmony_ci 13175bd8deadSopenharmony_ci The above establishes a uniform block named "Transform" with four uniforms 13185bd8deadSopenharmony_ci grouped inside it. 13195bd8deadSopenharmony_ci 13205bd8deadSopenharmony_ci The names declared inside the block are accessed as if they were declared 13215bd8deadSopenharmony_ci outside the block. In no way does the shader ever access block members 13225bd8deadSopenharmony_ci through any use of block-name. 13235bd8deadSopenharmony_ci 13245bd8deadSopenharmony_ci Uniform block names and variable names declared within uniform blocks are 13255bd8deadSopenharmony_ci scoped at the program level. Matching block names from multiple compilation 13265bd8deadSopenharmony_ci units in the same program must match in terms of having the same number of 13275bd8deadSopenharmony_ci declarations with the same sequence of types and the same sequence of member 13285bd8deadSopenharmony_ci names, as well as having the same member-wise layout qualification (see next 13295bd8deadSopenharmony_ci section). Any mismatch will generate a link error. 13305bd8deadSopenharmony_ci 13315bd8deadSopenharmony_ci Sampler types are not allowed inside of uniform blocks. All other types, 13325bd8deadSopenharmony_ci arrays, and structures allowed for uniforms are allowed within a uniform 13335bd8deadSopenharmony_ci block. 13345bd8deadSopenharmony_ci 13355bd8deadSopenharmony_ci There is an implementation-dependent limit on the number of uniform blocks 13365bd8deadSopenharmony_ci that can be used per stage. If this limit is exceeded, it will cause a link 13375bd8deadSopenharmony_ci error. 13385bd8deadSopenharmony_ci 13395bd8deadSopenharmony_ci 4.3.5.2 Uniform Block Layout Qualifiers 13405bd8deadSopenharmony_ci 13415bd8deadSopenharmony_ci The layout-qualifier-id-list for uniform blocks is a comma separated list of 13425bd8deadSopenharmony_ci the following qualifiers: 13435bd8deadSopenharmony_ci 13445bd8deadSopenharmony_ci shared (default) 13455bd8deadSopenharmony_ci packed 13465bd8deadSopenharmony_ci std140 13475bd8deadSopenharmony_ci row_major 13485bd8deadSopenharmony_ci column_major (default) 13495bd8deadSopenharmony_ci 13505bd8deadSopenharmony_ci These qualifiers are identifiers, not keywords. None of these have any 13515bd8deadSopenharmony_ci semantic affect at all on the usage of the variables being declared; they 13525bd8deadSopenharmony_ci only describe how data is laid out in memory. For example, matrix semantics 13535bd8deadSopenharmony_ci are always column-based, as described in the rest of this specification, no 13545bd8deadSopenharmony_ci matter what layout qualifiers are being used. 13555bd8deadSopenharmony_ci 13565bd8deadSopenharmony_ci Uniform block layout qualifiers can be declared at global scope, on a single 13575bd8deadSopenharmony_ci uniform block, or on a single block member. 13585bd8deadSopenharmony_ci 13595bd8deadSopenharmony_ci At global scope, it is an error to use layout qualifiers to declare a 13605bd8deadSopenharmony_ci variable. Instead, at global scope, layout qualifiers apply just to the 13615bd8deadSopenharmony_ci keyword uniform and establish default qualification for subsequent blocks: 13625bd8deadSopenharmony_ci 13635bd8deadSopenharmony_ci layout-defaults : 13645bd8deadSopenharmony_ci layout-qualifier uniform ; 13655bd8deadSopenharmony_ci 13665bd8deadSopenharmony_ci When this is done, the previous default qualification is first inherited and 13675bd8deadSopenharmony_ci then overridden as per the override rules listed below for each qualifier 13685bd8deadSopenharmony_ci listed in the declaration. The result becomes the new default qualification 13695bd8deadSopenharmony_ci scoped to subsequent uniform block definitions. Layout defaults can only be 13705bd8deadSopenharmony_ci specified at global scope. 13715bd8deadSopenharmony_ci 13725bd8deadSopenharmony_ci The initial state of compilation is as if the following were declared: 13735bd8deadSopenharmony_ci 13745bd8deadSopenharmony_ci layout(shared, column_major) uniform; 13755bd8deadSopenharmony_ci 13765bd8deadSopenharmony_ci Explicitly declaring this in a shader will return defaults back to their 13775bd8deadSopenharmony_ci initial state. 13785bd8deadSopenharmony_ci 13795bd8deadSopenharmony_ci Uniform blocks can be declared with optional layout qualifiers, and so can 13805bd8deadSopenharmony_ci their individual member declarations. Such block layout qualification is 13815bd8deadSopenharmony_ci scoped only to the content of the block. As with global layout declarations, 13825bd8deadSopenharmony_ci block layout qualification first inherits from the current default 13835bd8deadSopenharmony_ci qualification and then overrides it. Similarly, individual member layout 13845bd8deadSopenharmony_ci qualification is scoped just to the member declaration, and inherits from 13855bd8deadSopenharmony_ci and overrides the block's qualification. 13865bd8deadSopenharmony_ci 13875bd8deadSopenharmony_ci The shared qualifier overrides only the std140 and packed qualifiers; other 13885bd8deadSopenharmony_ci qualifiers are inherited. The compiler/linker will ensure that multiple 13895bd8deadSopenharmony_ci programs and programmable stages containing this definition will share the 13905bd8deadSopenharmony_ci same memory layout for this block, as long as they also matched in their 13915bd8deadSopenharmony_ci row_major and/or column_major qualifications. This allows use of the same 13925bd8deadSopenharmony_ci buffer to back the same block definition across different programs. 13935bd8deadSopenharmony_ci 13945bd8deadSopenharmony_ci The packed qualifier overrides only std140 and shared; other qualifiers are 13955bd8deadSopenharmony_ci inherited. When packed is used, no shareable layout is guaranteed. The 13965bd8deadSopenharmony_ci compiler and linker can optimize memory use based on what variables actively 13975bd8deadSopenharmony_ci get used and on other criteria. Offsets must be queried, as there is no 13985bd8deadSopenharmony_ci other way of guaranteeing where (and which) variables reside within the 13995bd8deadSopenharmony_ci block. Attempts to share a packed uniform block across programs or stages 14005bd8deadSopenharmony_ci will generally fail. However, implementations may aid application management 14015bd8deadSopenharmony_ci of packed blocks by using canonical layouts for packed blocks. 14025bd8deadSopenharmony_ci 14035bd8deadSopenharmony_ci The std140 qualifier overrides only the packed and shared qualifiers; other 14045bd8deadSopenharmony_ci qualifiers are inherited. The layout is explicitly determined by this, as 14055bd8deadSopenharmony_ci described in the API specification section 2.15.3.1.2. Hence, as in shared 14065bd8deadSopenharmony_ci above, the resulting layout is shareable across programs. 14075bd8deadSopenharmony_ci 14085bd8deadSopenharmony_ci Layout qualifiers on member declarations cannot use the shared, packed, or 14095bd8deadSopenharmony_ci std140 qualifiers. These can only be used at global scope or on a block 14105bd8deadSopenharmony_ci declaration. 14115bd8deadSopenharmony_ci 14125bd8deadSopenharmony_ci The row_major qualifier overrides only the column_major qualifier; other 14135bd8deadSopenharmony_ci qualifiers are inherited. It only affects the layout of matrices. Elements 14145bd8deadSopenharmony_ci within a matrix row will be contiguous in memory. 14155bd8deadSopenharmony_ci 14165bd8deadSopenharmony_ci The column_major qualifier overrides only the row_major qualifier; other 14175bd8deadSopenharmony_ci qualifiers are inherited. It only affects the layout of matrices. Elements 14185bd8deadSopenharmony_ci within a matrix column will be contiguous in memory. 14195bd8deadSopenharmony_ci 14205bd8deadSopenharmony_ci When multiple arguments are listed in a layout declaration, the affect will 14215bd8deadSopenharmony_ci be the same as if they were declared one at a time, in order from left to 14225bd8deadSopenharmony_ci right, each in turn inheriting from and overriding the result from the 14235bd8deadSopenharmony_ci previous qualification. 14245bd8deadSopenharmony_ci 14255bd8deadSopenharmony_ci For example 14265bd8deadSopenharmony_ci 14275bd8deadSopenharmony_ci layout(row_major, column_major) 14285bd8deadSopenharmony_ci 14295bd8deadSopenharmony_ci results in the qualification being column_major. Other examples: 14305bd8deadSopenharmony_ci 14315bd8deadSopenharmony_ci layout(shared, row_major) uniform; // default is now shared & row_major 14325bd8deadSopenharmony_ci 14335bd8deadSopenharmony_ci layout(std140) uniform Transform { // layout of this block is std140 14345bd8deadSopenharmony_ci mat4 M1; // row_major 14355bd8deadSopenharmony_ci layout(column_major) mat4 M2; // column major 14365bd8deadSopenharmony_ci mat3 N1; // row_major 14375bd8deadSopenharmony_ci }; 14385bd8deadSopenharmony_ci 14395bd8deadSopenharmony_ci uniform T2 { // layout of this block is shared 14405bd8deadSopenharmony_ci ... 14415bd8deadSopenharmony_ci }; 14425bd8deadSopenharmony_ci 14435bd8deadSopenharmony_ci layout(column_major) uniform T3 { // shared and column_major 14445bd8deadSopenharmony_ci mat4 M3; // column_major 14455bd8deadSopenharmony_ci layout(row_major) mat4 m4; // row major 14465bd8deadSopenharmony_ci mat3 N2; // column_major 14475bd8deadSopenharmony_ci }; 14485bd8deadSopenharmony_ci 14495bd8deadSopenharmony_ciInteractions with OpenGL 3.0 14505bd8deadSopenharmony_ci 14515bd8deadSopenharmony_ci If OpenGL 3.0 is supported, the introduction of BindBufferBase and 14525bd8deadSopenharmony_ci BindBufferRange can be ignored, though the uniform buffer object 14535bd8deadSopenharmony_ci language herein will need to be merged with the transform feedback 14545bd8deadSopenharmony_ci language in GL 3.0. 14555bd8deadSopenharmony_ci 14565bd8deadSopenharmony_ci If OpenGL 3.0 is supported, the introduction of GetIntegeri_v 14575bd8deadSopenharmony_ci can be ignored. 14585bd8deadSopenharmony_ci 14595bd8deadSopenharmony_ci If OpenGL 3.0 is supported, change: 14605bd8deadSopenharmony_ci 14615bd8deadSopenharmony_ci "When a program is successfully linked, all active uniforms belonging to 14625bd8deadSopenharmony_ci the program object's default uniform block are initialized to zero (FALSE 14635bd8deadSopenharmony_ci for booleans). A successful link will also generate a location for each 14645bd8deadSopenharmony_ci active uniform in the default uniform block. The values of active uniforms 14655bd8deadSopenharmony_ci in the default uniform block can be changed using this location and the 14665bd8deadSopenharmony_ci appropriate Uniform* command (see below)." 14675bd8deadSopenharmony_ci 14685bd8deadSopenharmony_ci to 14695bd8deadSopenharmony_ci 14705bd8deadSopenharmony_ci "When a program is successfully linked, all active uniforms belonging to 14715bd8deadSopenharmony_ci the program object's default uniform block are initialized as defined by 14725bd8deadSopenharmony_ci the version of the OpenGL Shading Language used to compile the program. A 14735bd8deadSopenharmony_ci successful link will also generate a location for each active uniform in 14745bd8deadSopenharmony_ci the default uniform block. The values of active uniforms in the default 14755bd8deadSopenharmony_ci uniform block can be changed using this location and the appropriate 14765bd8deadSopenharmony_ci Uniform* command (see below)." 14775bd8deadSopenharmony_ci 14785bd8deadSopenharmony_ci If OpenGL 3.0 is supported, replace "Begin or commands that perform 14795bd8deadSopenharmony_ci an implicit Begin" with "Draw* commands." 14805bd8deadSopenharmony_ci 14815bd8deadSopenharmony_ci If OpenGL 3.0 is supported, UNIFORM_BUFFER is a valid target for 14825bd8deadSopenharmony_ci new buffer-related API, e.g. MapBufferRange. 14835bd8deadSopenharmony_ci 14845bd8deadSopenharmony_ciInteractions with EXT_gpu_shader4 14855bd8deadSopenharmony_ci 14865bd8deadSopenharmony_ci If EXT_gpu_shader4 is not supported, then all of the types in table 14875bd8deadSopenharmony_ci 2.utype with extension suffixes should be omitted. 14885bd8deadSopenharmony_ci 14895bd8deadSopenharmony_ciInteractions with ARB_texture_rectangle 14905bd8deadSopenharmony_ci 14915bd8deadSopenharmony_ci If ARB_texture_rectangle is not available, then all of the types in 14925bd8deadSopenharmony_ci table 2.utype with RECT in their names should be omitted. 14935bd8deadSopenharmony_ci 14945bd8deadSopenharmony_ciInteractions with EXT_texture_array 14955bd8deadSopenharmony_ci 14965bd8deadSopenharmony_ci If EXT_texture_array is not available, then all of the types in 14975bd8deadSopenharmony_ci table 2.utype with ARRAY in their names should be omitted. 14985bd8deadSopenharmony_ci 14995bd8deadSopenharmony_ciInteractions with EXT_texture_buffer_object 15005bd8deadSopenharmony_ci 15015bd8deadSopenharmony_ci If EXT_texture_buffer_object is not available, then all of the types 15025bd8deadSopenharmony_ci in table 2.utype with BUFFER in their names should be omitted. 15035bd8deadSopenharmony_ci 15045bd8deadSopenharmony_ciInteractions with EXT_texture_integer 15055bd8deadSopenharmony_ci 15065bd8deadSopenharmony_ci If EXT_texture_integer is not available, then all of the types in 15075bd8deadSopenharmony_ci table 2.utype with UNSIGNED_INT or INT_SAMPLER in their names should 15085bd8deadSopenharmony_ci be omitted. 15095bd8deadSopenharmony_ci 15105bd8deadSopenharmony_ciInteractions with ARB_geometry_shader4 15115bd8deadSopenharmony_ci 15125bd8deadSopenharmony_ci If ARB_geometry_shader4 is not supported, omit all mentions of the 15135bd8deadSopenharmony_ci geometry shader stage, including MAX_GEOMETRY_UNIFORM_BUFFERS 15145bd8deadSopenharmony_ci and UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER. The minimum 15155bd8deadSopenharmony_ci value of MAX_COMBINED_UNIFORM_BLOCKS and 15165bd8deadSopenharmony_ci MAX_UNIFORM_BUFFER_BINDINGS changes from 36 to 24. 15175bd8deadSopenharmony_ci 15185bd8deadSopenharmony_ci Language describing MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS can be found 15195bd8deadSopenharmony_ci in the ARB_geometry_shader4 specification. 15205bd8deadSopenharmony_ci 15215bd8deadSopenharmony_ciErrors 15225bd8deadSopenharmony_ci 15235bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by BindBufferRange and 15245bd8deadSopenharmony_ci BindBufferBase if <buffer> is not the name of a valid buffer object. 15255bd8deadSopenharmony_ci 15265bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetUniformIndices, 15275bd8deadSopenharmony_ci GetActiveUniformsiv, GetActiveUniformName, GetUniformBlockIndex, 15285bd8deadSopenharmony_ci GetActiveUniformBlockiv, GetActiveUniformBlockName, and 15295bd8deadSopenharmony_ci UniformBlockBinding if <program> is not a value generated by GL. 15305bd8deadSopenharmony_ci 15315bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetUniformIndices and 15325bd8deadSopenharmony_ci GetActiveUniformsiv if <uniformCount> is less than zero. 15335bd8deadSopenharmony_ci 15345bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetActiveUniformName and 15355bd8deadSopenharmony_ci GetActiveUniformBlockName if <bufSize> is less than zero. 15365bd8deadSopenharmony_ci 15375bd8deadSopenharmony_ci The error INVALID_VALUE is generated by BindBufferRange if <size> is less 15385bd8deadSopenharmony_ci than zero. 15395bd8deadSopenharmony_ci 15405bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetActiveUniformName if 15415bd8deadSopenharmony_ci <uniformIndex> is greater than or equal to ACTIVE_UNIFORMS. 15425bd8deadSopenharmony_ci 15435bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetActiveUniformsiv if any of 15445bd8deadSopenharmony_ci the indices in <uniformIndices> is greater than or equal to ACTIVE_UNIFORMS. 15455bd8deadSopenharmony_ci 15465bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetActiveUniformBlockiv, 15475bd8deadSopenharmony_ci GetActiveUniformBlockName, and UniformBlockBinding if 15485bd8deadSopenharmony_ci <uniformBlockIndex> is greater than or equal to ACTIVE_UNIFORM_BLOCKS. 15495bd8deadSopenharmony_ci 15505bd8deadSopenharmony_ci The error INVALID_VALUE is generated by UniformBlockBinding if 15515bd8deadSopenharmony_ci <uniformBlockBinding> is greater than or equal to 15525bd8deadSopenharmony_ci MAX_UNIFORM_BUFFER_BINDINGS. 15535bd8deadSopenharmony_ci 15545bd8deadSopenharmony_ci The error INVALID_VALUE is generated by BindBufferRange and BindBufferBase 15555bd8deadSopenharmony_ci if <index> is greater than or equal to MAX_UNIFORM_BUFFER_BINDINGS. 15565bd8deadSopenharmony_ci 15575bd8deadSopenharmony_ci The error INVALID_VALUE is generated by BindBufferRange if <offset> is not 15585bd8deadSopenharmony_ci a multiple of UNIFORM_BUFFER_OFFSET_ALIGNMENT basic machine units. 15595bd8deadSopenharmony_ci 15605bd8deadSopenharmony_ci The error INVALID_ENUM is generated by GetActiveUniformsiv and 15615bd8deadSopenharmony_ci GetActiveUniformBlockiv if <pname> is not one of the accepted values. 15625bd8deadSopenharmony_ci 15635bd8deadSopenharmony_ci The error INVALID_ENUM is generated by BindBufferRange and BindBufferBase 15645bd8deadSopenharmony_ci if <target> is not an accepted indexable buffer object target. 15655bd8deadSopenharmony_ci 15665bd8deadSopenharmony_ci 15675bd8deadSopenharmony_ciNew State 15685bd8deadSopenharmony_ci Initial 15695bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 15705bd8deadSopenharmony_ci -------------------------- ---- ----------- ----- ------------------------- ----- --------- 15715bd8deadSopenharmony_ci UNIFORM_BUFFER_BINDING Z+ GetIntegerv 0 Uniform buffer object 2.15.3 - 15725bd8deadSopenharmony_ci bound to the context for 15735bd8deadSopenharmony_ci buffer object manipulation. 15745bd8deadSopenharmony_ci 15755bd8deadSopenharmony_ci UNIFORM_BUFFER_BINDING nxZ+ GetIntegeri_v 0 Uniform buffer object 2.15.3 - 15765bd8deadSopenharmony_ci bound to the specified 15775bd8deadSopenharmony_ci context binding point 15785bd8deadSopenharmony_ci 15795bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCKS Z+ GetProgramiv 0 Number of active 2.15.3 - 15805bd8deadSopenharmony_ci uniform blocks in a 15815bd8deadSopenharmony_ci program 15825bd8deadSopenharmony_ci 15835bd8deadSopenharmony_ci ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 15845bd8deadSopenharmony_ci Z+ GetProgramiv 0 Length of longest active 2.15.3 - 15855bd8deadSopenharmony_ci uniform block name 15865bd8deadSopenharmony_ci 15875bd8deadSopenharmony_ci UNIFORM_TYPE 0*xZ_27 GetActiveUniformsiv - Type of active uniform 2.15.3 - 15885bd8deadSopenharmony_ci 15895bd8deadSopenharmony_ci UNIFORM_SIZE 0*xZ+ GetActiveUniformsiv - Size of active uniform 2.15.3 - 15905bd8deadSopenharmony_ci 15915bd8deadSopenharmony_ci UNIFORM_NAME_LENGTH 0*xZ+ GetActiveUniformsiv - Uniform name length 2.15.3 - 15925bd8deadSopenharmony_ci 15935bd8deadSopenharmony_ci UNIFORM_BLOCK_INDEX 0*xZ GetActiveUniformsiv - Uniform block index 2.15.3 - 15945bd8deadSopenharmony_ci 15955bd8deadSopenharmony_ci UNIFORM_OFFSET 0*xZ GetActiveUniformsiv - Uniform buffer offset 2.15.3 - 15965bd8deadSopenharmony_ci 15975bd8deadSopenharmony_ci UNIFORM_ARRAY_STRIDE 0*xZ GetActiveUniformsiv - Uniform buffer array 2.15.3 - 15985bd8deadSopenharmony_ci stride 15995bd8deadSopenharmony_ci 16005bd8deadSopenharmony_ci UNIFORM_MATRIX_STRIDE 0*xZ GetActiveUniformsiv - Uniform buffer intra- 2.15.3 - 16015bd8deadSopenharmony_ci matrix stride 16025bd8deadSopenharmony_ci 16035bd8deadSopenharmony_ci UNIFORM_IS_ROW_MAJOR 0*xZ+ GetActiveUniformsiv - Whether uniform is a 2.15.3 - 16045bd8deadSopenharmony_ci row-major matrix 16055bd8deadSopenharmony_ci 16065bd8deadSopenharmony_ci UNIFORM_BLOCK_BINDING 0*xZ+ GetActiveUniformBlockiv 0 Uniform buffer binding 2.15.3 - 16075bd8deadSopenharmony_ci points associated with the 16085bd8deadSopenharmony_ci specified uniform block 16095bd8deadSopenharmony_ci 16105bd8deadSopenharmony_ci 16115bd8deadSopenharmony_ci UNIFORM_BLOCK_DATA_SIZE 0*xZ+ GetActiveUniformBlockiv - Size of the storage 2.15.3 - 16125bd8deadSopenharmony_ci needed to hold this 16135bd8deadSopenharmony_ci uniform block's data 16145bd8deadSopenharmony_ci 16155bd8deadSopenharmony_ci 16165bd8deadSopenharmony_ci UNIFORM_BLOCK_ACTIVE_UNIFORMS 0*xZ+ GetActiveUniformBlockiv - Count of active 2.15.3 - 16175bd8deadSopenharmony_ci uniforms in 16185bd8deadSopenharmony_ci the specified 16195bd8deadSopenharmony_ci uniform block 16205bd8deadSopenharmony_ci 16215bd8deadSopenharmony_ci UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 16225bd8deadSopenharmony_ci 0*xnxZ+ GetActiveUniformBlockiv - Array of active 2.15.3 - 16235bd8deadSopenharmony_ci uniform indices of 16245bd8deadSopenharmony_ci the specified 16255bd8deadSopenharmony_ci uniform block 16265bd8deadSopenharmony_ci 16275bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 16285bd8deadSopenharmony_ci 0*xB GetActiveUniformBlockiv 0 TRUE if uniform block 2.15.3 - 16295bd8deadSopenharmony_ci is actively 16305bd8deadSopenharmony_ci referenced by the 16315bd8deadSopenharmony_ci vertex shader 16325bd8deadSopenharmony_ci 16335bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 16345bd8deadSopenharmony_ci 0*xB GetActiveUniformBlockiv 0 TRUE if uniform block 2.15.3 - 16355bd8deadSopenharmony_ci is actively 16365bd8deadSopenharmony_ci referenced by the 16375bd8deadSopenharmony_ci geometry shader 16385bd8deadSopenharmony_ci 16395bd8deadSopenharmony_ci UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 16405bd8deadSopenharmony_ci 0*xB GetActiveUniformBlockiv 0 TRUE if uniform block 2.15.3 - 16415bd8deadSopenharmony_ci is actively 16425bd8deadSopenharmony_ci referenced by the 16435bd8deadSopenharmony_ci fragment shader 16445bd8deadSopenharmony_ci 16455bd8deadSopenharmony_ciNew Implementation Dependent State 16465bd8deadSopenharmony_ci 16475bd8deadSopenharmony_ci Minimum 16485bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 16495bd8deadSopenharmony_ci -------------------------------- -- ----------- ----- ------------------------- ----- ---------- 16505bd8deadSopenharmony_ci MAX_VERTEX_UNIFORM_BLOCKS Z+ GetIntegerv 12 Maximum number of vertex 2.15.3 - 16515bd8deadSopenharmony_ci uniform buffers per 16525bd8deadSopenharmony_ci program 16535bd8deadSopenharmony_ci 16545bd8deadSopenharmony_ci MAX_FRAGMENT_UNIFORM_BLOCKS Z+ GetIntegerv 12 Maximum number of fragment 2.15.3 - 16555bd8deadSopenharmony_ci uniform buffers per 16565bd8deadSopenharmony_ci program 16575bd8deadSopenharmony_ci 16585bd8deadSopenharmony_ci MAX_GEOMETRY_UNIFORM_BLOCKS Z+ GetIntegerv 12 Maximum number of geometry 2.15.3 - 16595bd8deadSopenharmony_ci uniform buffers per 16605bd8deadSopenharmony_ci program 16615bd8deadSopenharmony_ci 16625bd8deadSopenharmony_ci MAX_COMBINED_UNIFORM_BLOCKS Z+ GetIntegerv 36 Maximum number of uniform 2.15.3 - 16635bd8deadSopenharmony_ci buffers per program 16645bd8deadSopenharmony_ci 16655bd8deadSopenharmony_ci MAX_UNIFORM_BUFFER_BINDINGS Z+ GetIntegerv 36 Maximum number of uniform 2.15.3 - 16665bd8deadSopenharmony_ci buffer binding points 16675bd8deadSopenharmony_ci on the context 16685bd8deadSopenharmony_ci 16695bd8deadSopenharmony_ci MAX_UNIFORM_BLOCK_SIZE Z+ GetIntegerv 16384 Max size in basic machine 2.15.3 - 16705bd8deadSopenharmony_ci units of a uniform block 16715bd8deadSopenharmony_ci 16725bd8deadSopenharmony_ci MAX_VERTEX_UNIFORM_COMPONENTS Z+ GetIntegerv * Number of words for vertex 2.15.3 - 16735bd8deadSopenharmony_ci shader uniform variables 16745bd8deadSopenharmony_ci in default uniform block 16755bd8deadSopenharmony_ci 16765bd8deadSopenharmony_ci MAX_FRAGMENT_UNIFORM_COMPONENTS Z+ GetIntegerv * Number of words for fragment 2.15.3 - 16775bd8deadSopenharmony_ci shader uniform variables 16785bd8deadSopenharmony_ci in default uniform block 16795bd8deadSopenharmony_ci 16805bd8deadSopenharmony_ci MAX_GEOMETRY_UNIFORM_COMPONENTS Z+ GetIntegerv * Number of words for geometry 2.15.3 - 16815bd8deadSopenharmony_ci shader uniform variables 16825bd8deadSopenharmony_ci in default uniform block 16835bd8deadSopenharmony_ci 16845bd8deadSopenharmony_ci MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS Z+ GetIntegerv * Number of words for vertex 2.15.3 - 16855bd8deadSopenharmony_ci shader uniform variables 16865bd8deadSopenharmony_ci in all uniform blocks 16875bd8deadSopenharmony_ci (including default) 16885bd8deadSopenharmony_ci 16895bd8deadSopenharmony_ci MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS Z+ GetIntegerv * Number of words for fragment 2.15.3 - 16905bd8deadSopenharmony_ci shader uniform variables 16915bd8deadSopenharmony_ci in all uniform blocks 16925bd8deadSopenharmony_ci (including default) 16935bd8deadSopenharmony_ci 16945bd8deadSopenharmony_ci MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS Z+ GetIntegerv * Number of words for geometry 2.15.3 - 16955bd8deadSopenharmony_ci shader uniform variables 16965bd8deadSopenharmony_ci in all uniform blocks 16975bd8deadSopenharmony_ci (including default) 16985bd8deadSopenharmony_ci 16995bd8deadSopenharmony_ci UNIFORM_BUFFER_OFFSET_ALIGNMENT Z+ GetIntegerv 1 Minimum required alignment 2.15.3 - 17005bd8deadSopenharmony_ci for uniform buffer sizes 17015bd8deadSopenharmony_ci and offsets 17025bd8deadSopenharmony_ci 17035bd8deadSopenharmony_ci * Minimum value for OpenGL 3.1 is (MAX_<stage>_UNIFORM_BLOCKS * 17045bd8deadSopenharmony_ci MAX_UNIFORM_BLOCK_SIZE) + MAX_<stage>_UNIFORM_COMPONENTS. Minimum 17055bd8deadSopenharmony_ci value prior to OpenGL 3.1 is MAX_<stage>_UNIFORM_COMPONENTS. 17065bd8deadSopenharmony_ci 17075bd8deadSopenharmony_ciSample Code 17085bd8deadSopenharmony_ci 17095bd8deadSopenharmony_ci //////////////////////////////////////////////////////////////////////////// 17105bd8deadSopenharmony_ci Example: Full code of a simple use case: updating a group of variables 17115bd8deadSopenharmony_ci in a real shader. 17125bd8deadSopenharmony_ci //////////////////////////////////////////////////////////////////////////// 17135bd8deadSopenharmony_ci 17145bd8deadSopenharmony_ci //Platform-specific includes go here 17155bd8deadSopenharmony_ci 17165bd8deadSopenharmony_ci #define glError() { \ 17175bd8deadSopenharmony_ci GLenum err = glGetError(); \ 17185bd8deadSopenharmony_ci while (err != GL_NO_ERROR) { \ 17195bd8deadSopenharmony_ci printf("glError: %s caught at %s:%u", \ 17205bd8deadSopenharmony_ci (char*)gluErrorString(err), __FILE__, __LINE__); \ 17215bd8deadSopenharmony_ci err = glGetError(); \ 17225bd8deadSopenharmony_ci exit(-1); \ 17235bd8deadSopenharmony_ci } \ 17245bd8deadSopenharmony_ci } 17255bd8deadSopenharmony_ci 17265bd8deadSopenharmony_ci // globals 17275bd8deadSopenharmony_ci int initialized = 0; 17285bd8deadSopenharmony_ci 17295bd8deadSopenharmony_ci int width=640; 17305bd8deadSopenharmony_ci int height=480; 17315bd8deadSopenharmony_ci 17325bd8deadSopenharmony_ci GLfloat wf,hf; 17335bd8deadSopenharmony_ci //uniform names 17345bd8deadSopenharmony_ci GLchar* names[] = 17355bd8deadSopenharmony_ci { 17365bd8deadSopenharmony_ci "SurfaceColor", 17375bd8deadSopenharmony_ci "WarmColor", 17385bd8deadSopenharmony_ci "CoolColor", 17395bd8deadSopenharmony_ci "DiffuseWarm", 17405bd8deadSopenharmony_ci "DiffuseCool" 17415bd8deadSopenharmony_ci }; 17425bd8deadSopenharmony_ci GLuint buffer_id, uniformBlockIndex, index, vshad_id, fshad_id, prog_id; 17435bd8deadSopenharmony_ci GLsizei uniformBlockSize; 17445bd8deadSopenharmony_ci GLint singleSize, offset; 17455bd8deadSopenharmony_ci 17465bd8deadSopenharmony_ci GLfloat colors[] = 17475bd8deadSopenharmony_ci { 17485bd8deadSopenharmony_ci 0.45,0.45,1,1, 17495bd8deadSopenharmony_ci 0.45,0.45,1,1, 17505bd8deadSopenharmony_ci 0.75,0.75,0.75,1, 17515bd8deadSopenharmony_ci 0.0,0.0,1.0,1, 17525bd8deadSopenharmony_ci 0.0,1.0,0.0,1, 17535bd8deadSopenharmony_ci }; 17545bd8deadSopenharmony_ci 17555bd8deadSopenharmony_ci void reshape(int w, int h) { 17565bd8deadSopenharmony_ci width = w; height = h; 17575bd8deadSopenharmony_ci wf = (GLfloat) width; 17585bd8deadSopenharmony_ci hf = (GLfloat) height; 17595bd8deadSopenharmony_ci glMatrixMode(GL_PROJECTION); 17605bd8deadSopenharmony_ci glLoadIdentity(); 17615bd8deadSopenharmony_ci gluPerspective(60.0, wf/hf, 0.1, 100.0); 17625bd8deadSopenharmony_ci } 17635bd8deadSopenharmony_ci 17645bd8deadSopenharmony_ci void init_opengl() 17655bd8deadSopenharmony_ci { 17665bd8deadSopenharmony_ci reshape(width, height); 17675bd8deadSopenharmony_ci //load_shader and link_program are utility functions omitted here 17685bd8deadSopenharmony_ci vshad_id = load_shader(GL_VERTEX_SHADER, "gooch.vs"); 17695bd8deadSopenharmony_ci fshad_id = load_shader(GL_FRAGMENT_SHADER, "gooch.fs"); 17705bd8deadSopenharmony_ci prog_id = glCreateProgram(); 17715bd8deadSopenharmony_ci glAttachShader(prog_id, vshad_id); 17725bd8deadSopenharmony_ci glAttachShader(prog_id, fshad_id); 17735bd8deadSopenharmony_ci link_program(prog_id); 17745bd8deadSopenharmony_ci 17755bd8deadSopenharmony_ci //Update the uniforms using ARB_uniform_buffer_object 17765bd8deadSopenharmony_ci glGenBuffers(1, &buffer_id); 17775bd8deadSopenharmony_ci 17785bd8deadSopenharmony_ci //There's only one uniform block here, the 'colors0' uniform block. 17795bd8deadSopenharmony_ci //It contains the color info for the gooch shader. 17805bd8deadSopenharmony_ci uniformBlockIndex = glGetUniformBlockIndex(prog_id, "colors0"); 17815bd8deadSopenharmony_ci 17825bd8deadSopenharmony_ci //We need to get the uniform block's size in order to back it with the 17835bd8deadSopenharmony_ci //appropriate buffer 17845bd8deadSopenharmony_ci glGetActiveUniformBlockiv(prog_id, uniformBlockIndex, 17855bd8deadSopenharmony_ci GL_UNIFORM_BLOCK_DATA_SIZE, 17865bd8deadSopenharmony_ci &uniformBlockSize); 17875bd8deadSopenharmony_ci glError(); 17885bd8deadSopenharmony_ci 17895bd8deadSopenharmony_ci //Create UBO. 17905bd8deadSopenharmony_ci glBindBuffer(GL_UNIFORM_BUFFER, buffer_id); 17915bd8deadSopenharmony_ci glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, 17925bd8deadSopenharmony_ci NULL, GL_DYNAMIC_DRAW); 17935bd8deadSopenharmony_ci 17945bd8deadSopenharmony_ci //Now we attach the buffer to UBO binding point 0... 17955bd8deadSopenharmony_ci glBindBufferBase(GL_UNIFORM_BUFFER, 0, buffer_id); 17965bd8deadSopenharmony_ci //And associate the uniform block to this binding point. 17975bd8deadSopenharmony_ci glUniformBlockBinding(prog_id, uniformBlockIndex, 0); 17985bd8deadSopenharmony_ci glError(); 17995bd8deadSopenharmony_ci 18005bd8deadSopenharmony_ci //To update a single uniform in a uniform block, we need to get its 18015bd8deadSopenharmony_ci //offset into the buffer. 18025bd8deadSopenharmony_ci glGetUniformIndices(prog_id, 1, &names[2], &index); 18035bd8deadSopenharmony_ci glGetActiveUniformsiv(prog_id, 1, &index, 18045bd8deadSopenharmony_ci GL_UNIFORM_OFFSET, &offset); 18055bd8deadSopenharmony_ci 18065bd8deadSopenharmony_ci glGetActiveUniformsiv(prog_id, 1, &index, 18075bd8deadSopenharmony_ci GL_UNIFORM_SIZE, &singleSize); 18085bd8deadSopenharmony_ci glError(); 18095bd8deadSopenharmony_ci 18105bd8deadSopenharmony_ci glViewport(0, 0, width, height); 18115bd8deadSopenharmony_ci } 18125bd8deadSopenharmony_ci 18135bd8deadSopenharmony_ci void render() 18145bd8deadSopenharmony_ci { 18155bd8deadSopenharmony_ci glClearColor(0.0, 0.0, 0.0, 0.0); 18165bd8deadSopenharmony_ci glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); 18175bd8deadSopenharmony_ci 18185bd8deadSopenharmony_ci glUseProgram(prog_id); 18195bd8deadSopenharmony_ci 18205bd8deadSopenharmony_ci glEnable(GL_DEPTH_TEST); 18215bd8deadSopenharmony_ci glMatrixMode(GL_MODELVIEW); 18225bd8deadSopenharmony_ci glLoadIdentity(); 18235bd8deadSopenharmony_ci glTranslatef(0, 0, -4); 18245bd8deadSopenharmony_ci glColor3f(1.0, 1.0, 1.0); 18255bd8deadSopenharmony_ci glBindBuffer(GL_UNIFORM_BUFFER, buffer_id); 18265bd8deadSopenharmony_ci //We can use BufferData to upload our data to the shader, 18275bd8deadSopenharmony_ci //since we know it's in the std140 layout 18285bd8deadSopenharmony_ci glBufferData(GL_UNIFORM_BUFFER, 80, colors, GL_DYNAMIC_DRAW); 18295bd8deadSopenharmony_ci //With a non-standard layout, we'd use BufferSubData for each uniform. 18305bd8deadSopenharmony_ci glBufferSubData(GL_UNIFORM_BUFFER, offset, singleSize, &colors[8]); 18315bd8deadSopenharmony_ci //the teapot winds backwards 18325bd8deadSopenharmony_ci glFrontFace(GL_CW); 18335bd8deadSopenharmony_ci glutSolidTeapot(1.33); 18345bd8deadSopenharmony_ci glFrontFace(GL_CCW); 18355bd8deadSopenharmony_ci glutSwapBuffers(); 18365bd8deadSopenharmony_ci } 18375bd8deadSopenharmony_ci 18385bd8deadSopenharmony_ci void display() 18395bd8deadSopenharmony_ci { 18405bd8deadSopenharmony_ci if(!initialized) 18415bd8deadSopenharmony_ci { 18425bd8deadSopenharmony_ci init_opengl(); 18435bd8deadSopenharmony_ci initialized = 1; 18445bd8deadSopenharmony_ci } 18455bd8deadSopenharmony_ci 18465bd8deadSopenharmony_ci render(); 18475bd8deadSopenharmony_ci } 18485bd8deadSopenharmony_ci 18495bd8deadSopenharmony_ci int main (int argc, const char** argv) { 18505bd8deadSopenharmony_ci //GLUT initialization goes here 18515bd8deadSopenharmony_ci } 18525bd8deadSopenharmony_ci 18535bd8deadSopenharmony_ci // Vertex shader for Gooch shading 18545bd8deadSopenharmony_ci // Author: Randi Rost 18555bd8deadSopenharmony_ci // Copyright (c) 2002-2006 3Dlabs Inc. Ltd. 18565bd8deadSopenharmony_ci // See 3Dlabs-License.txt for license information 18575bd8deadSopenharmony_ci 18585bd8deadSopenharmony_ci vec3 LightPosition = vec3(0.0, 10.0, 4.0); 18595bd8deadSopenharmony_ci 18605bd8deadSopenharmony_ci varying float NdotL; 18615bd8deadSopenharmony_ci varying vec3 ReflectVec; 18625bd8deadSopenharmony_ci varying vec3 ViewVec; 18635bd8deadSopenharmony_ci 18645bd8deadSopenharmony_ci void main(void) 18655bd8deadSopenharmony_ci { 18665bd8deadSopenharmony_ci vec3 ecPos = vec3 (gl_ModelViewMatrix * gl_Vertex); 18675bd8deadSopenharmony_ci vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal); 18685bd8deadSopenharmony_ci vec3 lightVec = normalize(LightPosition - ecPos); 18695bd8deadSopenharmony_ci ReflectVec = normalize(reflect(-lightVec, tnorm)); 18705bd8deadSopenharmony_ci ViewVec = normalize(-ecPos); 18715bd8deadSopenharmony_ci NdotL = (dot(lightVec, tnorm) + 1.0) * 0.5; 18725bd8deadSopenharmony_ci gl_Position = ftransform(); 18735bd8deadSopenharmony_ci } 18745bd8deadSopenharmony_ci 18755bd8deadSopenharmony_ci // Fragment shader for Gooch shading, adapted for ARB_uniform_buffer_object 18765bd8deadSopenharmony_ci 18775bd8deadSopenharmony_ci #extension GL_ARB_uniform_buffer_object : enable 18785bd8deadSopenharmony_ci 18795bd8deadSopenharmony_ci layout(std140) uniform colors0 18805bd8deadSopenharmony_ci { 18815bd8deadSopenharmony_ci float DiffuseCool; 18825bd8deadSopenharmony_ci float DiffuseWarm; 18835bd8deadSopenharmony_ci vec3 SurfaceColor; 18845bd8deadSopenharmony_ci vec3 WarmColor; 18855bd8deadSopenharmony_ci vec3 CoolColor; 18865bd8deadSopenharmony_ci }; 18875bd8deadSopenharmony_ci 18885bd8deadSopenharmony_ci varying float NdotL; 18895bd8deadSopenharmony_ci varying vec3 ReflectVec; 18905bd8deadSopenharmony_ci varying vec3 ViewVec; 18915bd8deadSopenharmony_ci 18925bd8deadSopenharmony_ci void main (void) 18935bd8deadSopenharmony_ci { 18945bd8deadSopenharmony_ci vec3 kcool = min(CoolColor + DiffuseCool * SurfaceColor, 1.0); 18955bd8deadSopenharmony_ci vec3 kwarm = min(WarmColor + DiffuseWarm * SurfaceColor, 1.0); 18965bd8deadSopenharmony_ci vec3 kfinal = mix(kcool, kwarm, NdotL); 18975bd8deadSopenharmony_ci 18985bd8deadSopenharmony_ci vec3 nreflect = normalize(ReflectVec); 18995bd8deadSopenharmony_ci vec3 nview = normalize(ViewVec); 19005bd8deadSopenharmony_ci 19015bd8deadSopenharmony_ci float spec = max(dot(nreflect, nview), 0.0); 19025bd8deadSopenharmony_ci spec = pow(spec, 32.0); 19035bd8deadSopenharmony_ci 19045bd8deadSopenharmony_ci gl_FragColor = vec4 (min(kfinal + spec, 1.0), 1.0); 19055bd8deadSopenharmony_ci } 19065bd8deadSopenharmony_ci 19075bd8deadSopenharmony_ciExamples 19085bd8deadSopenharmony_ci 19095bd8deadSopenharmony_ci The following example illustrates the rules specified by the "std140" 19105bd8deadSopenharmony_ci layout. 19115bd8deadSopenharmony_ci 19125bd8deadSopenharmony_ci layout(std140) uniform Example { 19135bd8deadSopenharmony_ci 19145bd8deadSopenharmony_ci // Base types below consume 4 basic machine units 19155bd8deadSopenharmony_ci // 19165bd8deadSopenharmony_ci // base base align 19175bd8deadSopenharmony_ci // rule align off. off. bytes used 19185bd8deadSopenharmony_ci // ---- ------ ---- ---- ----------------------- 19195bd8deadSopenharmony_ci float a; // 1 4 0 0 0..3 19205bd8deadSopenharmony_ci vec2 b; // 2 8 4 8 8..15 19215bd8deadSopenharmony_ci vec3 c; // 3 16 16 16 16..27 19225bd8deadSopenharmony_ci struct { // 9 16 28 32 (align begin) 19235bd8deadSopenharmony_ci int d; // 1 4 32 32 32..35 19245bd8deadSopenharmony_ci bvec2 e; // 2 8 36 40 40..47 19255bd8deadSopenharmony_ci } f; // 9 16 48 48 (pad end) 19265bd8deadSopenharmony_ci float g; // 1 4 48 48 48..51 19275bd8deadSopenharmony_ci float h[2]; // 4 16 52 64 64..67 (h[0]) 19285bd8deadSopenharmony_ci // 80 80..83 (h[1]) 19295bd8deadSopenharmony_ci // 4 16 84 96 (pad end of h) 19305bd8deadSopenharmony_ci mat2x3 i; // 5/4 16 96 96 96..107 (i, column 0) 19315bd8deadSopenharmony_ci // 112 112..123 (i, column 1) 19325bd8deadSopenharmony_ci // 5/4 16 124 128 (pad end of i) 19335bd8deadSopenharmony_ci struct { // 10 16 128 128 (align begin) 19345bd8deadSopenharmony_ci uvec3 j; // 3 16 128 128 128..139 (o[0].j) 19355bd8deadSopenharmony_ci vec2 k; // 2 8 140 144 144..151 (o[0].k) 19365bd8deadSopenharmony_ci float l[2]; // 4 16 152 160 160..163 (o[0].l[0]) 19375bd8deadSopenharmony_ci // 176 176..179 (o[0].l[1]) 19385bd8deadSopenharmony_ci // 4 16 180 192 (pad end of o[0].l) 19395bd8deadSopenharmony_ci vec2 m; // 2 8 192 192 192..199 (o[0].m) 19405bd8deadSopenharmony_ci mat3 n[2]; // 6/4 16 200 208 208..219 (o[0].n[0], column 0) 19415bd8deadSopenharmony_ci // 224 224..235 (o[0].n[0], column 1) 19425bd8deadSopenharmony_ci // 240 240..251 (o[0].n[0], column 2) 19435bd8deadSopenharmony_ci // 256 256..267 (o[0].n[1], column 0) 19445bd8deadSopenharmony_ci // 272 272..283 (o[0].n[1], column 1) 19455bd8deadSopenharmony_ci // 288 288..299 (o[0].n[1], column 2) 19465bd8deadSopenharmony_ci // 6/4 16 300 304 (pad end of o[0].n) 19475bd8deadSopenharmony_ci // 9 16 304 304 (pad end of o[0]) 19485bd8deadSopenharmony_ci // 3 16 304 304 304..315 (o[1].j) 19495bd8deadSopenharmony_ci // 2 8 316 320 320..327 (o[1].k) 19505bd8deadSopenharmony_ci // 4 16 328 336 336..347 (o[1].l[0]) 19515bd8deadSopenharmony_ci // 352 352..355 (o[1].l[1]) 19525bd8deadSopenharmony_ci // 4 16 356 368 (pad end of o[1].l) 19535bd8deadSopenharmony_ci // 2 8 368 368 368..375 (o[1].m) 19545bd8deadSopenharmony_ci // 6/4 16 376 384 384..395 (o[1].n[0], column 0) 19555bd8deadSopenharmony_ci // 400 400..411 (o[1].n[0], column 1) 19565bd8deadSopenharmony_ci // 416 416..427 (o[1].n[0], column 2) 19575bd8deadSopenharmony_ci // 432 432..443 (o[1].n[1], column 0) 19585bd8deadSopenharmony_ci // 448 448..459 (o[1].n[1], column 1) 19595bd8deadSopenharmony_ci // 464 464..475 (o[1].n[1], column 2) 19605bd8deadSopenharmony_ci // 6/4 16 476 480 (pad end of o[1].n) 19615bd8deadSopenharmony_ci // 9 16 480 480 (pad end of o[1]) 19625bd8deadSopenharmony_ci } o[2]; 19635bd8deadSopenharmony_ci }; 19645bd8deadSopenharmony_ci 19655bd8deadSopenharmony_ci 19665bd8deadSopenharmony_ciIssues 19675bd8deadSopenharmony_ci 19685bd8deadSopenharmony_ci (1) How are offsets to elements in a uniform buffer correlated to 19695bd8deadSopenharmony_ci uniform locations? 19705bd8deadSopenharmony_ci 19715bd8deadSopenharmony_ci Resolved: Traditional uniform locations were used in the glUniform 19725bd8deadSopenharmony_ci API to access the private uniform storage. This API does not allow 19735bd8deadSopenharmony_ci the use of glUniform to update uniforms stored in uniform blocks. 19745bd8deadSopenharmony_ci Instead it uses the various means to update buffer objects, and 19755bd8deadSopenharmony_ci exposes the byte offsets of the uniforms in the buffer object. So, 19765bd8deadSopenharmony_ci in short, uniform locations and uniform offsets are similar concepts 19775bd8deadSopenharmony_ci but unrelated. 19785bd8deadSopenharmony_ci 19795bd8deadSopenharmony_ci (2) Should uniforms declared bindable be excluded from a uniform 19805bd8deadSopenharmony_ci buffer? 19815bd8deadSopenharmony_ci 19825bd8deadSopenharmony_ci Resolved: No, however, if a bindable uniform is declared inside 19835bd8deadSopenharmony_ci a named uniform uniform block, the bindable declaration and all 19845bd8deadSopenharmony_ci associated behavior of the bindable uniform extension will be 19855bd8deadSopenharmony_ci superceded by the mechanisms defined in this extension to obtain 19865bd8deadSopenharmony_ci information about the location of uniforms and to update the values 19875bd8deadSopenharmony_ci of those uniforms. 19885bd8deadSopenharmony_ci 19895bd8deadSopenharmony_ci In other words, if the bindable modifier is used on a uniform declared 19905bd8deadSopenharmony_ci within a named uniform block, it will be ignored. 19915bd8deadSopenharmony_ci 19925bd8deadSopenharmony_ci (3) Are there restrictions on the data types or the order in which uniforms 19935bd8deadSopenharmony_ci are declared that are to be included as part of the uniform buffer? 19945bd8deadSopenharmony_ci 19955bd8deadSopenharmony_ci Resolved: The only restriction is that sampler uniforms can not be 19965bd8deadSopenharmony_ci stored in a uniform buffer object. All other uniform types can be 19975bd8deadSopenharmony_ci stored in a uniform block. 19985bd8deadSopenharmony_ci 19995bd8deadSopenharmony_ci (4) Should a uniform buffer be split into multiple uniform buffers 20005bd8deadSopenharmony_ci on a per data type basis to simplify the buffer offset interface ? 20015bd8deadSopenharmony_ci 20025bd8deadSopenharmony_ci Resolved: No. This violates the intended "generic data store" 20035bd8deadSopenharmony_ci convention of buffer objects. Users of this extension are free 20045bd8deadSopenharmony_ci to group their uniform definitions on a per data-type basis in 20055bd8deadSopenharmony_ci this manner and, indeed, it may, on some implementations, result 20065bd8deadSopenharmony_ci in a more efficient uniform update model. 20075bd8deadSopenharmony_ci 20085bd8deadSopenharmony_ci (5) Should uniform buffers be scoped per shader (program 20095bd8deadSopenharmony_ci stage) rather than per program (as in GLSL) ? 20105bd8deadSopenharmony_ci 20115bd8deadSopenharmony_ci Resolved: No, this extension does not change the per-program 20125bd8deadSopenharmony_ci scope of uniforms. Uniforms in a uniform block, like traditional 20135bd8deadSopenharmony_ci GLSL uniforms, are global to a program object. 20145bd8deadSopenharmony_ci 20155bd8deadSopenharmony_ci It's tricky because allowing uniforms to have per-stage scope 20165bd8deadSopenharmony_ci exposes both a feature and the possibility for an application 20175bd8deadSopenharmony_ci programming error. 20185bd8deadSopenharmony_ci 20195bd8deadSopenharmony_ci feature: an application that wants to use a uniform "foo" in two 20205bd8deadSopenharmony_ci stages and wants uniform "foo" has different layouts 20215bd8deadSopenharmony_ci and/or values in each stage (or possibly simply does not 20225bd8deadSopenharmony_ci care if they do) 20235bd8deadSopenharmony_ci vs. 20245bd8deadSopenharmony_ci 20255bd8deadSopenharmony_ci error: an application that wants to use a uniform "foo" in two 20265bd8deadSopenharmony_ci stages and does not want them to have different values, but 20275bd8deadSopenharmony_ci *accidentally* defines "foo" in each stage differently or 20285bd8deadSopenharmony_ci binds different uniform buffers to each stage. 20295bd8deadSopenharmony_ci 20305bd8deadSopenharmony_ci Rather than enable this feature (and simultaneously add possibility 20315bd8deadSopenharmony_ci for error) in this extension, we defer the choice to a future 20325bd8deadSopenharmony_ci extension. 20335bd8deadSopenharmony_ci 20345bd8deadSopenharmony_ci Note however, some of the motivation for a per-stage scope for 20355bd8deadSopenharmony_ci uniform names comes from a broader desire to augment the GLSL API 20365bd8deadSopenharmony_ci with a set of per-stage program objects that do not need to be 20375bd8deadSopenharmony_ci linked at all. This is possibly a valuable addition to the GL API, 20385bd8deadSopenharmony_ci but is left to be defined by an additional extension. Such a future 20395bd8deadSopenharmony_ci extension could, if desired, add syntax to the GLSL to allow any 20405bd8deadSopenharmony_ci uniform (uniform block or default) to be defined with "per-stage" scope 20415bd8deadSopenharmony_ci in a more comprehensive way. 20425bd8deadSopenharmony_ci 20435bd8deadSopenharmony_ci 20445bd8deadSopenharmony_ci (6) Should AttachUniformBuffer take a <program> argument? 20455bd8deadSopenharmony_ci 20465bd8deadSopenharmony_ci This issue is moot. Earlier versions of this extension included 20475bd8deadSopenharmony_ci the additional ability to attach a uniform buffer object directly 20485bd8deadSopenharmony_ci to a progam's uniform blocks instead of going through the per-context 20495bd8deadSopenharmony_ci uniform buffer binding points. 20505bd8deadSopenharmony_ci 20515bd8deadSopenharmony_ci This feature has been deferred, possibly to be added in a future 20525bd8deadSopenharmony_ci extension. 20535bd8deadSopenharmony_ci 20545bd8deadSopenharmony_ci If this routine were to be added and does not take a program 20555bd8deadSopenharmony_ci argument, then it should work on the currently bound program 20565bd8deadSopenharmony_ci object, and its name should be changed to 20575bd8deadSopenharmony_ci ProgramUniformBuffer, to conform to precedent set by 20585bd8deadSopenharmony_ci FramebufferTexture, et. all. 20595bd8deadSopenharmony_ci 20605bd8deadSopenharmony_ci Alternately, if AttachUniformBuffer requires a program 20615bd8deadSopenharmony_ci argument, it would be for consistency with existing C API to 20625bd8deadSopenharmony_ci GLSL (i.e., those that attach shaders to program objects and 20635bd8deadSopenharmony_ci query program objects for information). 20645bd8deadSopenharmony_ci 20655bd8deadSopenharmony_ci RESOLUTION: RESOLVED, moot. 20665bd8deadSopenharmony_ci 20675bd8deadSopenharmony_ci 20685bd8deadSopenharmony_ci (7) Should uniforms in a uniform block be identified by location or 20695bd8deadSopenharmony_ci string? 20705bd8deadSopenharmony_ci 20715bd8deadSopenharmony_ci Resolved: By string and also by index (but not location). Name 20725bd8deadSopenharmony_ci strings will be used to identify uniforms much as they are 20735bd8deadSopenharmony_ci today. Uniform indices were available before for referring to 20745bd8deadSopenharmony_ci uniforms because they provide a more efficient update mechanism 20755bd8deadSopenharmony_ci to specify uniforms. Uniform block indices have been used in 20765bd8deadSopenharmony_ci this extension for the same reason. 20775bd8deadSopenharmony_ci 20785bd8deadSopenharmony_ci The location API not used by this extension and is only relevant for 20795bd8deadSopenharmony_ci the glUniform* API. 20805bd8deadSopenharmony_ci 20815bd8deadSopenharmony_ci RESOLUTION: RESOLVED, moot. 20825bd8deadSopenharmony_ci 20835bd8deadSopenharmony_ci 20845bd8deadSopenharmony_ci (8) What is the order of operations under which a uniform buffer 20855bd8deadSopenharmony_ci association is made with a program (or shader)? 20865bd8deadSopenharmony_ci 20875bd8deadSopenharmony_ci It is known that at very least, that the uniform buffer 20885bd8deadSopenharmony_ci offsets and strides will be known at link time. Does the 20895bd8deadSopenharmony_ci uniform buffer need to be attached to the program prior to linking in 20905bd8deadSopenharmony_ci order to keep these offsets constant or can a uniform buffer be 20915bd8deadSopenharmony_ci bound to a program at any time post-link effectively acting as 20925bd8deadSopenharmony_ci substitute storage for the uniform data? 20935bd8deadSopenharmony_ci 20945bd8deadSopenharmony_ci RESOLVED: Uniform buffer objects are bound to the context's 20955bd8deadSopenharmony_ci uniform buffer binding points, and this can happen at any time. 20965bd8deadSopenharmony_ci However, the association of a program's uniform block to the context's 20975bd8deadSopenharmony_ci uniform buffer binding points can only happen after linking because only 20985bd8deadSopenharmony_ci then are uniform block indices known. 20995bd8deadSopenharmony_ci 21005bd8deadSopenharmony_ci 21015bd8deadSopenharmony_ci (9) Can the existing Uniform API be used to update values in a 21025bd8deadSopenharmony_ci uniform buffer? 21035bd8deadSopenharmony_ci 21045bd8deadSopenharmony_ci Resolved: No. The Uniform* API won't update values in a uniform buffer, 21055bd8deadSopenharmony_ci which is reinforced by the fact that uniform block uniforms do not have 21065bd8deadSopenharmony_ci a location. 21075bd8deadSopenharmony_ci 21085bd8deadSopenharmony_ci 21095bd8deadSopenharmony_ci (10) When is the size of a uniform block's storage known? 21105bd8deadSopenharmony_ci 21115bd8deadSopenharmony_ci Resolved: Only after linking. 21125bd8deadSopenharmony_ci 21135bd8deadSopenharmony_ci Once a program is linked, the storage needed for a given uniform 21145bd8deadSopenharmony_ci block can be determined by querying for 21155bd8deadSopenharmony_ci UNIFORM_BLOCK_DATA_SIZE. 21165bd8deadSopenharmony_ci 21175bd8deadSopenharmony_ci If a uniform block needs more storage than the buffer object 21185bd8deadSopenharmony_ci bound to the associated uniform buffer binding point can provide, 21195bd8deadSopenharmony_ci results are undefined. This is no different than fetching off the end 21205bd8deadSopenharmony_ci of an array. 21215bd8deadSopenharmony_ci 21225bd8deadSopenharmony_ci 21235bd8deadSopenharmony_ci (11) Is it an error to call AttachUniformBuffer prior to 21245bd8deadSopenharmony_ci linking the program designated by <program>? 21255bd8deadSopenharmony_ci 21265bd8deadSopenharmony_ci Resolved. This issue is moot because the 21275bd8deadSopenharmony_ci AttachUniformBuffer was removed/deferred to a future 21285bd8deadSopenharmony_ci extension. 21295bd8deadSopenharmony_ci 21305bd8deadSopenharmony_ci But if this API were added, then yes. INVALID_VALUE is generated 21315bd8deadSopenharmony_ci if AttachUniformBuffer is used to attach a buffer to an 21325bd8deadSopenharmony_ci invalid uniform block index. Prior to linking, there are no 21335bd8deadSopenharmony_ci uniform block indices. 21345bd8deadSopenharmony_ci 21355bd8deadSopenharmony_ci 21365bd8deadSopenharmony_ci (12) Some hardware does not support some of the GLSL data types 21375bd8deadSopenharmony_ci natively (bools or ints perhaps). What limitations do we have in 21385bd8deadSopenharmony_ci exposing the raw uniform data storage via the buffer object API ? 21395bd8deadSopenharmony_ci 21405bd8deadSopenharmony_ci Resolved: None, but note that some implementations without 21415bd8deadSopenharmony_ci native support for these data types may have to copy the data 21425bd8deadSopenharmony_ci in these data types into some more native data types. 21435bd8deadSopenharmony_ci 21445bd8deadSopenharmony_ci Also, queries are provided to expose the layout of the buffer 21455bd8deadSopenharmony_ci objects to allow the buffers to be packed properly. 21465bd8deadSopenharmony_ci 21475bd8deadSopenharmony_ci 21485bd8deadSopenharmony_ci (13) Are there expected limitations for dead uniform elimination 21495bd8deadSopenharmony_ci using this extension? 21505bd8deadSopenharmony_ci 21515bd8deadSopenharmony_ci Resolved: yes. 21525bd8deadSopenharmony_ci 21535bd8deadSopenharmony_ci For starters, when using the "std140" layout, an implementation 21545bd8deadSopenharmony_ci may not alter the storage layout in any way. This limitation 21555bd8deadSopenharmony_ci includes dead uniform elimination. The standard layout must 21565bd8deadSopenharmony_ci remain unchanged because an application will depend on it 21575bd8deadSopenharmony_ci rather than querying for uniform offsets/strides. 21585bd8deadSopenharmony_ci 21595bd8deadSopenharmony_ci When using the "shared" layout, dead uniform elimination is again 21605bd8deadSopenharmony_ci excluded because different uniforms could be eliminated based on 21615bd8deadSopenharmony_ci different shaders' uniform usage. In order to preserve shareability 21625bd8deadSopenharmony_ci of the uniform blocks, the full contingent of uniforms must remain. 21635bd8deadSopenharmony_ci 21645bd8deadSopenharmony_ci For the "packed" layout, an implementation may take the liberty of 21655bd8deadSopenharmony_ci eliminating uniforms and uniform blocks that are not used by the paired 21665bd8deadSopenharmony_ci shaders. Here, limitations exist only for arrays. Dead elements may be 21675bd8deadSopenharmony_ci stripped from the end of an array that is never dynamically 21685bd8deadSopenharmony_ci dereferenced. An application must query UNIFORM_SIZE before 21695bd8deadSopenharmony_ci loading array data into the uniform buffer to ensure that trailing 21705bd8deadSopenharmony_ci elements exist. 21715bd8deadSopenharmony_ci 21725bd8deadSopenharmony_ci Issue (24) deals with stripping leading elements from an array, and 21735bd8deadSopenharmony_ci issue (25) deals with stripping arbitrary elements from an array, 21745bd8deadSopenharmony_ci both of which are currently disallowed. 21755bd8deadSopenharmony_ci 21765bd8deadSopenharmony_ci Note that the default uniform block always exists even if it is empty. 21775bd8deadSopenharmony_ci 21785bd8deadSopenharmony_ci 21795bd8deadSopenharmony_ci (14) Is it necessary to provide array uniform element offsets into 21805bd8deadSopenharmony_ci a uniform buffer object? If so, this suggests string parsing 21815bd8deadSopenharmony_ci of things such as "myuniform[12]". If not, this assumes array 21825bd8deadSopenharmony_ci strides be guaranteed based on array data type for all hw platforms? 21835bd8deadSopenharmony_ci 21845bd8deadSopenharmony_ci Resolved: No. The stride is provided explictly by querying 21855bd8deadSopenharmony_ci UNIFORM_ARRAY_STRIDE with GetActiveUniformsiv. 21865bd8deadSopenharmony_ci 21875bd8deadSopenharmony_ci 21885bd8deadSopenharmony_ci (15) How are the values from static initializer values propagated 21895bd8deadSopenharmony_ci to a buffer object once it is attached? 21905bd8deadSopenharmony_ci 21915bd8deadSopenharmony_ci Resolved: Static initialization values declared in a shader mapped 21925bd8deadSopenharmony_ci to a uniform buffer are disallowed by the grammar and must be 21935bd8deadSopenharmony_ci established through writes to the uniform buffer. 21945bd8deadSopenharmony_ci 21955bd8deadSopenharmony_ci 21965bd8deadSopenharmony_ci (16) Is GetUniformBlockIndex needed? This information can be 21975bd8deadSopenharmony_ci obtained (in reverse mapping) from GetActiveUniformBlock. 21985bd8deadSopenharmony_ci 21995bd8deadSopenharmony_ci Resolved: Yes. GetUniformBlockIndex allows the uniform 22005bd8deadSopenharmony_ci block database to be queried in the most natural manner: step 1) 22015bd8deadSopenharmony_ci do the expensive conversion from a uniform block name to a 22025bd8deadSopenharmony_ci uniform block index, step 2) use the uniform block index to 22035bd8deadSopenharmony_ci obtain all other uniform block data, which is a simple array 22045bd8deadSopenharmony_ci dereference, not a search. 22055bd8deadSopenharmony_ci 22065bd8deadSopenharmony_ci 22075bd8deadSopenharmony_ci (17) is GetUniformIndex needed? This information can be obtained (in 22085bd8deadSopenharmony_ci reverse mapping) from GetActiveUniform. 22095bd8deadSopenharmony_ci 22105bd8deadSopenharmony_ci Resolved: Yes. See issue (16). 22115bd8deadSopenharmony_ci 22125bd8deadSopenharmony_ci 22135bd8deadSopenharmony_ci (18) Should we add a separate function GetActiveUniformBlockBufferSize 22145bd8deadSopenharmony_ci instead of using GetActiveUniformBlock to return everything. 22155bd8deadSopenharmony_ci 22165bd8deadSopenharmony_ci Resolved: No. This issue became moot when the more general function 22175bd8deadSopenharmony_ci GetActiveUniformBlockiv was added. 22185bd8deadSopenharmony_ci 22195bd8deadSopenharmony_ci 22205bd8deadSopenharmony_ci (19) Should we provide a mechanism for iterating over the uniforms in a 22215bd8deadSopenharmony_ci particular uniform block? 22225bd8deadSopenharmony_ci 22235bd8deadSopenharmony_ci Resolved: Yes. This is provided by querying 22245bd8deadSopenharmony_ci UNIFORM_BLOCK_ACTIVE_UNIFORMS with GetActiveUniformBlockiv. 22255bd8deadSopenharmony_ci 22265bd8deadSopenharmony_ci 22275bd8deadSopenharmony_ci (20) Should we provide a means for the application to query the desired 22285bd8deadSopenharmony_ci storage format for integers, booleans, and matrices, or should we specify 22295bd8deadSopenharmony_ci a format and force non-conforming implementations to do a conversion? 22305bd8deadSopenharmony_ci 22315bd8deadSopenharmony_ci RESOLUTION: No queries will be introduced. Implementations that cannot 22325bd8deadSopenharmony_ci handle the prescribed storage formats must convert as necessary. 22335bd8deadSopenharmony_ci 22345bd8deadSopenharmony_ci See also issue (48) 22355bd8deadSopenharmony_ci 22365bd8deadSopenharmony_ci 22375bd8deadSopenharmony_ci (21) Should we delete the integer and boolean storage types in favor of 22385bd8deadSopenharmony_ci implementation repacking of the data when the hardware doesn't support it? 22395bd8deadSopenharmony_ci 22405bd8deadSopenharmony_ci RESOLUTION: RESOLVED, no. 22415bd8deadSopenharmony_ci 22425bd8deadSopenharmony_ci Hardware that doesn't support the types must repack the uniform data 22435bd8deadSopenharmony_ci if needed. This is true for all layout options. 22445bd8deadSopenharmony_ci 22455bd8deadSopenharmony_ci 22465bd8deadSopenharmony_ci (22) How does the program notice new changes to the uniform buffer object? 22475bd8deadSopenharmony_ci 22485bd8deadSopenharmony_ci Should we add a new "UpdateUniforms()" call or use 22495bd8deadSopenharmony_ci AttachUniformBuffer(), or UseProgram() to realize changes. 22505bd8deadSopenharmony_ci 22515bd8deadSopenharmony_ci RESOLUTION: Following the "standard" way in which object changes are 22525bd8deadSopenharmony_ci noticed, the buffer object in question must be re-bound or 22535bd8deadSopenharmony_ci re-attached if the changes to the buffer object come from another 22545bd8deadSopenharmony_ci context. 22555bd8deadSopenharmony_ci 22565bd8deadSopenharmony_ci If the changes come from this context, then the intent is to 22575bd8deadSopenharmony_ci follow the general object model decision here that governs how 22585bd8deadSopenharmony_ci child/container object state changes are made. 22595bd8deadSopenharmony_ci 22605bd8deadSopenharmony_ci [Currently, this means that changes by this context will be 22615bd8deadSopenharmony_ci noticed at next draw time, at the latest]. 22625bd8deadSopenharmony_ci 22635bd8deadSopenharmony_ci 22645bd8deadSopenharmony_ci (23) The naming convention choosen for GetActiveUniformsiv and 22655bd8deadSopenharmony_ci GetActivePartitionsiv is not a simple matter. 22665bd8deadSopenharmony_ci 22675bd8deadSopenharmony_ci First, considering that the list of uniforms passed into these 22685bd8deadSopenharmony_ci routines must be active uniform indices, and is an error if not, 22695bd8deadSopenharmony_ci suggests that the name "Active" in these function calls is 22705bd8deadSopenharmony_ci redundant. GLSL established a precedent of using "Active" in 22715bd8deadSopenharmony_ci the names of functions that require their uniform parameters to 22725bd8deadSopenharmony_ci consist solely of active uniforms. For these routines, it is an 22735bd8deadSopenharmony_ci error to include an inactive uniform as one of their input 22745bd8deadSopenharmony_ci parameters. Consistency with this GLSL precedent is the reason 22755bd8deadSopenharmony_ci we've choosen to include "Active" in these routine names. 22765bd8deadSopenharmony_ci 22775bd8deadSopenharmony_ci Second, note that GetActiveUniformsiv does not "get active 22785bd8deadSopenharmony_ci uniforms" and GetActiveUniformBlocksiv does not "get active 22795bd8deadSopenharmony_ci uniform blocks". There is a compelling argument therefore that 22805bd8deadSopenharmony_ci these names are counterintuitive. In reality, these routines 22815bd8deadSopenharmony_ci return parameters of active uniforms and active uniform blocks 22825bd8deadSopenharmony_ci rather than the uniforms or uniform blocks themselves. Again, 22835bd8deadSopenharmony_ci looking back at GLSL precedent note the conventions used for 22845bd8deadSopenharmony_ci both GetProgramiv and GetShaderiv. Both of these routines have 22855bd8deadSopenharmony_ci a <pname> argument and both of these routines are in fact 22865bd8deadSopenharmony_ci returning parameters of programs and shaders respectively 22875bd8deadSopenharmony_ci however "Parameters" was not included in the name. 22885bd8deadSopenharmony_ci 22895bd8deadSopenharmony_ci Further challenging this second point are two other 22905bd8deadSopenharmony_ci considerations. First, the GL spec prior to GLSL does in fact 22915bd8deadSopenharmony_ci use "Parameters" in the name of functions that match this 22925bd8deadSopenharmony_ci pattern. Second, this spec itself includes the name of the 22935bd8deadSopenharmony_ci output parameter in the name (specifically calls to get Indices 22945bd8deadSopenharmony_ci and Names). 22955bd8deadSopenharmony_ci 22965bd8deadSopenharmony_ci In the end, because this specification has to work within the 22975bd8deadSopenharmony_ci GLSL framework, it was decided that this precendent should 22985bd8deadSopenharmony_ci prevail over all others. Therefore, these routines will not 22995bd8deadSopenharmony_ci include "Parameters" in their names. 23005bd8deadSopenharmony_ci 23015bd8deadSopenharmony_ci Resolved: See above. 23025bd8deadSopenharmony_ci 23035bd8deadSopenharmony_ci 23045bd8deadSopenharmony_ci (24) Do we need to be able to query UNIFORM_START to get the index of 23055bd8deadSopenharmony_ci the first active element of an array? 23065bd8deadSopenharmony_ci 23075bd8deadSopenharmony_ci An application must query UNIFORM_SIZE to find the extent of an 23085bd8deadSopenharmony_ci array at runtime because the GLSL compiler may have eliminated elements 23095bd8deadSopenharmony_ci from the end of a static array during dead code elimination. If the 23105bd8deadSopenharmony_ci application is not required to similarly query UNIFORM_START, the 23115bd8deadSopenharmony_ci compiler must be prevented from eliminating elements from the start of 23125bd8deadSopenharmony_ci an array. 23135bd8deadSopenharmony_ci 23145bd8deadSopenharmony_ci For example, if an application declares "uniform float myFloat[10];" and 23155bd8deadSopenharmony_ci accesses only the single element myFloat[7] in the shader text, the 23165bd8deadSopenharmony_ci compiler may eliminate elements 8-9 only. Querying UNIFORM_SIZE 23175bd8deadSopenharmony_ci will give 8, and UNIFORM_OFFSET will give the offset of element 0. 23185bd8deadSopenharmony_ci 23195bd8deadSopenharmony_ci If we add UNIFORM_START, in this example, querying 23205bd8deadSopenharmony_ci UNIFORM_SIZE will give 1, UNIFORM_START will give 7, and 23215bd8deadSopenharmony_ci UNIFORM_OFFSET will give the offset of element 7 in the uniform 23225bd8deadSopenharmony_ci buffer. 23235bd8deadSopenharmony_ci 23245bd8deadSopenharmony_ci Purely for symmetry, it seems that the compiler should be as free to 23255bd8deadSopenharmony_ci strip leading elements as it is to strip trailing elements. 23265bd8deadSopenharmony_ci 23275bd8deadSopenharmony_ci After additional discussions, however, the working group decided 23285bd8deadSopenharmony_ci not to introduce this complexity. This feature could be layered 23295bd8deadSopenharmony_ci as an additional extension if desired. 23305bd8deadSopenharmony_ci 23315bd8deadSopenharmony_ci RESOLUTION: RESOLVED 23325bd8deadSopenharmony_ci 23335bd8deadSopenharmony_ci 23345bd8deadSopenharmony_ci (25) Following issue (24), should we provide a mechanism to allow the 23355bd8deadSopenharmony_ci compiler to strip *any* dead elements from a uniform array without 23365bd8deadSopenharmony_ci restriction, not just leading and trailing elements? 23375bd8deadSopenharmony_ci 23385bd8deadSopenharmony_ci Resolved: No. Too cumbersome for the application to use. 23395bd8deadSopenharmony_ci 23405bd8deadSopenharmony_ci 23415bd8deadSopenharmony_ci (26) Should we make any guarantees about the ordering of uniforms in the 23425bd8deadSopenharmony_ci active uniform array, relative to their uniform block number? 23435bd8deadSopenharmony_ci 23445bd8deadSopenharmony_ci It might be useful to guarantee that the ordering of the 23455bd8deadSopenharmony_ci uniforms in the active uniform array is such that all uniforms 23465bd8deadSopenharmony_ci in a single uniform block form a contiguous subrange of the 23475bd8deadSopenharmony_ci active uniform array. 23485bd8deadSopenharmony_ci 23495bd8deadSopenharmony_ci On the other hand, just knowing the order is probably not enough 23505bd8deadSopenharmony_ci since you need to know offsets/strides, packing, etc. 23515bd8deadSopenharmony_ci 23525bd8deadSopenharmony_ci This extension provides uniform block-based uniform updates. 23535bd8deadSopenharmony_ci This level of organization is efficient and requires no further 23545bd8deadSopenharmony_ci augmentation as this issue suggests. 23555bd8deadSopenharmony_ci 23565bd8deadSopenharmony_ci RESOLUTION: RESOLVED, no 23575bd8deadSopenharmony_ci 23585bd8deadSopenharmony_ci 23595bd8deadSopenharmony_ci (27) What is the difference between 23605bd8deadSopenharmony_ci MAX_LOGICAL_UNIFORM_BUFFERS and 23615bd8deadSopenharmony_ci MAX_COMBINED_UNIFORM_BUFFERS? 23625bd8deadSopenharmony_ci 23635bd8deadSopenharmony_ci MAX_LOGICAL_UNIFORM_BUFFERS is the maximum number of 23645bd8deadSopenharmony_ci uniform buffer binding points on the context. 23655bd8deadSopenharmony_ci MAX_COMBINED_UNIFORM_BUFFERS is the maximum number of 23665bd8deadSopenharmony_ci uniform buffers that any one program can use at one time. 23675bd8deadSopenharmony_ci 23685bd8deadSopenharmony_ci Note, see issue (46) for a related issue with textures. 23695bd8deadSopenharmony_ci 23705bd8deadSopenharmony_ci RESOLUTION: RESOLVED 23715bd8deadSopenharmony_ci 23725bd8deadSopenharmony_ci 23735bd8deadSopenharmony_ci (28) Should we have versions of GetActiveUniforms and GetActiveUniformBlocks 23745bd8deadSopenharmony_ci that return intptr types so a cast is not required. 23755bd8deadSopenharmony_ci 23765bd8deadSopenharmony_ci No. Another extension can add them, and they have no real 23775bd8deadSopenharmony_ci utility at this time except causing the app to allocate twice as much 23785bd8deadSopenharmony_ci storage to store values that can't exceed 32 bits. 23795bd8deadSopenharmony_ci 23805bd8deadSopenharmony_ci RESOLUTION: RESOLVED, No. 23815bd8deadSopenharmony_ci 23825bd8deadSopenharmony_ci 23835bd8deadSopenharmony_ci (29) Transform feedback writes primitive information to a buffer object 23845bd8deadSopenharmony_ci tightly arranged and in accordance with the size of the attributes 23855bd8deadSopenharmony_ci designated for transform feedback (or varyings thereof). If uniform 23865bd8deadSopenharmony_ci buffers are to leverage data supplied from the transform feedback 23875bd8deadSopenharmony_ci operation, yet uniforms are not guaranteed to be tightly packed, how 23885bd8deadSopenharmony_ci can one reasonably use transform feedback to populate uniform 23895bd8deadSopenharmony_ci buffers? 23905bd8deadSopenharmony_ci 23915bd8deadSopenharmony_ci DISCUSSION: As it stands, existing implementations pack uniform 23925bd8deadSopenharmony_ci definitions on 16 byte boundaries, 4 byte boundaries or are tightly 23935bd8deadSopenharmony_ci packed. If this is known for a given implementation, uniform 23945bd8deadSopenharmony_ci declarations could of course be made such that they lined up on these 23955bd8deadSopenharmony_ci boundaries. However, without a dedicated queryable interface in the GL 23965bd8deadSopenharmony_ci C API, there is no way to guarantee the portability of this logic. 23975bd8deadSopenharmony_ci 23985bd8deadSopenharmony_ci RESOLUTION: resolved, compatibility with XFB output is only guaranteed 23995bd8deadSopenharmony_ci for vec4 types in a "std140" layout uniform block: 24005bd8deadSopenharmony_ci 24015bd8deadSopenharmony_ci In order to facilitate the read-only nature of uniform and 24025bd8deadSopenharmony_ci transform feedback data formatting, we've added to this 24035bd8deadSopenharmony_ci specification a uniform buffer "std140" layout qualifier guarantee of 24045bd8deadSopenharmony_ci vec4 types being tightly packed. This layout guarantee will provide 24055bd8deadSopenharmony_ci portability of applications that wish to use transform feedback in 24065bd8deadSopenharmony_ci conjunction with uniform buffers as they can simply rely on this 24075bd8deadSopenharmony_ci data arrangement, declaring their uniforms accordingly, to allow 24085bd8deadSopenharmony_ci ARB_uniform_buffer_object and EXT_transform_feedback to 24095bd8deadSopenharmony_ci interoperate. 24105bd8deadSopenharmony_ci 24115bd8deadSopenharmony_ci 24125bd8deadSopenharmony_ci (30) Should the "active" keyword in shader text be declared per uniform or 24135bd8deadSopenharmony_ci per uniform block ? 24145bd8deadSopenharmony_ci 24155bd8deadSopenharmony_ci Note, this issue is mostly moot, as we've decided to use a 24165bd8deadSopenharmony_ci different syntax in the GLSL. Earlier versions of this spec 24175bd8deadSopenharmony_ci leveraged the concept of 'active' uniforms from GLSL that were 24185bd8deadSopenharmony_ci defined with the initial GLSL API. 24195bd8deadSopenharmony_ci 24205bd8deadSopenharmony_ci The discussion that follows pertains to a feature where the user can 24215bd8deadSopenharmony_ci declare uniforms and uniform blocks as active explicitly. 24225bd8deadSopenharmony_ci 24235bd8deadSopenharmony_ci DISCUSSION: Declaring a uniform active has the advantages of simplicity 24245bd8deadSopenharmony_ci and little additional spec language to describe behavior. When a 24255bd8deadSopenharmony_ci uniform is declared active, all of its members are considered active 24265bd8deadSopenharmony_ci (for structs and arrays) and therefore the arrangement of the data in 24275bd8deadSopenharmony_ci that uniform can be guaranteed to be consistent. Consistency of this 24285bd8deadSopenharmony_ci uniform data arrangement can be used to share the uniform across muliple 24295bd8deadSopenharmony_ci programs without worrying about dead code elimination changing the 24305bd8deadSopenharmony_ci offsets and strides of uniform data. 24315bd8deadSopenharmony_ci 24325bd8deadSopenharmony_ci Declaring uniform blocks active has some of the advantages that were 24335bd8deadSopenharmony_ci primary motivating factors for this specficiation being written. 24345bd8deadSopenharmony_ci Namely, that uniforms did not have to be aggregated into structures in 24355bd8deadSopenharmony_ci order to update them efficiently. In this case, uniforms don't have to 24365bd8deadSopenharmony_ci be aggregated into structs in order to share them easily. Another 24375bd8deadSopenharmony_ci advantage is the logical distinction of a group of shared uniforms that 24385bd8deadSopenharmony_ci is analogous to how the uniform buffer object, also a shared entity, 24395bd8deadSopenharmony_ci that backs them. 24405bd8deadSopenharmony_ci 24415bd8deadSopenharmony_ci If a uniform uniform block is declared active, all uniforms therein are 24425bd8deadSopenharmony_ci considered active. It is presumed under this model, that an advisable 24435bd8deadSopenharmony_ci usage pattern would be to gather the declaration of shared uniforms of 24445bd8deadSopenharmony_ci multiple shaders into an atomic shader source call. Then each 24455bd8deadSopenharmony_ci individual shader would carry declarations of uniforms unique to 24465bd8deadSopenharmony_ci themselves. 24475bd8deadSopenharmony_ci 24485bd8deadSopenharmony_ci GLSL allows piecewise declaration of uniforms in multiple modules in a 24495bd8deadSopenharmony_ci program. Piecewise declaration of shared uniform blocks carries with it 24505bd8deadSopenharmony_ci some difficulties because missing pieces can change the layout of the 24515bd8deadSopenharmony_ci uniform block. 24525bd8deadSopenharmony_ci 24535bd8deadSopenharmony_ci A) Should we disallow piecewise construction of uniform blocks 24545bd8deadSopenharmony_ci declared active by setting a compile time error if this is 24555bd8deadSopenharmony_ci attempted ? 24565bd8deadSopenharmony_ci 24575bd8deadSopenharmony_ci RESOLVED: Yes, piecewise construction of uniform blocks will be 24585bd8deadSopenharmony_ci allowed. 24595bd8deadSopenharmony_ci 24605bd8deadSopenharmony_ci Proposal for active uniform block demarcation: 24615bd8deadSopenharmony_ci 24625bd8deadSopenharmony_ci Active uniform blocks are declared as followed: 24635bd8deadSopenharmony_ci 24645bd8deadSopenharmony_ci active uniform block foo; 24655bd8deadSopenharmony_ci 24665bd8deadSopenharmony_ci uniform <type> a; 24675bd8deadSopenharmony_ci uniform <type> b; 24685bd8deadSopenharmony_ci uniform <type> c; 24695bd8deadSopenharmony_ci 24705bd8deadSopenharmony_ci uniform block; 24715bd8deadSopenharmony_ci 24725bd8deadSopenharmony_ci The first uniform block delimiter names the uniform block. The second 24735bd8deadSopenharmony_ci uniform block, with no name argument, terminates the "foo" uniform block 24745bd8deadSopenharmony_ci and indicates that any subsequent uniform definition will be part of the 24755bd8deadSopenharmony_ci default uniform block. 24765bd8deadSopenharmony_ci 24775bd8deadSopenharmony_ci Subsequent declarations referring to uniform block "foo" augment the 24785bd8deadSopenharmony_ci contents of the uniform block. These subsequent declarations, of 24795bd8deadSopenharmony_ci course, can appear within the same shader or within other shader sources 24805bd8deadSopenharmony_ci in the same program. 24815bd8deadSopenharmony_ci 24825bd8deadSopenharmony_ci This aggregation mechanism, and the use of piece-wise definitions of 24835bd8deadSopenharmony_ci uniform blocks, has sharing implications. 24845bd8deadSopenharmony_ci 24855bd8deadSopenharmony_ci Considering the following example: 24865bd8deadSopenharmony_ci 24875bd8deadSopenharmony_ci ***************************** 24885bd8deadSopenharmony_ci PROGRAM A Text: 24895bd8deadSopenharmony_ci 24905bd8deadSopenharmony_ci active uniform block foo; 24915bd8deadSopenharmony_ci 24925bd8deadSopenharmony_ci uniform <type> a; 24935bd8deadSopenharmony_ci uniform <type> b; 24945bd8deadSopenharmony_ci 24955bd8deadSopenharmony_ci uniform block; 24965bd8deadSopenharmony_ci 24975bd8deadSopenharmony_ci 24985bd8deadSopenharmony_ci ***************************** 24995bd8deadSopenharmony_ci PROGRAM B Text: 25005bd8deadSopenharmony_ci 25015bd8deadSopenharmony_ci active uniform block foo; 25025bd8deadSopenharmony_ci 25035bd8deadSopenharmony_ci uniform <type> b; 25045bd8deadSopenharmony_ci uniform <type> a; 25055bd8deadSopenharmony_ci 25065bd8deadSopenharmony_ci uniform block; 25075bd8deadSopenharmony_ci 25085bd8deadSopenharmony_ci ... some place later in the program text 25095bd8deadSopenharmony_ci 25105bd8deadSopenharmony_ci active uniform block foo; 25115bd8deadSopenharmony_ci 25125bd8deadSopenharmony_ci uniform <type> e; 25135bd8deadSopenharmony_ci uniform <type> d; 25145bd8deadSopenharmony_ci 25155bd8deadSopenharmony_ci uniform block; 25165bd8deadSopenharmony_ci ***************************** 25175bd8deadSopenharmony_ci 25185bd8deadSopenharmony_ci Both the order and the number of uniforms in the aggregate definition of 25195bd8deadSopenharmony_ci 'foo' in program B must be considered for sharing the uniform buffer 25205bd8deadSopenharmony_ci backing A & B corresponding to uniform block 'foo'. 25215bd8deadSopenharmony_ci 25225bd8deadSopenharmony_ci First, order. To avoid potential confusion with order of declarations 25235bd8deadSopenharmony_ci of uniforms, all uniforms declared in a uniform block will be sorted in 25245bd8deadSopenharmony_ci an implementation defined manner. By doing so, the implementation will 25255bd8deadSopenharmony_ci allow sharing of uniform buffers with identical uniform declarations by 25265bd8deadSopenharmony_ci name, type and number, but arranged in different orders. 25275bd8deadSopenharmony_ci 25285bd8deadSopenharmony_ci Second, mismatches in declarations of uniforms within 'foo' between two 25295bd8deadSopenharmony_ci different programs. Because uniforms are sorted, partial matches of 25305bd8deadSopenharmony_ci uniform declarations within uniform blocks are not guaranteed to have 25315bd8deadSopenharmony_ci the same offsets when the buffer is bound to different programs. In our 25325bd8deadSopenharmony_ci example, there are no guarantees that the offset of uniform 'a' and the 25335bd8deadSopenharmony_ci offset of uniform 'b' would be the same in uniform block foo of program 25345bd8deadSopenharmony_ci 'A' when compared to program 'B'. Applications must therefore use care 25355bd8deadSopenharmony_ci when attempting to share uniform buffers between multiple programs 25365bd8deadSopenharmony_ci because any mismatch in uniform name or type or the number of uniforms 25375bd8deadSopenharmony_ci themselves between uniform block declarations will result in offsets 25385bd8deadSopenharmony_ci without correlation and application errors should be expected if any 25395bd8deadSopenharmony_ci assumptions about these offsets is made otherwise. 25405bd8deadSopenharmony_ci 25415bd8deadSopenharmony_ci This sharing behavior if of particular significance when defining 25425bd8deadSopenharmony_ci shaders as it suggests that the shaders themselves, if they choose to 25435bd8deadSopenharmony_ci define uniform blocks piecewise across given program text. This sharing 25445bd8deadSopenharmony_ci model suggests defining all uniform uniform blocks that are expected to 25455bd8deadSopenharmony_ci be shared as standalone shader text definitions to logically segragate 25465bd8deadSopenharmony_ci them from uniform block declarations that can be changed in a piecewise 25475bd8deadSopenharmony_ci fashion. In this manner, the logically separated shared uniform uniform 25485bd8deadSopenharmony_ci block can be handled as a distinct ShaderSource call and effectively act 25495bd8deadSopenharmony_ci as a header file where the uniform block definition is guaranteed to be 25505bd8deadSopenharmony_ci the same when used in multiple programs thus allowing sharing and 25515bd8deadSopenharmony_ci consistent offsets. 25525bd8deadSopenharmony_ci 25535bd8deadSopenharmony_ci RESOLUTION: RESOLVED 25545bd8deadSopenharmony_ci 25555bd8deadSopenharmony_ci Partitions, uniforms, and varyings can all have the "active" keyword 25565bd8deadSopenharmony_ci applied to them. See rules q - t in the rules and concepts list 25575bd8deadSopenharmony_ci following the opening summary to this spec. 25585bd8deadSopenharmony_ci 25595bd8deadSopenharmony_ci The resolution of issue (34) to use struct-like syntax for uniform block 25605bd8deadSopenharmony_ci definition closes the issue on piecewise definition of uniform blocks 25615bd8deadSopenharmony_ci discussed above. 25625bd8deadSopenharmony_ci 25635bd8deadSopenharmony_ci 25645bd8deadSopenharmony_ci (31) ActiveVaryingNV() uses the GL C API to declare a varying active in 25655bd8deadSopenharmony_ci contrast to declaring uniforms/uniform uniform blocks active as suggested in 25665bd8deadSopenharmony_ci this specification. Is this inconsistency a concern ? 25675bd8deadSopenharmony_ci 25685bd8deadSopenharmony_ci RESOLUTION: RESOLVED, moot. 25695bd8deadSopenharmony_ci 25705bd8deadSopenharmony_ci Earlier versions of this spec declared uniforms and uniform blocks 25715bd8deadSopenharmony_ci as active, and optionally extended this to varyings as well. 25725bd8deadSopenharmony_ci 25735bd8deadSopenharmony_ci Later versions of this spec deferred this concept out of the extension. 25745bd8deadSopenharmony_ci 25755bd8deadSopenharmony_ci The declaring a varying as active via function call requires 25765bd8deadSopenharmony_ci that this call is made prior to link time and that it identifies 25775bd8deadSopenharmony_ci the varying using a name string. It is more efficient to manage 25785bd8deadSopenharmony_ci program resources using indices and is better in terms of 25795bd8deadSopenharmony_ci locality of reference to make 'active' declarations in program 25805bd8deadSopenharmony_ci text. We should consider whether we might want to add this back 25815bd8deadSopenharmony_ci in in a future extension. 25825bd8deadSopenharmony_ci 25835bd8deadSopenharmony_ci 25845bd8deadSopenharmony_ci (32) GetVaryingLocationNV() returns -1 if the designated name doesn't 25855bd8deadSopenharmony_ci exist. Should we return -1 rather than a special purposed token if a 25865bd8deadSopenharmony_ci uniform name doesn't exist to follow this precedent ? 25875bd8deadSopenharmony_ci 25885bd8deadSopenharmony_ci RESOLUTION: RESOLVED 25895bd8deadSopenharmony_ci 25905bd8deadSopenharmony_ci This specification uses indices which are unsigned integers and 25915bd8deadSopenharmony_ci therefore our unsigned value of 0xFFFFFFFF is not called "-1" 25925bd8deadSopenharmony_ci but acts effectively the same on platforms where GLint is 25935bd8deadSopenharmony_ci 32-bit twos-complement. 25945bd8deadSopenharmony_ci 25955bd8deadSopenharmony_ci Also note, uniform (and varying locations) are signed which 25965bd8deadSopenharmony_ci allows them to use -1 as a signifier, but uniform (and uniform 25975bd8deadSopenharmony_ci block) indices are unsigned because they are used to iterate 25985bd8deadSopenharmony_ci through uniforms (and uniform blocks). 25995bd8deadSopenharmony_ci 26005bd8deadSopenharmony_ci 26015bd8deadSopenharmony_ci (33) Which uniform buffer object commands must be excluded from display 26025bd8deadSopenharmony_ci lists? 26035bd8deadSopenharmony_ci 26045bd8deadSopenharmony_ci RESOLUTION: Resolved 26055bd8deadSopenharmony_ci 26065bd8deadSopenharmony_ci When used with 3.1 (where display lists have been removed 26075bd8deadSopenharmony_ci altogether) obviously, this question is moot. 26085bd8deadSopenharmony_ci 26095bd8deadSopenharmony_ci For GL 2.0/3.0, this should be resolved with the following 26105bd8deadSopenharmony_ci precedents: 26115bd8deadSopenharmony_ci 26125bd8deadSopenharmony_ci BindUniformBlock should follow the precedent of BindBufferRange, 26135bd8deadSopenharmony_ci which does not get included in display lists. 26145bd8deadSopenharmony_ci 26155bd8deadSopenharmony_ci UniformBlockBinding should follow the precedent of glUniform (for 26165bd8deadSopenharmony_ci setting samplers) which *does* get included in display lists. 26175bd8deadSopenharmony_ci 26185bd8deadSopenharmony_ci Note, the GL 2.1 spec says (p.244, section 5.4) that "GL 26195bd8deadSopenharmony_ci commands that source data from buffer objects dereference the 26205bd8deadSopenharmony_ci buffer object data in question at display list compile time, 26215bd8deadSopenharmony_ci rather than encoding the buffer ID and buffer offset into the 26225bd8deadSopenharmony_ci display list. Only GL commands that are executed immediately, 26235bd8deadSopenharmony_ci rather than being compiled into a display list, are permitted to 26245bd8deadSopenharmony_ci use a buffer object as a data sink." 26255bd8deadSopenharmony_ci 26265bd8deadSopenharmony_ci The same rules would affect uniform blocks sourcing data from 26275bd8deadSopenharmony_ci buffer objects. 26285bd8deadSopenharmony_ci 26295bd8deadSopenharmony_ci So this basically means that only BindUniformBlock is excluded, 26305bd8deadSopenharmony_ci (since all queries are already excluded), however see issue (55). 26315bd8deadSopenharmony_ci 26325bd8deadSopenharmony_ci Since we use the BindBufferRange API introduced by OpenGL 3.0, and 26335bd8deadSopenharmony_ci those routines are already excluded, there's no additions to the 26345bd8deadSopenharmony_ci display list exclusion list needed. 26355bd8deadSopenharmony_ci 26365bd8deadSopenharmony_ci 26375bd8deadSopenharmony_ci (34) What should the syntax of uniform block demarcation be ? 26385bd8deadSopenharmony_ci 26395bd8deadSopenharmony_ci DISCUSSION: The two following syntaxes were considered: 26405bd8deadSopenharmony_ci 26415bd8deadSopenharmony_ci uniform block foo; 26425bd8deadSopenharmony_ci 26435bd8deadSopenharmony_ci uniform <type> a; 26445bd8deadSopenharmony_ci uniform <type> b; 26455bd8deadSopenharmony_ci 26465bd8deadSopenharmony_ci uniform block; 26475bd8deadSopenharmony_ci 26485bd8deadSopenharmony_ci In this example, the "uniform block" keyword both opens and closes the 26495bd8deadSopenharmony_ci uniform block. 26505bd8deadSopenharmony_ci 26515bd8deadSopenharmony_ci Second, a struct-like syntax: 26525bd8deadSopenharmony_ci 26535bd8deadSopenharmony_ci uniform myUniformBlock 26545bd8deadSopenharmony_ci { 26555bd8deadSopenharmony_ci int a; 26565bd8deadSopenharmony_ci vec4 b; 26575bd8deadSopenharmony_ci }; 26585bd8deadSopenharmony_ci 26595bd8deadSopenharmony_ci and 26605bd8deadSopenharmony_ci 26615bd8deadSopenharmony_ci packed uniform myUniformBlock 26625bd8deadSopenharmony_ci { 26635bd8deadSopenharmony_ci int a; 26645bd8deadSopenharmony_ci vec4 b; 26655bd8deadSopenharmony_ci }; 26665bd8deadSopenharmony_ci 26675bd8deadSopenharmony_ci where "packed" means that the uniform block might be optimized by the 26685bd8deadSopenharmony_ci compiler to eliminate/re-order uniforms. 26695bd8deadSopenharmony_ci 26705bd8deadSopenharmony_ci This is functionally equivalent to the current uniform block 26715bd8deadSopenharmony_ci syntax in this spec. 26725bd8deadSopenharmony_ci 26735bd8deadSopenharmony_ci RESOLUTION: RESOLVED, using the "struct-like" syntax above. 26745bd8deadSopenharmony_ci 26755bd8deadSopenharmony_ci 26765bd8deadSopenharmony_ci (35) Should UBOs be bound to context binding points rather than to 26775bd8deadSopenharmony_ci programs themselves ? 26785bd8deadSopenharmony_ci 26795bd8deadSopenharmony_ci DISCUSSION: 26805bd8deadSopenharmony_ci 26815bd8deadSopenharmony_ci Attaching UBOs to programs versus the context has the following 26825bd8deadSopenharmony_ci advantages: 26835bd8deadSopenharmony_ci 26845bd8deadSopenharmony_ci UBOs and programs have natural encapsulation boundaries that 26855bd8deadSopenharmony_ci fit with the conventions of object-oriented design 26865bd8deadSopenharmony_ci programming. 26875bd8deadSopenharmony_ci 26885bd8deadSopenharmony_ci Alternately, binding UBOs to the context has the following advantages: 26895bd8deadSopenharmony_ci 26905bd8deadSopenharmony_ci Migration to the possible program environment object design 26915bd8deadSopenharmony_ci expected in future versions of OpenGL will be handled more 26925bd8deadSopenharmony_ci easily and won't require a semantics change because these 26935bd8deadSopenharmony_ci context bindings will all be moved collectively to the PEO 26945bd8deadSopenharmony_ci and UBO attachments will not have to be handled as a 26955bd8deadSopenharmony_ci "special case" item. 26965bd8deadSopenharmony_ci 26975bd8deadSopenharmony_ci If we support per-context per-stage bindings, then we'll need the 26985bd8deadSopenharmony_ci following additions to this extension: 26995bd8deadSopenharmony_ci 27005bd8deadSopenharmony_ci - a set number of binding points on the context for each stage 27015bd8deadSopenharmony_ci (vertex/fragment/geometry) 27025bd8deadSopenharmony_ci VERTEX_SHADER_BINDING_0..n 27035bd8deadSopenharmony_ci GEOMETRY_SHADER_BINDING_0..n 27045bd8deadSopenharmony_ci FRAGMENT_SHADER_BINDING_0..n 27055bd8deadSopenharmony_ci 27065bd8deadSopenharmony_ci or alternately, a unified set of per context bindings 27075bd8deadSopenharmony_ci SHADER_BINDING_0..n 27085bd8deadSopenharmony_ci 27095bd8deadSopenharmony_ci - a new routine to bind a UBO to a per-stage context binding point 27105bd8deadSopenharmony_ci BindUniformBuffer(enum target, uint uniformBlockIndex, 27115bd8deadSopenharmony_ci uint buffer); 27125bd8deadSopenharmony_ci 27135bd8deadSopenharmony_ci - a new routine that defines the mapping of a uniform block name 27145bd8deadSopenharmony_ci string to a per-stage binding point index 27155bd8deadSopenharmony_ci void UniformBlockBinding(uint program, uint unit, 27165bd8deadSopenharmony_ci const char* name); 27175bd8deadSopenharmony_ci 27185bd8deadSopenharmony_ci 27195bd8deadSopenharmony_ci RESOLUTION: RESOLVED, 27205bd8deadSopenharmony_ci 27215bd8deadSopenharmony_ci Note per-context and per-program bindings serve two distinct use cases. 27225bd8deadSopenharmony_ci 27235bd8deadSopenharmony_ci Per-context: assumes that there is generally many to one mapping 27245bd8deadSopenharmony_ci between programs and given set of uniform buffers. 27255bd8deadSopenharmony_ci 27265bd8deadSopenharmony_ci Per-program: assumes that there is a one to one mapping between 27275bd8deadSopenharmony_ci programs and a given set of uniform buffers. 27285bd8deadSopenharmony_ci 27295bd8deadSopenharmony_ci The original ARB "assembly-language" programming extensions serviced 27305bd8deadSopenharmony_ci both use cases (with "program locals" and "program environment" 27315bd8deadSopenharmony_ci parameters). 27325bd8deadSopenharmony_ci 27335bd8deadSopenharmony_ci The GLSL programming API dropped the "program environment" / 27345bd8deadSopenharmony_ci per-context storage of uniforms in favor of per-program only storage 27355bd8deadSopenharmony_ci for uniforms. 27365bd8deadSopenharmony_ci 27375bd8deadSopenharmony_ci This API currently supports only the context binding model, but 27385bd8deadSopenharmony_ci a future extension could add the per-program-object bindings if 27395bd8deadSopenharmony_ci desired. 27405bd8deadSopenharmony_ci 27415bd8deadSopenharmony_ci 27425bd8deadSopenharmony_ci (36) How is the query for MAX_{FRAGMENT|VERTEX}_UNIFORM_COMPONENTS 27435bd8deadSopenharmony_ci affected by UBOs? 27445bd8deadSopenharmony_ci 27455bd8deadSopenharmony_ci DISCUSSION: MAX_{FRAGMENT|VERTEX}_UNIFORM_COMPONENTS traditionally 27465bd8deadSopenharmony_ci referred to the limited amount of dedicated (often register based, 27475bd8deadSopenharmony_ci sometimes per-stage) uniform storage. For implementations that 27485bd8deadSopenharmony_ci support directly reading uniforms from arbitrary memory, the limit 27495bd8deadSopenharmony_ci on uniform storage is generally not quantified by a single number of 27505bd8deadSopenharmony_ci uniforms. Instead it is quantified by two numbers: the number of 27515bd8deadSopenharmony_ci separate buffers that can be read at one time (per stage), and the 27525bd8deadSopenharmony_ci sizes of one of those buffers. 27535bd8deadSopenharmony_ci 27545bd8deadSopenharmony_ci On the other hand for implementations that wish to support this 27555bd8deadSopenharmony_ci extension but that still have this limited amount of dedicated 27565bd8deadSopenharmony_ci uniform storage this single MAX_{FRAGMENT|VERTEX}_UNIFORM_COMPONENTS 27575bd8deadSopenharmony_ci value is still valid. 27585bd8deadSopenharmony_ci 27595bd8deadSopenharmony_ci RESOLUTION: Resolved, as follows: 27605bd8deadSopenharmony_ci 27615bd8deadSopenharmony_ci We added a new set of integer implementation-dependent queries, named 27625bd8deadSopenharmony_ci MAX_COMBINED_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_COMPONENTS. These 27635bd8deadSopenharmony_ci would indicate the maximum total number of uniforms available between 27645bd8deadSopenharmony_ci the default uniform block and all uniform blocks. For this ARB version 27655bd8deadSopenharmony_ci of the extension, the minimum maximum would be 27665bd8deadSopenharmony_ci MAX_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_COMPONENTS. For the 3.1 core 27675bd8deadSopenharmony_ci version, the minimum maximum would be larger: 27685bd8deadSopenharmony_ci MAX_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE + 27695bd8deadSopenharmony_ci MAX_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_COMPONENTS. 27705bd8deadSopenharmony_ci 27715bd8deadSopenharmony_ci 27725bd8deadSopenharmony_ci (37) Do we need MAX_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_BUFFERS 27735bd8deadSopenharmony_ci or can we merge these into a single value MAX_UNIFORM_BUFFERS that 27745bd8deadSopenharmony_ci is the same for the 3 stages? 27755bd8deadSopenharmony_ci 27765bd8deadSopenharmony_ci DISCUSSION: 27775bd8deadSopenharmony_ci 27785bd8deadSopenharmony_ci 3 separate queries is needed only if we think implementations would have 27795bd8deadSopenharmony_ci different values for each stage. 27805bd8deadSopenharmony_ci 27815bd8deadSopenharmony_ci RESOLUTION: currently 3 queries, plus a "combined" query. 27825bd8deadSopenharmony_ci 27835bd8deadSopenharmony_ci 27845bd8deadSopenharmony_ci (38) What's the deal with UniformBlockBinding()? How does it 27855bd8deadSopenharmony_ci work? What is it for? 27865bd8deadSopenharmony_ci 27875bd8deadSopenharmony_ci DISCUSSION: 27885bd8deadSopenharmony_ci 27895bd8deadSopenharmony_ci UniformBlockBinding can be defined in two different ways, depending on 27905bd8deadSopenharmony_ci the precedent we'd like to use. 27915bd8deadSopenharmony_ci 27925bd8deadSopenharmony_ci It can either be similar to a uniform sampler (i.e., an indirection 27935bd8deadSopenharmony_ci table that can choose a particular buffer to use after linking), or 27945bd8deadSopenharmony_ci an attribute location (i.e., an indirection table that can choose a 27955bd8deadSopenharmony_ci particular buffer to use PRIOR to linking). 27965bd8deadSopenharmony_ci 27975bd8deadSopenharmony_ci The current API chooses the former precedent (i.e., uniform 27985bd8deadSopenharmony_ci samplers), and as a result, UniformBlockBinding can be called (in 27995bd8deadSopenharmony_ci fact, must be called) after linking the program. 28005bd8deadSopenharmony_ci 28015bd8deadSopenharmony_ci If we desired to change this behavior, we'd need to modify 28025bd8deadSopenharmony_ci UniformBlockBinding to take a uniform block *name* intead of *index*, 28035bd8deadSopenharmony_ci because a uniform block index is only defined post-link. 28045bd8deadSopenharmony_ci 28055bd8deadSopenharmony_ci This is workable, but slightly less flexible for the developer, at 28065bd8deadSopenharmony_ci the cost of an indirection. 28075bd8deadSopenharmony_ci 28085bd8deadSopenharmony_ci RESOLUTION: Use the "sampler" precedent, UniformBlockBinding is 28095bd8deadSopenharmony_ci called post link. 28105bd8deadSopenharmony_ci 28115bd8deadSopenharmony_ci 28125bd8deadSopenharmony_ci (39) Does the matrix packing need to be "per program" state or "per 28135bd8deadSopenharmony_ci implementation" state? 28145bd8deadSopenharmony_ci 28155bd8deadSopenharmony_ci DISCUSSION: 28165bd8deadSopenharmony_ci 28175bd8deadSopenharmony_ci Is the choice of matrix packing really "per program"? If not, 28185bd8deadSopenharmony_ci should we just use the per-context queries for this information? The 28195bd8deadSopenharmony_ci former might be useful if we intend to expose some kind of 28205bd8deadSopenharmony_ci per-program packing control in the shading language or API. If we 28215bd8deadSopenharmony_ci don't, then the latter might be simpler. 28225bd8deadSopenharmony_ci 28235bd8deadSopenharmony_ci Or do we think we might go further and make this per-uniform state 28245bd8deadSopenharmony_ci in the future? if so, then the current per-program query is also 28255bd8deadSopenharmony_ci insufficient. 28265bd8deadSopenharmony_ci 28275bd8deadSopenharmony_ci After discussion with the working group, queries for 28285bd8deadSopenharmony_ci matrix (and all other uniform layout) will be per-uniform, not 28295bd8deadSopenharmony_ci per program, so these routines have been removed. 28305bd8deadSopenharmony_ci 28315bd8deadSopenharmony_ci RESOLUTION: Resolved, this issue is moot. 28325bd8deadSopenharmony_ci 28335bd8deadSopenharmony_ci 28345bd8deadSopenharmony_ci (40) Are uniform block indices assumed to be "tightly packed"? 28355bd8deadSopenharmony_ci 28365bd8deadSopenharmony_ci Yes, an implementation will assign consecutive indices to 28375bd8deadSopenharmony_ci active uniform blocks, starting with zero. 28385bd8deadSopenharmony_ci 28395bd8deadSopenharmony_ci Note that there is no prescribed ordering in which indices must be 28405bd8deadSopenharmony_ci assigned. In other words, which uniform block indices are assigned to 28415bd8deadSopenharmony_ci which uniform blocks is an implementation choice. An application must 28425bd8deadSopenharmony_ci call GetUniformBlockIndex to find the mapping. 28435bd8deadSopenharmony_ci 28445bd8deadSopenharmony_ci RESOLUTION: Resolved, yes. 28455bd8deadSopenharmony_ci 28465bd8deadSopenharmony_ci 28475bd8deadSopenharmony_ci (41) Is "uniform block" the right name? 28485bd8deadSopenharmony_ci 28495bd8deadSopenharmony_ci The GLSL group considered many names here: "uniform blocks", 28505bd8deadSopenharmony_ci "commons", "uniform groups", etc. Regardless of what the GLSL 28515bd8deadSopenharmony_ci calls these groupings, we need *some name* that we can describe 28525bd8deadSopenharmony_ci in the API spec and in the API names. Currently we use "uniform 28535bd8deadSopenharmony_ci block" for this, and the API seems to make sense, but could 28545bd8deadSopenharmony_ci change if someone has a better name. 28555bd8deadSopenharmony_ci 28565bd8deadSopenharmony_ci RESOLUTION: RESOLVED, yes. 28575bd8deadSopenharmony_ci 28585bd8deadSopenharmony_ci 28595bd8deadSopenharmony_ci (42) Should there be an "offset" for the base of the ubo so that an 28605bd8deadSopenharmony_ci application can use collections uniforms within a buffer object? 28615bd8deadSopenharmony_ci 28625bd8deadSopenharmony_ci DISCUSSION: 28635bd8deadSopenharmony_ci 28645bd8deadSopenharmony_ci If we do this, we'd need an additional/augmented version of 28655bd8deadSopenharmony_ci BindUniformBuffer that takes an offset, and a queriable required 28665bd8deadSopenharmony_ci alignment for the offset. See also issue 55. 28675bd8deadSopenharmony_ci 28685bd8deadSopenharmony_ci Currently, we do now support this offset (via BindBufferRange) and an 28695bd8deadSopenharmony_ci alignment query (UNIFORM_BUFFER_OFFSET_ALIGNMENT). The offset 28705bd8deadSopenharmony_ci is per-context binding point state. We probably want to pick up 28715bd8deadSopenharmony_ci UNIFORM_BUFFER_START and UNIFORM_BUFFER_SIZE queries, too. See issue 28725bd8deadSopenharmony_ci (65) to track whether we add these. 28735bd8deadSopenharmony_ci 28745bd8deadSopenharmony_ci RESOLUTION: Resolved, there should be an offset for the base of a 28755bd8deadSopenharmony_ci uniform block within a UBO. If an implementation can not support 28765bd8deadSopenharmony_ci non-zero offsets, they can set UNIFORM_BUFFER_OFFSET_ALIGNMENT 28775bd8deadSopenharmony_ci to a sufficiently large value. 28785bd8deadSopenharmony_ci 28795bd8deadSopenharmony_ci 28805bd8deadSopenharmony_ci (43) Do we need the versions of the uniform queries that query the 28815bd8deadSopenharmony_ci GL for the properties/names of multiple uniforms at one time? Or 28825bd8deadSopenharmony_ci can we simplify those apis to only query for the property/name of 28835bd8deadSopenharmony_ci one uniform at a time? 28845bd8deadSopenharmony_ci 28855bd8deadSopenharmony_ci DISCUSSION: The multiquery apis are useful for getting lists of 28865bd8deadSopenharmony_ci uniform data at once, but are more complicated (require arrays of 28875bd8deadSopenharmony_ci pointers to output values). 28885bd8deadSopenharmony_ci 28895bd8deadSopenharmony_ci Do we need these? 28905bd8deadSopenharmony_ci 28915bd8deadSopenharmony_ci RESOLUTION: Resolved, we'll replace GetActiveUniformNames with 28925bd8deadSopenharmony_ci GetActiveUniformName, but keep the rest which have solid use 28935bd8deadSopenharmony_ci cases. 28945bd8deadSopenharmony_ci 28955bd8deadSopenharmony_ci 28965bd8deadSopenharmony_ci (44) What is the default value for UNIFORM_BLOCK_BINDING? 28975bd8deadSopenharmony_ci 28985bd8deadSopenharmony_ci Having the default values be set equal to the uniform block index at 28995bd8deadSopenharmony_ci link time would be convenient. This would make it unnecessary 29005bd8deadSopenharmony_ci for apps to call glUniformBlockBinding unless they wanted a 29015bd8deadSopenharmony_ci non-default mapping. 29025bd8deadSopenharmony_ci 29035bd8deadSopenharmony_ci After some discussion, using texture samplers as precedent, then 29045bd8deadSopenharmony_ci the default value should be zero. 29055bd8deadSopenharmony_ci 29065bd8deadSopenharmony_ci RESOLUTION. Resolved, default value is zero. 29075bd8deadSopenharmony_ci 29085bd8deadSopenharmony_ci 29095bd8deadSopenharmony_ci (45) What is the default value of UNIFORM_BLOCK_BUFFER_BINDING? 29105bd8deadSopenharmony_ci 29115bd8deadSopenharmony_ci This is moot without the AttachUniformBuffer API. This was the 29125bd8deadSopenharmony_ci query for the uniform buffer object bound directly to a uniform 29135bd8deadSopenharmony_ci block in the program object. 29145bd8deadSopenharmony_ci 29155bd8deadSopenharmony_ci If we add this API in a future extension, it seems it should be 29165bd8deadSopenharmony_ci zero. We would need for the spec to state the precedence of 29175bd8deadSopenharmony_ci program attachments over context attachments. I.e., if the 29185bd8deadSopenharmony_ci value of UNIFORM_BLOCK_BUFFER_BINDING is non-zero, then 29195bd8deadSopenharmony_ci the backing for that uniform block comes from the specified 29205bd8deadSopenharmony_ci uniform block uniform buffer binding, otherwise it comes from 29215bd8deadSopenharmony_ci the unit binding, and hence from the context that is currently 29225bd8deadSopenharmony_ci using the program. 29235bd8deadSopenharmony_ci 29245bd8deadSopenharmony_ci RESOLUTION. RESOLVED, moot. 29255bd8deadSopenharmony_ci 29265bd8deadSopenharmony_ci 29275bd8deadSopenharmony_ci (46) How do the logical/combined maximums for UBOs and textures 29285bd8deadSopenharmony_ci relate to each other? 29295bd8deadSopenharmony_ci 29305bd8deadSopenharmony_ci Textures have these queries: 29315bd8deadSopenharmony_ci 29325bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS 29335bd8deadSopenharmony_ci maximum textures that can be used by the fragment stage. 29345bd8deadSopenharmony_ci 29355bd8deadSopenharmony_ci MAX_COMBINED_TEXTURE_IMAGE_UNITS 29365bd8deadSopenharmony_ci maximum textures that can be used by all program stages 29375bd8deadSopenharmony_ci at once. 29385bd8deadSopenharmony_ci 29395bd8deadSopenharmony_ci Ideally, MAX_TEXTURE_IMAGE_UNITS would be called 29405bd8deadSopenharmony_ci "MAX_FRAGMENT_TEXTURE_IMAGE_UNITS" 29415bd8deadSopenharmony_ci 29425bd8deadSopenharmony_ci Also, most implementations use MAX_TEXTURE_IMAGE_UNITS to define 29435bd8deadSopenharmony_ci the number of per-context binding points for textures, though 29445bd8deadSopenharmony_ci technically, there's no requirement that the number of context 29455bd8deadSopenharmony_ci binding points is equal to the number of fragment textures. 29465bd8deadSopenharmony_ci 29475bd8deadSopenharmony_ci For instance, if an implementation had the ability to use more 29485bd8deadSopenharmony_ci vertex or geometry textures than fragment textures, then this 29495bd8deadSopenharmony_ci scheme would break down because there would not be enough 29505bd8deadSopenharmony_ci context binding points for these other stages. 29515bd8deadSopenharmony_ci 29525bd8deadSopenharmony_ci This spec tries to avoid this problem with the following queries: 29535bd8deadSopenharmony_ci 29545bd8deadSopenharmony_ci MAX_VERTEX_UNIFORM_BLOCKS 29555bd8deadSopenharmony_ci MAX_GEOMETRY_UNIFORM_BLOCKS 29565bd8deadSopenharmony_ci MAX_FRAGMENT_UNIFORM_BLOCKS 29575bd8deadSopenharmony_ci MAX_COMBINED_UNIFORM_BLOCKS (much like "combined" for textures) 29585bd8deadSopenharmony_ci MAX_UNIFORM_BUFFER_BINDINGS (# UBO binding points on context) 29595bd8deadSopenharmony_ci 29605bd8deadSopenharmony_ci For symmetry, we'd recommend that we make a similar update to textures 29615bd8deadSopenharmony_ci in the 3.1 spec: 29625bd8deadSopenharmony_ci 29635bd8deadSopenharmony_ci MAX_FRAGMENT_SAMPLERS (= old MAX_TEXTURE_IMAGE_UNITS) 29645bd8deadSopenharmony_ci MAX_GEOMETRY_SAMPLERS (= old MAX_GEOMETRY_TEXTURE_IMAGE_UNITS) 29655bd8deadSopenharmony_ci MAX_VERTEX_SAMPLERS (= old MAX_VERTEX_TEXTURE_IMAGE_UNITS) 29665bd8deadSopenharmony_ci MAX_COMBINED_SAMPLERS (= old MAX_COMBINED_TEXTURE_IMAGE_UNITS) 29675bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_BINDINGS (# texture binding points on context) 29685bd8deadSopenharmony_ci 29695bd8deadSopenharmony_ci RESOLUTION: Resolved. The texture token name changes should be made 29705bd8deadSopenharmony_ci in the 3.1 API spec, deprecating the old names. 29715bd8deadSopenharmony_ci 29725bd8deadSopenharmony_ci 29735bd8deadSopenharmony_ci (47) Is using a keyword to specify packed/shared/std140 the best way 29745bd8deadSopenharmony_ci to manage uniform block packing? What do they mean anyway? 29755bd8deadSopenharmony_ci 29765bd8deadSopenharmony_ci DISCUSSION: 29775bd8deadSopenharmony_ci 29785bd8deadSopenharmony_ci There are 3 use cases of interest: 29795bd8deadSopenharmony_ci 29805bd8deadSopenharmony_ci "packed" 29815bd8deadSopenharmony_ci 29825bd8deadSopenharmony_ci - implementation may optimize the layout to remove inactive 29835bd8deadSopenharmony_ci uniforms and otherwise restructure the layout for 29845bd8deadSopenharmony_ci efficiency. 29855bd8deadSopenharmony_ci 29865bd8deadSopenharmony_ci - application must query the GL for the uniform block layout 29875bd8deadSopenharmony_ci 29885bd8deadSopenharmony_ci "shared" 29895bd8deadSopenharmony_ci 29905bd8deadSopenharmony_ci - implementation may optimize the layout but must use the same 29915bd8deadSopenharmony_ci layout across shaders so that the resulting layout can be shared 29925bd8deadSopenharmony_ci by multiple shaders 29935bd8deadSopenharmony_ci 29945bd8deadSopenharmony_ci - application must query the GL for the uniform block layout 29955bd8deadSopenharmony_ci 29965bd8deadSopenharmony_ci 29975bd8deadSopenharmony_ci "std140": 29985bd8deadSopenharmony_ci - implementation must use a pre-determined layout, defined 29995bd8deadSopenharmony_ci in this specification. 30005bd8deadSopenharmony_ci - application need not query the implementation for layout 30015bd8deadSopenharmony_ci information as it can be determined by reading the shader 30025bd8deadSopenharmony_ci and the specification 30035bd8deadSopenharmony_ci 30045bd8deadSopenharmony_ci 30055bd8deadSopenharmony_ci Other options considered included: 30065bd8deadSopenharmony_ci - an API in the GL 30075bd8deadSopenharmony_ci - a #pragma in the GLSL 30085bd8deadSopenharmony_ci - gcc style __attribute__ tokens 30095bd8deadSopenharmony_ci - others? 30105bd8deadSopenharmony_ci 30115bd8deadSopenharmony_ci RESOLUTION: resolved, we use a layout qualifier construct which 30125bd8deadSopenharmony_ci includes identifiers for "packed", "std140", and "shared" which is the 30135bd8deadSopenharmony_ci intial default. These qualifiers can be used either within a uniform 30145bd8deadSopenharmony_ci block declaration, or at global scope causing subsequent uniform blocks 30155bd8deadSopenharmony_ci with unspecified layouts to adopt a new default layout. 30165bd8deadSopenharmony_ci 30175bd8deadSopenharmony_ci 30185bd8deadSopenharmony_ci (48) What is the "std140" packing layout? 30195bd8deadSopenharmony_ci 30205bd8deadSopenharmony_ci This extension is supposed to define a standard packing layout 30215bd8deadSopenharmony_ci that applications can choose to use and know the uniform block 30225bd8deadSopenharmony_ci data layout within the uniform buffer without querying the 30235bd8deadSopenharmony_ci implementation. 30245bd8deadSopenharmony_ci 30255bd8deadSopenharmony_ci The user would need to opt-in to this layout. 30265bd8deadSopenharmony_ci 30275bd8deadSopenharmony_ci We need to define what this layout looks like. 30285bd8deadSopenharmony_ci 30295bd8deadSopenharmony_ci See also issue (20). 30305bd8deadSopenharmony_ci 30315bd8deadSopenharmony_ci RESOLUTION: resolved, standard layout is now in 2.15.3.1.2. 30325bd8deadSopenharmony_ci 30335bd8deadSopenharmony_ci 30345bd8deadSopenharmony_ci (49) Will storage of int/ivec*/uint/uvec*/float/vec* be guaranteed 30355bd8deadSopenharmony_ci to match the GLint, GLuint, and GLfloat types of the CPU's 30365bd8deadSopenharmony_ci implementation? What if the CPU and GPU differ? What about indirect 30375bd8deadSopenharmony_ci renderers? 30385bd8deadSopenharmony_ci 30395bd8deadSopenharmony_ci See also issues (20) and (48) 30405bd8deadSopenharmony_ci 30415bd8deadSopenharmony_ci RESOLVED: We've never figured out how to properly handle other buffer 30425bd8deadSopenharmony_ci object extensions (e.g., VBO) in conjunction with indirect rendering 30435bd8deadSopenharmony_ci with data type differences. This feature should continue that fine (?) 30445bd8deadSopenharmony_ci tradition. 30455bd8deadSopenharmony_ci 30465bd8deadSopenharmony_ci Ignoring indirect rendering, if the native data types of the GLSL 30475bd8deadSopenharmony_ci executable's processor differs from the client's representation, data 30485bd8deadSopenharmony_ci should still be extracted from buffer objects using the client's 30495bd8deadSopenharmony_ci representation. Mechanisms that could be used to accomplish this 30505bd8deadSopenharmony_ci include: 30515bd8deadSopenharmony_ci 30525bd8deadSopenharmony_ci * having the driver making a copy of the buffer object for internal use, 30535bd8deadSopenharmony_ci doing conversion during the copy; 30545bd8deadSopenharmony_ci 30555bd8deadSopenharmony_ci * having the GLSL executable's processor automatically convert data 30565bd8deadSopenharmony_ci types as they are fetched; or 30575bd8deadSopenharmony_ci 30585bd8deadSopenharmony_ci * generating code to be executed by the GLSL executable's processor to 30595bd8deadSopenharmony_ci manually perform data type conversions. 30605bd8deadSopenharmony_ci 30615bd8deadSopenharmony_ci If dealing with data type mismatches turns out to be a problem on some 30625bd8deadSopenharmony_ci implementations, it might be possible to provide an extension where 30635bd8deadSopenharmony_ci applications to avoid conversion overhead by storing data using the 30645bd8deadSopenharmony_ci native data type of the GPU, instead of the CPU. 30655bd8deadSopenharmony_ci 30665bd8deadSopenharmony_ci 30675bd8deadSopenharmony_ci (50) This extension needs to be sanitized to be written against 30685bd8deadSopenharmony_ci the 2.1 and 3.0 core specs. What are the differences? 30695bd8deadSopenharmony_ci 30705bd8deadSopenharmony_ci Aside from the sanity checking for using the right 30715bd8deadSopenharmony_ci section numbers and such, there are two other changes: 30725bd8deadSopenharmony_ci 30735bd8deadSopenharmony_ci 1) GetIntegeri_v doesn't exist in 2.0 so needs to be 30745bd8deadSopenharmony_ci added by this extension for the 2.0 version 30755bd8deadSopenharmony_ci 30765bd8deadSopenharmony_ci 2) The "max components" query needs different behavior 30775bd8deadSopenharmony_ci for a 2.1 vs. a 3.0/3.1 implementation. See issue (36) 30785bd8deadSopenharmony_ci 30795bd8deadSopenharmony_ci 30805bd8deadSopenharmony_ci RESOLUTION: Resolved, interactions section added which 30815bd8deadSopenharmony_ci details the differences when OpenGL 3.0 is supported. 30825bd8deadSopenharmony_ci Spec is written against OpenGL 2.1, so that's where the 30835bd8deadSopenharmony_ci section numbers come from. 30845bd8deadSopenharmony_ci 30855bd8deadSopenharmony_ci 30865bd8deadSopenharmony_ci (51) Do we need to name the default uniform block with index 0 and 30875bd8deadSopenharmony_ci name ""? 30885bd8deadSopenharmony_ci 30895bd8deadSopenharmony_ci This is done for symmetry and to allow iterating through 30905bd8deadSopenharmony_ci all uniform blocks, including the default, and treat them 30915bd8deadSopenharmony_ci similarly. 30925bd8deadSopenharmony_ci 30935bd8deadSopenharmony_ci On the other hand, it's a little weird since the default 30945bd8deadSopenharmony_ci partition can not be used with a buffer object. On the third hand, 30955bd8deadSopenharmony_ci maybe some day we will allow that. 30965bd8deadSopenharmony_ci 30975bd8deadSopenharmony_ci As a side note, if we go with a name, should it be "", or 30985bd8deadSopenharmony_ci perhaps "gl_DefaultUniformBlock" or something like that. 30995bd8deadSopenharmony_ci 31005bd8deadSopenharmony_ci RESOLUTION: Resolved, do not reserve block number 0 for the default 31015bd8deadSopenharmony_ci uniform block. The default uniform block no longer needs a name. 31025bd8deadSopenharmony_ci If the uniform block index is queried for a uniform that is associated 31035bd8deadSopenharmony_ci with the default uniform block, -1 is returned. 31045bd8deadSopenharmony_ci 31055bd8deadSopenharmony_ci 31065bd8deadSopenharmony_ci (52) The current extension spec seems to specify "uint" indices, but 31075bd8deadSopenharmony_ci the values in the queries such as GetActiveUniformBlockiv are 31085bd8deadSopenharmony_ci returned as "int" values. Should we fix this? 31095bd8deadSopenharmony_ci 31105bd8deadSopenharmony_ci Need to double check the APIs to see if we'd have to duplicate 31115bd8deadSopenharmony_ci some or all of the queries to make them type safe for signed vs. 31125bd8deadSopenharmony_ci unsigned ints. 31135bd8deadSopenharmony_ci 31145bd8deadSopenharmony_ci RESOLUTION: resolved, No. There are a few other places in the GL 31155bd8deadSopenharmony_ci query APIs that already suffer from this problem. 31165bd8deadSopenharmony_ci 31175bd8deadSopenharmony_ci 31185bd8deadSopenharmony_ci (53) What are the UNIFORM_BLOCK_REFERENCED_BY_*_SHADER queries used 31195bd8deadSopenharmony_ci for? 31205bd8deadSopenharmony_ci 31215bd8deadSopenharmony_ci The total number of uniform blocks in each stage may be subject 31225bd8deadSopenharmony_ci to a per-stage limit on some implementations. These queries 31235bd8deadSopenharmony_ci allow the user to query the program's uniform blocks to see 31245bd8deadSopenharmony_ci which are used for each stage. 31255bd8deadSopenharmony_ci 31265bd8deadSopenharmony_ci RESOLUTION: resolved 31275bd8deadSopenharmony_ci 31285bd8deadSopenharmony_ci (54) How do the APIs that use uniform locations relate to the 31295bd8deadSopenharmony_ci uniforms in named uniform blocks? And how do the APIs 31305bd8deadSopenharmony_ci introduced by this extension relate to uniforms in the default 31315bd8deadSopenharmony_ci uniform block? 31325bd8deadSopenharmony_ci 31335bd8deadSopenharmony_ci Basically, locations can't be used with uniforms in a uniform 31345bd8deadSopenharmony_ci block, so that rules out any queries that require locations. 31355bd8deadSopenharmony_ci 31365bd8deadSopenharmony_ci However, the query APIs introduced by this extension can be used 31375bd8deadSopenharmony_ci with all uniforms, including those in a default uniform block. 31385bd8deadSopenharmony_ci 31395bd8deadSopenharmony_ci RESOLUTION: resolved 31405bd8deadSopenharmony_ci 31415bd8deadSopenharmony_ci (55) Should we use the BindBufferBase/BindBufferRange APIs that were 31425bd8deadSopenharmony_ci introduced in GL 3.0 instead of BindUniformBuffer? 31435bd8deadSopenharmony_ci 31445bd8deadSopenharmony_ci As defined, they'd work fine. 31455bd8deadSopenharmony_ci 31465bd8deadSopenharmony_ci One side issue: should the "offset" be part of the context binding? 31475bd8deadSopenharmony_ci or should the uniform blocks get to each select their own 31485bd8deadSopenharmony_ci offset within a single context binding? 31495bd8deadSopenharmony_ci 31505bd8deadSopenharmony_ci If implementations can support the latter, it may allow 31515bd8deadSopenharmony_ci applications to get by with fewer context bindings. 31525bd8deadSopenharmony_ci 31535bd8deadSopenharmony_ci If not, then we should replace BindUniformBuffer with 31545bd8deadSopenharmony_ci these routines, but for the 2.0 extension version we'd still 31555bd8deadSopenharmony_ci need to add those routines and duplicate their spec language 31565bd8deadSopenharmony_ci in this spec. 31575bd8deadSopenharmony_ci 31585bd8deadSopenharmony_ci See issue 42 for the resolution of this side issue. 31595bd8deadSopenharmony_ci 31605bd8deadSopenharmony_ci RESOLUTION: resolved, yes we should use BindBufferBase/Range. 31615bd8deadSopenharmony_ci 31625bd8deadSopenharmony_ci 31635bd8deadSopenharmony_ci (56) Can a mapping from uniform block to uniform buffer object be 31645bd8deadSopenharmony_ci queried? 31655bd8deadSopenharmony_ci 31665bd8deadSopenharmony_ci On one hand, it seems like GetActiveUniformBlock could handle 31675bd8deadSopenharmony_ci it. 31685bd8deadSopenharmony_ci 31695bd8deadSopenharmony_ci On the other hand, this linking is indirect: a uniform block 31705bd8deadSopenharmony_ci selects a binding point, and a binding point binds a UBO. The GL 31715bd8deadSopenharmony_ci *could* do the indirect lookup for you, but the data would only be 31725bd8deadSopenharmony_ci valid until you changed the unit binding, so it's a little fragile 31735bd8deadSopenharmony_ci for the implementation to provide this query. 31745bd8deadSopenharmony_ci 31755bd8deadSopenharmony_ci RESOLUTION: Resolved, not needed, the user can do this. 31765bd8deadSopenharmony_ci 31775bd8deadSopenharmony_ci 31785bd8deadSopenharmony_ci (57) Should we have MAX_UNIFORM_BUFFER_SIZE or a max size on 31795bd8deadSopenharmony_ci uniform block data instead? 31805bd8deadSopenharmony_ci 31815bd8deadSopenharmony_ci The uniform buffer could be larger than the amount of uniform 31825bd8deadSopenharmony_ci block(s) data inside it. 31835bd8deadSopenharmony_ci 31845bd8deadSopenharmony_ci Also see issue (36). 31855bd8deadSopenharmony_ci 31865bd8deadSopenharmony_ci RESOLUTION: Resolved, name is MAX_UNIFORM_BLOCK_SIZE. 31875bd8deadSopenharmony_ci 31885bd8deadSopenharmony_ci 31895bd8deadSopenharmony_ci (58) Is there any expectation that uniforms stay in the order 31905bd8deadSopenharmony_ci declared for the packed/shared layouts? 31915bd8deadSopenharmony_ci 31925bd8deadSopenharmony_ci This might make sharing easier, but is not clear if it's 31935bd8deadSopenharmony_ci worth it / overly constraining. 31945bd8deadSopenharmony_ci 31955bd8deadSopenharmony_ci RESOLUTION: resolved, yes, names/types must retain declaration order 31965bd8deadSopenharmony_ci 31975bd8deadSopenharmony_ci 31985bd8deadSopenharmony_ci (59) Do we need the glsl syntax for declaring arrays of uniform 31995bd8deadSopenharmony_ci blocks? 32005bd8deadSopenharmony_ci 32015bd8deadSopenharmony_ci Deferred this feature to a future extension. 32025bd8deadSopenharmony_ci 32035bd8deadSopenharmony_ci RESOLUTION, resolved 32045bd8deadSopenharmony_ci 32055bd8deadSopenharmony_ci 32065bd8deadSopenharmony_ci (60) When using this extension with OpenGL 2.1/3.0, do we require 32075bd8deadSopenharmony_ci that uniform buffer object names must be generated with glGenBuffers 32085bd8deadSopenharmony_ci to be used with these new entry points? 32095bd8deadSopenharmony_ci 32105bd8deadSopenharmony_ci For OpenGL 3.1 core, there is a blanket requirement to call glGen 32115bd8deadSopenharmony_ci for object names. 32125bd8deadSopenharmony_ci 32135bd8deadSopenharmony_ci For OpenGL 2.x, there is not a requirement to call glGen but in 32145bd8deadSopenharmony_ci 3.0, user-generated names have been deprecated. 32155bd8deadSopenharmony_ci 32165bd8deadSopenharmony_ci For 3.0, we added two new object types (FBO/VAO) that 32175bd8deadSopenharmony_ci required the user to call glGen, but existing object types 32185bd8deadSopenharmony_ci (textures/renderbuffers/buffer objects) could be used 32195bd8deadSopenharmony_ci without calling glGen. 32205bd8deadSopenharmony_ci 32215bd8deadSopenharmony_ci We need to decide what to do with this when exporting 32225bd8deadSopenharmony_ci this extension on 2.1 and 3.0. 32235bd8deadSopenharmony_ci 32245bd8deadSopenharmony_ci RESOLUTION: Resolved, this extension does not govern the creation of 32255bd8deadSopenharmony_ci buffer objects. That's done by BindBuffer, which is not altered 32265bd8deadSopenharmony_ci by this spec, so on 2.1 and 3.0 you'd be able to use any name, 32275bd8deadSopenharmony_ci whereas on 3.1 you'd be required to call GenBuffers. 32285bd8deadSopenharmony_ci 32295bd8deadSopenharmony_ci 32305bd8deadSopenharmony_ci (61) Do we need "instance name" syntax? 32315bd8deadSopenharmony_ci 32325bd8deadSopenharmony_ci RESOLUTION: resolved, deferred for now 32335bd8deadSopenharmony_ci 32345bd8deadSopenharmony_ci 32355bd8deadSopenharmony_ci (62) Why don't the new tokens and entry points in this extension have 32365bd8deadSopenharmony_ci "ARB" suffixes like other ARB extensions? 32375bd8deadSopenharmony_ci 32385bd8deadSopenharmony_ci RESOLVED: Unlike a normal ARB extension, this is a strict subset 32395bd8deadSopenharmony_ci of functionality already approved in OpenGL 3.1. This extension 32405bd8deadSopenharmony_ci exists only to support that functionality on older hardware that 32415bd8deadSopenharmony_ci cannot implement a full OpenGL 3.1 driver. Since there are no 32425bd8deadSopenharmony_ci possible behavior changes between the ARB extension and core 32435bd8deadSopenharmony_ci features, source code compatibility is improved by not using 32445bd8deadSopenharmony_ci suffixes on the extension. 32455bd8deadSopenharmony_ci 32465bd8deadSopenharmony_ci 32475bd8deadSopenharmony_ci (63) Should we introduce a query of a program's longest uniform name length, 32485bd8deadSopenharmony_ci similar to the ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH query of a 32495bd8deadSopenharmony_ci program's longest uniform block name? 32505bd8deadSopenharmony_ci 32515bd8deadSopenharmony_ci RESOLUTION: Resolved, no. ACTIVE_UNIFORM_MAX_LENGTH serves this purpose 32525bd8deadSopenharmony_ci well enough. No great need for a per uniform block query of the same. 32535bd8deadSopenharmony_ci 32545bd8deadSopenharmony_ci 32555bd8deadSopenharmony_ci (64) What should the UNIFORM_OFFSET query return for uniforms that 32565bd8deadSopenharmony_ci are associated with the default uniform block? Same for strides? 32575bd8deadSopenharmony_ci 32585bd8deadSopenharmony_ci RESOLUTION: Resolved, spec'd to return -1 in these cases. 32595bd8deadSopenharmony_ci 32605bd8deadSopenharmony_ci 32615bd8deadSopenharmony_ci (65) Should we add queries for the base offset and size of the uniform 32625bd8deadSopenharmony_ci buffer bound to a binding point? What should the names be? 32635bd8deadSopenharmony_ci 32645bd8deadSopenharmony_ci DISCUSSION: This would be analogous to the similar transform feedback 32655bd8deadSopenharmony_ci queries. Names could be UNIFORM_BUFFER_START and UNIFORM_BUFFER_SIZE. 32665bd8deadSopenharmony_ci 32675bd8deadSopenharmony_ci RESOLUTION: Resolved, yes. 32685bd8deadSopenharmony_ci 32695bd8deadSopenharmony_ci 32705bd8deadSopenharmony_ci (66) Should we provide some mechanism allow applications to annotate their 32715bd8deadSopenharmony_ci uniform declarations to specify an offset by hand? Direct3D 10 does. An 32725bd8deadSopenharmony_ci example of the D3D syntax: 32735bd8deadSopenharmony_ci 32745bd8deadSopenharmony_ci cbuffer D3DExample { 32755bd8deadSopenharmony_ci float4 a : packoffset(c0); // bytes 0-15 32765bd8deadSopenharmony_ci float3 b : packoffset(c16); // bytes 256-267 (c0-c15 are all vec4s) 32775bd8deadSopenharmony_ci float1 c : packoffset(c1.y); // bytes 20-23 32785bd8deadSopenharmony_ci } 32795bd8deadSopenharmony_ci 32805bd8deadSopenharmony_ci If so, how would we handle a mixed declaration that includes some 32815bd8deadSopenharmony_ci uniforms with annotations and others without? 32825bd8deadSopenharmony_ci 32835bd8deadSopenharmony_ci RESOLVED: An annotation mechanism would be useful for fine-grained 32845bd8deadSopenharmony_ci application control, but we will defer this. 32855bd8deadSopenharmony_ci 32865bd8deadSopenharmony_ci 32875bd8deadSopenharmony_ci (67) Should we provide a mechanism to expose both row-major and column-major 32885bd8deadSopenharmony_ci storage of matrices? 32895bd8deadSopenharmony_ci 32905bd8deadSopenharmony_ci If no controls are provided in GLSL 1.40, the default resolution for the 32915bd8deadSopenharmony_ci UBO layout documentation would be to treat all matrices as column-major. 32925bd8deadSopenharmony_ci We will also need to pick a default orientation for matrices with that 32935bd8deadSopenharmony_ci use no GLSL language mechanism to declare orientation. 32945bd8deadSopenharmony_ci 32955bd8deadSopenharmony_ci Either way, the UBO GL API should provide a GetActiveUniform query to 32965bd8deadSopenharmony_ci determine if an active matrix is stored in row- or column-major order. 32975bd8deadSopenharmony_ci 32985bd8deadSopenharmony_ci RECOMMENDATION: Provide a should have a type modifier for matrix 32995bd8deadSopenharmony_ci declarations, for example: 33005bd8deadSopenharmony_ci 33015bd8deadSopenharmony_ci row_major mat4 matrix1; 33025bd8deadSopenharmony_ci column_major mat4 matrix2; 33035bd8deadSopenharmony_ci 33045bd8deadSopenharmony_ci It may be desirable to have a global control (e.g., a #pragma) to 33055bd8deadSopenharmony_ci specify that all matrices are row- or column-major. 33065bd8deadSopenharmony_ci 33075bd8deadSopenharmony_ci RESOLVED: Yes, we should provide this control. It is now available 33085bd8deadSopenharmony_ci in the form of uniform block layout qualifiers. The identifiers 33095bd8deadSopenharmony_ci "row_major" and "column_major" are allowed, with the latter serving as 33105bd8deadSopenharmony_ci the initial default. These qualifiers can be specified on a per- 33115bd8deadSopenharmony_ci matrix basis, a per-uniform block basis (affecting all matrices within 33125bd8deadSopenharmony_ci the uniform block that have unspecified orders), or globally. In the 33135bd8deadSopenharmony_ci latter case, all subsequent matrices with unspecified order will adopt 33145bd8deadSopenharmony_ci a new default order. 33155bd8deadSopenharmony_ci 33165bd8deadSopenharmony_ci 33175bd8deadSopenharmony_ci (68) Should the buffer layout be expressed in terms of standard GL types? 33185bd8deadSopenharmony_ci For example, should the storage for a "vec3" be equivalent to "GLfloat [3]"? 33195bd8deadSopenharmony_ci 33205bd8deadSopenharmony_ci RESOLVED: Yes. One other alternative would be to specify exact type 33215bd8deadSopenharmony_ci (e.g., "32-bit floats using IEEE 754 encoding", "32-bit two's complement 33225bd8deadSopenharmony_ci integers", etc...). These choices will be roughly equivalent in 33235bd8deadSopenharmony_ci practice, and it's probably better to use standard GL types. 33245bd8deadSopenharmony_ci 33255bd8deadSopenharmony_ci 33265bd8deadSopenharmony_ci (69) Do we need to pad the end of structures and/or arrays using the 33275bd8deadSopenharmony_ci standard packing rules? Or should we be able to squeeze data types with 33285bd8deadSopenharmony_ci small alignment requirements in the "holes" left at the end of structures or 33295bd8deadSopenharmony_ci arrays with larger alignment requirements? 33305bd8deadSopenharmony_ci 33315bd8deadSopenharmony_ci uniform ExamplePad { 33325bd8deadSopenharmony_ci // with without 33335bd8deadSopenharmony_ci // padding padding comments 33345bd8deadSopenharmony_ci // ------- ------- ------------------------ 33355bd8deadSopenharmony_ci struct { // 33365bd8deadSopenharmony_ci vec3 a; // 0..11 0..11 33375bd8deadSopenharmony_ci } b; // add 4B of padding? 33385bd8deadSopenharmony_ci float c; // 16..19 12..15 33395bd8deadSopenharmony_ci vec3 d[2]; // 32..43 16..27 align to 16B due to vec3 33405bd8deadSopenharmony_ci // 48..59 32..43 add 4B of padding? 33415bd8deadSopenharmony_ci float e; // 64..67 44..47 33425bd8deadSopenharmony_ci struct { // align to 16B due to <f> 33435bd8deadSopenharmony_ci vec4 f; // 80..95 48..63 33445bd8deadSopenharmony_ci ivec2 g; // 96..103 64..71 33455bd8deadSopenharmony_ci } h; // add 8B of padding? 33465bd8deadSopenharmony_ci uint i; // 112..115 72..75 33475bd8deadSopenharmony_ci } 33485bd8deadSopenharmony_ci 33495bd8deadSopenharmony_ci The strongest argument against padding is compactness. 33505bd8deadSopenharmony_ci 33515bd8deadSopenharmony_ci The strongest argument in favor of padding is to have a structure 33525bd8deadSopenharmony_ci definition that can be matched with a similar structure definition in 33535bd8deadSopenharmony_ci application code. For example, consider the following GLSL code: 33545bd8deadSopenharmony_ci 33555bd8deadSopenharmony_ci uniform Example { 33565bd8deadSopenharmony_ci vec3 a[10]; 33575bd8deadSopenharmony_ci float b; 33585bd8deadSopenharmony_ci }; 33595bd8deadSopenharmony_ci 33605bd8deadSopenharmony_ci The standard layout rules suggest that the vec3 members of "a" are 33615bd8deadSopenharmony_ci effectively padded out to vec4's in the array; so the natural C structure 33625bd8deadSopenharmony_ci would look like: 33635bd8deadSopenharmony_ci 33645bd8deadSopenharmony_ci typedef struct { float x, y, z, pad; } vec3InArray; 33655bd8deadSopenharmony_ci struct Example { 33665bd8deadSopenharmony_ci vec3InArray a[10]; 33675bd8deadSopenharmony_ci float b; 33685bd8deadSopenharmony_ci } 33695bd8deadSopenharmony_ci 33705bd8deadSopenharmony_ci The problem is that without padding the end of arrays, the uniform "b" 33715bd8deadSopenharmony_ci will be stored immediately after the last float in a[9], but with the C 33725bd8deadSopenharmony_ci structure, that word will be consumed by a[9].pad, and "b" will be stored 33735bd8deadSopenharmony_ci one word following. 33745bd8deadSopenharmony_ci 33755bd8deadSopenharmony_ci A similar issue arises with structures; common C compilers seem to pad the 33765bd8deadSopenharmony_ci end of structures to the largest alignment of the atomic types used in the 33775bd8deadSopenharmony_ci structure. For example, if you have: 33785bd8deadSopenharmony_ci 33795bd8deadSopenharmony_ci struct { 33805bd8deadSopenharmony_ci double a; 33815bd8deadSopenharmony_ci char b; 33825bd8deadSopenharmony_ci } c; 33835bd8deadSopenharmony_ci 33845bd8deadSopenharmony_ci common compilers will generate code where sizeof(c)==16. We are 33855bd8deadSopenharmony_ci effectively treating vectors and matrices as atomic types, so it seems to 33865bd8deadSopenharmony_ci make sense that for GLSL code like: 33875bd8deadSopenharmony_ci 33885bd8deadSopenharmony_ci struct { 33895bd8deadSopenharmony_ci vec4 a; 33905bd8deadSopenharmony_ci float b; 33915bd8deadSopenharmony_ci } c; 33925bd8deadSopenharmony_ci 33935bd8deadSopenharmony_ci it would follow that sizeof(c)==32. 33945bd8deadSopenharmony_ci 33955bd8deadSopenharmony_ci RESOLVED: Yes, we need to pad in support of the reasons above. 33965bd8deadSopenharmony_ci 33975bd8deadSopenharmony_ci 33985bd8deadSopenharmony_ci (70) Should "bool" data types be represented as 8-bit quantities (a la 33995bd8deadSopenharmony_ci GLboolean in most gl.h versions) or 32-bit? 34005bd8deadSopenharmony_ci 34015bd8deadSopenharmony_ci RESOLVED: Use 32-bit integers. 34025bd8deadSopenharmony_ci 34035bd8deadSopenharmony_ci Using GLboolean (8-bit) would be the closest match to the API types, but 34045bd8deadSopenharmony_ci some implementations of this standard may prefer 32-bit integers at this 34055bd8deadSopenharmony_ci point. We don't expect uniform blocks to contain enough bool-typed data 34065bd8deadSopenharmony_ci where the wasted storage matters significantly. 34075bd8deadSopenharmony_ci 34085bd8deadSopenharmony_ci One other option considered was to have an implementation-dependent 34095bd8deadSopenharmony_ci representation, which could be queried, but requiring applications to 34105bd8deadSopenharmony_ci query and handle multiple basic data types seemed cumbersome. Even if 34115bd8deadSopenharmony_ci we did this, we would still want to have a single representation for a 34125bd8deadSopenharmony_ci fully-defined "std140" packing, at least. 34135bd8deadSopenharmony_ci 34145bd8deadSopenharmony_ci 34155bd8deadSopenharmony_ci (71) What happens we are using indirect rendering where the data types used 34165bd8deadSopenharmony_ci by the client and server differ, due to endianness or some other issues 34175bd8deadSopenharmony_ci related to basic data type? What happens if the processor running the GLSL 34185bd8deadSopenharmony_ci executable uses different data type representations than the application? 34195bd8deadSopenharmony_ci 34205bd8deadSopenharmony_ci DUPLICATE of issue (49) 34215bd8deadSopenharmony_ci 34225bd8deadSopenharmony_ci 34235bd8deadSopenharmony_ci (72) What parameters should we provide for querying the layout of matrices 34245bd8deadSopenharmony_ci (and arrays of matrices) in memory? 34255bd8deadSopenharmony_ci 34265bd8deadSopenharmony_ci RESOLVED: We expect that matrices will be stored as an array of column 34275bd8deadSopenharmony_ci vectors or row vectors. There are two possibly independent strides: 34285bd8deadSopenharmony_ci 34295bd8deadSopenharmony_ci - bytes between columns/rows within a single matrix 34305bd8deadSopenharmony_ci - bytes between matrices within an array of matrices 34315bd8deadSopenharmony_ci 34325bd8deadSopenharmony_ci The GetActiveUniform*() API for UBO will provide queries for both 34335bd8deadSopenharmony_ci strides. 34345bd8deadSopenharmony_ci 34355bd8deadSopenharmony_ci For single matrices, the stride between columns/rows is the only 34365bd8deadSopenharmony_ci parameter. Some implementations may provide tightly packed matrices, 34375bd8deadSopenharmony_ci where a 3x3 column-major matrix might be represented with 9 consecutive 34385bd8deadSopenharmony_ci floats with a 12-byte (3-float) stride between columns. Others, such as 34395bd8deadSopenharmony_ci the "std140" packing above represents such a matrix as an array of 3 34405bd8deadSopenharmony_ci column or row vectors, but pads each row/column for a 16-byte (4-float) 34415bd8deadSopenharmony_ci stride. 34425bd8deadSopenharmony_ci 34435bd8deadSopenharmony_ci For arrays of matrices, two queries would be needed for maximum 34445bd8deadSopenharmony_ci flexibility. For example, a hypothetical implementation might pack 3x3 34455bd8deadSopenharmony_ci arrays tightly as 9 floats, but require that each array in the matrix be 34465bd8deadSopenharmony_ci aligned on a 16-byte boundary. This would have a column stride of 12B, 34475bd8deadSopenharmony_ci but would require a matrix stride of 48B, not 3*12=36B. If we didn't 34485bd8deadSopenharmony_ci care about such implementations, an alternate approach would be to 34495bd8deadSopenharmony_ci treat an array of N column-major matrices with C columns as though it 34505bd8deadSopenharmony_ci were an array of N*C column vectors, as in the std140 layout. The 34515bd8deadSopenharmony_ci stride between matrices would be derived from the stride between 34525bd8deadSopenharmony_ci columns. 34535bd8deadSopenharmony_ci 34545bd8deadSopenharmony_ci Providing multiple queries seems like the safest choice, and doesn't 34555bd8deadSopenharmony_ci have any significant down-side. The first stride query, between major 34565bd8deadSopenharmony_ci vectors of a matrix, is UNIFORM_MATRIX_STRIDE. The latter query is 34575bd8deadSopenharmony_ci actually the same UNIFORM_ARRAY_STRIDE query used for any type of 34585bd8deadSopenharmony_ci array element. 34595bd8deadSopenharmony_ci 34605bd8deadSopenharmony_ci 34615bd8deadSopenharmony_ci (73) Should GetActiveUniform allow you to query if a matrix is column- or 34625bd8deadSopenharmony_ci row-major, so an app can determine the layout without knowing how the 34635bd8deadSopenharmony_ci matrix is declared in the shader? 34645bd8deadSopenharmony_ci 34655bd8deadSopenharmony_ci RESOLVED: Yes, UNIFORM_IS_ROW_MAJOR. 34665bd8deadSopenharmony_ci 34675bd8deadSopenharmony_ci 34685bd8deadSopenharmony_ci (74) What's language mechanism should be used for opting into standard 34695bd8deadSopenharmony_ci layout? 34705bd8deadSopenharmony_ci 34715bd8deadSopenharmony_ci At the January 2009 F2F, it was recommended to specify a per-uniform 34725bd8deadSopenharmony_ci block layout via a language mechanism such as: 34735bd8deadSopenharmony_ci 34745bd8deadSopenharmony_ci layout(<identifier>) uniform { 34755bd8deadSopenharmony_ci ... 34765bd8deadSopenharmony_ci }; 34775bd8deadSopenharmony_ci 34785bd8deadSopenharmony_ci where <identifier> must be "std140" in the current standard. Future 34795bd8deadSopenharmony_ci extensions and core versions could define additional identifiers (such 34805bd8deadSopenharmony_ci as "std140novec4"). The mechanism could be further extended to 34815bd8deadSopenharmony_ci include an identifier list if there is ever a need for very fine-grained 34825bd8deadSopenharmony_ci control. 34835bd8deadSopenharmony_ci 34845bd8deadSopenharmony_ci There appears to be a strong desire for a global mechanism that doesn't 34855bd8deadSopenharmony_ci require individually annotating each and every uniform block. Options 34865bd8deadSopenharmony_ci considered include the #pragma described above and a GL API call that 34875bd8deadSopenharmony_ci might set a "compiler flag" such as: 34885bd8deadSopenharmony_ci 34895bd8deadSopenharmony_ci glProgramParameteri(program, GL_UNIFORM_BLOCK_LAYOUT, GL_LAYOUT_STD140); 34905bd8deadSopenharmony_ci 34915bd8deadSopenharmony_ci It was noted that the GL API call, since implementations are permitted 34925bd8deadSopenharmony_ci to do some or most code generation during glCompileShader(), where a 34935bd8deadSopenharmony_ci program parameter would not be available. A similar shader parameter 34945bd8deadSopenharmony_ci call could conceivably be provided. 34955bd8deadSopenharmony_ci 34965bd8deadSopenharmony_ci RESOLVED: We've adopted a layout qualifier construct which can be used 34975bd8deadSopenharmony_ci to specify the "std140" standard layout either within a uniform block 34985bd8deadSopenharmony_ci declaration or at global scope, affecting all subsequently declared 34995bd8deadSopenharmony_ci uniform blocks with unspecified layout. 35005bd8deadSopenharmony_ci 35015bd8deadSopenharmony_ci (75) What is the story behind the "std140" packing, and the possible 35025bd8deadSopenharmony_ci "std140vec4" alternative? 35035bd8deadSopenharmony_ci 35045bd8deadSopenharmony_ci RESOLVED: The "std140" packing is intended to provide a common 35055bd8deadSopenharmony_ci device-independent layout for uniform blocks that can be supported by 35065bd8deadSopenharmony_ci all OpenGL 3.1-capable GPUs. Applications using this packing do not 35075bd8deadSopenharmony_ci need to query the offsets and strides of all its uniforms and can rely 35085bd8deadSopenharmony_ci on the same packing being used on all OpenGL 3.1 implementations. 35095bd8deadSopenharmony_ci 35105bd8deadSopenharmony_ci While some implementations may be able to support a more space-efficient 35115bd8deadSopenharmony_ci packing, "std140" does not attempt to provide any features not available 35125bd8deadSopenharmony_ci on all platforms. Some of the limitations baked into this packing 35135bd8deadSopenharmony_ci include: 35145bd8deadSopenharmony_ci 35155bd8deadSopenharmony_ci * scalars need to be size-aligned; 35165bd8deadSopenharmony_ci 35175bd8deadSopenharmony_ci * vectors are treated as atomic units, and need to be vector-size- 35185bd8deadSopenharmony_ci aligned; 35195bd8deadSopenharmony_ci 35205bd8deadSopenharmony_ci * array elements and structures are aligned/padded to 16-byte 35215bd8deadSopenharmony_ci boundaries 35225bd8deadSopenharmony_ci 35235bd8deadSopenharmony_ci The array/structure restriction is because some implementations treat 35245bd8deadSopenharmony_ci uniform buffers as arrays of four-component vectors and may not be able 35255bd8deadSopenharmony_ci to efficiently perform indexed array access with strides less than 16 35265bd8deadSopenharmony_ci bytes. 35275bd8deadSopenharmony_ci 35285bd8deadSopenharmony_ci The "std140novec4" alternate packing illustrates an alternate approach 35295bd8deadSopenharmony_ci without required 16-byte alignment that might be exposed as a future 35305bd8deadSopenharmony_ci vendor extension. 35315bd8deadSopenharmony_ci 35325bd8deadSopenharmony_ci Future versions of OpenGL/GLSL may choose to provide additional sets of 35335bd8deadSopenharmony_ci canonical packing rules that may end up being more compact. 35345bd8deadSopenharmony_ci 35355bd8deadSopenharmony_ci (76) When using the standard layout, how is UNIFORM_BLOCK_DATA_SIZE 35365bd8deadSopenharmony_ci determined? 35375bd8deadSopenharmony_ci 35385bd8deadSopenharmony_ci RESOLVED: The data size returned by the query is derived by taking the 35395bd8deadSopenharmony_ci next free byte after all uniform block members (including any specified 35405bd8deadSopenharmony_ci end-of-array or end-of-structure padding) and rounding up to the next 35415bd8deadSopenharmony_ci vec4 boundary. It would be equivalent to the offset of a hypothetical 35425bd8deadSopenharmony_ci vec4 member added to the end of the uniform block. 35435bd8deadSopenharmony_ci 35445bd8deadSopenharmony_ci There is no implementation-dependent padding of the uniform block data 35455bd8deadSopenharmony_ci size when using the standard layout. 35465bd8deadSopenharmony_ci 35475bd8deadSopenharmony_ci 35485bd8deadSopenharmony_ciRevision History 35495bd8deadSopenharmony_ci 35505bd8deadSopenharmony_ci (v68, 2015-06-23, srahman) 35515bd8deadSopenharmony_ci - Add GLX protocol specification. 35525bd8deadSopenharmony_ci 35535bd8deadSopenharmony_ci (v67, 2013-08-17, jon) 35545bd8deadSopenharmony_ci - Add extra 'const' qualifier for GetUniformIndices <uniformNames> 35555bd8deadSopenharmony_ci argument (Bug 10703). 35565bd8deadSopenharmony_ci 35575bd8deadSopenharmony_ci (v66, 2012-09-17, jon) 35585bd8deadSopenharmony_ci - Remove _EXT suffix from GL_UNIFORM_BUFFER_EXT in sample code (Bug 35595bd8deadSopenharmony_ci 7948). 35605bd8deadSopenharmony_ci 35615bd8deadSopenharmony_ci (v65, 2012-06-28, jon) 35625bd8deadSopenharmony_ci - Remove INVALID_VALUE error for BindBufferRange when specifying a 35635bd8deadSopenharmony_ci range beyond the current end of buffer. Define BindBufferBase as 35645bd8deadSopenharmony_ci specifying a range as large as the actual buffer size at time of 35655bd8deadSopenharmony_ci use, and return zero when querying the buffer size as a sentinel 35665bd8deadSopenharmony_ci value for the buffer size indicating this behavior. Specify that 35675bd8deadSopenharmony_ci the GL will never read from or write to beyond the end of a bound 35685bd8deadSopenharmony_ci buffer (Bugs 7318 and 7329, matching OpenGL 4.2 core spec 35695bd8deadSopenharmony_ci behavior). Remove dangling references to nonexistent 35705bd8deadSopenharmony_ci BindBufferOffset. 35715bd8deadSopenharmony_ci 35725bd8deadSopenharmony_ci (v64, 2011-01-27, jon) 35735bd8deadSopenharmony_ci - Change return value for start/size queries when no buffer 35745bd8deadSopenharmony_ci bound from -1 to zero, to match state tables (Bug 7318). 35755bd8deadSopenharmony_ci 35765bd8deadSopenharmony_ci (v63, 2011-01-21, pbrown) 35775bd8deadSopenharmony_ci - Add interaction with ARB_geometry_shader4 to indicate that 35785bd8deadSopenharmony_ci MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS is defined there. 35795bd8deadSopenharmony_ci 35805bd8deadSopenharmony_ci (v62, 2009-03-26, jon) 35815bd8deadSopenharmony_ci - Remove ARB suffixes for consistency with other extensions 35825bd8deadSopenharmony_ci simultaneously introduced with new GL core features, intended 35835bd8deadSopenharmony_ci to enable those features in older drivers. 35845bd8deadSopenharmony_ci 35855bd8deadSopenharmony_ci (v61, 2009-02-16, benj) 35865bd8deadSopenharmony_ci - pickup latest changes to GLSL language 35875bd8deadSopenharmony_ci 35885bd8deadSopenharmony_ci (v60, 2009-02-12, benj) 35895bd8deadSopenharmony_ci - revert the change to silently ignore INVALID_INDEX_ARB within 35905bd8deadSopenharmony_ci <uniformIndices> passed to GetActiveUniformsivARB 35915bd8deadSopenharmony_ci - picked up a few proposed language changes from Pat 35925bd8deadSopenharmony_ci - updated table 2.utype to include types from extensions 35935bd8deadSopenharmony_ci - added interactions for these extension types 35945bd8deadSopenharmony_ci - fixed issue (40) resolution 35955bd8deadSopenharmony_ci 35965bd8deadSopenharmony_ci (v59, 2009-02-12, benj) 35975bd8deadSopenharmony_ci - remove INVALID_OPERATION error when <program> has not been linked, 35985bd8deadSopenharmony_ci and instead just behave appropriately for the case where there are 35995bd8deadSopenharmony_ci no active uniforms or uniform blocks 36005bd8deadSopenharmony_ci - added GL 3.0 interaction regarding description of uniform 36015bd8deadSopenharmony_ci initialization, which is limited to uniforms in the default block 36025bd8deadSopenharmony_ci 36035bd8deadSopenharmony_ci (v58, 2009-02-11, jon) 36045bd8deadSopenharmony_ci - Add some more comments. 36055bd8deadSopenharmony_ci 36065bd8deadSopenharmony_ci (v57, 2009-02-11, benj) 36075bd8deadSopenharmony_ci - restore 80-column width 36085bd8deadSopenharmony_ci - change _STAGE to _SHADER in UNIFORM_BLOCK_REFERENCED_BY token names 36095bd8deadSopenharmony_ci - silently ignore INVALID_INDEX_ARB in GetActiveUniformsivARB 36105bd8deadSopenharmony_ci - clarify that matrices in the default uniform block return 0 for 36115bd8deadSopenharmony_ci UNIFORM_IS_ROW_MAJOR 36125bd8deadSopenharmony_ci - Replace Draw* with Begin or commands that perform an implicit Begin 36135bd8deadSopenharmony_ci since the extension is written against GL 2.1 36145bd8deadSopenharmony_ci 36155bd8deadSopenharmony_ci (v56, 2009-02-11, jon) 36165bd8deadSopenharmony_ci - Accept some of Pat's edits and remove associated notes/comments. 36175bd8deadSopenharmony_ci Add my comments on some others. 36185bd8deadSopenharmony_ci 36195bd8deadSopenharmony_ci (v55, 2009-02-11, pbrown) 36205bd8deadSopenharmony_ci - Many edits attempting to make the spec read more clearly. 36215bd8deadSopenharmony_ci - Added a number of notes and issues in the spec for additional edits. 36225bd8deadSopenharmony_ci 36235bd8deadSopenharmony_ci (v54, 2009-02-11, jon) 36245bd8deadSopenharmony_ci - Note that uniform binding limits change when geometry 36255bd8deadSopenharmony_ci shaders not supported, and update uniform state variable 36265bd8deadSopenharmony_ci types. 36275bd8deadSopenharmony_ci 36285bd8deadSopenharmony_ci (v53, 2009-02-09, jon) 36295bd8deadSopenharmony_ci - Restore an error accidentally removed from GetUniformLocation 36305bd8deadSopenharmony_ci (at least, I think it was accidentaly). 36315bd8deadSopenharmony_ci 36325bd8deadSopenharmony_ci (v52, 2009-02-09, jon) 36335bd8deadSopenharmony_ci - Resolve some issues as recommended by Bruce and leave his 36345bd8deadSopenharmony_ci comments in for others Benj should look at. 36355bd8deadSopenharmony_ci - Allow undefined behavior including termination if no buffer is 36365bd8deadSopenharmony_ci bound backing a uniform block. 36375bd8deadSopenharmony_ci 36385bd8deadSopenharmony_ci (v51, 2009-02-08, jon) 36395bd8deadSopenharmony_ci - Cleanup before core spec integration: 36405bd8deadSopenharmony_ci - Change definition of INVALID_INDEX_ARB to avoid signed/unsigned 36415bd8deadSopenharmony_ci conversion questions by making it an unsigned literal (would 36425bd8deadSopenharmony_ci like to change the name too, it looks too much like an error). 36435bd8deadSopenharmony_ci - Rephrase some query language for greater consistency with core 36445bd8deadSopenharmony_ci spec. Duplicated <program> error conditions in each affected 36455bd8deadSopenharmony_ci call to avoid more state-dependent reading. 36465bd8deadSopenharmony_ci 36475bd8deadSopenharmony_ci (v50, 2009-02-08, benj) 36485bd8deadSopenharmony_ci - resolve last four issues (47), (67), (74), (76) 36495bd8deadSopenharmony_ci - update the GLSL changes for uniform blocks 36505bd8deadSopenharmony_ci - update API descriptions to refer to packed/shared/std140 layouts 36515bd8deadSopenharmony_ci - update the buffer overrun language courtesy of Bruce 36525bd8deadSopenharmony_ci - rename APPLE to ARB in the issues list 36535bd8deadSopenharmony_ci - misc. other cleanups 36545bd8deadSopenharmony_ci 36555bd8deadSopenharmony_ci (v49, 2009-02-05, benj) 36565bd8deadSopenharmony_ci - change UBO overrun language to say "undefined behavior that may lead 36575bd8deadSopenharmony_ci to GL interruption or termination" instead of just "undefined values" 36585bd8deadSopenharmony_ci - flesh out Errors section 36595bd8deadSopenharmony_ci 36605bd8deadSopenharmony_ci (v48, 2009-02-04, benj) 36615bd8deadSopenharmony_ci - add query for whether a matrix uniform is row- or column-major 36625bd8deadSopenharmony_ci - add query for the stride between a matrix uniform's major vectors 36635bd8deadSopenharmony_ci - apply one description of <program> to all uniform query commands 36645bd8deadSopenharmony_ci - update example code 36655bd8deadSopenharmony_ci 36665bd8deadSopenharmony_ci (v47, 2009-02-03, benj) 36675bd8deadSopenharmony_ci - update packing rules and examples 36685bd8deadSopenharmony_ci - standardize on "named" uniform block instead of "user-defined" 36695bd8deadSopenharmony_ci - refactor UBO spec language so it is blended with old uniform language 36705bd8deadSopenharmony_ci 36715bd8deadSopenharmony_ci (v46, 2009-02-03, benj) 36725bd8deadSopenharmony_ci - update token MAX token names re: issue (46) 36735bd8deadSopenharmony_ci - rename "uniform block unit" to "uniform buffer binding point" 36745bd8deadSopenharmony_ci - updated uniform block binding and uniform buffer binding overview 36755bd8deadSopenharmony_ci - add queries for uniform buffer start and size re: issue (65) 36765bd8deadSopenharmony_ci - resolved issues (46), (65), (69) 36775bd8deadSopenharmony_ci - incorporated many more misc. suggestions from Bruce 36785bd8deadSopenharmony_ci 36795bd8deadSopenharmony_ci (v45, 2009-02-02, benj) 36805bd8deadSopenharmony_ci - rename from APPLE to ARB 36815bd8deadSopenharmony_ci - assigned token values 36825bd8deadSopenharmony_ci - misc. suggestions from Bruce, more to come 36835bd8deadSopenharmony_ci - pull issues over from Pat's packing doc 36845bd8deadSopenharmony_ci - resolved issues (57), (60), (62), (63), (64), (65) 36855bd8deadSopenharmony_ci 36865bd8deadSopenharmony_ci (v44, 2009-01-30, benj) 36875bd8deadSopenharmony_ci - resolved issues (20), (29), (42) 36885bd8deadSopenharmony_ci - added MAX_COMBINED_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_COMPONENTS 36895bd8deadSopenharmony_ci queries with different minimum maxima for before and after GL 3.1, 36905bd8deadSopenharmony_ci resolving issue (36) 36915bd8deadSopenharmony_ci - replaced GetActiveUniformNamesAPPLE with GetActiveUniformNameAPPLE, 36925bd8deadSopenharmony_ci resolving issue (43) 36935bd8deadSopenharmony_ci - stop reserving uniform block index 0 for the default uniform block, 36945bd8deadSopenharmony_ci resolving issue (51) 36955bd8deadSopenharmony_ci - remove language saying uniform buffer range size must be aligned to 36965bd8deadSopenharmony_ci UNIFORM_BUFFER_OFFSET_ALIGNMENT 36975bd8deadSopenharmony_ci - make consistent use of "uniform block unit" instead of "uniform 36985bd8deadSopenharmony_ci buffer unit" 36995bd8deadSopenharmony_ci 37005bd8deadSopenharmony_ci (v43, 2009-01-29, benj) 37015bd8deadSopenharmony_ci - UNIFORM_BLOCK_NAME_LENGTH changed from 0 to 1 for the default 37025bd8deadSopenharmony_ci uniform block, since "" still has a null terminator 37035bd8deadSopenharmony_ci - UNIFORM_BLOCK_DATA_SIZE description updated to reflect how 37045bd8deadSopenharmony_ci offset/stride queries are unnecessary for "standard" layout 37055bd8deadSopenharmony_ci - Add language to GetUniformLocation to say that uniforms in 37065bd8deadSopenharmony_ci named uniform blocks return -1, and that Uniform* are for 37075bd8deadSopenharmony_ci loading uniforms of the default uniform block 37085bd8deadSopenharmony_ci - update discussion of issues (13), (15), (21), (34) to align with 37095bd8deadSopenharmony_ci current spec 37105bd8deadSopenharmony_ci - sanitize uniform query descriptions (both pre-existing and 37115bd8deadSopenharmony_ci new in this extension) to clarify handling of uniforms from 37125bd8deadSopenharmony_ci default uniform blocks vs. named uniform blocks, 37135bd8deadSopenharmony_ci resolving issue (54) 37145bd8deadSopenharmony_ci - rename MAX_UNIFORM_BUFFER_SIZE to MAX_UNIFORM_BLOCK_SIZE per 37155bd8deadSopenharmony_ci issue (57) 37165bd8deadSopenharmony_ci - introduce language guaranteeing order of member offsets will match 37175bd8deadSopenharmony_ci order within declaration per issue (58) 37185bd8deadSopenharmony_ci - update some section #s 37195bd8deadSopenharmony_ci 37205bd8deadSopenharmony_ci (v42, 2009-01-28, benj) 37215bd8deadSopenharmony_ci - introduce Pat's packing rules, including standard layout, 37225bd8deadSopenharmony_ci resolving issues (48), (49) 37235bd8deadSopenharmony_ci - add interactions with extensions and GL 3.0, resolving 37245bd8deadSopenharmony_ci issue (50) 37255bd8deadSopenharmony_ci - change names of MAX query names for uniform block 37265bd8deadSopenharmony_ci per-stage, combined, and binding point limits 37275bd8deadSopenharmony_ci - introduce BindBufferRange/BindBufferBase in place of 37285bd8deadSopenharmony_ci BindUniformBufferAPPLE, resolving issue (55) 37295bd8deadSopenharmony_ci - add missing query language in Chapter 6 37305bd8deadSopenharmony_ci - add missing UNIFORM_BUFFER_OFFSET_ALIGNMENT_APPLE from 37315bd8deadSopenharmony_ci state tables 37325bd8deadSopenharmony_ci - separate new state from implementation state in state tables 37335bd8deadSopenharmony_ci - remove instance-name language and arrays of uniform blocks per 37345bd8deadSopenharmony_ci resolution to issues (59), (61) 37355bd8deadSopenharmony_ci - fix minor typos and cosmetic issues 37365bd8deadSopenharmony_ci - reformat some lines to fit in 80 columns 37375bd8deadSopenharmony_ci - replace tabs with spaces 37385bd8deadSopenharmony_ci 37395bd8deadSopenharmony_ci (v41, 2009-01-25, jsandmel) 37405bd8deadSopenharmony_ci - incorporated resolutions/feedback from Portland F2F 37415bd8deadSopenharmony_ci - resolved issues (33), (39), (44), (52), (55), (56), (58), (59) 37425bd8deadSopenharmony_ci - added issue (61) 37435bd8deadSopenharmony_ci 37445bd8deadSopenharmony_ci (v40, 2009-01-25, jsandmel) 37455bd8deadSopenharmony_ci - fixed a few typos noticed by Barthold Lichtenbelt 37465bd8deadSopenharmony_ci - fixed up some white space in issues list 37475bd8deadSopenharmony_ci 37485bd8deadSopenharmony_ci (v39, 2009-01-21, jsandmel) 37495bd8deadSopenharmony_ci - fixed a few typos noticed by Daniel Koch 37505bd8deadSopenharmony_ci - added issue (60) 37515bd8deadSopenharmony_ci 37525bd8deadSopenharmony_ci 37535bd8deadSopenharmony_ci (v38, 2009-01-21, jsandmel) 37545bd8deadSopenharmony_ci - integrated feedback and questions from Bruce Merry 37555bd8deadSopenharmony_ci - fixed typo in GetUniformIndices (missing const char**) 37565bd8deadSopenharmony_ci - added length (output) parameter to GetActiveUniformBlockNameAPPLE 37575bd8deadSopenharmony_ci for symmetry with GetActiveUniform 37585bd8deadSopenharmony_ci - removed stale matrix packing queries (to be handled more generally 37595bd8deadSopenharmony_ci with rest of packing language) 37605bd8deadSopenharmony_ci - fixed wrong error language when validating <program> arguments 37615bd8deadSopenharmony_ci to be consistent with generic error language already in 37625bd8deadSopenharmony_ci GL spec 37635bd8deadSopenharmony_ci - make GetActiveUniformNamesAPPLE not write NULL to names entries 37645bd8deadSopenharmony_ci for invalid indices 37655bd8deadSopenharmony_ci - made <bufSize> validation the same as GetActiveUniform 37665bd8deadSopenharmony_ci - added issues (57), (58), (59) 37675bd8deadSopenharmony_ci 37685bd8deadSopenharmony_ci 37695bd8deadSopenharmony_ci (v37, 2009-01-19, jsandmel) 37705bd8deadSopenharmony_ci - incorporated feedback from Pat Brown 37715bd8deadSopenharmony_ci - added issues (47) - (56) 37725bd8deadSopenharmony_ci - added note to interactions section 37735bd8deadSopenharmony_ci - clarified layouts in overview section 37745bd8deadSopenharmony_ci - fixed wrong error code in GetActiveUniformBlockivAPPLE 37755bd8deadSopenharmony_ci - added additional description to parameters in 37765bd8deadSopenharmony_ci GetActiveUniformNamesAPPLE 37775bd8deadSopenharmony_ci - added note to GetActiveUniformsivAPPLE to make it more 37785bd8deadSopenharmony_ci similar to GetActiveUniform wrt to program linking and 37795bd8deadSopenharmony_ci type/size queries. 37805bd8deadSopenharmony_ci - added todo for UniformBlockBindingAPPLE to clarify over better 37815bd8deadSopenharmony_ci based on feedback from pat 37825bd8deadSopenharmony_ci - increased MAX_UNIFORM_BUFFER_SIZE_APPLE from 64 to 16k 37835bd8deadSopenharmony_ci - unresolved issue (33) re: display lists 37845bd8deadSopenharmony_ci 37855bd8deadSopenharmony_ci 37865bd8deadSopenharmony_ci (v36, 2009-01-14, jsandmel) 37875bd8deadSopenharmony_ci - added issue (48) requesting the standard layout and referred 37885bd8deadSopenharmony_ci to this in various places 37895bd8deadSopenharmony_ci - added missing UNIFORM_BLOCK_NAME_LENGTH_APPLE state variable 37905bd8deadSopenharmony_ci - corrected references of GetIndexedIntegerv with GetIntegeri_v 37915bd8deadSopenharmony_ci - fixed typo in description of UNIFORM_BLOCK_INDEX_APPLE 37925bd8deadSopenharmony_ci - clarified UNIFORM_OFFSET_APPLE description further 37935bd8deadSopenharmony_ci - clarified that several constantscan be queried with GetIntegerv 37945bd8deadSopenharmony_ci - fixed a set of stale references to "partitions" 37955bd8deadSopenharmony_ci 37965bd8deadSopenharmony_ci (v35, 2009-01-14, jdr) 37975bd8deadSopenharmony_ci - improved readability of a few areas 37985bd8deadSopenharmony_ci - fixed a data type typo 37995bd8deadSopenharmony_ci 38005bd8deadSopenharmony_ci (v34, 2009-01-12, jsandmel) 38015bd8deadSopenharmony_ci - added issue (47) and preliminary keyword support for packed, 38025bd8deadSopenharmony_ci sharable, standard layouts 38035bd8deadSopenharmony_ci 38045bd8deadSopenharmony_ci (v33, 2009-01-11, jsandmel) 38055bd8deadSopenharmony_ci - switched terminology from "partition" to "uniform block" 38065bd8deadSopenharmony_ci - switched syntax from 'active' to 'packed', and changed default 38075bd8deadSopenharmony_ci behavior 38085bd8deadSopenharmony_ci - changed lots of function names to account for the above 38095bd8deadSopenharmony_ci - cleaned up overview 38105bd8deadSopenharmony_ci - dropped language talking about "binding" for the uniform block -> 38115bd8deadSopenharmony_ci uniform block unit association, since it's not an object binding 38125bd8deadSopenharmony_ci operation 38135bd8deadSopenharmony_ci - added concept of "combined"/"logical" binding point max queries 38145bd8deadSopenharmony_ci - incorporated most recent GLSL syntax from the GLSL working group for 38155bd8deadSopenharmony_ci uniform blocks 38165bd8deadSopenharmony_ci - removed the AttachUniformBufferAPPLE for per-program bindings of UBOs 38175bd8deadSopenharmony_ci 38185bd8deadSopenharmony_ci (v32, 2008-12-08, jsandmel) 38195bd8deadSopenharmony_ci - added UNIFORM_BUFFER_OFFSET_ALIGNMENT_APPLE 38205bd8deadSopenharmony_ci 38215bd8deadSopenharmony_ci (v31, 2008-12-08, jsandmel) 38225bd8deadSopenharmony_ci - minor updates to overview (this could still use more editing). 38235bd8deadSopenharmony_ci 38245bd8deadSopenharmony_ci (v30, 2008-12-08, jsandmel) 38255bd8deadSopenharmony_ci - cleaned up function argument names for clarity 38265bd8deadSopenharmony_ci - reformatted new procedures/tokens section 38275bd8deadSopenharmony_ci - added concept of uniformBlockBinding (for context bindings) to 38285bd8deadSopenharmony_ci distinguish from uniformBlockIndex 38295bd8deadSopenharmony_ci - renamed MAX_VERTEX_UNIFORM_BUFFERS_APPLE -> 38305bd8deadSopenharmony_ci MAX_VERTEX_UNIFORM_BUFFERS_APPLE and friends. 38315bd8deadSopenharmony_ci - removed/simplified the unneeded per-stage quries for active 38325bd8deadSopenharmony_ci partitions (under assumption that partition names are global per 38335bd8deadSopenharmony_ci program) 38345bd8deadSopenharmony_ci - de-assigned apple enums for most tokens while we work out the enums 38355bd8deadSopenharmony_ci - added UNIFORM_BLOCK_REFERENCED_BY_VERTEX_STAGE_APPLE and friends 38365bd8deadSopenharmony_ci to queries of each partition 38375bd8deadSopenharmony_ci - clarified/cleaned up overview of uniform partitions 38385bd8deadSopenharmony_ci - added more detail to each of the function descriptions to clarify 38395bd8deadSopenharmony_ci how each of the arguments was to be handled 38405bd8deadSopenharmony_ci - temporarily deleted the Errors section since it was partially stale 38415bd8deadSopenharmony_ci need to add this back later 38425bd8deadSopenharmony_ci - removed stale query for UNIFORM_LOCATION_APPLE from state table 38435bd8deadSopenharmony_ci - cleaned up (most of) issues list with API changes 38445bd8deadSopenharmony_ci - removed some AMD/NV'isms from the issues language 38455bd8deadSopenharmony_ci 38465bd8deadSopenharmony_ci (v29, 2008-11-24, jsandmel) 38475bd8deadSopenharmony_ci - Added <stage> argument to query routines to indicate 38485bd8deadSopenharmony_ci vtx/geom/fragment. 38495bd8deadSopenharmony_ci - Still need to update sample code for this proposal. 38505bd8deadSopenharmony_ci - Also need to still specify how uniform scoping works (cross 38515bd8deadSopenharmony_ci stage or per stage). 38525bd8deadSopenharmony_ci - Eliminated special "INVALID_INDEX_APPLE" value since the rest 38535bd8deadSopenharmony_ci of the GLSL API uses "-1" to mean invalid index, so we use 38545bd8deadSopenharmony_ci that here too. 38555bd8deadSopenharmony_ci 38565bd8deadSopenharmony_ci (v28, 2008-10-08, jsandmel) 38575bd8deadSopenharmony_ci - Added more discussion to issue (35) regarding context vs. 38585bd8deadSopenharmony_ci program bindings of UBOs. 38595bd8deadSopenharmony_ci - Added prototypes for BindUniformBuffer API. 38605bd8deadSopenharmony_ci - Added issue (36) about maximum uniform component API. 38615bd8deadSopenharmony_ci - Integrated the proposed API for per-context bindings into 38625bd8deadSopenharmony_ci issue (35) from NVIDIA's NV_ubo proposal. 38635bd8deadSopenharmony_ci - Added issue (37) about if we need 3 values for 38645bd8deadSopenharmony_ci MAX_{VERTEX|GEOMETRY|FRAGMENT}_UNIFORM_BUFFERS_APPLE. 38655bd8deadSopenharmony_ci 38665bd8deadSopenharmony_ci (2008-10-08, jdr) Grammar additions. Re-instated piece-wise partition 38675bd8deadSopenharmony_ci definitions. Elaboration of issue 35. Addition of 36. Readability 38685bd8deadSopenharmony_ci improvements. 38695bd8deadSopenharmony_ci 38705bd8deadSopenharmony_ci (2008-10-07, jdr) 18 in previous check-in -> not true. 18 *is* in this 38715bd8deadSopenharmony_ci one. Skeltal issue for NV suggested context binding points. 38725bd8deadSopenharmony_ci 38735bd8deadSopenharmony_ci (2008-10-06, jdr) Incorporated Nick's and Matt's changes 2, 3, 4, 5, 38745bd8deadSopenharmony_ci 6, 8, 12, 14, 16, 17, and 18. 38755bd8deadSopenharmony_ci 38765bd8deadSopenharmony_ci (2008-08-27, jdr) Additions to contributer list. 38775bd8deadSopenharmony_ci 38785bd8deadSopenharmony_ci (2008-07-22, jdr) Changed buffer minimums and contributor list per 38795bd8deadSopenharmony_ci discussion with NVidia. 38805bd8deadSopenharmony_ci 38815bd8deadSopenharmony_ci (2008-06-19, jdr) Added issue 34 and language describing the decision 38825bd8deadSopenharmony_ci to use struct-like syntax for partition definitions. Added explicit 38835bd8deadSopenharmony_ci mention that AttachUniformBufferObjectAPPLE() was required after a 38845bd8deadSopenharmony_ci uniform buffer object has been modified. Fixed examples. 38855bd8deadSopenharmony_ci 38865bd8deadSopenharmony_ci (2008-03-18, jdr) Provide resolution and spec language for "active" and 38875bd8deadSopenharmony_ci "partition" resolving related issues. Appended "_object" to spec name. 38885bd8deadSopenharmony_ci Added required GLSL v1.20.8 spec language. 38895bd8deadSopenharmony_ci 38905bd8deadSopenharmony_ci (2008-03-17, jdr) Removed issue 30 as it was a misread spec. Added 38915bd8deadSopenharmony_ci resolutions for 29, 31, and 32 - made spec changes accordingly. Added 38925bd8deadSopenharmony_ci proposal for active partition demarcation and sharing rules. 38935bd8deadSopenharmony_ci 38945bd8deadSopenharmony_ci (2008-03-14, jdr) Added issues 29-34 for transform feedback, scoping the 38955bd8deadSopenharmony_ci "active" keyword, and following precedents. 38965bd8deadSopenharmony_ci 38975bd8deadSopenharmony_ci (2008-03-13, bb) Fixed incorrect error returns. 38985bd8deadSopenharmony_ci 38995bd8deadSopenharmony_ci (2008-03-13, bb) Changed the return value of GetUniformBlockIndexAPPLE to 39005bd8deadSopenharmony_ci uint. Added INVALID_INDEX. Fixed Example code 2. Cleaned up line breaks. 39015bd8deadSopenharmony_ci Cleaned up issues. Added issues 24-26. 39025bd8deadSopenharmony_ci 39035bd8deadSopenharmony_ci (2008-03-12, jdr) Added state tables and state retrieval segment. 39045bd8deadSopenharmony_ci 39055bd8deadSopenharmony_ci (2008-03-12, jdr) Rewrote advanced source example. Made a few minor fixes 39065bd8deadSopenharmony_ci and additions that writing the example illuminated. 39075bd8deadSopenharmony_ci 39085bd8deadSopenharmony_ci (2008-03-11, jdr) After considerable dialog with BB around handling of bulk 39095bd8deadSopenharmony_ci extraction of uniform meta-data, conclusions of dialog required sweeping 39105bd8deadSopenharmony_ci changes to spec. Rewrote specification updates section. Added new 39115bd8deadSopenharmony_ci tokens. Changed New Functions segment. Updated Errors segment. 39125bd8deadSopenharmony_ci Added issue 23. 39135bd8deadSopenharmony_ci 39145bd8deadSopenharmony_ci (2008-03-04, jdr) Rewrote specification updates section. Rewrote error 39155bd8deadSopenharmony_ci section. 39165bd8deadSopenharmony_ci 39175bd8deadSopenharmony_ci (2008-03-03, jdr) Rewrote overview to reflect partitioning. Re-arranged 39185bd8deadSopenharmony_ci for spec worthiness. Cleaned up new procedures functions and defined 39195bd8deadSopenharmony_ci aggregate layout function. Revised issues list to reflect partitioning, 39205bd8deadSopenharmony_ci include more recent discussions, and used current accepted vernacular. 39215bd8deadSopenharmony_ci 39225bd8deadSopenharmony_ci (2008-03-03, bb) Resolved issue 19. Changed the return value of 39235bd8deadSopenharmony_ci GetActivePartitionUniformInfoAPPLE to a void because it does not return 39245bd8deadSopenharmony_ci locations. 39255bd8deadSopenharmony_ci 39265bd8deadSopenharmony_ci (2008-03-03, jdr) Changed to namespace to partitions. Added issues 21 & 39275bd8deadSopenharmony_ci 22. Added aggregate uniform info query per partition. 39285bd8deadSopenharmony_ci 39295bd8deadSopenharmony_ci (2008-03-03, bb) Added separate partition support. Changed extension name 39305bd8deadSopenharmony_ci to APPLE_uniform_buffer. 39315bd8deadSopenharmony_ci 39325bd8deadSopenharmony_ci (2008-02-27, jdr) Dumped program arguments. Changed "types" output array 39335bd8deadSopenharmony_ci to "sizes" output array. Added expected scatter/gather logic in the 39345bd8deadSopenharmony_ci example to advocate efficient schlepping of uniform data into the buffer. 39355bd8deadSopenharmony_ci 39365bd8deadSopenharmony_ci (2008-02-26, jdr) Changes to accomodate relative offsets. Revised 39375bd8deadSopenharmony_ci example source. Error additions. Removed contact information for 39385bd8deadSopenharmony_ci contributors list. 39395bd8deadSopenharmony_ci 39405bd8deadSopenharmony_ci (2008-02-25, jdr) Added source example. 39415bd8deadSopenharmony_ci 39425bd8deadSopenharmony_ci (2008-02-21, jdr) Added to issues list, resolutions of all issues 39435bd8deadSopenharmony_ci excepting 16. Changes per meeting. Additions to procedures and 39445bd8deadSopenharmony_ci explanations. 2.1 spec integration. Implementation Dependent State. 39455bd8deadSopenharmony_ci 39465bd8deadSopenharmony_ci (2008-02-19, jdr) Added to issues list, additions to procedures and 39475bd8deadSopenharmony_ci explanations, errors. 39485bd8deadSopenharmony_ci 39495bd8deadSopenharmony_ci (2008-02-18, jdr) Added to issues list, modifications to procedures and 39505bd8deadSopenharmony_ci explanations. 39515bd8deadSopenharmony_ci 39525bd8deadSopenharmony_ci (2008-02-16, jdr) Added to issues list and procedures. 39535bd8deadSopenharmony_ci 39545bd8deadSopenharmony_ci (2008-02-15, jdr) Initial revision, overview. 3955