15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_bindable_uniform 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName String 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_bindable_uniform 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Pat Brown, NVIDIA (pbrown 'at' nvidia.com) 125bd8deadSopenharmony_ci Barthold Lichtenbelt, NVIDIA (blichtenbelt 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciStatus 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Shipping for GeForce 8 Series (November 2006) 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciVersion 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Last Modified Date: 04/04/2008 215bd8deadSopenharmony_ci Author revision: 15 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciNumber 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci 342 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciDependencies 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci OpenGL 1.1 is required. 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci This extension is written against the OpenGL 2.0 specification and version 325bd8deadSopenharmony_ci 1.10.59 of the OpenGL Shading Language specification. 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci This extension interacts with GL_EXT_geometry_shader4. 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ciOverview 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci This extension introduces the concept of bindable uniforms to the OpenGL 395bd8deadSopenharmony_ci Shading Language. A uniform variable can be declared bindable, which 405bd8deadSopenharmony_ci means that the storage for the uniform is not allocated by the 415bd8deadSopenharmony_ci compiler/linker anymore, but is backed by a buffer object. This buffer 425bd8deadSopenharmony_ci object is bound to the bindable uniform through the new command 435bd8deadSopenharmony_ci UniformBufferEXT(). Binding needs to happen after linking a program 445bd8deadSopenharmony_ci object. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci Binding different buffer objects to a bindable uniform allows an 475bd8deadSopenharmony_ci application to easily use different "uniform data sets", without having to 485bd8deadSopenharmony_ci re-specify the data every time. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci A buffer object can be bound to bindable uniforms in different program 515bd8deadSopenharmony_ci objects. If those bindable uniforms are all of the same type, accessing a 525bd8deadSopenharmony_ci bindable uniform in program object A will result in the same data if the 535bd8deadSopenharmony_ci same access is made in program object B. This provides a mechanism for 545bd8deadSopenharmony_ci 'environment uniforms', uniform values that can be shared among multiple 555bd8deadSopenharmony_ci program objects. 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciNew Procedures and Functions 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci void UniformBufferEXT(uint program, int location, uint buffer); 605bd8deadSopenharmony_ci int GetUniformBufferSizeEXT(uint program, int location); 615bd8deadSopenharmony_ci intptr GetUniformOffsetEXT(uint program, int location); 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ciNew Tokens 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 665bd8deadSopenharmony_ci and GetDoublev: 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 695bd8deadSopenharmony_ci MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 705bd8deadSopenharmony_ci MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 715bd8deadSopenharmony_ci MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED 725bd8deadSopenharmony_ci UNIFORM_BUFFER_BINDING_EXT 0x8DEF 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci Accepted by the <target> parameters of BindBuffer, BufferData, 755bd8deadSopenharmony_ci BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and 765bd8deadSopenharmony_ci GetBufferPointerv: 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci UNIFORM_BUFFER_EXT 0x8DEE 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci Modify section 2.15.3 "Shader Variables", page 75. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci Add the following paragraph between the second and third paragraph on page 855bd8deadSopenharmony_ci 79, "Uniform Variables" 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci Uniform variables can be further characterized into bindable 885bd8deadSopenharmony_ci uniforms. Storage for bindable uniforms does not come out of the, 895bd8deadSopenharmony_ci potentially limited, uniform variable storage discussed in the previous 905bd8deadSopenharmony_ci paragraph. Instead, storage for a bindable uniform is provided by a buffer 915bd8deadSopenharmony_ci object that is bound to the uniform variable. Binding different buffer 925bd8deadSopenharmony_ci objects to a bindable uniform allows an application to easily use 935bd8deadSopenharmony_ci different "uniform data sets", without having to re-specify the data every 945bd8deadSopenharmony_ci time. A buffer object can be bound to bindable uniforms in different 955bd8deadSopenharmony_ci program objects. If those bindable uniforms are all of the same type, 965bd8deadSopenharmony_ci accessing a bindable uniform in program object A will result in the same 975bd8deadSopenharmony_ci data if the same access is made in program object B. This provides a 985bd8deadSopenharmony_ci mechanism for 'environment', uniform values that can be shared among 995bd8deadSopenharmony_ci multiple program objects. 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci Change the first sentence of the third paragraph, p. 79, as follows: 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci When a program object is successfully linked, all non-bindable active 1045bd8deadSopenharmony_ci uniforms belonging to the program object are initialized to zero (FALSE 1055bd8deadSopenharmony_ci for Booleans). All active bindable uniforms have their buffer object 1065bd8deadSopenharmony_ci bindings reset to an invalid state. A successful link will also generate a 1075bd8deadSopenharmony_ci location for each active uniform, including active bindable uniforms. The 1085bd8deadSopenharmony_ci values of active uniforms can be changed using this location and the 1095bd8deadSopenharmony_ci appropriate Uniform* command (see below). For bindable uniforms, a buffer 1105bd8deadSopenharmony_ci object has to be first bound to the uniform before changing its 1115bd8deadSopenharmony_ci value. These locations are invalidated. 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci Change the second to last paragraph, p. 79, as follows: 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci A valid name for a non-bindable uniform cannot be a structure, an array of 1165bd8deadSopenharmony_ci structures, or any portion of a single vector or a matrix. A valid name 1175bd8deadSopenharmony_ci for a bindable uniform cannot be any portion of a single vector or 1185bd8deadSopenharmony_ci matrix. In order to identify a valid name, ... 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci Change the fifth paragraph, p. 81, as follows: 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci The given values are loaded into the uniform variable location identified 1235bd8deadSopenharmony_ci by <location>. The parameter <location> cannot identify a bindable uniform 1245bd8deadSopenharmony_ci structure or a bindable uniform array of structures. When loading data for 1255bd8deadSopenharmony_ci a bindable uniform, the data will be stored in the appropriate location of 1265bd8deadSopenharmony_ci the buffer object bound to the bindable uniform (see UniformBufferEXT 1275bd8deadSopenharmony_ci below). 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci Add the following bullets to the list of errors on p. 82: 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci - If <location> refers to a bindable uniform structure or a bindable 1325bd8deadSopenharmony_ci uniform array of structures. 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci - If <location> refers to a bindable uniform that has no buffer object 1355bd8deadSopenharmony_ci bound to the uniform. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci - If <location> refers to a bindable uniform and the bound buffer object 1385bd8deadSopenharmony_ci is not of sufficient size. This means that the buffer object is 1395bd8deadSopenharmony_ci smaller than the size that would be returned by 1405bd8deadSopenharmony_ci GetUniformBufferSizeEXT for the bindable uniform. 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci - If <location> refers to a bindable uniform and the buffer object is 1435bd8deadSopenharmony_ci bound to multiple bindable uniforms in the currently active program 1445bd8deadSopenharmony_ci object. 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci Add a sub-section called "Bindable Uniforms" above the section "Samplers", 1475bd8deadSopenharmony_ci p. 82: 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci The number of active bindable uniform variables that can be supported by a 1505bd8deadSopenharmony_ci vertex shader is limited and specified by the implementation dependent 1515bd8deadSopenharmony_ci constant MAX_VERTEX_BINDABLE_UNIFORMS_EXT. The minimum supported number 1525bd8deadSopenharmony_ci of bindable uniforms is eight. A link error will be generated if the 1535bd8deadSopenharmony_ci program object contains more active bindable uniform variables. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci To query the minimum size needed for a buffer object to back a given 1565bd8deadSopenharmony_ci bindable uniform, use the command: 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci int GetUniformBufferSizeEXT(uint program, int location); 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci This command returns the size in basic machine units of the smallest 1615bd8deadSopenharmony_ci buffer object that can be used for the bindable uniform given by 1625bd8deadSopenharmony_ci <location>. The size returned is intended to be passed as the <size> 1635bd8deadSopenharmony_ci parameter to the BufferData() command. The error INVALID_OPERATION will be 1645bd8deadSopenharmony_ci generated if <location> does not correspond to an active bindable uniform 1655bd8deadSopenharmony_ci in <program>. The parameter <location> has to be location corresponding 1665bd8deadSopenharmony_ci to the name of the bindable uniform itself, otherwise the error 1675bd8deadSopenharmony_ci INVALID_OPERATION is generated. If the bindable uniform is a structure, 1685bd8deadSopenharmony_ci <location> can not refer to a structure member. If it is an array, 1695bd8deadSopenharmony_ci <location> can not refer to any array member other than the first one. If 1705bd8deadSopenharmony_ci <program> has not been successfully linked, the error INVALID_OPERATION is 1715bd8deadSopenharmony_ci generated. 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci There is an implementation-dependent limit on the size of bindable uniform 1745bd8deadSopenharmony_ci variables. LinkProgram will fail if the storage required for the uniform 1755bd8deadSopenharmony_ci (in basic machine units) exceeds MAX_BINDABLE_UNIFORM_SIZE_EXT. 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci To bind a buffer object to a bindable uniform, use the command: 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci void UniformBufferEXT(uint program, int location, uint buffer) 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci This command binds the buffer object <buffer> to the bindable uniform 1825bd8deadSopenharmony_ci <location> in the program object <program>. Any previous binding to the 1835bd8deadSopenharmony_ci bindable uniform <location> is broken. Before calling UniformBufferEXT the 1845bd8deadSopenharmony_ci buffer object has to be created, but it does not have to be initialized 1855bd8deadSopenharmony_ci with data nor its size set. Passing the value zero in <buffer> will 1865bd8deadSopenharmony_ci unbind the currently bound buffer object. The error INVALID_OPERATION is 1875bd8deadSopenharmony_ci generated if <location> does not correspond to an active bindable uniform 1885bd8deadSopenharmony_ci in <program>. The parameter <location> has to correspond to the name of 1895bd8deadSopenharmony_ci the uniform variable itself, as described for GetUniformBufferSizeEXT, 1905bd8deadSopenharmony_ci otherwise the error INVALID_OPERATION is generated. If <program> has not 1915bd8deadSopenharmony_ci been successfully linked, or if <buffer> is not the name of an existing 1925bd8deadSopenharmony_ci buffer object, the error INVALID_OPERATION is generated. 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci A buffer object cannot be bound to more than one uniform variable in any 1955bd8deadSopenharmony_ci single program object. However, a buffer object can be bound to bindable 1965bd8deadSopenharmony_ci uniform variables in multiple program objects. Furthermore, if those 1975bd8deadSopenharmony_ci bindable uniforms are all of the same type, accessing a scalar, vector, a 1985bd8deadSopenharmony_ci member of a structure, or an element of an array in program object A will 1995bd8deadSopenharmony_ci result in the same data if the same scalar, vector, structure member, or 2005bd8deadSopenharmony_ci array element is accessed in program object B. Additionally the structures 2015bd8deadSopenharmony_ci in both program objects have to have the same members, specified in the 2025bd8deadSopenharmony_ci same order, declared with the same data types and have the same name. If 2035bd8deadSopenharmony_ci the buffer object bound to the uniform variable is smaller than the 2045bd8deadSopenharmony_ci minimum size required to store the uniform variable, as reported by 2055bd8deadSopenharmony_ci GetUniformbufferSizeEXT, the results of reading the variable (or any 2065bd8deadSopenharmony_ci portion thereof) are undefined. 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci If LinkProgram is called on a program object that has already been linked, 2095bd8deadSopenharmony_ci any buffer objects bound to the bindable uniforms in the program are 2105bd8deadSopenharmony_ci unbound prior to linking, as though UniformBufferEXT were called for each 2115bd8deadSopenharmony_ci bindable uniform with a <buffer> value of zero. 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci Buffer objects used to store uniform variables may be created and 2145bd8deadSopenharmony_ci manipulated by buffer object functions (e.g., BufferData, BufferSubData, 2155bd8deadSopenharmony_ci MapBuffer) by calling BindBuffer with a <target> of UNIFORM_BUFFER_EXT. 2165bd8deadSopenharmony_ci It is not necessary to bind a buffer object to UNIFORM_BUFFER_EXT in order 2175bd8deadSopenharmony_ci to use it with an active program object. 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci The exact layout of bindable uniform variables in buffer object storage is 2205bd8deadSopenharmony_ci not defined. However, the values of signed integer, unsigned integer, or 2215bd8deadSopenharmony_ci floating-point uniforms, or vectors thereof, may be updated by modifying 2225bd8deadSopenharmony_ci the underlying buffer object storage using either MapBuffer or 2235bd8deadSopenharmony_ci BufferSubData. The command 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci intptr GetUniformOffsetEXT(uint program, int location); 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci returns the offset (in bytes) of the uniform in <program> whose location 2285bd8deadSopenharmony_ci as returned by GetUniformLocation is <location>. The error INVALID_VALUE 2295bd8deadSopenharmony_ci is generated if the object named by <program> does not exist. The error 2305bd8deadSopenharmony_ci INVALID_OPERATION is generated if <program> is not a program object, if 2315bd8deadSopenharmony_ci <program> was not linked successfully, or if <location> refers to a 2325bd8deadSopenharmony_ci uniform that was not declared as bindable. The memory layout of matrix, 2335bd8deadSopenharmony_ci boolean, or boolean vector uniforms is not defined, and the error 2345bd8deadSopenharmony_ci INVALID_OPERATION will be generated if <location> refers to a boolean, 2355bd8deadSopenharmony_ci boolean vector, or matrix uniform. The value -1 is returned by 2365bd8deadSopenharmony_ci GetUniformOffsetEXT if an error is generated. 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci The values of such uniforms may be changing by writing signed integer, 2395bd8deadSopenharmony_ci unsigned integer, or floating-point values into the buffer object at the 2405bd8deadSopenharmony_ci byte offset returned by GetUniformOffsetEXT. For vectors, two to four 2415bd8deadSopenharmony_ci integers or floating-point values should be written to consecutive 2425bd8deadSopenharmony_ci locations in the buffer object storage. For arrays of scalar or vector 2435bd8deadSopenharmony_ci variables, the number of bytes between individual array members is 2445bd8deadSopenharmony_ci guaranteed to be constant, but array members are not guaranteed to be 2455bd8deadSopenharmony_ci stored in adjacent locations. For example, some implementations may pad 2465bd8deadSopenharmony_ci scalars, or two- or three-component vectors out to a four-component 2475bd8deadSopenharmony_ci vector. 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci Change the first paragraph below the sub-heading 'Samplers', p. 82, as 2505bd8deadSopenharmony_ci follows: 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci Samplers are special uniforms used in the OpenGL Shading Language to 2535bd8deadSopenharmony_ci identify the texture object used for each texture lookup. Samplers cannot 2545bd8deadSopenharmony_ci be declared as bindable in a shader. The value of a sampler indicates the 2555bd8deadSopenharmony_ci texture image unit being accessed. Setting a sampler's value. 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci Add the following bullets to the list of error conditions for Begin on 2585bd8deadSopenharmony_ci p. 87: 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci - There is one, or more, bindable uniform(s) in the currently 2615bd8deadSopenharmony_ci active program object that does not have a buffer object 2625bd8deadSopenharmony_ci bound to it. 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci - There is one, or more, bindable uniform(s) in the currently active 2655bd8deadSopenharmony_ci program object that have a buffer object bound to it of insufficient 2665bd8deadSopenharmony_ci size. This means that the buffer object is smaller than the size that 2675bd8deadSopenharmony_ci would be returned by GetUniformBufferSizeEXT for the bindable uniform. 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ci - A buffer object is bound to multiple bindable uniforms in the currently 2705bd8deadSopenharmony_ci active program object. 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci Modify Section 3.11.1 "Shader Variables", p. 193 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci Add a paragraph between the first and second paragraph, p. 194 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci The number of active bindable uniform variables that can be supported by a 2805bd8deadSopenharmony_ci fragment shader is limited and specified by the implementation dependent 2815bd8deadSopenharmony_ci constant MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT. The minimum supported number 2825bd8deadSopenharmony_ci of bindable uniforms is eight. A link error will be generated if the 2835bd8deadSopenharmony_ci program object contains more active bindable uniform variables. 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 2865bd8deadSopenharmony_ciOperations and the Frame Buffer) 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci None. 2895bd8deadSopenharmony_ci 2905bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ci Change section 5.4 Display Lists, p. 237 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci Add the command UniformBufferEXT to the list of commands that are not 2955bd8deadSopenharmony_ci compiled into a display list, but executed immediately, under "Program and 2965bd8deadSopenharmony_ci Shader Objects", p. 241. 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and State 2995bd8deadSopenharmony_ciRequests) 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci None. 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 2.0 Specification (Invariance) 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci None. 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci None. 3105bd8deadSopenharmony_ci 3115bd8deadSopenharmony_ciInteractions with GL_EXT_geometry_shader4 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci If GL_EXT_geometry_shader4 is supported, a geometry shader will also 3145bd8deadSopenharmony_ci support bindable uniforms. The following paragraph needs to be added to 3155bd8deadSopenharmony_ci the section that discusses geometry shaders: 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ci "The number of active bindable uniform variables that can be supported by 3185bd8deadSopenharmony_ci a geometry shader is limited and specified by the implementation dependent 3195bd8deadSopenharmony_ci constant MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT. The minimum supported number 3205bd8deadSopenharmony_ci of bindable uniforms is eight. A link error will be generated if the 3215bd8deadSopenharmony_ci program object contains more active bindable uniform variables." 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci The implementation dependent value MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT will 3245bd8deadSopenharmony_ci need to be added to the state tables and assigned an enum value. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ciErrors 3275bd8deadSopenharmony_ci 3285bd8deadSopenharmony_ci The error INVALID_VALUE is generated by UniformBufferEXT, 3295bd8deadSopenharmony_ci GetUniformBufferSize, or GetUniformOffsetEXT if <program> is not the name 3305bd8deadSopenharmony_ci of a program or shader object. 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by UniformBufferEXT, 3335bd8deadSopenharmony_ci GetUniformBufferSize, or GetUniformOffsetEXT if <program> is the name of a 3345bd8deadSopenharmony_ci shader object. 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by the Uniform* commands if 3375bd8deadSopenharmony_ci <location> refers to a bindable uniform structure or an array of such 3385bd8deadSopenharmony_ci structures. 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by the Uniform* commands if 3415bd8deadSopenharmony_ci <location> refers to a bindable uniform that has no buffer object bound. 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by the Uniform* commands if 3445bd8deadSopenharmony_ci <location> refers to a bindable uniform and the bound buffer object is not 3455bd8deadSopenharmony_ci of sufficient size to store data into <location>. 3465bd8deadSopenharmony_ci 3475bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by the GetUniformBufferSizeEXT 3485bd8deadSopenharmony_ci and UniformBufferEXT commands if <program> has not been successfully 3495bd8deadSopenharmony_ci linked. 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by the GetUniformBufferSizeEXT 3525bd8deadSopenharmony_ci and UniformBufferEXT commands if <location> is not the location 3535bd8deadSopenharmony_ci corresponding to the name of the bindable uniform itself or if <location> 3545bd8deadSopenharmony_ci does not correspond to an active bindable uniform in <program>. 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by GetUniformOffsetEXT if 3575bd8deadSopenharmony_ci <program> was not linked successfully, if <location> refers to a uniform 3585bd8deadSopenharmony_ci that was not declared as bindable, or if <location> refers to a boolean, 3595bd8deadSopenharmony_ci boolean vector, or matrix uniform. 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by the UniformBufferEXT command if 3625bd8deadSopenharmony_ci <buffer> is not the name of a buffer object. 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by Begin, Rasterpos or any 3655bd8deadSopenharmony_ci command that performs an implicit Begin if: 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci - A buffer object is bound to multiple bindable uniforms in the currently 3685bd8deadSopenharmony_ci active program object. 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci - There is one, or more, bindable uniform(s) in the currently active 3715bd8deadSopenharmony_ci program object that does not have a buffer object bound to it. 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci - There is one, or more, bindable uniform(s) in the currently active 3745bd8deadSopenharmony_ci program object that have a buffer object bound to it of insufficient 3755bd8deadSopenharmony_ci size. This means that the buffer object is smaller than the size that 3765bd8deadSopenharmony_ci would be returned by GetUniformBufferSizeEXT for the bindable uniform. 3775bd8deadSopenharmony_ci 3785bd8deadSopenharmony_ciNew State 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci Initial 3815bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 3825bd8deadSopenharmony_ci -------------------------- ---- ----------- ----- ------------------------- ----- --------- 3835bd8deadSopenharmony_ci UNIFORM_BUFFER_BINDING_EXT Z+ GetIntegerv 0 Uniform buffer bound to 2.15 - 3845bd8deadSopenharmony_ci the context for buffer 3855bd8deadSopenharmony_ci object manipulation. 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ciNew Implementation Dependent State 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci Minimum 3905bd8deadSopenharmony_ci Get Value Type Get Command Value Description Section Attrib 3915bd8deadSopenharmony_ci ---------------------- ---- ----------- ----- --------------------- ------- ------ 3925bd8deadSopenharmony_ci MAX_BINDABLE_VERTEX_ Z+ GetIntegerv 8 Number of bindable 2.15 - 3935bd8deadSopenharmony_ci UNIFORMS_EXT uniforms per vertex 3945bd8deadSopenharmony_ci shader 3955bd8deadSopenharmony_ci MAX_BINDABLE_FRAGMENT_ Z+ GetIntegerv 8 Number of bindable 3.11.1 - 3965bd8deadSopenharmony_ci UNIFORMS_EXT uniforms per fragment 3975bd8deadSopenharmony_ci shader 3985bd8deadSopenharmony_ci MAX_BINDABLE_GEOMETRY_ Z+ GetIntegerv 8 Number of bindable X.X.X - 3995bd8deadSopenharmony_ci UNIFORMS_EXT uniforms per geometry 4005bd8deadSopenharmony_ci shader 4015bd8deadSopenharmony_ci MAX_BINDABLE_UNIFORM_ Z+ GetIntegerv 16384 Maximum size (in bytes) 2.15 - 4025bd8deadSopenharmony_ci SIZE_EXT for bindable uniform 4035bd8deadSopenharmony_ci storage. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 4065bd8deadSopenharmony_ci1.10.59 4075bd8deadSopenharmony_ci 4085bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 4095bd8deadSopenharmony_ci language features described in this extension: 4105bd8deadSopenharmony_ci 4115bd8deadSopenharmony_ci #extension GL_EXT_bindable_uniform: <behavior> 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL Shading Language: 4165bd8deadSopenharmony_ci 4175bd8deadSopenharmony_ci #define GL_EXT_bindable_uniform 1 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci Add to section 3.6 "Keywords" 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ci Add the following keyword: 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci bindable 4245bd8deadSopenharmony_ci 4255bd8deadSopenharmony_ci Change section 4.3 "Type Qualifiers" 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci In the qualifier table, add the following sub-qualifiers under the uniform 4285bd8deadSopenharmony_ci qualifier: 4295bd8deadSopenharmony_ci 4305bd8deadSopenharmony_ci bindable uniform 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci Change section 4.3.5 "Uniform" 4335bd8deadSopenharmony_ci 4345bd8deadSopenharmony_ci Add the following paragraphs between the last and the second to last 4355bd8deadSopenharmony_ci paragraphs: 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ci Uniform variables, except for samplers, can optionally be further 4385bd8deadSopenharmony_ci qualified with "bindable". If "bindable" is present, the storage for the 4395bd8deadSopenharmony_ci uniform comes from a buffer object, which is bound to the uniform through 4405bd8deadSopenharmony_ci the GL API, as described in section 2.15.3 of the OpenGL 2.0 4415bd8deadSopenharmony_ci specification. In this case, the memory used does not count against the 4425bd8deadSopenharmony_ci storage limit described in the previous paragraph. When using the 4435bd8deadSopenharmony_ci "bindable" keyword, it must immediately precede the "uniform" keyword. 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci An example bindable uniform declaration is: 4465bd8deadSopenharmony_ci 4475bd8deadSopenharmony_ci bindable uniform float foo; 4485bd8deadSopenharmony_ci 4495bd8deadSopenharmony_ci Only a limited number of uniforms can be bindable for each type of 4505bd8deadSopenharmony_ci shader. If this limit is exceeded, it will cause a compile-time or 4515bd8deadSopenharmony_ci link-time error. Bindable uniforms that are declared but not used do not 4525bd8deadSopenharmony_ci count against this limit. 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci Add to section 9 "Shading Language Grammar" 4555bd8deadSopenharmony_ci 4565bd8deadSopenharmony_ci type_qualifer: 4575bd8deadSopenharmony_ci CONST 4585bd8deadSopenharmony_ci ATTRIBUTE // Vertex only 4595bd8deadSopenharmony_ci uniform-modifieropt UNIFORM 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci uniform-modifier: 4625bd8deadSopenharmony_ci BINDABLE 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ciIssues 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci 1. Is binding a buffer object to a uniform done before or after linking a 4675bd8deadSopenharmony_ci program object? 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci DISCUSSION: There is no need to re-link when changing the buffer object 4705bd8deadSopenharmony_ci that backs a uniform. Re-binding can therefore be relatively quickly. 4715bd8deadSopenharmony_ci Binding is be done using the location of the uniform retrieved by 4725bd8deadSopenharmony_ci GetUniformLocation, to make it even faster (instead of binding by name 4735bd8deadSopenharmony_ci of the uniform). 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci Reasons to do this before linking: The linker might want to know what 4765bd8deadSopenharmony_ci buffer object backs the uniform. Binding of a buffer object to a 4775bd8deadSopenharmony_ci bindable uniform, in this case, will have to be done using the name of 4785bd8deadSopenharmony_ci the uniform (no location is available until after linking). Changing the 4795bd8deadSopenharmony_ci binding of a buffer object to a bindable uniform means the program 4805bd8deadSopenharmony_ci object will have to be re-linked, which would substantially increase the 4815bd8deadSopenharmony_ci overhead of using multiple different "constant sets" in a single 4825bd8deadSopenharmony_ci program. 4835bd8deadSopenharmony_ci 4845bd8deadSopenharmony_ci RESOLUTION: Binding a buffer object to a bindable uniform needs to be 4855bd8deadSopenharmony_ci done after the program object is linked. One of the purposes of this 4865bd8deadSopenharmony_ci extension is to be able to switch among multiple sets of uniform values 4875bd8deadSopenharmony_ci efficiently. 4885bd8deadSopenharmony_ci 4895bd8deadSopenharmony_ci 2. Is the memory layout of a bindable uniform available to an application? 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci DISCUSSION: Buffer objects are arrays of bytes. The application can map 4925bd8deadSopenharmony_ci a buffer object and retrieve a pointer to it, and read or write into it 4935bd8deadSopenharmony_ci directly. Or, the application can use the BufferSubData() command to 4945bd8deadSopenharmony_ci store data in a buffer object. They can also be filled using ReadPixels 4955bd8deadSopenharmony_ci (with ARB_pixel_buffer_object), or filled using extensions such as the 4965bd8deadSopenharmony_ci new transform feedback extension. 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci If the layout of a uniform in buffer object memory is known, these 4995bd8deadSopenharmony_ci different ways of filling a buffer object could be leveraged. On the 5005bd8deadSopenharmony_ci other hand, different compiler implementations may want a different 5015bd8deadSopenharmony_ci packing schemes that may or may not match an end-user's expectations 5025bd8deadSopenharmony_ci (e.g., all individual uniforms might be stored as vec4's). If only the 5035bd8deadSopenharmony_ci Uniform*() API were allowed to modify buffer objects, we could 5045bd8deadSopenharmony_ci completely hide the layout of bindable uniforms. Unfortuantely, that 5055bd8deadSopenharmony_ci would limit how the buffer object can be linked to other sources of 5065bd8deadSopenharmony_ci data. 5075bd8deadSopenharmony_ci 5085bd8deadSopenharmony_ci RESOLUTION: RESOLVED. The memory layout of a bindable uniform variable 5095bd8deadSopenharmony_ci will not be specified. However, a query function will be added that 5105bd8deadSopenharmony_ci allows applications to determine the layout and load their buffer object 5115bd8deadSopenharmony_ci via API's other than Uniform*() accordingly if they choose. 5125bd8deadSopenharmony_ci Unfortunately, the layout may not be consistent across implementations 5135bd8deadSopenharmony_ci of this extension. 5145bd8deadSopenharmony_ci 5155bd8deadSopenharmony_ci Providing a better standard set of packing rules is highly desirable, 5165bd8deadSopenharmony_ci and we hope to design and add such functionality in an extension in the 5175bd8deadSopenharmony_ci near future. 5185bd8deadSopenharmony_ci 5195bd8deadSopenharmony_ci 3. How is synchronization handled between a program object using a buffer 5205bd8deadSopenharmony_ci object and updates to the buffer object? 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci DISCUSSION: For example, what happens when a ReadPixels into a buffer 5235bd8deadSopenharmony_ci object is outstanding, that is bound to a bindable uniform while the 5245bd8deadSopenharmony_ci program object, containing the bindable uniform, is in use? 5255bd8deadSopenharmony_ci 5265bd8deadSopenharmony_ci RESOLUTION: UNRESOLVED. It is probably the GL implementation's 5275bd8deadSopenharmony_ci responsibility to properly synchronize such usages. This issue needs 5285bd8deadSopenharmony_ci solving for GL_EXT_texture_buffer_object also, and should be consistent. 5295bd8deadSopenharmony_ci 5305bd8deadSopenharmony_ci 4. A limited number of bindable uniforms can exist in one program 5315bd8deadSopenharmony_ci object. Should this limit be queriable? 5325bd8deadSopenharmony_ci 5335bd8deadSopenharmony_ci DISCUSSION: The link operation will fail if too many bindable uniforms 5345bd8deadSopenharmony_ci are declared and active. Should the limit on the number of active 5355bd8deadSopenharmony_ci bindable uniforms be queriable by the application? 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci RESOLUTION: Yes, this limit is queriable. 5385bd8deadSopenharmony_ci 5395bd8deadSopenharmony_ci 5. Is the limit discussed in the previous issue per shader type? 5405bd8deadSopenharmony_ci 5415bd8deadSopenharmony_ci DISCUSSION: Is there a different limit for vertex shader and fragment 5425bd8deadSopenharmony_ci shaders? Hardware might support different limits. The storage for 5435bd8deadSopenharmony_ci uniform variables is a limit queriable per shader type, thus it would be 5445bd8deadSopenharmony_ci nice to be consistent with the existing model. 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci RESOLUTION: YES. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci 6. Can an application find out programmatically that a uniform is declared 5495bd8deadSopenharmony_ci as a bindable uniform? 5505bd8deadSopenharmony_ci 5515bd8deadSopenharmony_ci DISCUSSION: Using GetActiveUniform() the application can 5525bd8deadSopenharmony_ci programmatically find out which uniforms are active, what their type and 5535bd8deadSopenharmony_ci size etc it. Do we need to add a mechanism for an application to find 5545bd8deadSopenharmony_ci out if an active uniform is a bindable uniform? 5555bd8deadSopenharmony_ci 5565bd8deadSopenharmony_ci RESOLUTION: UNRESOLVED. To be consistent, the answer should be 5575bd8deadSopenharmony_ci yes. However, extending GetActiveUniform() is not possible, which means 5585bd8deadSopenharmony_ci we need a new API command. If we define a new API command, it probably 5595bd8deadSopenharmony_ci is better to define something like: GetNewActiveUniform(int program, 5605bd8deadSopenharmony_ci uint index, enum property, void *data); Or alternatively, define new API 5615bd8deadSopenharmony_ci to query the properties of a uniform per uniform location: 5625bd8deadSopenharmony_ci GetActiveUniformProperty(int program, int location, enum property, void 5635bd8deadSopenharmony_ci *data) 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci 7. What to do when the buffer object bound to a bindable uniform is not big 5665bd8deadSopenharmony_ci enough to back the uniform or if no buffer object is bound at all? 5675bd8deadSopenharmony_ci 5685bd8deadSopenharmony_ci DISCUSSION: The size of a buffer object can be changed, after it is 5695bd8deadSopenharmony_ci bound, by calling BufferData. It is possible that the buffer object 5705bd8deadSopenharmony_ci isn't sufficiently big enough to back the bindable uniform. This is an 5715bd8deadSopenharmony_ci issue when loading values for uniforms and when actually rendering. In 5725bd8deadSopenharmony_ci the case of loading uniforms, should the Uniform* API generate an error? 5735bd8deadSopenharmony_ci In the case of rendering, should this be a Begin error? 5745bd8deadSopenharmony_ci 5755bd8deadSopenharmony_ci RESOLUTION: RESOLVED. It is a Begin error if a buffer object is too 5765bd8deadSopenharmony_ci small or no buffer object is bound at all. The Uniform* commands will 5775bd8deadSopenharmony_ci generate an error in these cases as well. 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci 8. What restrictions are there on binding a buffer object to more than one 5805bd8deadSopenharmony_ci bindable uniform? 5815bd8deadSopenharmony_ci 5825bd8deadSopenharmony_ci DISCUSSION: Can a buffer object be bound to more than one uniform within 5835bd8deadSopenharmony_ci a program object? No, this does not seem to be a good idea. Can a 5845bd8deadSopenharmony_ci buffer object be bound to more than one uniform in different program 5855bd8deadSopenharmony_ci objects? Yes, this is useful functionality to have. If each uniform is 5865bd8deadSopenharmony_ci also of the same type, then data access in program object A then the 5875bd8deadSopenharmony_ci same access in program object B results in the same data. In the latter 5885bd8deadSopenharmony_ci case, if the uniform variables are arrays, must the arrays have the same 5895bd8deadSopenharmony_ci length declared? No, that is too big of a restriction. The application 5905bd8deadSopenharmony_ci is responsible for making sure the buffer object is sufficiently sized 5915bd8deadSopenharmony_ci to provide storage for the largest bindable uniform array. 5925bd8deadSopenharmony_ci 5935bd8deadSopenharmony_ci RESOLUTION: RESOLVED. 5945bd8deadSopenharmony_ci 5955bd8deadSopenharmony_ci 9. It is not allowed to bind a buffer object to more than one bindable 5965bd8deadSopenharmony_ci uniform in a program object. There are several operations that could be 5975bd8deadSopenharmony_ci affected by this rule: UseProgram(), the uniform loading commands 5985bd8deadSopenharmony_ci Uniform*, Begin, RasterPos and any related rendering command. Should 5995bd8deadSopenharmony_ci each operation generate an error if the rule is violated? 6005bd8deadSopenharmony_ci 6015bd8deadSopenharmony_ci DISCUSSION: See also issue 7. The UseProgram command could generate an 6025bd8deadSopenharmony_ci error if the rule is violated. However, it is possible to change the 6035bd8deadSopenharmony_ci binding of a buffer object to a bindable uniform even after UseProgram 6045bd8deadSopenharmony_ci has been issued. Thus should the Uniform* commands also check for this? 6055bd8deadSopenharmony_ci If so, is that going to be a performance burden on uniform loading? Or 6065bd8deadSopenharmony_ci should it be undefined? Finally, at rendering time violation of this 6075bd8deadSopenharmony_ci rule will have to be checked. If violated, it seems to make sense to 6085bd8deadSopenharmony_ci generate an error. 6095bd8deadSopenharmony_ci 6105bd8deadSopenharmony_ci RESOLUTION: RESOLVED. Make violation of the rule a Begin error and a 6115bd8deadSopenharmony_ci Uniform* error. 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci 10. How to provide the ability to use bindable uniform arrays (or bindable 6145bd8deadSopenharmony_ci uniform arrays of structures) where the amount of data can differ based 6155bd8deadSopenharmony_ci on the buffer object bound to it? 6165bd8deadSopenharmony_ci 6175bd8deadSopenharmony_ci DISCUSSION: In other words, the size of the bindable uniform is no 6185bd8deadSopenharmony_ci longer declared in the shader, but determined by the buffer object 6195bd8deadSopenharmony_ci backing it. This can be achieved through a variety of ways: 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci bindable uniform vec3 foo[1]; 6225bd8deadSopenharmony_ci 6235bd8deadSopenharmony_ci Where we would allow indexing 'off the end' of the array 'foo', because 6245bd8deadSopenharmony_ci it is backed by a buffer object. The actual size of the array will be 6255bd8deadSopenharmony_ci implicitly inferred from the buffer object bound to it. It'll be the 6265bd8deadSopenharmony_ci shader's responsibility to not index outside the size of the buffer 6275bd8deadSopenharmony_ci object. That in turn means that the layout in buffer object memory of a 6285bd8deadSopenharmony_ci bindable uniform needs to be exposed to the application. 6295bd8deadSopenharmony_ci 6305bd8deadSopenharmony_ci Or we could support something like: 6315bd8deadSopenharmony_ci 6325bd8deadSopenharmony_ci bindable uniform vec3 foo[100000]; // Some really big number 6335bd8deadSopenharmony_ci 6345bd8deadSopenharmony_ci and make all accesses inside the buffer object bound to "foo" legal. 6355bd8deadSopenharmony_ci 6365bd8deadSopenharmony_ci Or we could support something like: 6375bd8deadSopenharmony_ci 6385bd8deadSopenharmony_ci bindable uniform float foo[]; 6395bd8deadSopenharmony_ci 6405bd8deadSopenharmony_ci foo[3] = 1.0; 6415bd8deadSopenharmony_ci foo[i] = . 6425bd8deadSopenharmony_ci 6435bd8deadSopenharmony_ci Where 'i' could be a run-time index. 6445bd8deadSopenharmony_ci 6455bd8deadSopenharmony_ci RESOLUTION: For now, we will not support this functionality. 6465bd8deadSopenharmony_ci 6475bd8deadSopenharmony_ci 11. Do we want to have bindable namespaces instead of the uniform qualifier 6485bd8deadSopenharmony_ci "bindable"? 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ci DISCUSSION: Something like this: 6515bd8deadSopenharmony_ci 6525bd8deadSopenharmony_ci bindable { 6535bd8deadSopenharmony_ci vec3 blarg; 6545bd8deadSopenharmony_ci int booyah; 6555bd8deadSopenharmony_ci }; 6565bd8deadSopenharmony_ci 6575bd8deadSopenharmony_ci where "blarg" and "booyah" can be referred to directly, but are both 6585bd8deadSopenharmony_ci bindable to the same buffer. You can achieve this with bindable uniforms 6595bd8deadSopenharmony_ci stored in structures: 6605bd8deadSopenharmony_ci 6615bd8deadSopenharmony_ci bindable uniform struct { 6625bd8deadSopenharmony_ci vec3 blarg; 6635bd8deadSopenharmony_ci int booyah; 6645bd8deadSopenharmony_ci } foo; 6655bd8deadSopenharmony_ci 6665bd8deadSopenharmony_ci but then have to use "foo.blarg" and "foo.booyah". 6675bd8deadSopenharmony_ci 6685bd8deadSopenharmony_ci RESOLUTION: Not in this extension. This might be nice programming sugar, 6695bd8deadSopenharmony_ci but not essential. Such a feature may be added in a future extension 6705bd8deadSopenharmony_ci building on this one. 6715bd8deadSopenharmony_ci 6725bd8deadSopenharmony_ci 12. How can an application load data into a bindable uniform? 6735bd8deadSopenharmony_ci 6745bd8deadSopenharmony_ci RESOLUTION: See also issue 2. Uniform variables declared as bindable can 6755bd8deadSopenharmony_ci be loaded using the existing Uniform* commands, or data can be loaded in 6765bd8deadSopenharmony_ci the buffer object bound to the uniform using any of the existing 6775bd8deadSopenharmony_ci mechanisms. 6785bd8deadSopenharmony_ci 6795bd8deadSopenharmony_ci 13. Should it be allowed to load data, using the Uniform* commands, into a 6805bd8deadSopenharmony_ci buffer object that is bound to more than one bindable uniform variable 6815bd8deadSopenharmony_ci in a program object? 6825bd8deadSopenharmony_ci 6835bd8deadSopenharmony_ci DISCUSSION: It is a Begin error to attempt to render in this situation. 6845bd8deadSopenharmony_ci 6855bd8deadSopenharmony_ci RESOLUTION: Yes, to be consistent with the Begin error, it is also an 6865bd8deadSopenharmony_ci error to load a value in this case. 6875bd8deadSopenharmony_ci 6885bd8deadSopenharmony_ci 14. Should a buffer object binding point be provided for bindable uniforms? 6895bd8deadSopenharmony_ci 6905bd8deadSopenharmony_ci DISCUSSION: All current OpenGL buffer object manipulation functions take 6915bd8deadSopenharmony_ci a <target> to which a buffer object must be bound. In this extension, 6925bd8deadSopenharmony_ci buffer objects are bound to uniforms stored in a program, and are not 6935bd8deadSopenharmony_ci bound directly to the context. So these bindings may not be used to 6945bd8deadSopenharmony_ci manipulate the 6955bd8deadSopenharmony_ci 6965bd8deadSopenharmony_ci RESOLUTION: Yes, a new <target> called UNIFORM_BUFFER_EXT is provided. 6975bd8deadSopenharmony_ci 6985bd8deadSopenharmony_ci The following is a simple example of creating, binding, and populating a 6995bd8deadSopenharmony_ci buffer object for a bindable uniform named "stuff", which is an array of 7005bd8deadSopenharmony_ci vec4 values: 7015bd8deadSopenharmony_ci 7025bd8deadSopenharmony_ci GLuint program, buffer; 7035bd8deadSopenharmony_ci GLint location, size; 7045bd8deadSopenharmony_ci GLfloat values; 7055bd8deadSopenharmony_ci 7065bd8deadSopenharmony_ci // ... compile shaders and link <program> 7075bd8deadSopenharmony_ci location = glGetUniformLocation(program, "stuff"); 7085bd8deadSopenharmony_ci size = GetUniformBufferSize(program, location); 7095bd8deadSopenharmony_ci glGenBuffers(1, &buffer); 7105bd8deadSopenharmony_ci glBindBuffer(GL_UNIFORM_BUFFER_EXT, buffer); 7115bd8deadSopenharmony_ci glBufferData(GL_UNIFORM_BUFFER_EXT, size, NULL, STATIC_READ); 7125bd8deadSopenharmony_ci glUniformBufferEXT(program, location, buffer); 7135bd8deadSopenharmony_ci ... 7145bd8deadSopenharmony_ci glUseProgram(program); 7155bd8deadSopenharmony_ci glUniform4fv(location, count, values); 7165bd8deadSopenharmony_ci 7175bd8deadSopenharmony_ciRevision History 7185bd8deadSopenharmony_ci 7195bd8deadSopenharmony_ci Rev. Date Author Changes 7205bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 7215bd8deadSopenharmony_ci 15 04/04/08 aeddy Moved state sections into the proper order. 7225bd8deadSopenharmony_ci 7235bd8deadSopenharmony_ci 14 02/14/08 pbrown Clarify some confusing language about the memory 7245bd8deadSopenharmony_ci layout restrictions and GetUniformOffsetEXT. 7255bd8deadSopenharmony_ci 7265bd8deadSopenharmony_ci 13 12/13/07 pbrown Minor clarification on what values can be passed 7275bd8deadSopenharmony_ci to GetUniformBufferSizeEXT and UniformBufferEXT. 7285bd8deadSopenharmony_ci 7295bd8deadSopenharmony_ci 12 12/15/06 pbrown Documented that the '#extension' token 7305bd8deadSopenharmony_ci for this extension should begin with "GL_", 7315bd8deadSopenharmony_ci as apparently called for per convention. 7325bd8deadSopenharmony_ci 7335bd8deadSopenharmony_ci 11 -- Pre-release revisions. 734