OLD | NEW |
(Empty) | |
| 1 Name |
| 2 |
| 3 CHROMIUM_consistent_uniform_locations |
| 4 |
| 5 Name Strings |
| 6 |
| 7 GL_CHROMIUM_consistent_uniform_locations |
| 8 |
| 9 Version |
| 10 |
| 11 Last Modifed Date: June 17, 2012 |
| 12 |
| 13 Dependencies |
| 14 |
| 15 OpenGL ES 2.0 is required. |
| 16 |
| 17 Overview |
| 18 |
| 19 This extension guarantees uniforms always have the same locations. |
| 20 |
| 21 This allows the client program to know the locations of uniforms |
| 22 without having to compile the shaders, link the program and query |
| 23 the locations and therefore have no blocking calls when initializing |
| 24 programs. |
| 25 |
| 26 To be forward compatible the locations are provided through the |
| 27 function GetUniformLocationsCHROMIUM but they can be provided |
| 28 even before linking a program and therefore do not have to wait |
| 29 for compile or link completion to return results. |
| 30 |
| 31 Issues |
| 32 |
| 33 If a uniform is unused in the actual program it may be optimized out |
| 34 by the GL driver. In this case the locations will be wrong. You |
| 35 must provide a list of only the used uniforms. |
| 36 |
| 37 New Tokens |
| 38 |
| 39 None |
| 40 |
| 41 New Procedures and Functions |
| 42 |
| 43 void GetUniformLocationsCHROMIUM (const GLUniformDefinitionCHROMIUM* uniform
s, |
| 44 GLsizei count, GLsizei max_locations, |
| 45 GLint* locations); |
| 46 |
| 47 Provides the locations of uniforms assuming the list of uniforms provided |
| 48 matches the uniforms actually used in the corresponding program. |
| 49 |
| 50 <uniforms> is an array of uniforms. <count> is the number of uniforms in th
e |
| 51 array. <max_locations> is the maximum number of locations to write to |
| 52 <locations>. <locations> is an array to receive the uniform locations. |
| 53 |
| 54 INVALID_VALUE is generated if <count> is less then or equal to 0. |
| 55 |
| 56 INVALID_VALUE is generated if any GLUniformDefinitionHCHROMIUM's size |
| 57 field is <= 0. |
| 58 |
| 59 For each uniform <size> locations are provided. For example: |
| 60 |
| 61 static const GLUniformDefinitionCHROMIUM defs[] = { |
| 62 { GL_FLOAT_VEC2, 3, "someUniform", }, // An array of 3 vec2s |
| 63 { GL_FLOAT_VEC4, 1, "someOtherUniform", }, // A single vec4 |
| 64 { GL_SAMPLER_2D, 2, "yetAnotherUniform", }, // An array of 2 sampler2Ds |
| 65 }; |
| 66 |
| 67 Would return an array of locations as follows |
| 68 |
| 69 location[0] = location for "someUniform[0]" |
| 70 location[1] = location for "someUniform[1]" |
| 71 location[2] = location for "someUniform[2]" |
| 72 location[3] = location for "someOtherUniform" |
| 73 location[4] = location for "yetAnotherUniform[0]" |
| 74 location[5] = location for "yetAnotherUniform[1]" |
| 75 |
| 76 Errors |
| 77 |
| 78 None. |
| 79 |
| 80 New State |
| 81 |
| 82 None. |
| 83 |
| 84 Revision History |
| 85 |
| 86 7/17/2012 Documented the extension |
OLD | NEW |