Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / es / main / get_gen.py
1 #!/usr/bin/env python
2
3 # Mesa 3-D graphics library
4 #
5 # Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
6 #
7 # Permission is hereby granted, free of charge, to any person obtaining a
8 # copy of this software and associated documentation files (the "Software"),
9 # to deal in the Software without restriction, including without limitation
10 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 # and/or sell copies of the Software, and to permit persons to whom the
12 # Software is furnished to do so, subject to the following conditions:
13 #
14 # The above copyright notice and this permission notice shall be included
15 # in all copies or substantial portions of the Software.
16 #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24
25 # This script is used to generate the get.c file:
26 # python get_gen.py > get.c
27
28
29 import string
30 import sys
31
32
33 GLint = 1
34 GLenum = 2
35 GLfloat = 3
36 GLdouble = 4
37 GLboolean = 5
38 GLfloatN = 6 # A normalized value, such as a color or depth range
39 GLfixed = 7
40
41
42 TypeStrings = {
43 GLint : "GLint",
44 GLenum : "GLenum",
45 GLfloat : "GLfloat",
46 GLdouble : "GLdouble",
47 GLboolean : "GLboolean",
48 GLfixed : "GLfixed"
49 }
50
51
52 # Each entry is a tuple of:
53 # - the GL state name, such as GL_CURRENT_COLOR
54 # - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
55 # - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
56 # - optional extra code or empty string
57 # - optional extensions to check, or None
58 #
59
60 # Present in ES 1.x and 2.x:
61 StateVars_common = [
62 ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"],
63 "", None ),
64 ( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ),
65 ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
66 ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ),
67 ( "GL_COLOR_CLEAR_VALUE", GLfloatN,
68 [ "ctx->Color.ClearColor[0]",
69 "ctx->Color.ClearColor[1]",
70 "ctx->Color.ClearColor[2]",
71 "ctx->Color.ClearColor[3]" ], "", None ),
72 ( "GL_COLOR_WRITEMASK", GLint,
73 [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0",
74 "ctx->Color.ColorMask[GCOMP] ? 1 : 0",
75 "ctx->Color.ColorMask[BCOMP] ? 1 : 0",
76 "ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ),
77 ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ),
78 ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ),
79 ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
80 "", None ),
81 ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["ctx->Depth.Clear"], "", None ),
82 ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
83 ( "GL_DEPTH_RANGE", GLfloatN,
84 [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
85 ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ),
86 ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ),
87 ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ),
88 ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ),
89 ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"],
90 "", None ),
91 ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ),
92 ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat,
93 ["ctx->Const.MinLineWidth",
94 "ctx->Const.MaxLineWidth"], "", None ),
95 ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
96 ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
97
98 ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ),
99 ( "GL_MAX_VIEWPORT_DIMS", GLint,
100 ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"],
101 "", None ),
102 ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ),
103 ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat,
104 ["ctx->Const.MinPointSize",
105 "ctx->Const.MaxPointSize"], "", None ),
106 ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
107 ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
108 ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", None ),
109 ( "GL_SCISSOR_BOX", GLint,
110 ["ctx->Scissor.X",
111 "ctx->Scissor.Y",
112 "ctx->Scissor.Width",
113 "ctx->Scissor.Height"], "", None ),
114 ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ),
115 ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ),
116 ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ),
117 ( "GL_STENCIL_FAIL", GLenum,
118 ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ),
119 ( "GL_STENCIL_FUNC", GLenum,
120 ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ),
121 ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum,
122 ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ),
123 ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum,
124 ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ),
125 ( "GL_STENCIL_REF", GLint,
126 ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ),
127 ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ),
128 ( "GL_STENCIL_VALUE_MASK", GLint,
129 ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ),
130 ( "GL_STENCIL_WRITEMASK", GLint,
131 ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ),
132 ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ),
133 ( "GL_TEXTURE_BINDING_2D", GLint,
134 ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ),
135 ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),
136 ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y",
137 "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ),
138
139 # GL_ARB_multitexture
140 ( "GL_ACTIVE_TEXTURE_ARB", GLint,
141 [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ),
142
143 # Note that all the OES_* extensions require that the Mesa
144 # "struct gl_extensions" include a member with the name of
145 # the extension. That structure does not yet include OES
146 # extensions (and we're not sure whether it will). If
147 # it does, all the OES_* extensions below should mark the
148 # dependency.
149
150 # OES_texture_cube_map
151 ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
152 ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"],
153 "", None),
154 ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
155 ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
156 "", None),
157
158 # OES_blend_subtract
159 ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None),
160 ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None),
161 ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None),
162 ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None),
163
164 # GL_BLEND_EQUATION_RGB, which is what we're really after,
165 # is defined identically to GL_BLEND_EQUATION.
166 ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None),
167 ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "],
168 "", None),
169
170 # GL_ARB_texture_compression */
171 # ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
172 # ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
173 # "", ["ARB_texture_compression"] ),
174 # ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum,
175 # [],
176 # """GLint formats[100];
177 # GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
178 # ASSERT(n <= 100);
179 # for (i = 0; i < n; i++)
180 # params[i] = ENUM_TO_INT(formats[i]);""",
181 # ["ARB_texture_compression"] ),
182
183 # GL_ARB_multisample
184 ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
185 ["ctx->Multisample.SampleAlphaToCoverage"], "", ["ARB_multisample"] ),
186 ( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
187 ["ctx->Multisample.SampleCoverage"], "", ["ARB_multisample"] ),
188 ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
189 ["ctx->Multisample.SampleCoverageValue"], "", ["ARB_multisample"] ),
190 ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
191 ["ctx->Multisample.SampleCoverageInvert"], "", ["ARB_multisample"] ),
192 ( "GL_SAMPLE_BUFFERS_ARB", GLint,
193 ["ctx->DrawBuffer->Visual.sampleBuffers"], "", ["ARB_multisample"] ),
194 ( "GL_SAMPLES_ARB", GLint,
195 ["ctx->DrawBuffer->Visual.samples"], "", ["ARB_multisample"] ),
196
197
198 # GL_SGIS_generate_mipmap
199 ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
200 "", ["SGIS_generate_mipmap"] ),
201
202 # GL_ARB_vertex_buffer_object
203 ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint,
204 ["ctx->Array.ArrayBufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
205 # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
206 ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
207 ["ctx->Array.ElementArrayBufferObj->Name"],
208 "", ["ARB_vertex_buffer_object"] ),
209
210 # GL_OES_read_format
211 ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
212 ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ),
213 ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
214 ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ),
215
216 # GL_OES_framebuffer_object
217 ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "",
218 None),
219 ( "GL_RENDERBUFFER_BINDING_EXT", GLint,
220 ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "",
221 None),
222 ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint,
223 ["ctx->Const.MaxRenderbufferSize"], "",
224 None),
225
226 # OpenGL ES 1/2 special:
227 ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
228 [ "ARRAY_SIZE(compressed_formats)" ],
229 "",
230 None ),
231
232 ("GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
233 [],
234 """
235 int i;
236 for (i = 0; i < ARRAY_SIZE(compressed_formats); i++) {
237 params[i] = compressed_formats[i];
238 }""",
239 None ),
240
241 ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ),
242
243 ]
244
245 # Only present in ES 1.x:
246 StateVars_es1 = [
247 ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
248 ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ),
249 ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ),
250 ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ),
251 ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ),
252 ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ),
253 ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ),
254 ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ),
255 ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ),
256 ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ),
257 ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN,
258 ["ctx->Light.Model.Ambient[0]",
259 "ctx->Light.Model.Ambient[1]",
260 "ctx->Light.Model.Ambient[2]",
261 "ctx->Light.Model.Ambient[3]"], "", None ),
262 ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ),
263 ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ),
264 ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ),
265 ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ),
266 ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
267 ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
268 ( "GL_CLIP_PLANE0", GLboolean,
269 [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ),
270 ( "GL_CLIP_PLANE1", GLboolean,
271 [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ),
272 ( "GL_CLIP_PLANE2", GLboolean,
273 [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ),
274 ( "GL_CLIP_PLANE3", GLboolean,
275 [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ),
276 ( "GL_CLIP_PLANE4", GLboolean,
277 [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ),
278 ( "GL_CLIP_PLANE5", GLboolean,
279 [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ),
280 ( "GL_COLOR_MATERIAL", GLboolean,
281 ["ctx->Light.ColorMaterialEnabled"], "", None ),
282 ( "GL_CURRENT_COLOR", GLfloatN,
283 [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]",
284 "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]",
285 "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
286 "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
287 "FLUSH_CURRENT(ctx, 0);", None ),
288 ( "GL_CURRENT_NORMAL", GLfloatN,
289 [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
290 "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]",
291 "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"],
292 "FLUSH_CURRENT(ctx, 0);", None ),
293 ( "GL_CURRENT_TEXTURE_COORDS", GLfloat,
294 ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]",
295 "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]",
296 "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]",
297 "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]"],
298 "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ),
299 ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat,
300 ["ctx->Point.Params[0]",
301 "ctx->Point.Params[1]",
302 "ctx->Point.Params[2]"], "", None ),
303 ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ),
304 ( "GL_FOG_COLOR", GLfloatN,
305 [ "ctx->Fog.Color[0]",
306 "ctx->Fog.Color[1]",
307 "ctx->Fog.Color[2]",
308 "ctx->Fog.Color[3]" ], "", None ),
309 ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ),
310 ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ),
311 ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ),
312 ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ),
313 ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ),
314 ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ),
315 ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ),
316 ( "GL_LINE_WIDTH_RANGE", GLfloat,
317 ["ctx->Const.MinLineWidthAA",
318 "ctx->Const.MaxLineWidthAA"], "", None ),
319 ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ),
320 ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ),
321 ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ),
322
323 ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ),
324 ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ),
325 ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ),
326 ( "GL_MODELVIEW_MATRIX", GLfloat,
327 [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
328 "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
329 "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
330 "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
331 "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
332 ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ),
333 ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ),
334 ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ),
335 ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
336 ["ctx->Hint.PerspectiveCorrection"], "", None ),
337 ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
338 ( "GL_POINT_SIZE_RANGE", GLfloat,
339 ["ctx->Const.MinPointSizeAA",
340 "ctx->Const.MaxPointSizeAA"], "", None ),
341 ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ),
342 ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ),
343 ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ),
344 ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ),
345 ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat,
346 ["ctx->Point.Threshold"], "", None ),
347 ( "GL_PROJECTION_MATRIX", GLfloat,
348 [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
349 "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
350 "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
351 "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
352 "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
353 ( "GL_PROJECTION_STACK_DEPTH", GLint,
354 ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ),
355 ( "GL_RESCALE_NORMAL", GLboolean,
356 ["ctx->Transform.RescaleNormals"], "", None ),
357 ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ),
358 ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ),
359 ( "GL_TEXTURE_MATRIX", GLfloat,
360 ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
361 "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
362 "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
363 "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
364 "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
365 ( "GL_TEXTURE_STACK_DEPTH", GLint,
366 ["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ),
367 ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", None ),
368 ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", None ),
369 ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", None ),
370 ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", None ),
371 ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", None ),
372 ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", None ),
373 ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", None ),
374 ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", None ),
375 ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", None ),
376 ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", None ),
377 ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", None ),
378 ( "GL_TEXTURE_COORD_ARRAY", GLboolean,
379 ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
380 ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
381 ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
382 ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
383 ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
384 ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
385 ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
386 # GL_ARB_multitexture
387 ( "GL_MAX_TEXTURE_UNITS_ARB", GLint,
388 ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ),
389 ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint,
390 ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ),
391 # OES_texture_cube_map
392 ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
393 ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", None),
394 ( "GL_TEXTURE_GEN_STR_OES", GLboolean,
395 # S, T, and R are always set at the same time
396 ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None),
397 # ARB_multisample
398 ( "GL_MULTISAMPLE_ARB", GLboolean,
399 ["ctx->Multisample.Enabled"], "", ["ARB_multisample"] ),
400 ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
401 ["ctx->Multisample.SampleAlphaToOne"], "", ["ARB_multisample"] ),
402
403 ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
404 ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
405 ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
406 ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
407 ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
408 ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
409 ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
410 ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
411 "", ["ARB_vertex_buffer_object"] ),
412
413 # OES_point_sprite
414 ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
415 "", None),
416
417 # GL_ARB_fragment_shader
418 ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
419 ["ctx->Const.FragmentProgram.MaxUniformComponents"], "",
420 ["ARB_fragment_shader"] ),
421
422 # GL_ARB_vertex_shader
423 ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
424 ["ctx->Const.VertexProgram.MaxUniformComponents"], "",
425 ["ARB_vertex_shader"] ),
426 ( "GL_MAX_VARYING_FLOATS_ARB", GLint,
427 ["ctx->Const.MaxVarying * 4"], "", ["ARB_vertex_shader"] ),
428
429 # OES_matrix_get
430 ( "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES", GLint, [],
431 """
432 /* See GL_OES_matrix_get */
433 {
434 const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
435 memcpy(params, matrix, 16 * sizeof(GLint));
436 }""",
437 None),
438
439 ( "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES", GLint, [],
440 """
441 /* See GL_OES_matrix_get */
442 {
443 const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
444 memcpy(params, matrix, 16 * sizeof(GLint));
445 }""",
446 None),
447
448 ( "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES", GLint, [],
449 """
450 /* See GL_OES_matrix_get */
451 {
452 const GLfloat *matrix =
453 ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
454 memcpy(params, matrix, 16 * sizeof(GLint));
455 }""",
456 None),
457
458 # OES_point_size_array
459 ("GL_POINT_SIZE_ARRAY_OES", GLboolean,
460 ["ctx->Array.ArrayObj->PointSize.Enabled"], "", None),
461 ("GL_POINT_SIZE_ARRAY_TYPE_OES", GLenum,
462 ["ctx->Array.ArrayObj->PointSize.Type"], "", None),
463 ("GL_POINT_SIZE_ARRAY_STRIDE_OES", GLint,
464 ["ctx->Array.ArrayObj->PointSize.Stride"], "", None),
465 ("GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES", GLint,
466 ["ctx->Array.ArrayObj->PointSize.BufferObj->Name"], "", None),
467
468 # GL_EXT_texture_lod_bias
469 ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat,
470 ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]),
471
472 # GL_EXT_texture_filter_anisotropic
473 ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat,
474 ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]),
475
476 ]
477
478 # Only present in ES 2.x:
479 StateVars_es2 = [
480 # XXX These entries are not spec'ed for GLES 2, but are
481 # needed for Mesa's GLSL:
482 ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
483 ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
484 ( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV
485 ["ctx->Const.MaxTextureCoordUnits"], "",
486 ["ARB_fragment_program", "NV_fragment_program"] ),
487 ( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
488 ["ctx->Const.MaxDrawBuffers"], "", ["ARB_draw_buffers"] ),
489 ( "GL_BLEND_COLOR_EXT", GLfloatN,
490 [ "ctx->Color.BlendColor[0]",
491 "ctx->Color.BlendColor[1]",
492 "ctx->Color.BlendColor[2]",
493 "ctx->Color.BlendColor[3]"], "", None ),
494
495 # This is required for GLES2, but also needed for GLSL:
496 ( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNI
497 ["ctx->Const.MaxTextureImageUnits"], "",
498 ["ARB_fragment_program", "NV_fragment_program"] ),
499
500 ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
501 ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
502 ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
503 ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
504
505 # GL_ARB_shader_objects
506 # Actually, this token isn't part of GL_ARB_shader_objects, but is
507 # close enough for now.
508 ( "GL_CURRENT_PROGRAM", GLint,
509 ["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"],
510 "", ["ARB_shader_objects"] ),
511
512 # OpenGL 2.0
513 ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ),
514 ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ),
515 ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], "", None ),
516 ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ),
517 ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ),
518 ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ),
519 ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ),
520
521 ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
522 ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
523
524 # OES_texture_3D
525 ( "GL_TEXTURE_BINDING_3D", GLint,
526 ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None),
527 ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None),
528
529 # OES_standard_derivatives
530 ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
531 ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
532
533 # Unique to ES 2 (not in full GL)
534 ( "GL_MAX_FRAGMENT_UNIFORM_VECTORS", GLint,
535 ["ctx->Const.FragmentProgram.MaxUniformComponents / 4"], "", None),
536 ( "GL_MAX_VARYING_VECTORS", GLint,
537 ["ctx->Const.MaxVarying"], "", None),
538 ( "GL_MAX_VERTEX_UNIFORM_VECTORS", GLint,
539 ["ctx->Const.VertexProgram.MaxUniformComponents / 4"], "", None),
540 ( "GL_SHADER_COMPILER", GLint, ["1"], "", None),
541 # OES_get_program_binary
542 ( "GL_NUM_SHADER_BINARY_FORMATS", GLint, ["0"], "", None),
543 ( "GL_SHADER_BINARY_FORMATS", GLint, [], "", None),
544 ]
545
546
547
548 def ConversionFunc(fromType, toType):
549 """Return the name of the macro to convert between two data types."""
550 if fromType == toType:
551 return ""
552 elif fromType == GLfloat and toType == GLint:
553 return "IROUND"
554 elif fromType == GLfloatN and toType == GLfloat:
555 return ""
556 elif fromType == GLint and toType == GLfloat: # but not GLfloatN!
557 return "(GLfloat)"
558 else:
559 if fromType == GLfloatN:
560 fromType = GLfloat
561 fromStr = TypeStrings[fromType]
562 fromStr = string.upper(fromStr[2:])
563 toStr = TypeStrings[toType]
564 toStr = string.upper(toStr[2:])
565 return fromStr + "_TO_" + toStr
566
567
568 def EmitGetFunction(stateVars, returnType):
569 """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
570 assert (returnType == GLboolean or
571 returnType == GLint or
572 returnType == GLfloat or
573 returnType == GLfixed)
574
575 strType = TypeStrings[returnType]
576 # Capitalize first letter of return type
577 if returnType == GLint:
578 function = "_mesa_GetIntegerv"
579 elif returnType == GLboolean:
580 function = "_mesa_GetBooleanv"
581 elif returnType == GLfloat:
582 function = "_mesa_GetFloatv"
583 elif returnType == GLfixed:
584 function = "_mesa_GetFixedv"
585 else:
586 abort()
587
588 print "void GLAPIENTRY"
589 print "%s( GLenum pname, %s *params )" % (function, strType)
590 print "{"
591 print " GET_CURRENT_CONTEXT(ctx);"
592 print " ASSERT_OUTSIDE_BEGIN_END(ctx);"
593 print ""
594 print " if (!params)"
595 print " return;"
596 print ""
597 print " if (ctx->NewState)"
598 print " _mesa_update_state(ctx);"
599 print ""
600 print " switch (pname) {"
601
602 for (name, varType, state, optionalCode, extensions) in stateVars:
603 print " case " + name + ":"
604 if extensions:
605 if len(extensions) == 1:
606 print (' CHECK_EXT1(%s, "%s");' %
607 (extensions[0], function))
608 elif len(extensions) == 2:
609 print (' CHECK_EXT2(%s, %s, "%s");' %
610 (extensions[0], extensions[1], function))
611 elif len(extensions) == 3:
612 print (' CHECK_EXT3(%s, %s, %s, "%s");' %
613 (extensions[0], extensions[1], extensions[2], function))
614 else:
615 assert len(extensions) == 4
616 print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
617 (extensions[0], extensions[1], extensions[2], extensions[3], function))
618 if optionalCode:
619 print " {"
620 print " " + optionalCode
621 conversion = ConversionFunc(varType, returnType)
622 n = len(state)
623 for i in range(n):
624 if conversion:
625 print " params[%d] = %s(%s);" % (i, conversion, state[i])
626 else:
627 print " params[%d] = %s;" % (i, state[i])
628 if optionalCode:
629 print " }"
630 print " break;"
631
632 print " default:"
633 print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function
634 print " }"
635 print "}"
636 print ""
637 return
638
639
640
641 def EmitHeader():
642 """Print the get.c file header."""
643 print """
644 /***
645 *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py
646 ***/
647
648 #include "main/glheader.h"
649 #include "main/context.h"
650 #include "main/enable.h"
651 #include "main/extensions.h"
652 #include "main/fbobject.h"
653 #include "main/get.h"
654 #include "main/macros.h"
655 #include "main/mtypes.h"
656 #include "main/state.h"
657 #include "main/texcompress.h"
658 #include "main/framebuffer.h"
659
660
661 /* ES1 tokens that should be in gl.h but aren't */
662 #define GL_MAX_ELEMENTS_INDICES 0x80E9
663 #define GL_MAX_ELEMENTS_VERTICES 0x80E8
664
665
666 /* ES2 special tokens */
667 #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
668 #define GL_MAX_VARYING_VECTORS 0x8DFC
669 #define GL_MAX_VARYING_VECTORS 0x8DFC
670 #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
671 #define GL_SHADER_COMPILER 0x8DFA
672 #define GL_PLATFORM_BINARY 0x8D63
673 #define GL_SHADER_BINARY_FORMATS 0x8DF8
674 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
675
676
677 #ifndef GL_OES_matrix_get
678 #define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
679 #define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
680 #define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
681 #endif
682
683 #ifndef GL_OES_compressed_paletted_texture
684 #define GL_PALETTE4_RGB8_OES 0x8B90
685 #define GL_PALETTE4_RGBA8_OES 0x8B91
686 #define GL_PALETTE4_R5_G6_B5_OES 0x8B92
687 #define GL_PALETTE4_RGBA4_OES 0x8B93
688 #define GL_PALETTE4_RGB5_A1_OES 0x8B94
689 #define GL_PALETTE8_RGB8_OES 0x8B95
690 #define GL_PALETTE8_RGBA8_OES 0x8B96
691 #define GL_PALETTE8_R5_G6_B5_OES 0x8B97
692 #define GL_PALETTE8_RGBA4_OES 0x8B98
693 #define GL_PALETTE8_RGB5_A1_OES 0x8B99
694 #endif
695
696 /* GL_OES_texture_cube_map */
697 #ifndef GL_OES_texture_cube_map
698 #define GL_TEXTURE_GEN_STR_OES 0x8D60
699 #endif
700
701 #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
702 #define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \\
703 ((F) * 65536.0f < INT_MIN) ? INT_MIN : \\
704 (GLint) ((F) * 65536.0f) )
705
706 #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
707 #define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \\
708 ((I) < SHRT_MIN) ? INT_MIN : \\
709 (GLint) ((I) * 65536) )
710
711 #define BOOLEAN_TO_INT(B) ( (GLint) (B) )
712 #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
713 #define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 )
714
715 #define ENUM_TO_FIXED(E) (E)
716
717
718 /*
719 * Check if named extension is enabled, if not generate error and return.
720 */
721 #define CHECK_EXT1(EXT1, FUNC) \\
722 if (!ctx->Extensions.EXT1) { \\
723 _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
724 return; \\
725 }
726
727 /*
728 * Check if either of two extensions is enabled.
729 */
730 #define CHECK_EXT2(EXT1, EXT2, FUNC) \\
731 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \\
732 _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
733 return; \\
734 }
735
736 /*
737 * Check if either of three extensions is enabled.
738 */
739 #define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC) \\
740 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\
741 !ctx->Extensions.EXT3) { \\
742 _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
743 return; \\
744 }
745
746 /*
747 * Check if either of four extensions is enabled.
748 */
749 #define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC) \\
750 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\
751 !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \\
752 _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
753 return; \\
754 }
755
756
757
758 /**
759 * List of compressed texture formats supported by ES.
760 */
761 static GLenum compressed_formats[] = {
762 GL_PALETTE4_RGB8_OES,
763 GL_PALETTE4_RGBA8_OES,
764 GL_PALETTE4_R5_G6_B5_OES,
765 GL_PALETTE4_RGBA4_OES,
766 GL_PALETTE4_RGB5_A1_OES,
767 GL_PALETTE8_RGB8_OES,
768 GL_PALETTE8_RGBA8_OES,
769 GL_PALETTE8_R5_G6_B5_OES,
770 GL_PALETTE8_RGBA4_OES,
771 GL_PALETTE8_RGB5_A1_OES
772 };
773
774 #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
775
776 void GLAPIENTRY
777 _mesa_GetFixedv( GLenum pname, GLfixed *params );
778
779 """
780 return
781
782
783 def EmitAll(stateVars, API):
784 EmitHeader()
785 EmitGetFunction(stateVars, GLboolean)
786 EmitGetFunction(stateVars, GLfloat)
787 EmitGetFunction(stateVars, GLint)
788 if API == 1:
789 EmitGetFunction(stateVars, GLfixed)
790
791
792 def main(args):
793 # Determine whether to generate ES1 or ES2 queries
794 if len(args) > 1 and args[1] == "1":
795 API = 1
796 elif len(args) > 1 and args[1] == "2":
797 API = 2
798 else:
799 API = 1
800 #print "len args = %d API = %d" % (len(args), API)
801
802 if API == 1:
803 vars = StateVars_common + StateVars_es1
804 else:
805 vars = StateVars_common + StateVars_es2
806
807 EmitAll(vars, API)
808
809
810 main(sys.argv)