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 wait for shaders to compile or GLSL programs to | |
23 link to query the locations and therefore have no blocking calls | |
24 when initializing programs. | |
25 | |
26 To be forward compatible the locations are provided through the | |
27 function GetUniformLocationsCHROMIUM. LinkProgram must be called | |
28 before calling GetUniformLocationsCHROMIUM. | |
29 | |
30 Issues | |
31 | |
32 If a uniform is unused in the actual program it may be optimized out | |
33 by the GL driver. In this case the locations will be wrong. You | |
34 must provide a list of only the used uniforms. | |
35 | |
36 New Tokens | |
37 | |
38 None | |
39 | |
40 New Procedures and Functions | |
41 | |
42 void GetUniformLocationsCHROMIUM (GLuint program, | |
43 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 | |
87 7/19/2012 Added <program> argument. | |
88 | |
OLD | NEW |