2 * Copyright (C) 2010 Brian Paul All Rights Reserved.
3 * Copyright (C) 2010 Intel Corporation
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 * Author: Kristian Høgsberg <krh@bitplanet.net>
29 #include "extensions.h"
32 #include "mfeatures.h"
35 #include "texcompress.h"
36 #include "framebuffer.h"
38 /* This is a table driven implemetation of the glGet*v() functions.
39 * The basic idea is that most getters just look up an int somewhere
40 * in struct gl_context and then convert it to a bool or float according to
41 * which of glGetIntegerv() glGetBooleanv() etc is being called.
42 * Instead of generating code to do this, we can just record the enum
43 * value and the offset into struct gl_context in an array of structs. Then
44 * in glGet*(), we lookup the struct for the enum in question, and use
45 * the offset to get the int we need.
47 * Sometimes we need to look up a float, a boolean, a bit in a
48 * bitfield, a matrix or other types instead, so we need to track the
49 * type of the value in struct gl_context. And sometimes the value isn't in
50 * struct gl_context but in the drawbuffer, the array object, current texture
51 * unit, or maybe it's a computed value. So we need to also track
52 * where or how to find the value. Finally, we sometimes need to
53 * check that one of a number of extensions are enabled, the GL
54 * version or flush or call _mesa_update_state(). This is done by
55 * attaching optional extra information to the value description
56 * struct, it's sort of like an array of opcodes that describe extra
59 * Putting all this together we end up with struct value_desc below,
60 * and with a couple of macros to help, the table of struct value_desc
61 * is about as concise as the specification in the old python script.
66 #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
67 #define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \
68 ((F) * 65536.0f < INT_MIN) ? INT_MIN : \
69 (GLint) ((F) * 65536.0f) )
71 #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
72 #define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \
73 ((I) < SHRT_MIN) ? INT_MIN : \
74 (GLint) ((I) * 65536) )
76 #define INT64_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
77 #define INT64_TO_INT(I) ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) )
79 #define BOOLEAN_TO_INT(B) ( (GLint) (B) )
80 #define BOOLEAN_TO_INT64(B) ( (GLint64) (B) )
81 #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
82 #define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 )
84 #define ENUM_TO_INT64(E) ( (GLint64) (E) )
85 #define ENUM_TO_FIXED(E) (E)
121 enum value_location
{
136 EXTRA_NEW_FRAG_CLAMP
,
137 EXTRA_VALID_DRAW_BUFFER
,
138 EXTRA_VALID_TEXTURE_UNIT
,
139 EXTRA_VALID_CLIP_DISTANCE
,
144 #define NO_EXTRA NULL
149 GLubyte location
; /**< enum value_location */
150 GLubyte type
; /**< enum value_type */
157 GLfloat value_float_4
[4];
158 GLmatrix
*value_matrix
;
160 GLint value_int_4
[4];
164 /* Sigh, see GL_COMPRESSED_TEXTURE_FORMATS_ARB handling */
168 GLboolean value_bool
;
171 #define BUFFER_FIELD(field, type) \
172 LOC_BUFFER, type, offsetof(struct gl_framebuffer, field)
173 #define CONTEXT_FIELD(field, type) \
174 LOC_CONTEXT, type, offsetof(struct gl_context, field)
175 #define ARRAY_FIELD(field, type) \
176 LOC_ARRAY, type, offsetof(struct gl_array_object, field)
177 #define CONST(value) \
178 LOC_CONTEXT, TYPE_CONST, value
180 #define BUFFER_INT(field) BUFFER_FIELD(field, TYPE_INT)
181 #define BUFFER_ENUM(field) BUFFER_FIELD(field, TYPE_ENUM)
182 #define BUFFER_BOOL(field) BUFFER_FIELD(field, TYPE_BOOLEAN)
184 #define CONTEXT_INT(field) CONTEXT_FIELD(field, TYPE_INT)
185 #define CONTEXT_INT2(field) CONTEXT_FIELD(field, TYPE_INT_2)
186 #define CONTEXT_INT64(field) CONTEXT_FIELD(field, TYPE_INT64)
187 #define CONTEXT_ENUM(field) CONTEXT_FIELD(field, TYPE_ENUM)
188 #define CONTEXT_ENUM2(field) CONTEXT_FIELD(field, TYPE_ENUM_2)
189 #define CONTEXT_BOOL(field) CONTEXT_FIELD(field, TYPE_BOOLEAN)
190 #define CONTEXT_BIT0(field) CONTEXT_FIELD(field, TYPE_BIT_0)
191 #define CONTEXT_BIT1(field) CONTEXT_FIELD(field, TYPE_BIT_1)
192 #define CONTEXT_BIT2(field) CONTEXT_FIELD(field, TYPE_BIT_2)
193 #define CONTEXT_BIT3(field) CONTEXT_FIELD(field, TYPE_BIT_3)
194 #define CONTEXT_BIT4(field) CONTEXT_FIELD(field, TYPE_BIT_4)
195 #define CONTEXT_BIT5(field) CONTEXT_FIELD(field, TYPE_BIT_5)
196 #define CONTEXT_BIT6(field) CONTEXT_FIELD(field, TYPE_BIT_6)
197 #define CONTEXT_BIT7(field) CONTEXT_FIELD(field, TYPE_BIT_7)
198 #define CONTEXT_FLOAT(field) CONTEXT_FIELD(field, TYPE_FLOAT)
199 #define CONTEXT_FLOAT2(field) CONTEXT_FIELD(field, TYPE_FLOAT_2)
200 #define CONTEXT_FLOAT3(field) CONTEXT_FIELD(field, TYPE_FLOAT_3)
201 #define CONTEXT_FLOAT4(field) CONTEXT_FIELD(field, TYPE_FLOAT_4)
202 #define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX)
203 #define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T)
205 #define ARRAY_INT(field) ARRAY_FIELD(field, TYPE_INT)
206 #define ARRAY_ENUM(field) ARRAY_FIELD(field, TYPE_ENUM)
207 #define ARRAY_BOOL(field) ARRAY_FIELD(field, TYPE_BOOLEAN)
210 offsetof(struct gl_extensions, f)
212 #define EXTRA_EXT(e) \
213 static const int extra_##e[] = { \
217 #define EXTRA_EXT2(e1, e2) \
218 static const int extra_##e1##_##e2[] = { \
219 EXT(e1), EXT(e2), EXTRA_END \
222 /* The 'extra' mechanism is a way to specify extra checks (such as
223 * extensions or specific gl versions) or actions (flush current, new
224 * buffers) that we need to do before looking up an enum. We need to
225 * declare them all up front so we can refer to them in the value_desc
228 static const int extra_new_buffers
[] = {
233 static const int extra_new_frag_clamp
[] = {
234 EXTRA_NEW_FRAG_CLAMP
,
238 static const int extra_valid_draw_buffer
[] = {
239 EXTRA_VALID_DRAW_BUFFER
,
243 static const int extra_valid_texture_unit
[] = {
244 EXTRA_VALID_TEXTURE_UNIT
,
248 static const int extra_valid_clip_distance
[] = {
249 EXTRA_VALID_CLIP_DISTANCE
,
253 static const int extra_flush_current_valid_texture_unit
[] = {
255 EXTRA_VALID_TEXTURE_UNIT
,
259 static const int extra_flush_current
[] = {
264 static const int extra_EXT_secondary_color_flush_current
[] = {
265 EXT(EXT_secondary_color
),
270 static const int extra_EXT_fog_coord_flush_current
[] = {
276 static const int extra_EXT_texture_integer
[] = {
277 EXT(EXT_texture_integer
),
281 static const int extra_GLSL_130
[] = {
286 static const int extra_ARB_sampler_objects
[] = {
287 EXT(ARB_sampler_objects
),
292 EXTRA_EXT(ARB_ES2_compatibility
);
293 EXTRA_EXT(ARB_texture_cube_map
);
294 EXTRA_EXT(MESA_texture_array
);
295 EXTRA_EXT2(EXT_secondary_color
, ARB_vertex_program
);
296 EXTRA_EXT(EXT_secondary_color
);
297 EXTRA_EXT(EXT_fog_coord
);
298 EXTRA_EXT(NV_fog_distance
);
299 EXTRA_EXT(EXT_texture_filter_anisotropic
);
300 EXTRA_EXT(IBM_rasterpos_clip
);
301 EXTRA_EXT(NV_point_sprite
);
302 EXTRA_EXT(NV_vertex_program
);
303 EXTRA_EXT(NV_fragment_program
);
304 EXTRA_EXT(NV_texture_rectangle
);
305 EXTRA_EXT(EXT_stencil_two_side
);
306 EXTRA_EXT(NV_light_max_exponent
);
307 EXTRA_EXT(EXT_depth_bounds_test
);
308 EXTRA_EXT(ARB_depth_clamp
);
309 EXTRA_EXT(ATI_fragment_shader
);
310 EXTRA_EXT(EXT_framebuffer_blit
);
311 EXTRA_EXT(ARB_shader_objects
);
312 EXTRA_EXT(EXT_provoking_vertex
);
313 EXTRA_EXT(ARB_fragment_shader
);
314 EXTRA_EXT(ARB_fragment_program
);
315 EXTRA_EXT2(ARB_framebuffer_object
, EXT_framebuffer_multisample
);
316 EXTRA_EXT(EXT_framebuffer_object
);
317 EXTRA_EXT(APPLE_vertex_array_object
);
318 EXTRA_EXT(ARB_seamless_cube_map
);
319 EXTRA_EXT(EXT_compiled_vertex_array
);
321 EXTRA_EXT(ARB_vertex_shader
);
322 EXTRA_EXT(EXT_transform_feedback
);
323 EXTRA_EXT(ARB_transform_feedback2
);
324 EXTRA_EXT(EXT_pixel_buffer_object
);
325 EXTRA_EXT(ARB_vertex_program
);
326 EXTRA_EXT2(NV_point_sprite
, ARB_point_sprite
);
327 EXTRA_EXT2(ARB_fragment_program
, NV_fragment_program
);
328 EXTRA_EXT2(ARB_vertex_program
, NV_vertex_program
);
329 EXTRA_EXT2(ARB_vertex_program
, ARB_fragment_program
);
330 EXTRA_EXT(ARB_geometry_shader4
);
331 EXTRA_EXT(ARB_color_buffer_float
);
332 EXTRA_EXT(ARB_copy_buffer
);
333 EXTRA_EXT(EXT_framebuffer_sRGB
);
334 EXTRA_EXT(ARB_texture_buffer_object
);
335 EXTRA_EXT(OES_EGL_image_external
);
336 EXTRA_EXT(ARB_blend_func_extended
);
339 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
[] = {
340 EXT(ARB_vertex_program
),
341 EXT(ARB_fragment_program
),
342 EXT(NV_vertex_program
),
347 extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
[] = {
348 EXT(NV_vertex_program
),
349 EXT(ARB_vertex_program
),
350 EXT(ARB_fragment_program
),
351 EXT(NV_vertex_program
),
356 extra_NV_primitive_restart
[] = {
357 EXT(NV_primitive_restart
),
361 static const int extra_version_30
[] = { EXTRA_VERSION_30
, EXTRA_END
};
362 static const int extra_version_31
[] = { EXTRA_VERSION_31
, EXTRA_END
};
363 static const int extra_version_32
[] = { EXTRA_VERSION_32
, EXTRA_END
};
366 extra_ARB_vertex_program_version_es2
[] = {
367 EXT(ARB_vertex_program
),
372 #define API_OPENGL_BIT (1 << API_OPENGL)
373 #define API_OPENGLES_BIT (1 << API_OPENGLES)
374 #define API_OPENGLES2_BIT (1 << API_OPENGLES2)
376 /* This is the big table describing all the enums we accept in
377 * glGet*v(). The table is partitioned into six parts: enums
378 * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared
379 * between OpenGL and GLES, enums exclusive to GLES, etc for the
380 * remaining combinations. When we add the enums to the hash table in
381 * _mesa_init_get_hash(), we only add the enums for the API we're
382 * instantiating and the different sections are guarded by #if
383 * FEATURE_GL etc to make sure we only compile in the enums we may
386 static const struct value_desc values
[] = {
387 /* Enums shared between OpenGL, GLES1 and GLES2 */
388 { 0, 0, TYPE_API_MASK
,
389 API_OPENGL_BIT
| API_OPENGLES_BIT
| API_OPENGLES2_BIT
, NO_EXTRA
},
390 { GL_ALPHA_BITS
, BUFFER_INT(Visual
.alphaBits
), extra_new_buffers
},
391 { GL_BLEND
, CONTEXT_BIT0(Color
.BlendEnabled
), NO_EXTRA
},
392 { GL_BLEND_SRC
, CONTEXT_ENUM(Color
.Blend
[0].SrcRGB
), NO_EXTRA
},
393 { GL_BLUE_BITS
, BUFFER_INT(Visual
.blueBits
), extra_new_buffers
},
394 { GL_COLOR_CLEAR_VALUE
, LOC_CUSTOM
, TYPE_FLOATN_4
, 0, extra_new_frag_clamp
},
395 { GL_COLOR_WRITEMASK
, LOC_CUSTOM
, TYPE_INT_4
, 0, NO_EXTRA
},
396 { GL_CULL_FACE
, CONTEXT_BOOL(Polygon
.CullFlag
), NO_EXTRA
},
397 { GL_CULL_FACE_MODE
, CONTEXT_ENUM(Polygon
.CullFaceMode
), NO_EXTRA
},
398 { GL_DEPTH_BITS
, BUFFER_INT(Visual
.depthBits
), NO_EXTRA
},
399 { GL_DEPTH_CLEAR_VALUE
, CONTEXT_FIELD(Depth
.Clear
, TYPE_DOUBLEN
), NO_EXTRA
},
400 { GL_DEPTH_FUNC
, CONTEXT_ENUM(Depth
.Func
), NO_EXTRA
},
401 { GL_DEPTH_RANGE
, CONTEXT_FIELD(Viewport
.Near
, TYPE_FLOATN_2
), NO_EXTRA
},
402 { GL_DEPTH_TEST
, CONTEXT_BOOL(Depth
.Test
), NO_EXTRA
},
403 { GL_DEPTH_WRITEMASK
, CONTEXT_BOOL(Depth
.Mask
), NO_EXTRA
},
404 { GL_DITHER
, CONTEXT_BOOL(Color
.DitherFlag
), NO_EXTRA
},
405 { GL_FRONT_FACE
, CONTEXT_ENUM(Polygon
.FrontFace
), NO_EXTRA
},
406 { GL_GREEN_BITS
, BUFFER_INT(Visual
.greenBits
), extra_new_buffers
},
407 { GL_LINE_WIDTH
, CONTEXT_FLOAT(Line
.Width
), NO_EXTRA
},
408 { GL_ALIASED_LINE_WIDTH_RANGE
, CONTEXT_FLOAT2(Const
.MinLineWidth
), NO_EXTRA
},
409 { GL_MAX_ELEMENTS_VERTICES
, CONTEXT_INT(Const
.MaxArrayLockSize
), NO_EXTRA
},
410 { GL_MAX_ELEMENTS_INDICES
, CONTEXT_INT(Const
.MaxArrayLockSize
), NO_EXTRA
},
411 { GL_MAX_TEXTURE_SIZE
, LOC_CUSTOM
, TYPE_INT
,
412 offsetof(struct gl_context
, Const
.MaxTextureLevels
), NO_EXTRA
},
413 { GL_MAX_VIEWPORT_DIMS
, CONTEXT_INT2(Const
.MaxViewportWidth
), NO_EXTRA
},
414 { GL_PACK_ALIGNMENT
, CONTEXT_INT(Pack
.Alignment
), NO_EXTRA
},
415 { GL_ALIASED_POINT_SIZE_RANGE
, CONTEXT_FLOAT2(Const
.MinPointSize
), NO_EXTRA
},
416 { GL_POLYGON_OFFSET_FACTOR
, CONTEXT_FLOAT(Polygon
.OffsetFactor
), NO_EXTRA
},
417 { GL_POLYGON_OFFSET_UNITS
, CONTEXT_FLOAT(Polygon
.OffsetUnits
), NO_EXTRA
},
418 { GL_POLYGON_OFFSET_FILL
, CONTEXT_BOOL(Polygon
.OffsetFill
), NO_EXTRA
},
419 { GL_RED_BITS
, BUFFER_INT(Visual
.redBits
), extra_new_buffers
},
420 { GL_SCISSOR_BOX
, LOC_CUSTOM
, TYPE_INT_4
, 0, NO_EXTRA
},
421 { GL_SCISSOR_TEST
, CONTEXT_BOOL(Scissor
.Enabled
), NO_EXTRA
},
422 { GL_STENCIL_BITS
, BUFFER_INT(Visual
.stencilBits
), NO_EXTRA
},
423 { GL_STENCIL_CLEAR_VALUE
, CONTEXT_INT(Stencil
.Clear
), NO_EXTRA
},
424 { GL_STENCIL_FAIL
, LOC_CUSTOM
, TYPE_ENUM
, NO_OFFSET
, NO_EXTRA
},
425 { GL_STENCIL_FUNC
, LOC_CUSTOM
, TYPE_ENUM
, NO_OFFSET
, NO_EXTRA
},
426 { GL_STENCIL_PASS_DEPTH_FAIL
, LOC_CUSTOM
, TYPE_ENUM
, NO_OFFSET
, NO_EXTRA
},
427 { GL_STENCIL_PASS_DEPTH_PASS
, LOC_CUSTOM
, TYPE_ENUM
, NO_OFFSET
, NO_EXTRA
},
428 { GL_STENCIL_REF
, LOC_CUSTOM
, TYPE_INT
, NO_OFFSET
, NO_EXTRA
},
429 { GL_STENCIL_TEST
, CONTEXT_BOOL(Stencil
.Enabled
), NO_EXTRA
},
430 { GL_STENCIL_VALUE_MASK
, LOC_CUSTOM
, TYPE_INT
, NO_OFFSET
, NO_EXTRA
},
431 { GL_STENCIL_WRITEMASK
, LOC_CUSTOM
, TYPE_INT
, NO_OFFSET
, NO_EXTRA
},
432 { GL_SUBPIXEL_BITS
, CONTEXT_INT(Const
.SubPixelBits
), NO_EXTRA
},
433 { GL_TEXTURE_BINDING_2D
, LOC_CUSTOM
, TYPE_INT
, TEXTURE_2D_INDEX
, NO_EXTRA
},
434 { GL_UNPACK_ALIGNMENT
, CONTEXT_INT(Unpack
.Alignment
), NO_EXTRA
},
435 { GL_VIEWPORT
, LOC_CUSTOM
, TYPE_INT_4
, 0, NO_EXTRA
},
437 /* GL_ARB_multitexture */
438 { GL_ACTIVE_TEXTURE
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
440 /* Note that all the OES_* extensions require that the Mesa "struct
441 * gl_extensions" include a member with the name of the extension.
442 * That structure does not yet include OES extensions (and we're
443 * not sure whether it will). If it does, all the OES_*
444 * extensions below should mark the dependency. */
446 /* GL_ARB_texture_cube_map */
447 { GL_TEXTURE_BINDING_CUBE_MAP_ARB
, LOC_CUSTOM
, TYPE_INT
,
448 TEXTURE_CUBE_INDEX
, extra_ARB_texture_cube_map
},
449 { GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB
, LOC_CUSTOM
, TYPE_INT
,
450 offsetof(struct gl_context
, Const
.MaxCubeTextureLevels
),
451 extra_ARB_texture_cube_map
}, /* XXX: OES_texture_cube_map */
453 /* XXX: OES_blend_subtract */
454 { GL_BLEND_SRC_RGB_EXT
, CONTEXT_ENUM(Color
.Blend
[0].SrcRGB
), NO_EXTRA
},
455 { GL_BLEND_DST_RGB_EXT
, CONTEXT_ENUM(Color
.Blend
[0].DstRGB
), NO_EXTRA
},
456 { GL_BLEND_SRC_ALPHA_EXT
, CONTEXT_ENUM(Color
.Blend
[0].SrcA
), NO_EXTRA
},
457 { GL_BLEND_DST_ALPHA_EXT
, CONTEXT_ENUM(Color
.Blend
[0].DstA
), NO_EXTRA
},
459 /* GL_BLEND_EQUATION_RGB, which is what we're really after, is
460 * defined identically to GL_BLEND_EQUATION. */
461 { GL_BLEND_EQUATION
, CONTEXT_ENUM(Color
.Blend
[0].EquationRGB
), NO_EXTRA
},
462 { GL_BLEND_EQUATION_ALPHA_EXT
, CONTEXT_ENUM(Color
.Blend
[0].EquationA
), NO_EXTRA
},
464 /* GL_ARB_texture_compression */
465 { GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
466 { GL_COMPRESSED_TEXTURE_FORMATS_ARB
, LOC_CUSTOM
, TYPE_INT_N
, 0, NO_EXTRA
},
468 /* GL_ARB_multisample */
469 { GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
,
470 CONTEXT_BOOL(Multisample
.SampleAlphaToCoverage
), NO_EXTRA
},
471 { GL_SAMPLE_COVERAGE_ARB
, CONTEXT_BOOL(Multisample
.SampleCoverage
), NO_EXTRA
},
472 { GL_SAMPLE_COVERAGE_VALUE_ARB
,
473 CONTEXT_FLOAT(Multisample
.SampleCoverageValue
), NO_EXTRA
},
474 { GL_SAMPLE_COVERAGE_INVERT_ARB
,
475 CONTEXT_BOOL(Multisample
.SampleCoverageInvert
), NO_EXTRA
},
476 { GL_SAMPLE_BUFFERS_ARB
, BUFFER_INT(Visual
.sampleBuffers
), NO_EXTRA
},
477 { GL_SAMPLES_ARB
, BUFFER_INT(Visual
.samples
), NO_EXTRA
},
479 /* GL_SGIS_generate_mipmap */
480 { GL_GENERATE_MIPMAP_HINT_SGIS
, CONTEXT_ENUM(Hint
.GenerateMipmap
), NO_EXTRA
},
482 /* GL_ARB_vertex_buffer_object */
483 { GL_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
485 /* GL_ARB_vertex_buffer_object */
486 /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported */
487 { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
489 /* GL_ARB_color_buffer_float */
490 { GL_CLAMP_VERTEX_COLOR
, CONTEXT_ENUM(Light
.ClampVertexColor
), extra_ARB_color_buffer_float
},
491 { GL_CLAMP_FRAGMENT_COLOR
, CONTEXT_ENUM(Color
.ClampFragmentColor
), extra_ARB_color_buffer_float
},
492 { GL_CLAMP_READ_COLOR
, CONTEXT_ENUM(Color
.ClampReadColor
), extra_ARB_color_buffer_float
},
494 /* GL_ARB_copy_buffer */
495 { GL_COPY_READ_BUFFER
, LOC_CUSTOM
, TYPE_INT
, 0, extra_ARB_copy_buffer
},
496 { GL_COPY_WRITE_BUFFER
, LOC_CUSTOM
, TYPE_INT
, 0, extra_ARB_copy_buffer
},
498 /* GL_OES_read_format */
499 { GL_IMPLEMENTATION_COLOR_READ_TYPE_OES
, LOC_CUSTOM
, TYPE_INT
, 0,
501 { GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES
, LOC_CUSTOM
, TYPE_INT
, 0,
504 /* GL_EXT_framebuffer_object */
505 { GL_FRAMEBUFFER_BINDING_EXT
, BUFFER_INT(Name
),
506 extra_EXT_framebuffer_object
},
507 { GL_RENDERBUFFER_BINDING_EXT
, LOC_CUSTOM
, TYPE_INT
, 0,
508 extra_EXT_framebuffer_object
},
509 { GL_MAX_RENDERBUFFER_SIZE_EXT
, CONTEXT_INT(Const
.MaxRenderbufferSize
),
510 extra_EXT_framebuffer_object
},
512 /* This entry isn't spec'ed for GLES 2, but is needed for Mesa's
514 { GL_MAX_CLIP_PLANES
, CONTEXT_INT(Const
.MaxClipPlanes
), NO_EXTRA
},
516 #if FEATURE_GL || FEATURE_ES1
517 /* Enums in OpenGL and GLES1 */
518 { 0, 0, TYPE_API_MASK
, API_OPENGL_BIT
| API_OPENGLES_BIT
, NO_EXTRA
},
519 { GL_MAX_LIGHTS
, CONTEXT_INT(Const
.MaxLights
), NO_EXTRA
},
520 { GL_LIGHT0
, CONTEXT_BOOL(Light
.Light
[0].Enabled
), NO_EXTRA
},
521 { GL_LIGHT1
, CONTEXT_BOOL(Light
.Light
[1].Enabled
), NO_EXTRA
},
522 { GL_LIGHT2
, CONTEXT_BOOL(Light
.Light
[2].Enabled
), NO_EXTRA
},
523 { GL_LIGHT3
, CONTEXT_BOOL(Light
.Light
[3].Enabled
), NO_EXTRA
},
524 { GL_LIGHT4
, CONTEXT_BOOL(Light
.Light
[4].Enabled
), NO_EXTRA
},
525 { GL_LIGHT5
, CONTEXT_BOOL(Light
.Light
[5].Enabled
), NO_EXTRA
},
526 { GL_LIGHT6
, CONTEXT_BOOL(Light
.Light
[6].Enabled
), NO_EXTRA
},
527 { GL_LIGHT7
, CONTEXT_BOOL(Light
.Light
[7].Enabled
), NO_EXTRA
},
528 { GL_LIGHTING
, CONTEXT_BOOL(Light
.Enabled
), NO_EXTRA
},
529 { GL_LIGHT_MODEL_AMBIENT
,
530 CONTEXT_FIELD(Light
.Model
.Ambient
[0], TYPE_FLOATN_4
), NO_EXTRA
},
531 { GL_LIGHT_MODEL_TWO_SIDE
, CONTEXT_BOOL(Light
.Model
.TwoSide
), NO_EXTRA
},
532 { GL_ALPHA_TEST
, CONTEXT_BOOL(Color
.AlphaEnabled
), NO_EXTRA
},
533 { GL_ALPHA_TEST_FUNC
, CONTEXT_ENUM(Color
.AlphaFunc
), NO_EXTRA
},
534 { GL_ALPHA_TEST_REF
, LOC_CUSTOM
, TYPE_FLOATN
, 0, extra_new_frag_clamp
},
535 { GL_BLEND_DST
, CONTEXT_ENUM(Color
.Blend
[0].DstRGB
), NO_EXTRA
},
536 { GL_CLIP_DISTANCE0
, CONTEXT_BIT0(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
537 { GL_CLIP_DISTANCE1
, CONTEXT_BIT1(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
538 { GL_CLIP_DISTANCE2
, CONTEXT_BIT2(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
539 { GL_CLIP_DISTANCE3
, CONTEXT_BIT3(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
540 { GL_CLIP_DISTANCE4
, CONTEXT_BIT4(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
541 { GL_CLIP_DISTANCE5
, CONTEXT_BIT5(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
542 { GL_CLIP_DISTANCE6
, CONTEXT_BIT6(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
543 { GL_CLIP_DISTANCE7
, CONTEXT_BIT7(Transform
.ClipPlanesEnabled
), extra_valid_clip_distance
},
544 { GL_COLOR_MATERIAL
, CONTEXT_BOOL(Light
.ColorMaterialEnabled
), NO_EXTRA
},
546 CONTEXT_FIELD(Current
.Attrib
[VERT_ATTRIB_COLOR0
][0], TYPE_FLOATN_4
),
547 extra_flush_current
},
549 CONTEXT_FIELD(Current
.Attrib
[VERT_ATTRIB_NORMAL
][0], TYPE_FLOATN_3
),
550 extra_flush_current
},
551 { GL_CURRENT_TEXTURE_COORDS
, LOC_CUSTOM
, TYPE_FLOAT_4
, 0,
552 extra_flush_current_valid_texture_unit
},
553 { GL_DISTANCE_ATTENUATION_EXT
, CONTEXT_FLOAT3(Point
.Params
[0]), NO_EXTRA
},
554 { GL_FOG
, CONTEXT_BOOL(Fog
.Enabled
), NO_EXTRA
},
555 { GL_FOG_COLOR
, LOC_CUSTOM
, TYPE_FLOATN_4
, 0, extra_new_frag_clamp
},
556 { GL_FOG_DENSITY
, CONTEXT_FLOAT(Fog
.Density
), NO_EXTRA
},
557 { GL_FOG_END
, CONTEXT_FLOAT(Fog
.End
), NO_EXTRA
},
558 { GL_FOG_HINT
, CONTEXT_ENUM(Hint
.Fog
), NO_EXTRA
},
559 { GL_FOG_MODE
, CONTEXT_ENUM(Fog
.Mode
), NO_EXTRA
},
560 { GL_FOG_START
, CONTEXT_FLOAT(Fog
.Start
), NO_EXTRA
},
561 { GL_LINE_SMOOTH
, CONTEXT_BOOL(Line
.SmoothFlag
), NO_EXTRA
},
562 { GL_LINE_SMOOTH_HINT
, CONTEXT_ENUM(Hint
.LineSmooth
), NO_EXTRA
},
563 { GL_LINE_WIDTH_RANGE
, CONTEXT_FLOAT2(Const
.MinLineWidthAA
), NO_EXTRA
},
564 { GL_COLOR_LOGIC_OP
, CONTEXT_BOOL(Color
.ColorLogicOpEnabled
), NO_EXTRA
},
565 { GL_LOGIC_OP_MODE
, CONTEXT_ENUM(Color
.LogicOp
), NO_EXTRA
},
566 { GL_MATRIX_MODE
, CONTEXT_ENUM(Transform
.MatrixMode
), NO_EXTRA
},
567 { GL_MAX_MODELVIEW_STACK_DEPTH
, CONST(MAX_MODELVIEW_STACK_DEPTH
), NO_EXTRA
},
568 { GL_MAX_PROJECTION_STACK_DEPTH
, CONST(MAX_PROJECTION_STACK_DEPTH
), NO_EXTRA
},
569 { GL_MAX_TEXTURE_STACK_DEPTH
, CONST(MAX_TEXTURE_STACK_DEPTH
), NO_EXTRA
},
570 { GL_MODELVIEW_MATRIX
, CONTEXT_MATRIX(ModelviewMatrixStack
.Top
), NO_EXTRA
},
571 { GL_MODELVIEW_STACK_DEPTH
, LOC_CUSTOM
, TYPE_INT
,
572 offsetof(struct gl_context
, ModelviewMatrixStack
.Depth
), NO_EXTRA
},
573 { GL_NORMALIZE
, CONTEXT_BOOL(Transform
.Normalize
), NO_EXTRA
},
574 { GL_PACK_SKIP_IMAGES_EXT
, CONTEXT_INT(Pack
.SkipImages
), NO_EXTRA
},
575 { GL_PERSPECTIVE_CORRECTION_HINT
, CONTEXT_ENUM(Hint
.PerspectiveCorrection
), NO_EXTRA
},
576 { GL_POINT_SIZE
, CONTEXT_FLOAT(Point
.Size
), NO_EXTRA
},
577 { GL_POINT_SIZE_RANGE
, CONTEXT_FLOAT2(Const
.MinPointSizeAA
), NO_EXTRA
},
578 { GL_POINT_SMOOTH
, CONTEXT_BOOL(Point
.SmoothFlag
), NO_EXTRA
},
579 { GL_POINT_SMOOTH_HINT
, CONTEXT_ENUM(Hint
.PointSmooth
), NO_EXTRA
},
580 { GL_POINT_SIZE_MIN_EXT
, CONTEXT_FLOAT(Point
.MinSize
), NO_EXTRA
},
581 { GL_POINT_SIZE_MAX_EXT
, CONTEXT_FLOAT(Point
.MaxSize
), NO_EXTRA
},
582 { GL_POINT_FADE_THRESHOLD_SIZE_EXT
, CONTEXT_FLOAT(Point
.Threshold
), NO_EXTRA
},
583 { GL_PROJECTION_MATRIX
, CONTEXT_MATRIX(ProjectionMatrixStack
.Top
), NO_EXTRA
},
584 { GL_PROJECTION_STACK_DEPTH
, LOC_CUSTOM
, TYPE_INT
,
585 offsetof(struct gl_context
, ProjectionMatrixStack
.Depth
), NO_EXTRA
},
586 { GL_RESCALE_NORMAL
, CONTEXT_BOOL(Transform
.RescaleNormals
), NO_EXTRA
},
587 { GL_SHADE_MODEL
, CONTEXT_ENUM(Light
.ShadeModel
), NO_EXTRA
},
588 { GL_TEXTURE_2D
, LOC_CUSTOM
, TYPE_BOOLEAN
, 0, NO_EXTRA
},
589 { GL_TEXTURE_MATRIX
, LOC_CUSTOM
, TYPE_MATRIX
, 0, extra_valid_texture_unit
},
590 { GL_TEXTURE_STACK_DEPTH
, LOC_CUSTOM
, TYPE_INT
, 0,
591 extra_valid_texture_unit
},
593 { GL_VERTEX_ARRAY
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_POS
].Enabled
), NO_EXTRA
},
594 { GL_VERTEX_ARRAY_SIZE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_POS
].Size
), NO_EXTRA
},
595 { GL_VERTEX_ARRAY_TYPE
, ARRAY_ENUM(VertexAttrib
[VERT_ATTRIB_POS
].Type
), NO_EXTRA
},
596 { GL_VERTEX_ARRAY_STRIDE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_POS
].Stride
), NO_EXTRA
},
597 { GL_NORMAL_ARRAY
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
), NO_EXTRA
},
598 { GL_NORMAL_ARRAY_TYPE
, ARRAY_ENUM(VertexAttrib
[VERT_ATTRIB_NORMAL
].Type
), NO_EXTRA
},
599 { GL_NORMAL_ARRAY_STRIDE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_NORMAL
].Stride
), NO_EXTRA
},
600 { GL_COLOR_ARRAY
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
), NO_EXTRA
},
601 { GL_COLOR_ARRAY_SIZE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_COLOR0
].Size
), NO_EXTRA
},
602 { GL_COLOR_ARRAY_TYPE
, ARRAY_ENUM(VertexAttrib
[VERT_ATTRIB_COLOR0
].Type
), NO_EXTRA
},
603 { GL_COLOR_ARRAY_STRIDE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_COLOR0
].Stride
), NO_EXTRA
},
604 { GL_TEXTURE_COORD_ARRAY
,
605 LOC_CUSTOM
, TYPE_BOOLEAN
, offsetof(struct gl_client_array
, Enabled
), NO_EXTRA
},
606 { GL_TEXTURE_COORD_ARRAY_SIZE
,
607 LOC_CUSTOM
, TYPE_INT
, offsetof(struct gl_client_array
, Size
), NO_EXTRA
},
608 { GL_TEXTURE_COORD_ARRAY_TYPE
,
609 LOC_CUSTOM
, TYPE_ENUM
, offsetof(struct gl_client_array
, Type
), NO_EXTRA
},
610 { GL_TEXTURE_COORD_ARRAY_STRIDE
,
611 LOC_CUSTOM
, TYPE_INT
, offsetof(struct gl_client_array
, Stride
), NO_EXTRA
},
613 /* GL_ARB_ES2_compatibility */
614 { GL_SHADER_COMPILER
, CONST(1), extra_ARB_ES2_compatibility
},
615 { GL_MAX_VARYING_VECTORS
, CONTEXT_INT(Const
.MaxVarying
),
616 extra_ARB_ES2_compatibility
},
617 { GL_MAX_VERTEX_UNIFORM_VECTORS
, LOC_CUSTOM
, TYPE_INT
, 0,
618 extra_ARB_ES2_compatibility
},
619 { GL_MAX_FRAGMENT_UNIFORM_VECTORS
, LOC_CUSTOM
, TYPE_INT
, 0,
620 extra_ARB_ES2_compatibility
},
622 /* GL_ARB_multitexture */
623 { GL_MAX_TEXTURE_UNITS
, CONTEXT_INT(Const
.MaxTextureUnits
), NO_EXTRA
},
624 { GL_CLIENT_ACTIVE_TEXTURE
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
626 /* GL_ARB_texture_cube_map */
627 { GL_TEXTURE_CUBE_MAP_ARB
, LOC_CUSTOM
, TYPE_BOOLEAN
, 0, NO_EXTRA
},
628 /* S, T, and R are always set at the same time */
629 { GL_TEXTURE_GEN_STR_OES
, LOC_TEXUNIT
, TYPE_BIT_0
,
630 offsetof(struct gl_texture_unit
, TexGenEnabled
), NO_EXTRA
},
632 /* GL_ARB_multisample */
633 { GL_MULTISAMPLE_ARB
, CONTEXT_BOOL(Multisample
.Enabled
), NO_EXTRA
},
634 { GL_SAMPLE_ALPHA_TO_ONE_ARB
, CONTEXT_BOOL(Multisample
.SampleAlphaToOne
), NO_EXTRA
},
636 /* GL_ARB_vertex_buffer_object */
637 { GL_VERTEX_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
638 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_POS
].BufferObj
), NO_EXTRA
},
639 { GL_NORMAL_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
640 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_NORMAL
].BufferObj
), NO_EXTRA
},
641 { GL_COLOR_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
642 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_COLOR0
].BufferObj
), NO_EXTRA
},
643 { GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
, NO_OFFSET
, NO_EXTRA
},
645 /* GL_OES_point_sprite */
646 { GL_POINT_SPRITE_NV
,
647 CONTEXT_BOOL(Point
.PointSprite
),
648 extra_NV_point_sprite_ARB_point_sprite
},
650 /* GL_ARB_fragment_shader */
651 { GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB
,
652 CONTEXT_INT(Const
.FragmentProgram
.MaxUniformComponents
),
653 extra_ARB_fragment_shader
},
655 /* GL_ARB_vertex_shader */
656 { GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB
,
657 CONTEXT_INT(Const
.VertexProgram
.MaxUniformComponents
),
658 extra_ARB_vertex_shader
},
659 { GL_MAX_VARYING_FLOATS_ARB
, LOC_CUSTOM
, TYPE_INT
, 0,
660 extra_ARB_vertex_shader
},
662 /* GL_EXT_texture_lod_bias */
663 { GL_MAX_TEXTURE_LOD_BIAS_EXT
, CONTEXT_FLOAT(Const
.MaxTextureLodBias
),
666 /* GL_EXT_texture_filter_anisotropic */
667 { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
,
668 CONTEXT_FLOAT(Const
.MaxTextureMaxAnisotropy
),
669 extra_EXT_texture_filter_anisotropic
},
670 #endif /* FEATURE_GL || FEATURE_ES1 */
673 { 0, 0, TYPE_API_MASK
, API_OPENGLES_BIT
},
674 /* XXX: OES_matrix_get */
675 { GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES
},
676 { GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES
},
677 { GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES
},
679 /* OES_point_size_array */
680 { GL_POINT_SIZE_ARRAY_OES
, ARRAY_FIELD(VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Enabled
, TYPE_BOOLEAN
) },
681 { GL_POINT_SIZE_ARRAY_TYPE_OES
, ARRAY_FIELD(VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Type
, TYPE_ENUM
) },
682 { GL_POINT_SIZE_ARRAY_STRIDE_OES
, ARRAY_FIELD(VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Stride
, TYPE_INT
) },
683 { GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES
, LOC_CUSTOM
, TYPE_INT
, 0 },
684 #endif /* FEATURE_ES1 */
686 #if FEATURE_GL || FEATURE_ES2
687 { 0, 0, TYPE_API_MASK
, API_OPENGL_BIT
| API_OPENGLES2_BIT
, NO_EXTRA
},
688 { GL_MAX_TEXTURE_COORDS_ARB
, /* == GL_MAX_TEXTURE_COORDS_NV */
689 CONTEXT_INT(Const
.MaxTextureCoordUnits
),
690 extra_ARB_fragment_program_NV_fragment_program
},
692 /* GL_ARB_draw_buffers */
693 { GL_MAX_DRAW_BUFFERS_ARB
, CONTEXT_INT(Const
.MaxDrawBuffers
), NO_EXTRA
},
695 /* GL_EXT_framebuffer_object / GL_NV_fbo_color_attachments */
696 { GL_MAX_COLOR_ATTACHMENTS
, CONTEXT_INT(Const
.MaxColorAttachments
),
697 extra_EXT_framebuffer_object
},
699 /* GL_ARB_draw_buffers / GL_NV_draw_buffers (for ES 2.0) */
700 { GL_DRAW_BUFFER0_ARB
, BUFFER_ENUM(ColorDrawBuffer
[0]), NO_EXTRA
},
701 { GL_DRAW_BUFFER1_ARB
, BUFFER_ENUM(ColorDrawBuffer
[1]),
702 extra_valid_draw_buffer
},
703 { GL_DRAW_BUFFER2_ARB
, BUFFER_ENUM(ColorDrawBuffer
[2]),
704 extra_valid_draw_buffer
},
705 { GL_DRAW_BUFFER3_ARB
, BUFFER_ENUM(ColorDrawBuffer
[3]),
706 extra_valid_draw_buffer
},
707 { GL_DRAW_BUFFER4_ARB
, BUFFER_ENUM(ColorDrawBuffer
[4]),
708 extra_valid_draw_buffer
},
709 { GL_DRAW_BUFFER5_ARB
, BUFFER_ENUM(ColorDrawBuffer
[5]),
710 extra_valid_draw_buffer
},
711 { GL_DRAW_BUFFER6_ARB
, BUFFER_ENUM(ColorDrawBuffer
[6]),
712 extra_valid_draw_buffer
},
713 { GL_DRAW_BUFFER7_ARB
, BUFFER_ENUM(ColorDrawBuffer
[7]),
714 extra_valid_draw_buffer
},
716 { GL_BLEND_COLOR_EXT
, LOC_CUSTOM
, TYPE_FLOATN_4
, 0, extra_new_frag_clamp
},
717 /* GL_ARB_fragment_program */
718 { GL_MAX_TEXTURE_IMAGE_UNITS_ARB
, /* == GL_MAX_TEXTURE_IMAGE_UNITS_NV */
719 CONTEXT_INT(Const
.MaxTextureImageUnits
),
720 extra_ARB_fragment_program_NV_fragment_program
},
721 { GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB
,
722 CONTEXT_INT(Const
.MaxVertexTextureImageUnits
), extra_ARB_vertex_shader
},
723 { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB
,
724 CONTEXT_INT(Const
.MaxCombinedTextureImageUnits
),
725 extra_ARB_vertex_shader
},
727 /* GL_ARB_shader_objects
728 * Actually, this token isn't part of GL_ARB_shader_objects, but is
729 * close enough for now. */
730 { GL_CURRENT_PROGRAM
, LOC_CUSTOM
, TYPE_INT
, 0, extra_ARB_shader_objects
},
733 { GL_STENCIL_BACK_FUNC
, CONTEXT_ENUM(Stencil
.Function
[1]), NO_EXTRA
},
734 { GL_STENCIL_BACK_VALUE_MASK
, CONTEXT_INT(Stencil
.ValueMask
[1]), NO_EXTRA
},
735 { GL_STENCIL_BACK_WRITEMASK
, CONTEXT_INT(Stencil
.WriteMask
[1]), NO_EXTRA
},
736 { GL_STENCIL_BACK_REF
, CONTEXT_INT(Stencil
.Ref
[1]), NO_EXTRA
},
737 { GL_STENCIL_BACK_FAIL
, CONTEXT_ENUM(Stencil
.FailFunc
[1]), NO_EXTRA
},
738 { GL_STENCIL_BACK_PASS_DEPTH_FAIL
, CONTEXT_ENUM(Stencil
.ZFailFunc
[1]), NO_EXTRA
},
739 { GL_STENCIL_BACK_PASS_DEPTH_PASS
, CONTEXT_ENUM(Stencil
.ZPassFunc
[1]), NO_EXTRA
},
741 { GL_MAX_VERTEX_ATTRIBS_ARB
,
742 CONTEXT_INT(Const
.VertexProgram
.MaxAttribs
),
743 extra_ARB_vertex_program_version_es2
},
746 { GL_TEXTURE_BINDING_3D
, LOC_CUSTOM
, TYPE_INT
, TEXTURE_3D_INDEX
, NO_EXTRA
},
747 { GL_MAX_3D_TEXTURE_SIZE
, LOC_CUSTOM
, TYPE_INT
,
748 offsetof(struct gl_context
, Const
.Max3DTextureLevels
), NO_EXTRA
},
750 /* GL_ARB_fragment_program/OES_standard_derivatives */
751 { GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB
,
752 CONTEXT_ENUM(Hint
.FragmentShaderDerivative
), extra_ARB_fragment_shader
},
753 #endif /* FEATURE_GL || FEATURE_ES2 */
756 /* Enums unique to OpenGL ES 2.0 */
757 { 0, 0, TYPE_API_MASK
, API_OPENGLES2_BIT
, NO_EXTRA
},
758 { GL_MAX_FRAGMENT_UNIFORM_VECTORS
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
759 { GL_MAX_VARYING_VECTORS
, CONTEXT_INT(Const
.MaxVarying
), NO_EXTRA
},
760 { GL_MAX_VERTEX_UNIFORM_VECTORS
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
761 { GL_SHADER_COMPILER
, CONST(1), NO_EXTRA
},
762 /* OES_get_program_binary */
763 { GL_NUM_SHADER_BINARY_FORMATS
, CONST(0), NO_EXTRA
},
764 { GL_SHADER_BINARY_FORMATS
, CONST(0), NO_EXTRA
},
765 #endif /* FEATURE_ES2 */
767 /* GL_OES_EGL_image_external */
768 { GL_TEXTURE_BINDING_EXTERNAL_OES
, LOC_CUSTOM
,
769 TYPE_INT
, TEXTURE_EXTERNAL_INDEX
, extra_OES_EGL_image_external
},
770 { GL_TEXTURE_EXTERNAL_OES
, LOC_CUSTOM
,
771 TYPE_BOOLEAN
, 0, extra_OES_EGL_image_external
},
774 /* Remaining enums are only in OpenGL */
775 { 0, 0, TYPE_API_MASK
, API_OPENGL_BIT
, NO_EXTRA
},
776 { GL_ACCUM_RED_BITS
, BUFFER_INT(Visual
.accumRedBits
), NO_EXTRA
},
777 { GL_ACCUM_GREEN_BITS
, BUFFER_INT(Visual
.accumGreenBits
), NO_EXTRA
},
778 { GL_ACCUM_BLUE_BITS
, BUFFER_INT(Visual
.accumBlueBits
), NO_EXTRA
},
779 { GL_ACCUM_ALPHA_BITS
, BUFFER_INT(Visual
.accumAlphaBits
), NO_EXTRA
},
780 { GL_ACCUM_CLEAR_VALUE
, CONTEXT_FIELD(Accum
.ClearColor
[0], TYPE_FLOATN_4
), NO_EXTRA
},
781 { GL_ALPHA_BIAS
, CONTEXT_FLOAT(Pixel
.AlphaBias
), NO_EXTRA
},
782 { GL_ALPHA_SCALE
, CONTEXT_FLOAT(Pixel
.AlphaScale
), NO_EXTRA
},
783 { GL_ATTRIB_STACK_DEPTH
, CONTEXT_INT(AttribStackDepth
), NO_EXTRA
},
784 { GL_AUTO_NORMAL
, CONTEXT_BOOL(Eval
.AutoNormal
), NO_EXTRA
},
785 { GL_AUX_BUFFERS
, BUFFER_INT(Visual
.numAuxBuffers
), NO_EXTRA
},
786 { GL_BLUE_BIAS
, CONTEXT_FLOAT(Pixel
.BlueBias
), NO_EXTRA
},
787 { GL_BLUE_SCALE
, CONTEXT_FLOAT(Pixel
.BlueScale
), NO_EXTRA
},
788 { GL_CLIENT_ATTRIB_STACK_DEPTH
, CONTEXT_INT(ClientAttribStackDepth
), NO_EXTRA
},
789 { GL_COLOR_MATERIAL_FACE
, CONTEXT_ENUM(Light
.ColorMaterialFace
), NO_EXTRA
},
790 { GL_COLOR_MATERIAL_PARAMETER
, CONTEXT_ENUM(Light
.ColorMaterialMode
), NO_EXTRA
},
792 CONTEXT_FLOAT(Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0]),
793 extra_flush_current
},
794 { GL_CURRENT_RASTER_COLOR
,
795 CONTEXT_FIELD(Current
.RasterColor
[0], TYPE_FLOATN_4
), NO_EXTRA
},
796 { GL_CURRENT_RASTER_DISTANCE
, CONTEXT_FLOAT(Current
.RasterDistance
), NO_EXTRA
},
797 { GL_CURRENT_RASTER_INDEX
, CONST(1), NO_EXTRA
},
798 { GL_CURRENT_RASTER_POSITION
, CONTEXT_FLOAT4(Current
.RasterPos
[0]), NO_EXTRA
},
799 { GL_CURRENT_RASTER_SECONDARY_COLOR
,
800 CONTEXT_FIELD(Current
.RasterSecondaryColor
[0], TYPE_FLOATN_4
), NO_EXTRA
},
801 { GL_CURRENT_RASTER_TEXTURE_COORDS
, LOC_CUSTOM
, TYPE_FLOAT_4
, 0,
802 extra_valid_texture_unit
},
803 { GL_CURRENT_RASTER_POSITION_VALID
, CONTEXT_BOOL(Current
.RasterPosValid
), NO_EXTRA
},
804 { GL_DEPTH_BIAS
, CONTEXT_FLOAT(Pixel
.DepthBias
), NO_EXTRA
},
805 { GL_DEPTH_SCALE
, CONTEXT_FLOAT(Pixel
.DepthScale
), NO_EXTRA
},
806 { GL_DOUBLEBUFFER
, BUFFER_INT(Visual
.doubleBufferMode
), NO_EXTRA
},
807 { GL_DRAW_BUFFER
, BUFFER_ENUM(ColorDrawBuffer
[0]), NO_EXTRA
},
808 { GL_EDGE_FLAG
, LOC_CUSTOM
, TYPE_BOOLEAN
, 0, NO_EXTRA
},
809 { GL_FEEDBACK_BUFFER_SIZE
, CONTEXT_INT(Feedback
.BufferSize
), NO_EXTRA
},
810 { GL_FEEDBACK_BUFFER_TYPE
, CONTEXT_ENUM(Feedback
.Type
), NO_EXTRA
},
811 { GL_FOG_INDEX
, CONTEXT_FLOAT(Fog
.Index
), NO_EXTRA
},
812 { GL_GREEN_BIAS
, CONTEXT_FLOAT(Pixel
.GreenBias
), NO_EXTRA
},
813 { GL_GREEN_SCALE
, CONTEXT_FLOAT(Pixel
.GreenScale
), NO_EXTRA
},
814 { GL_INDEX_BITS
, BUFFER_INT(Visual
.indexBits
), extra_new_buffers
},
815 { GL_INDEX_CLEAR_VALUE
, CONTEXT_INT(Color
.ClearIndex
), NO_EXTRA
},
816 { GL_INDEX_MODE
, CONST(0) , NO_EXTRA
},
817 { GL_INDEX_OFFSET
, CONTEXT_INT(Pixel
.IndexOffset
), NO_EXTRA
},
818 { GL_INDEX_SHIFT
, CONTEXT_INT(Pixel
.IndexShift
), NO_EXTRA
},
819 { GL_INDEX_WRITEMASK
, CONTEXT_INT(Color
.IndexMask
), NO_EXTRA
},
820 { GL_LIGHT_MODEL_COLOR_CONTROL
, CONTEXT_ENUM(Light
.Model
.ColorControl
), NO_EXTRA
},
821 { GL_LIGHT_MODEL_LOCAL_VIEWER
, CONTEXT_BOOL(Light
.Model
.LocalViewer
), NO_EXTRA
},
822 { GL_LINE_STIPPLE
, CONTEXT_BOOL(Line
.StippleFlag
), NO_EXTRA
},
823 { GL_LINE_STIPPLE_PATTERN
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
824 { GL_LINE_STIPPLE_REPEAT
, CONTEXT_INT(Line
.StippleFactor
), NO_EXTRA
},
825 { GL_LINE_WIDTH_GRANULARITY
, CONTEXT_FLOAT(Const
.LineWidthGranularity
), NO_EXTRA
},
826 { GL_LIST_BASE
, CONTEXT_INT(List
.ListBase
), NO_EXTRA
},
827 { GL_LIST_INDEX
, LOC_CUSTOM
, TYPE_INT
, 0, NO_EXTRA
},
828 { GL_LIST_MODE
, LOC_CUSTOM
, TYPE_ENUM
, 0, NO_EXTRA
},
829 { GL_INDEX_LOGIC_OP
, CONTEXT_BOOL(Color
.IndexLogicOpEnabled
), NO_EXTRA
},
830 { GL_MAP1_COLOR_4
, CONTEXT_BOOL(Eval
.Map1Color4
), NO_EXTRA
},
831 { GL_MAP1_GRID_DOMAIN
, CONTEXT_FLOAT2(Eval
.MapGrid1u1
), NO_EXTRA
},
832 { GL_MAP1_GRID_SEGMENTS
, CONTEXT_INT(Eval
.MapGrid1un
), NO_EXTRA
},
833 { GL_MAP1_INDEX
, CONTEXT_BOOL(Eval
.Map1Index
), NO_EXTRA
},
834 { GL_MAP1_NORMAL
, CONTEXT_BOOL(Eval
.Map1Normal
), NO_EXTRA
},
835 { GL_MAP1_TEXTURE_COORD_1
, CONTEXT_BOOL(Eval
.Map1TextureCoord1
), NO_EXTRA
},
836 { GL_MAP1_TEXTURE_COORD_2
, CONTEXT_BOOL(Eval
.Map1TextureCoord2
), NO_EXTRA
},
837 { GL_MAP1_TEXTURE_COORD_3
, CONTEXT_BOOL(Eval
.Map1TextureCoord3
), NO_EXTRA
},
838 { GL_MAP1_TEXTURE_COORD_4
, CONTEXT_BOOL(Eval
.Map1TextureCoord4
), NO_EXTRA
},
839 { GL_MAP1_VERTEX_3
, CONTEXT_BOOL(Eval
.Map1Vertex3
), NO_EXTRA
},
840 { GL_MAP1_VERTEX_4
, CONTEXT_BOOL(Eval
.Map1Vertex4
), NO_EXTRA
},
841 { GL_MAP2_COLOR_4
, CONTEXT_BOOL(Eval
.Map2Color4
), NO_EXTRA
},
842 { GL_MAP2_GRID_DOMAIN
, LOC_CUSTOM
, TYPE_FLOAT_4
, 0, NO_EXTRA
},
843 { GL_MAP2_GRID_SEGMENTS
, CONTEXT_INT2(Eval
.MapGrid2un
), NO_EXTRA
},
844 { GL_MAP2_INDEX
, CONTEXT_BOOL(Eval
.Map2Index
), NO_EXTRA
},
845 { GL_MAP2_NORMAL
, CONTEXT_BOOL(Eval
.Map2Normal
), NO_EXTRA
},
846 { GL_MAP2_TEXTURE_COORD_1
, CONTEXT_BOOL(Eval
.Map2TextureCoord1
), NO_EXTRA
},
847 { GL_MAP2_TEXTURE_COORD_2
, CONTEXT_BOOL(Eval
.Map2TextureCoord2
), NO_EXTRA
},
848 { GL_MAP2_TEXTURE_COORD_3
, CONTEXT_BOOL(Eval
.Map2TextureCoord3
), NO_EXTRA
},
849 { GL_MAP2_TEXTURE_COORD_4
, CONTEXT_BOOL(Eval
.Map2TextureCoord4
), NO_EXTRA
},
850 { GL_MAP2_VERTEX_3
, CONTEXT_BOOL(Eval
.Map2Vertex3
), NO_EXTRA
},
851 { GL_MAP2_VERTEX_4
, CONTEXT_BOOL(Eval
.Map2Vertex4
), NO_EXTRA
},
852 { GL_MAP_COLOR
, CONTEXT_BOOL(Pixel
.MapColorFlag
), NO_EXTRA
},
853 { GL_MAP_STENCIL
, CONTEXT_BOOL(Pixel
.MapStencilFlag
), NO_EXTRA
},
854 { GL_MAX_ATTRIB_STACK_DEPTH
, CONST(MAX_ATTRIB_STACK_DEPTH
), NO_EXTRA
},
855 { GL_MAX_CLIENT_ATTRIB_STACK_DEPTH
, CONST(MAX_CLIENT_ATTRIB_STACK_DEPTH
), NO_EXTRA
},
857 { GL_MAX_EVAL_ORDER
, CONST(MAX_EVAL_ORDER
), NO_EXTRA
},
858 { GL_MAX_LIST_NESTING
, CONST(MAX_LIST_NESTING
), NO_EXTRA
},
859 { GL_MAX_NAME_STACK_DEPTH
, CONST(MAX_NAME_STACK_DEPTH
), NO_EXTRA
},
860 { GL_MAX_PIXEL_MAP_TABLE
, CONST(MAX_PIXEL_MAP_TABLE
), NO_EXTRA
},
861 { GL_NAME_STACK_DEPTH
, CONTEXT_INT(Select
.NameStackDepth
), NO_EXTRA
},
862 { GL_PACK_LSB_FIRST
, CONTEXT_BOOL(Pack
.LsbFirst
), NO_EXTRA
},
863 { GL_PACK_ROW_LENGTH
, CONTEXT_INT(Pack
.RowLength
), NO_EXTRA
},
864 { GL_PACK_SKIP_PIXELS
, CONTEXT_INT(Pack
.SkipPixels
), NO_EXTRA
},
865 { GL_PACK_SKIP_ROWS
, CONTEXT_INT(Pack
.SkipRows
), NO_EXTRA
},
866 { GL_PACK_SWAP_BYTES
, CONTEXT_BOOL(Pack
.SwapBytes
), NO_EXTRA
},
867 { GL_PACK_IMAGE_HEIGHT_EXT
, CONTEXT_INT(Pack
.ImageHeight
), NO_EXTRA
},
868 { GL_PACK_INVERT_MESA
, CONTEXT_BOOL(Pack
.Invert
), NO_EXTRA
},
869 { GL_PIXEL_MAP_A_TO_A_SIZE
, CONTEXT_INT(PixelMaps
.AtoA
.Size
), NO_EXTRA
},
870 { GL_PIXEL_MAP_B_TO_B_SIZE
, CONTEXT_INT(PixelMaps
.BtoB
.Size
), NO_EXTRA
},
871 { GL_PIXEL_MAP_G_TO_G_SIZE
, CONTEXT_INT(PixelMaps
.GtoG
.Size
), NO_EXTRA
},
872 { GL_PIXEL_MAP_I_TO_A_SIZE
, CONTEXT_INT(PixelMaps
.ItoA
.Size
), NO_EXTRA
},
873 { GL_PIXEL_MAP_I_TO_B_SIZE
, CONTEXT_INT(PixelMaps
.ItoB
.Size
), NO_EXTRA
},
874 { GL_PIXEL_MAP_I_TO_G_SIZE
, CONTEXT_INT(PixelMaps
.ItoG
.Size
), NO_EXTRA
},
875 { GL_PIXEL_MAP_I_TO_I_SIZE
, CONTEXT_INT(PixelMaps
.ItoI
.Size
), NO_EXTRA
},
876 { GL_PIXEL_MAP_I_TO_R_SIZE
, CONTEXT_INT(PixelMaps
.ItoR
.Size
), NO_EXTRA
},
877 { GL_PIXEL_MAP_R_TO_R_SIZE
, CONTEXT_INT(PixelMaps
.RtoR
.Size
), NO_EXTRA
},
878 { GL_PIXEL_MAP_S_TO_S_SIZE
, CONTEXT_INT(PixelMaps
.StoS
.Size
), NO_EXTRA
},
879 { GL_POINT_SIZE_GRANULARITY
, CONTEXT_FLOAT(Const
.PointSizeGranularity
), NO_EXTRA
},
880 { GL_POLYGON_MODE
, CONTEXT_ENUM2(Polygon
.FrontMode
), NO_EXTRA
},
881 { GL_POLYGON_OFFSET_BIAS_EXT
, CONTEXT_FLOAT(Polygon
.OffsetUnits
), NO_EXTRA
},
882 { GL_POLYGON_OFFSET_POINT
, CONTEXT_BOOL(Polygon
.OffsetPoint
), NO_EXTRA
},
883 { GL_POLYGON_OFFSET_LINE
, CONTEXT_BOOL(Polygon
.OffsetLine
), NO_EXTRA
},
884 { GL_POLYGON_SMOOTH
, CONTEXT_BOOL(Polygon
.SmoothFlag
), NO_EXTRA
},
885 { GL_POLYGON_SMOOTH_HINT
, CONTEXT_ENUM(Hint
.PolygonSmooth
), NO_EXTRA
},
886 { GL_POLYGON_STIPPLE
, CONTEXT_BOOL(Polygon
.StippleFlag
), NO_EXTRA
},
887 { GL_READ_BUFFER
, LOC_CUSTOM
, TYPE_ENUM
, NO_OFFSET
, NO_EXTRA
},
888 { GL_RED_BIAS
, CONTEXT_FLOAT(Pixel
.RedBias
), NO_EXTRA
},
889 { GL_RED_SCALE
, CONTEXT_FLOAT(Pixel
.RedScale
), NO_EXTRA
},
890 { GL_RENDER_MODE
, CONTEXT_ENUM(RenderMode
), NO_EXTRA
},
891 { GL_RGBA_MODE
, CONST(1), NO_EXTRA
},
892 { GL_SELECTION_BUFFER_SIZE
, CONTEXT_INT(Select
.BufferSize
), NO_EXTRA
},
894 { GL_STEREO
, BUFFER_INT(Visual
.stereoMode
), NO_EXTRA
},
896 { GL_TEXTURE_1D
, LOC_CUSTOM
, TYPE_BOOLEAN
, NO_OFFSET
, NO_EXTRA
},
897 { GL_TEXTURE_3D
, LOC_CUSTOM
, TYPE_BOOLEAN
, NO_OFFSET
, NO_EXTRA
},
898 { GL_TEXTURE_1D_ARRAY_EXT
, LOC_CUSTOM
, TYPE_BOOLEAN
, NO_OFFSET
, NO_EXTRA
},
899 { GL_TEXTURE_2D_ARRAY_EXT
, LOC_CUSTOM
, TYPE_BOOLEAN
, NO_OFFSET
, NO_EXTRA
},
901 { GL_TEXTURE_BINDING_1D
, LOC_CUSTOM
, TYPE_INT
, TEXTURE_1D_INDEX
, NO_EXTRA
},
902 { GL_TEXTURE_BINDING_1D_ARRAY
, LOC_CUSTOM
, TYPE_INT
,
903 TEXTURE_1D_ARRAY_INDEX
, extra_MESA_texture_array
},
904 { GL_TEXTURE_BINDING_2D_ARRAY
, LOC_CUSTOM
, TYPE_INT
,
905 TEXTURE_1D_ARRAY_INDEX
, extra_MESA_texture_array
},
906 { GL_MAX_ARRAY_TEXTURE_LAYERS_EXT
,
907 CONTEXT_INT(Const
.MaxArrayTextureLayers
), extra_MESA_texture_array
},
909 { GL_TEXTURE_GEN_S
, LOC_TEXUNIT
, TYPE_BIT_0
,
910 offsetof(struct gl_texture_unit
, TexGenEnabled
), NO_EXTRA
},
911 { GL_TEXTURE_GEN_T
, LOC_TEXUNIT
, TYPE_BIT_1
,
912 offsetof(struct gl_texture_unit
, TexGenEnabled
), NO_EXTRA
},
913 { GL_TEXTURE_GEN_R
, LOC_TEXUNIT
, TYPE_BIT_2
,
914 offsetof(struct gl_texture_unit
, TexGenEnabled
), NO_EXTRA
},
915 { GL_TEXTURE_GEN_Q
, LOC_TEXUNIT
, TYPE_BIT_3
,
916 offsetof(struct gl_texture_unit
, TexGenEnabled
), NO_EXTRA
},
917 { GL_UNPACK_LSB_FIRST
, CONTEXT_BOOL(Unpack
.LsbFirst
), NO_EXTRA
},
918 { GL_UNPACK_ROW_LENGTH
, CONTEXT_INT(Unpack
.RowLength
), NO_EXTRA
},
919 { GL_UNPACK_SKIP_PIXELS
, CONTEXT_INT(Unpack
.SkipPixels
), NO_EXTRA
},
920 { GL_UNPACK_SKIP_ROWS
, CONTEXT_INT(Unpack
.SkipRows
), NO_EXTRA
},
921 { GL_UNPACK_SWAP_BYTES
, CONTEXT_BOOL(Unpack
.SwapBytes
), NO_EXTRA
},
922 { GL_UNPACK_SKIP_IMAGES_EXT
, CONTEXT_INT(Unpack
.SkipImages
), NO_EXTRA
},
923 { GL_UNPACK_IMAGE_HEIGHT_EXT
, CONTEXT_INT(Unpack
.ImageHeight
), NO_EXTRA
},
924 { GL_ZOOM_X
, CONTEXT_FLOAT(Pixel
.ZoomX
), NO_EXTRA
},
925 { GL_ZOOM_Y
, CONTEXT_FLOAT(Pixel
.ZoomY
), NO_EXTRA
},
928 { GL_VERTEX_ARRAY_COUNT_EXT
, CONST(0), NO_EXTRA
},
929 { GL_NORMAL_ARRAY_COUNT_EXT
, CONST(0), NO_EXTRA
},
930 { GL_COLOR_ARRAY_COUNT_EXT
, CONST(0), NO_EXTRA
},
931 { GL_INDEX_ARRAY
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
), NO_EXTRA
},
932 { GL_INDEX_ARRAY_TYPE
, ARRAY_ENUM(VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Type
), NO_EXTRA
},
933 { GL_INDEX_ARRAY_STRIDE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Stride
), NO_EXTRA
},
934 { GL_INDEX_ARRAY_COUNT_EXT
, CONST(0), NO_EXTRA
},
935 { GL_TEXTURE_COORD_ARRAY_COUNT_EXT
, CONST(0), NO_EXTRA
},
936 { GL_EDGE_FLAG_ARRAY
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
), NO_EXTRA
},
937 { GL_EDGE_FLAG_ARRAY_STRIDE
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Stride
), NO_EXTRA
},
938 { GL_EDGE_FLAG_ARRAY_COUNT_EXT
, CONST(0), NO_EXTRA
},
940 /* GL_ARB_texture_compression */
941 { GL_TEXTURE_COMPRESSION_HINT_ARB
, CONTEXT_INT(Hint
.TextureCompression
), NO_EXTRA
},
943 /* GL_EXT_compiled_vertex_array */
944 { GL_ARRAY_ELEMENT_LOCK_FIRST_EXT
, CONTEXT_INT(Array
.LockFirst
),
945 extra_EXT_compiled_vertex_array
},
946 { GL_ARRAY_ELEMENT_LOCK_COUNT_EXT
, CONTEXT_INT(Array
.LockCount
),
947 extra_EXT_compiled_vertex_array
},
949 /* GL_ARB_transpose_matrix */
950 { GL_TRANSPOSE_MODELVIEW_MATRIX_ARB
,
951 CONTEXT_MATRIX_T(ModelviewMatrixStack
), NO_EXTRA
},
952 { GL_TRANSPOSE_PROJECTION_MATRIX_ARB
,
953 CONTEXT_MATRIX_T(ProjectionMatrixStack
.Top
), NO_EXTRA
},
954 { GL_TRANSPOSE_TEXTURE_MATRIX_ARB
, CONTEXT_MATRIX_T(TextureMatrixStack
), NO_EXTRA
},
956 /* GL_EXT_secondary_color */
957 { GL_COLOR_SUM_EXT
, CONTEXT_BOOL(Fog
.ColorSumEnabled
),
958 extra_EXT_secondary_color_ARB_vertex_program
},
959 { GL_CURRENT_SECONDARY_COLOR_EXT
,
960 CONTEXT_FIELD(Current
.Attrib
[VERT_ATTRIB_COLOR1
][0], TYPE_FLOATN_4
),
961 extra_EXT_secondary_color_flush_current
},
962 { GL_SECONDARY_COLOR_ARRAY_EXT
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
),
963 extra_EXT_secondary_color
},
964 { GL_SECONDARY_COLOR_ARRAY_TYPE_EXT
, ARRAY_ENUM(VertexAttrib
[VERT_ATTRIB_COLOR1
].Type
),
965 extra_EXT_secondary_color
},
966 { GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_COLOR1
].Stride
),
967 extra_EXT_secondary_color
},
968 { GL_SECONDARY_COLOR_ARRAY_SIZE_EXT
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_COLOR1
].Size
),
969 extra_EXT_secondary_color
},
971 /* GL_EXT_fog_coord */
972 { GL_CURRENT_FOG_COORDINATE_EXT
,
973 CONTEXT_FLOAT(Current
.Attrib
[VERT_ATTRIB_FOG
][0]),
974 extra_EXT_fog_coord_flush_current
},
975 { GL_FOG_COORDINATE_ARRAY_EXT
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
),
976 extra_EXT_fog_coord
},
977 { GL_FOG_COORDINATE_ARRAY_TYPE_EXT
, ARRAY_ENUM(VertexAttrib
[VERT_ATTRIB_FOG
].Type
),
978 extra_EXT_fog_coord
},
979 { GL_FOG_COORDINATE_ARRAY_STRIDE_EXT
, ARRAY_INT(VertexAttrib
[VERT_ATTRIB_FOG
].Stride
),
980 extra_EXT_fog_coord
},
981 { GL_FOG_COORDINATE_SOURCE_EXT
, CONTEXT_ENUM(Fog
.FogCoordinateSource
),
982 extra_EXT_fog_coord
},
984 /* GL_NV_fog_distance */
985 { GL_FOG_DISTANCE_MODE_NV
, CONTEXT_ENUM(Fog
.FogDistanceMode
),
986 extra_NV_fog_distance
},
988 /* GL_IBM_rasterpos_clip */
989 { GL_RASTER_POSITION_UNCLIPPED_IBM
,
990 CONTEXT_BOOL(Transform
.RasterPositionUnclipped
),
991 extra_IBM_rasterpos_clip
},
993 /* GL_NV_point_sprite */
994 { GL_POINT_SPRITE_R_MODE_NV
,
995 CONTEXT_ENUM(Point
.SpriteRMode
), extra_NV_point_sprite
},
996 { GL_POINT_SPRITE_COORD_ORIGIN
, CONTEXT_ENUM(Point
.SpriteOrigin
),
997 extra_NV_point_sprite_ARB_point_sprite
},
999 /* GL_NV_vertex_program */
1000 { GL_VERTEX_PROGRAM_BINDING_NV
, LOC_CUSTOM
, TYPE_INT
, 0,
1001 extra_NV_vertex_program
},
1002 { GL_VERTEX_ATTRIB_ARRAY0_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(0)].Enabled
),
1003 extra_NV_vertex_program
},
1004 { GL_VERTEX_ATTRIB_ARRAY1_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(1)].Enabled
),
1005 extra_NV_vertex_program
},
1006 { GL_VERTEX_ATTRIB_ARRAY2_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(2)].Enabled
),
1007 extra_NV_vertex_program
},
1008 { GL_VERTEX_ATTRIB_ARRAY3_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(3)].Enabled
),
1009 extra_NV_vertex_program
},
1010 { GL_VERTEX_ATTRIB_ARRAY4_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(4)].Enabled
),
1011 extra_NV_vertex_program
},
1012 { GL_VERTEX_ATTRIB_ARRAY5_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(5)].Enabled
),
1013 extra_NV_vertex_program
},
1014 { GL_VERTEX_ATTRIB_ARRAY6_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(6)].Enabled
),
1015 extra_NV_vertex_program
},
1016 { GL_VERTEX_ATTRIB_ARRAY7_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(7)].Enabled
),
1017 extra_NV_vertex_program
},
1018 { GL_VERTEX_ATTRIB_ARRAY8_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(8)].Enabled
),
1019 extra_NV_vertex_program
},
1020 { GL_VERTEX_ATTRIB_ARRAY9_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(9)].Enabled
),
1021 extra_NV_vertex_program
},
1022 { GL_VERTEX_ATTRIB_ARRAY10_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(10)].Enabled
),
1023 extra_NV_vertex_program
},
1024 { GL_VERTEX_ATTRIB_ARRAY11_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(11)].Enabled
),
1025 extra_NV_vertex_program
},
1026 { GL_VERTEX_ATTRIB_ARRAY12_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(12)].Enabled
),
1027 extra_NV_vertex_program
},
1028 { GL_VERTEX_ATTRIB_ARRAY13_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(13)].Enabled
),
1029 extra_NV_vertex_program
},
1030 { GL_VERTEX_ATTRIB_ARRAY14_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(14)].Enabled
),
1031 extra_NV_vertex_program
},
1032 { GL_VERTEX_ATTRIB_ARRAY15_NV
, ARRAY_BOOL(VertexAttrib
[VERT_ATTRIB_GENERIC(15)].Enabled
),
1033 extra_NV_vertex_program
},
1034 { GL_MAP1_VERTEX_ATTRIB0_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[0]),
1035 extra_NV_vertex_program
},
1036 { GL_MAP1_VERTEX_ATTRIB1_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[1]),
1037 extra_NV_vertex_program
},
1038 { GL_MAP1_VERTEX_ATTRIB2_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[2]),
1039 extra_NV_vertex_program
},
1040 { GL_MAP1_VERTEX_ATTRIB3_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[3]),
1041 extra_NV_vertex_program
},
1042 { GL_MAP1_VERTEX_ATTRIB4_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[4]),
1043 extra_NV_vertex_program
},
1044 { GL_MAP1_VERTEX_ATTRIB5_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[5]),
1045 extra_NV_vertex_program
},
1046 { GL_MAP1_VERTEX_ATTRIB6_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[6]),
1047 extra_NV_vertex_program
},
1048 { GL_MAP1_VERTEX_ATTRIB7_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[7]),
1049 extra_NV_vertex_program
},
1050 { GL_MAP1_VERTEX_ATTRIB8_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[8]),
1051 extra_NV_vertex_program
},
1052 { GL_MAP1_VERTEX_ATTRIB9_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[9]),
1053 extra_NV_vertex_program
},
1054 { GL_MAP1_VERTEX_ATTRIB10_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[10]),
1055 extra_NV_vertex_program
},
1056 { GL_MAP1_VERTEX_ATTRIB11_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[11]),
1057 extra_NV_vertex_program
},
1058 { GL_MAP1_VERTEX_ATTRIB12_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[12]),
1059 extra_NV_vertex_program
},
1060 { GL_MAP1_VERTEX_ATTRIB13_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[13]),
1061 extra_NV_vertex_program
},
1062 { GL_MAP1_VERTEX_ATTRIB14_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[14]),
1063 extra_NV_vertex_program
},
1064 { GL_MAP1_VERTEX_ATTRIB15_4_NV
, CONTEXT_BOOL(Eval
.Map1Attrib
[15]),
1065 extra_NV_vertex_program
},
1067 /* GL_NV_fragment_program */
1068 { GL_FRAGMENT_PROGRAM_NV
, CONTEXT_BOOL(FragmentProgram
.Enabled
),
1069 extra_NV_fragment_program
},
1070 { GL_FRAGMENT_PROGRAM_BINDING_NV
, LOC_CUSTOM
, TYPE_INT
, 0,
1071 extra_NV_fragment_program
},
1072 { GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV
,
1073 CONST(MAX_NV_FRAGMENT_PROGRAM_PARAMS
),
1074 extra_NV_fragment_program
},
1076 /* GL_NV_texture_rectangle */
1077 { GL_TEXTURE_RECTANGLE_NV
,
1078 LOC_CUSTOM
, TYPE_BOOLEAN
, 0, extra_NV_texture_rectangle
},
1079 { GL_TEXTURE_BINDING_RECTANGLE_NV
,
1080 LOC_CUSTOM
, TYPE_INT
, TEXTURE_RECT_INDEX
, extra_NV_texture_rectangle
},
1081 { GL_MAX_RECTANGLE_TEXTURE_SIZE_NV
,
1082 CONTEXT_INT(Const
.MaxTextureRectSize
), extra_NV_texture_rectangle
},
1084 /* GL_EXT_stencil_two_side */
1085 { GL_STENCIL_TEST_TWO_SIDE_EXT
, CONTEXT_BOOL(Stencil
.TestTwoSide
),
1086 extra_EXT_stencil_two_side
},
1087 { GL_ACTIVE_STENCIL_FACE_EXT
, LOC_CUSTOM
, TYPE_ENUM
, NO_OFFSET
, NO_EXTRA
},
1089 /* GL_NV_light_max_exponent */
1090 { GL_MAX_SHININESS_NV
, CONTEXT_FLOAT(Const
.MaxShininess
),
1091 extra_NV_light_max_exponent
},
1092 { GL_MAX_SPOT_EXPONENT_NV
, CONTEXT_FLOAT(Const
.MaxSpotExponent
),
1093 extra_NV_light_max_exponent
},
1095 /* GL_NV_primitive_restart */
1096 { GL_PRIMITIVE_RESTART_NV
, CONTEXT_BOOL(Array
.PrimitiveRestart
),
1097 extra_NV_primitive_restart
},
1098 { GL_PRIMITIVE_RESTART_INDEX_NV
, CONTEXT_INT(Array
.RestartIndex
),
1099 extra_NV_primitive_restart
},
1101 /* GL_ARB_vertex_buffer_object */
1102 { GL_INDEX_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
1103 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].BufferObj
), NO_EXTRA
},
1104 { GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
1105 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].BufferObj
), NO_EXTRA
},
1106 { GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
1107 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_COLOR1
].BufferObj
), NO_EXTRA
},
1108 { GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
1109 offsetof(struct gl_array_object
, VertexAttrib
[VERT_ATTRIB_FOG
].BufferObj
), NO_EXTRA
},
1111 /* GL_EXT_pixel_buffer_object */
1112 { GL_PIXEL_PACK_BUFFER_BINDING_EXT
, LOC_CUSTOM
, TYPE_INT
, 0,
1113 extra_EXT_pixel_buffer_object
},
1114 { GL_PIXEL_UNPACK_BUFFER_BINDING_EXT
, LOC_CUSTOM
, TYPE_INT
, 0,
1115 extra_EXT_pixel_buffer_object
},
1117 /* GL_ARB_vertex_program */
1118 { GL_VERTEX_PROGRAM_ARB
, /* == GL_VERTEX_PROGRAM_NV */
1119 CONTEXT_BOOL(VertexProgram
.Enabled
),
1120 extra_ARB_vertex_program_NV_vertex_program
},
1121 { GL_VERTEX_PROGRAM_POINT_SIZE_ARB
, /* == GL_VERTEX_PROGRAM_POINT_SIZE_NV*/
1122 CONTEXT_BOOL(VertexProgram
.PointSizeEnabled
),
1123 extra_ARB_vertex_program_NV_vertex_program
},
1124 { GL_VERTEX_PROGRAM_TWO_SIDE_ARB
, /* == GL_VERTEX_PROGRAM_TWO_SIDE_NV */
1125 CONTEXT_BOOL(VertexProgram
.TwoSideEnabled
),
1126 extra_ARB_vertex_program_NV_vertex_program
},
1127 { GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB
, /* == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
1128 CONTEXT_INT(Const
.MaxProgramMatrixStackDepth
),
1129 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
},
1130 { GL_MAX_PROGRAM_MATRICES_ARB
, /* == GL_MAX_TRACK_MATRICES_NV */
1131 CONTEXT_INT(Const
.MaxProgramMatrices
),
1132 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
},
1133 { GL_CURRENT_MATRIX_STACK_DEPTH_ARB
, /* == GL_CURRENT_MATRIX_STACK_DEPTH_NV */
1134 LOC_CUSTOM
, TYPE_INT
, 0,
1135 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
},
1137 { GL_CURRENT_MATRIX_ARB
, /* == GL_CURRENT_MATRIX_NV */
1138 LOC_CUSTOM
, TYPE_MATRIX
, 0,
1139 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
},
1140 { GL_TRANSPOSE_CURRENT_MATRIX_ARB
, /* == GL_CURRENT_MATRIX_NV */
1141 LOC_CUSTOM
, TYPE_MATRIX
, 0,
1142 extra_ARB_vertex_program_ARB_fragment_program
},
1144 { GL_PROGRAM_ERROR_POSITION_ARB
, /* == GL_PROGRAM_ERROR_POSITION_NV */
1145 CONTEXT_INT(Program
.ErrorPos
),
1146 extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program
},
1148 /* GL_ARB_fragment_program */
1149 { GL_FRAGMENT_PROGRAM_ARB
, CONTEXT_BOOL(FragmentProgram
.Enabled
),
1150 extra_ARB_fragment_program
},
1152 /* GL_EXT_depth_bounds_test */
1153 { GL_DEPTH_BOUNDS_TEST_EXT
, CONTEXT_BOOL(Depth
.BoundsTest
),
1154 extra_EXT_depth_bounds_test
},
1155 { GL_DEPTH_BOUNDS_EXT
, CONTEXT_FLOAT2(Depth
.BoundsMin
),
1156 extra_EXT_depth_bounds_test
},
1158 /* GL_ARB_depth_clamp*/
1159 { GL_DEPTH_CLAMP
, CONTEXT_BOOL(Transform
.DepthClamp
),
1160 extra_ARB_depth_clamp
},
1162 /* GL_ATI_fragment_shader */
1163 { GL_NUM_FRAGMENT_REGISTERS_ATI
, CONST(6), extra_ATI_fragment_shader
},
1164 { GL_NUM_FRAGMENT_CONSTANTS_ATI
, CONST(8), extra_ATI_fragment_shader
},
1165 { GL_NUM_PASSES_ATI
, CONST(2), extra_ATI_fragment_shader
},
1166 { GL_NUM_INSTRUCTIONS_PER_PASS_ATI
, CONST(8), extra_ATI_fragment_shader
},
1167 { GL_NUM_INSTRUCTIONS_TOTAL_ATI
, CONST(16), extra_ATI_fragment_shader
},
1168 { GL_COLOR_ALPHA_PAIRING_ATI
, CONST(GL_TRUE
), extra_ATI_fragment_shader
},
1169 { GL_NUM_LOOPBACK_COMPONENTS_ATI
, CONST(3), extra_ATI_fragment_shader
},
1170 { GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI
,
1171 CONST(3), extra_ATI_fragment_shader
},
1173 /* GL_EXT_framebuffer_blit
1174 * NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT */
1175 { GL_READ_FRAMEBUFFER_BINDING_EXT
, LOC_CUSTOM
, TYPE_INT
, 0,
1176 extra_EXT_framebuffer_blit
},
1178 /* GL_EXT_provoking_vertex */
1179 { GL_PROVOKING_VERTEX_EXT
,
1180 CONTEXT_ENUM(Light
.ProvokingVertex
), extra_EXT_provoking_vertex
},
1181 { GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT
,
1182 CONTEXT_BOOL(Const
.QuadsFollowProvokingVertexConvention
),
1183 extra_EXT_provoking_vertex
},
1185 /* GL_ARB_framebuffer_object */
1186 { GL_MAX_SAMPLES
, CONTEXT_INT(Const
.MaxSamples
),
1187 extra_ARB_framebuffer_object_EXT_framebuffer_multisample
},
1189 /* GL_APPLE_vertex_array_object */
1190 { GL_VERTEX_ARRAY_BINDING_APPLE
, ARRAY_INT(Name
),
1191 extra_APPLE_vertex_array_object
},
1193 /* GL_ARB_seamless_cube_map */
1194 { GL_TEXTURE_CUBE_MAP_SEAMLESS
,
1195 CONTEXT_BOOL(Texture
.CubeMapSeamless
), extra_ARB_seamless_cube_map
},
1198 { GL_MAX_SERVER_WAIT_TIMEOUT
,
1199 CONTEXT_INT64(Const
.MaxServerWaitTimeout
), extra_ARB_sync
},
1201 /* GL_EXT_texture_integer */
1202 { GL_RGBA_INTEGER_MODE_EXT
, BUFFER_BOOL(_IntegerColor
),
1203 extra_EXT_texture_integer
},
1205 /* GL_EXT_transform_feedback */
1206 { GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, LOC_CUSTOM
, TYPE_INT
, 0,
1207 extra_EXT_transform_feedback
},
1208 { GL_RASTERIZER_DISCARD
, CONTEXT_BOOL(RasterDiscard
),
1209 extra_EXT_transform_feedback
},
1210 { GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
,
1211 CONTEXT_INT(Const
.MaxTransformFeedbackInterleavedComponents
),
1212 extra_EXT_transform_feedback
},
1213 { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS
,
1214 CONTEXT_INT(Const
.MaxTransformFeedbackSeparateAttribs
),
1215 extra_EXT_transform_feedback
},
1216 { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS
,
1217 CONTEXT_INT(Const
.MaxTransformFeedbackSeparateComponents
),
1218 extra_EXT_transform_feedback
},
1220 /* GL_ARB_transform_feedback2 */
1221 { GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED
, LOC_CUSTOM
, TYPE_BOOLEAN
, 0,
1222 extra_ARB_transform_feedback2
},
1223 { GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE
, LOC_CUSTOM
, TYPE_BOOLEAN
, 0,
1224 extra_ARB_transform_feedback2
},
1225 { GL_TRANSFORM_FEEDBACK_BINDING
, LOC_CUSTOM
, TYPE_INT
, 0,
1226 extra_ARB_transform_feedback2
},
1228 /* GL_ARB_geometry_shader4 */
1229 { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB
,
1230 CONTEXT_INT(Const
.MaxGeometryTextureImageUnits
),
1231 extra_ARB_geometry_shader4
},
1232 { GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB
,
1233 CONTEXT_INT(Const
.MaxGeometryOutputVertices
),
1234 extra_ARB_geometry_shader4
},
1235 { GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB
,
1236 CONTEXT_INT(Const
.MaxGeometryTotalOutputComponents
),
1237 extra_ARB_geometry_shader4
},
1238 { GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB
,
1239 CONTEXT_INT(Const
.GeometryProgram
.MaxUniformComponents
),
1240 extra_ARB_geometry_shader4
},
1241 { GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB
,
1242 CONTEXT_INT(Const
.MaxGeometryVaryingComponents
),
1243 extra_ARB_geometry_shader4
},
1244 { GL_MAX_VERTEX_VARYING_COMPONENTS_ARB
,
1245 CONTEXT_INT(Const
.MaxVertexVaryingComponents
),
1246 extra_ARB_geometry_shader4
},
1248 /* GL_ARB_color_buffer_float */
1249 { GL_RGBA_FLOAT_MODE_ARB
, BUFFER_FIELD(Visual
.floatMode
, TYPE_BOOLEAN
), 0 },
1251 /* GL_EXT_gpu_shader4 / GLSL 1.30 */
1252 { GL_MIN_PROGRAM_TEXEL_OFFSET
,
1253 CONTEXT_INT(Const
.MinProgramTexelOffset
),
1255 { GL_MAX_PROGRAM_TEXEL_OFFSET
,
1256 CONTEXT_INT(Const
.MaxProgramTexelOffset
),
1259 /* GL_ARB_texture_buffer_object */
1260 { GL_MAX_TEXTURE_BUFFER_SIZE_ARB
, CONTEXT_INT(Const
.MaxTextureBufferSize
),
1261 extra_ARB_texture_buffer_object
},
1262 { GL_TEXTURE_BINDING_BUFFER_ARB
, LOC_CUSTOM
, TYPE_INT
, 0,
1263 extra_ARB_texture_buffer_object
},
1264 { GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB
, LOC_CUSTOM
, TYPE_INT
,
1265 TEXTURE_BUFFER_INDEX
, extra_ARB_texture_buffer_object
},
1266 { GL_TEXTURE_BUFFER_FORMAT_ARB
, LOC_CUSTOM
, TYPE_INT
, 0,
1267 extra_ARB_texture_buffer_object
},
1268 { GL_TEXTURE_BUFFER_ARB
, LOC_CUSTOM
, TYPE_INT
, 0,
1269 extra_ARB_texture_buffer_object
},
1271 /* GL_ARB_sampler_objects / GL 3.3 */
1272 { GL_SAMPLER_BINDING
,
1273 LOC_CUSTOM
, TYPE_INT
, GL_SAMPLER_BINDING
, extra_ARB_sampler_objects
},
1276 { GL_NUM_EXTENSIONS
, LOC_CUSTOM
, TYPE_INT
, 0, extra_version_30
},
1277 { GL_MAJOR_VERSION
, CONTEXT_INT(VersionMajor
), extra_version_30
},
1278 { GL_MINOR_VERSION
, CONTEXT_INT(VersionMinor
), extra_version_30
},
1279 { GL_CONTEXT_FLAGS
, CONTEXT_INT(Const
.ContextFlags
), extra_version_30
},
1281 /* GL3.0 / GL_EXT_framebuffer_sRGB */
1282 { GL_FRAMEBUFFER_SRGB_EXT
, CONTEXT_BOOL(Color
.sRGBEnabled
), extra_EXT_framebuffer_sRGB
},
1283 { GL_FRAMEBUFFER_SRGB_CAPABLE_EXT
, BUFFER_INT(Visual
.sRGBCapable
), extra_EXT_framebuffer_sRGB
},
1286 /* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV
1287 * vs. GL_PRIMITIVE_RESTART!
1289 { GL_PRIMITIVE_RESTART
, CONTEXT_BOOL(Array
.PrimitiveRestart
),
1291 { GL_PRIMITIVE_RESTART_INDEX
, CONTEXT_INT(Array
.RestartIndex
),
1296 { GL_CONTEXT_PROFILE_MASK
, CONTEXT_INT(Const
.ProfileMask
),
1299 /* GL_ARB_robustness */
1300 { GL_RESET_NOTIFICATION_STRATEGY_ARB
, CONTEXT_ENUM(Const
.ResetStrategy
), NO_EXTRA
},
1302 /* GL_ARB_debug_output */
1303 { GL_DEBUG_LOGGED_MESSAGES_ARB
, CONTEXT_INT(Debug
.NumMessages
), NO_EXTRA
},
1304 { GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB
, CONTEXT_INT(Debug
.NextMsgLength
), NO_EXTRA
},
1305 { GL_MAX_DEBUG_LOGGED_MESSAGES_ARB
, CONST(MAX_DEBUG_LOGGED_MESSAGES
), NO_EXTRA
},
1306 { GL_MAX_DEBUG_MESSAGE_LENGTH_ARB
, CONST(MAX_DEBUG_MESSAGE_LENGTH
), NO_EXTRA
},
1308 { GL_MAX_DUAL_SOURCE_DRAW_BUFFERS
, CONTEXT_INT(Const
.MaxDualSourceDrawBuffers
), extra_ARB_blend_func_extended
},
1310 #endif /* FEATURE_GL */
1313 /* All we need now is a way to look up the value struct from the enum.
1314 * The code generated by gcc for the old generated big switch
1315 * statement is a big, balanced, open coded if/else tree, essentially
1316 * an unrolled binary search. It would be natural to sort the new
1317 * enum table and use bsearch(), but we will use a read-only hash
1318 * table instead. bsearch() has a nice guaranteed worst case
1319 * performance, but we're also guaranteed to hit that worst case
1320 * (log2(n) iterations) for about half the enums. Instead, using an
1321 * open addressing hash table, we can find the enum on the first try
1322 * for 80% of the enums, 1 collision for 10% and never more than 5
1323 * collisions for any enum (typical numbers). And the code is very
1324 * simple, even though it feels a little magic. */
1326 static unsigned short table
[1024];
1327 static const int prime_factor
= 89, prime_step
= 281;
1331 print_table_stats(void)
1333 int i
, j
, collisions
[11], count
, hash
, mask
;
1334 const struct value_desc
*d
;
1337 mask
= Elements(table
) - 1;
1338 memset(collisions
, 0, sizeof collisions
);
1340 for (i
= 0; i
< Elements(table
); i
++) {
1344 d
= &values
[table
[i
]];
1345 hash
= (d
->pname
* prime_factor
);
1348 if (values
[table
[hash
& mask
]].pname
== d
->pname
)
1360 printf("number of enums: %d (total %d)\n", count
, Elements(values
));
1361 for (i
= 0; i
< Elements(collisions
) - 1; i
++)
1362 if (collisions
[i
] > 0)
1363 printf(" %d enums with %d %scollisions\n",
1364 collisions
[i
], i
, i
== 10 ? "or more " : "");
1369 * Initialize the enum hash for a given API
1371 * This is called from one_time_init() to insert the enum values that
1372 * are valid for the API in question into the enum hash table.
1374 * \param the current context, for determining the API in question
1376 void _mesa_init_get_hash(struct gl_context
*ctx
)
1378 int i
, hash
, index
, mask
;
1379 int api_mask
= 0, api_bit
;
1381 mask
= Elements(table
) - 1;
1382 api_bit
= 1 << ctx
->API
;
1384 for (i
= 0; i
< Elements(values
); i
++) {
1385 if (values
[i
].type
== TYPE_API_MASK
) {
1386 api_mask
= values
[i
].offset
;
1389 if (!(api_mask
& api_bit
))
1392 hash
= (values
[i
].pname
* prime_factor
) & mask
;
1394 index
= hash
& mask
;
1395 if (!table
[index
]) {
1404 print_table_stats();
1409 * Handle irregular enums
1411 * Some values don't conform to the "well-known type at context
1412 * pointer + offset" pattern, so we have this function to catch all
1413 * the corner cases. Typically, it's a computed value or a one-off
1414 * pointer to a custom struct or something.
1416 * In this case we can't return a pointer to the value, so we'll have
1417 * to use the temporary variable 'v' declared back in the calling
1418 * glGet*v() function to store the result.
1420 * \param ctx the current context
1421 * \param d the struct value_desc that describes the enum
1422 * \param v pointer to the tmp declared in the calling glGet*v() function
1425 find_custom_value(struct gl_context
*ctx
, const struct value_desc
*d
, union value
*v
)
1427 struct gl_buffer_object
**buffer_obj
;
1428 struct gl_client_array
*array
;
1435 case GL_TEXTURE_1D_ARRAY_EXT
:
1436 case GL_TEXTURE_2D_ARRAY_EXT
:
1437 case GL_TEXTURE_CUBE_MAP_ARB
:
1438 case GL_TEXTURE_RECTANGLE_NV
:
1439 case GL_TEXTURE_EXTERNAL_OES
:
1440 v
->value_bool
= _mesa_IsEnabled(d
->pname
);
1443 case GL_LINE_STIPPLE_PATTERN
:
1444 /* This is the only GLushort, special case it here by promoting
1445 * to an int rather than introducing a new type. */
1446 v
->value_int
= ctx
->Line
.StipplePattern
;
1449 case GL_CURRENT_RASTER_TEXTURE_COORDS
:
1450 unit
= ctx
->Texture
.CurrentUnit
;
1451 v
->value_float_4
[0] = ctx
->Current
.RasterTexCoords
[unit
][0];
1452 v
->value_float_4
[1] = ctx
->Current
.RasterTexCoords
[unit
][1];
1453 v
->value_float_4
[2] = ctx
->Current
.RasterTexCoords
[unit
][2];
1454 v
->value_float_4
[3] = ctx
->Current
.RasterTexCoords
[unit
][3];
1457 case GL_CURRENT_TEXTURE_COORDS
:
1458 unit
= ctx
->Texture
.CurrentUnit
;
1459 v
->value_float_4
[0] = ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
][0];
1460 v
->value_float_4
[1] = ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
][1];
1461 v
->value_float_4
[2] = ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
][2];
1462 v
->value_float_4
[3] = ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
][3];
1465 case GL_COLOR_WRITEMASK
:
1466 v
->value_int_4
[0] = ctx
->Color
.ColorMask
[0][RCOMP
] ? 1 : 0;
1467 v
->value_int_4
[1] = ctx
->Color
.ColorMask
[0][GCOMP
] ? 1 : 0;
1468 v
->value_int_4
[2] = ctx
->Color
.ColorMask
[0][BCOMP
] ? 1 : 0;
1469 v
->value_int_4
[3] = ctx
->Color
.ColorMask
[0][ACOMP
] ? 1 : 0;
1473 v
->value_bool
= ctx
->Current
.Attrib
[VERT_ATTRIB_EDGEFLAG
][0] == 1.0;
1476 case GL_READ_BUFFER
:
1477 v
->value_enum
= ctx
->ReadBuffer
->ColorReadBuffer
;
1480 case GL_MAP2_GRID_DOMAIN
:
1481 v
->value_float_4
[0] = ctx
->Eval
.MapGrid2u1
;
1482 v
->value_float_4
[1] = ctx
->Eval
.MapGrid2u2
;
1483 v
->value_float_4
[2] = ctx
->Eval
.MapGrid2v1
;
1484 v
->value_float_4
[3] = ctx
->Eval
.MapGrid2v2
;
1487 case GL_TEXTURE_STACK_DEPTH
:
1488 unit
= ctx
->Texture
.CurrentUnit
;
1489 v
->value_int
= ctx
->TextureMatrixStack
[unit
].Depth
+ 1;
1491 case GL_TEXTURE_MATRIX
:
1492 unit
= ctx
->Texture
.CurrentUnit
;
1493 v
->value_matrix
= ctx
->TextureMatrixStack
[unit
].Top
;
1496 case GL_TEXTURE_COORD_ARRAY
:
1497 case GL_TEXTURE_COORD_ARRAY_SIZE
:
1498 case GL_TEXTURE_COORD_ARRAY_TYPE
:
1499 case GL_TEXTURE_COORD_ARRAY_STRIDE
:
1500 array
= &ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)];
1501 v
->value_int
= *(GLuint
*) ((char *) array
+ d
->offset
);
1504 case GL_ACTIVE_TEXTURE_ARB
:
1505 v
->value_int
= GL_TEXTURE0_ARB
+ ctx
->Texture
.CurrentUnit
;
1507 case GL_CLIENT_ACTIVE_TEXTURE_ARB
:
1508 v
->value_int
= GL_TEXTURE0_ARB
+ ctx
->Array
.ActiveTexture
;
1511 case GL_MODELVIEW_STACK_DEPTH
:
1512 case GL_PROJECTION_STACK_DEPTH
:
1513 v
->value_int
= *(GLint
*) ((char *) ctx
+ d
->offset
) + 1;
1516 case GL_MAX_TEXTURE_SIZE
:
1517 case GL_MAX_3D_TEXTURE_SIZE
:
1518 case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB
:
1519 p
= (GLuint
*) ((char *) ctx
+ d
->offset
);
1520 v
->value_int
= 1 << (*p
- 1);
1523 case GL_SCISSOR_BOX
:
1524 v
->value_int_4
[0] = ctx
->Scissor
.X
;
1525 v
->value_int_4
[1] = ctx
->Scissor
.Y
;
1526 v
->value_int_4
[2] = ctx
->Scissor
.Width
;
1527 v
->value_int_4
[3] = ctx
->Scissor
.Height
;
1532 ctx
->ListState
.CurrentList
? ctx
->ListState
.CurrentList
->Name
: 0;
1535 if (!ctx
->CompileFlag
)
1537 else if (ctx
->ExecuteFlag
)
1538 v
->value_enum
= GL_COMPILE_AND_EXECUTE
;
1540 v
->value_enum
= GL_COMPILE
;
1544 v
->value_int_4
[0] = ctx
->Viewport
.X
;
1545 v
->value_int_4
[1] = ctx
->Viewport
.Y
;
1546 v
->value_int_4
[2] = ctx
->Viewport
.Width
;
1547 v
->value_int_4
[3] = ctx
->Viewport
.Height
;
1550 case GL_ACTIVE_STENCIL_FACE_EXT
:
1551 v
->value_enum
= ctx
->Stencil
.ActiveFace
? GL_BACK
: GL_FRONT
;
1554 case GL_STENCIL_FAIL
:
1555 v
->value_enum
= ctx
->Stencil
.FailFunc
[ctx
->Stencil
.ActiveFace
];
1557 case GL_STENCIL_FUNC
:
1558 v
->value_enum
= ctx
->Stencil
.Function
[ctx
->Stencil
.ActiveFace
];
1560 case GL_STENCIL_PASS_DEPTH_FAIL
:
1561 v
->value_enum
= ctx
->Stencil
.ZFailFunc
[ctx
->Stencil
.ActiveFace
];
1563 case GL_STENCIL_PASS_DEPTH_PASS
:
1564 v
->value_enum
= ctx
->Stencil
.ZPassFunc
[ctx
->Stencil
.ActiveFace
];
1566 case GL_STENCIL_REF
:
1567 v
->value_int
= ctx
->Stencil
.Ref
[ctx
->Stencil
.ActiveFace
];
1569 case GL_STENCIL_VALUE_MASK
:
1570 v
->value_int
= ctx
->Stencil
.ValueMask
[ctx
->Stencil
.ActiveFace
];
1572 case GL_STENCIL_WRITEMASK
:
1573 v
->value_int
= ctx
->Stencil
.WriteMask
[ctx
->Stencil
.ActiveFace
];
1576 case GL_NUM_EXTENSIONS
:
1577 v
->value_int
= _mesa_get_extension_count(ctx
);
1580 case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES
:
1581 v
->value_int
= _mesa_get_color_read_type(ctx
);
1583 case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES
:
1584 v
->value_int
= _mesa_get_color_read_format(ctx
);
1587 case GL_CURRENT_MATRIX_STACK_DEPTH_ARB
:
1588 v
->value_int
= ctx
->CurrentStack
->Depth
+ 1;
1590 case GL_CURRENT_MATRIX_ARB
:
1591 case GL_TRANSPOSE_CURRENT_MATRIX_ARB
:
1592 v
->value_matrix
= ctx
->CurrentStack
->Top
;
1595 case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB
:
1596 v
->value_int
= _mesa_get_compressed_formats(ctx
, NULL
);
1598 case GL_COMPRESSED_TEXTURE_FORMATS_ARB
:
1600 _mesa_get_compressed_formats(ctx
, v
->value_int_n
.ints
);
1601 ASSERT(v
->value_int_n
.n
<= 100);
1604 case GL_MAX_VARYING_FLOATS_ARB
:
1605 v
->value_int
= ctx
->Const
.MaxVarying
* 4;
1608 /* Various object names */
1610 case GL_TEXTURE_BINDING_1D
:
1611 case GL_TEXTURE_BINDING_2D
:
1612 case GL_TEXTURE_BINDING_3D
:
1613 case GL_TEXTURE_BINDING_1D_ARRAY_EXT
:
1614 case GL_TEXTURE_BINDING_2D_ARRAY_EXT
:
1615 case GL_TEXTURE_BINDING_CUBE_MAP_ARB
:
1616 case GL_TEXTURE_BINDING_RECTANGLE_NV
:
1617 case GL_TEXTURE_BINDING_EXTERNAL_OES
:
1618 unit
= ctx
->Texture
.CurrentUnit
;
1620 ctx
->Texture
.Unit
[unit
].CurrentTex
[d
->offset
]->Name
;
1623 /* GL_ARB_vertex_buffer_object */
1624 case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB
:
1625 case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB
:
1626 case GL_COLOR_ARRAY_BUFFER_BINDING_ARB
:
1627 case GL_INDEX_ARRAY_BUFFER_BINDING_ARB
:
1628 case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB
:
1629 case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB
:
1630 case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB
:
1631 buffer_obj
= (struct gl_buffer_object
**)
1632 ((char *) ctx
->Array
.ArrayObj
+ d
->offset
);
1633 v
->value_int
= (*buffer_obj
)->Name
;
1635 case GL_ARRAY_BUFFER_BINDING_ARB
:
1636 v
->value_int
= ctx
->Array
.ArrayBufferObj
->Name
;
1638 case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB
:
1640 ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)].BufferObj
->Name
;
1642 case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB
:
1643 v
->value_int
= ctx
->Array
.ArrayObj
->ElementArrayBufferObj
->Name
;
1646 /* ARB_copy_buffer */
1647 case GL_COPY_READ_BUFFER
:
1648 v
->value_int
= ctx
->CopyReadBuffer
->Name
;
1650 case GL_COPY_WRITE_BUFFER
:
1651 v
->value_int
= ctx
->CopyWriteBuffer
->Name
;
1654 case GL_FRAGMENT_PROGRAM_BINDING_NV
:
1656 ctx
->FragmentProgram
.Current
? ctx
->FragmentProgram
.Current
->Base
.Id
: 0;
1658 case GL_VERTEX_PROGRAM_BINDING_NV
:
1660 ctx
->VertexProgram
.Current
? ctx
->VertexProgram
.Current
->Base
.Id
: 0;
1662 case GL_PIXEL_PACK_BUFFER_BINDING_EXT
:
1663 v
->value_int
= ctx
->Pack
.BufferObj
->Name
;
1665 case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT
:
1666 v
->value_int
= ctx
->Unpack
.BufferObj
->Name
;
1668 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
:
1669 v
->value_int
= ctx
->TransformFeedback
.CurrentBuffer
->Name
;
1671 case GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED
:
1672 v
->value_int
= ctx
->TransformFeedback
.CurrentObject
->Paused
;
1674 case GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE
:
1675 v
->value_int
= ctx
->TransformFeedback
.CurrentObject
->Active
;
1677 case GL_TRANSFORM_FEEDBACK_BINDING
:
1678 v
->value_int
= ctx
->TransformFeedback
.CurrentObject
->Name
;
1680 case GL_CURRENT_PROGRAM
:
1682 ctx
->Shader
.ActiveProgram
? ctx
->Shader
.ActiveProgram
->Name
: 0;
1684 case GL_READ_FRAMEBUFFER_BINDING_EXT
:
1685 v
->value_int
= ctx
->ReadBuffer
->Name
;
1687 case GL_RENDERBUFFER_BINDING_EXT
:
1689 ctx
->CurrentRenderbuffer
? ctx
->CurrentRenderbuffer
->Name
: 0;
1691 case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES
:
1692 v
->value_int
= ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].BufferObj
->Name
;
1696 if(ctx
->Color
._ClampFragmentColor
)
1697 COPY_4FV(v
->value_float_4
, ctx
->Fog
.Color
);
1699 COPY_4FV(v
->value_float_4
, ctx
->Fog
.ColorUnclamped
);
1701 case GL_COLOR_CLEAR_VALUE
:
1702 if(ctx
->Color
._ClampFragmentColor
) {
1703 v
->value_float_4
[0] = CLAMP(ctx
->Color
.ClearColor
.f
[0], 0.0F
, 1.0F
);
1704 v
->value_float_4
[1] = CLAMP(ctx
->Color
.ClearColor
.f
[1], 0.0F
, 1.0F
);
1705 v
->value_float_4
[2] = CLAMP(ctx
->Color
.ClearColor
.f
[2], 0.0F
, 1.0F
);
1706 v
->value_float_4
[3] = CLAMP(ctx
->Color
.ClearColor
.f
[3], 0.0F
, 1.0F
);
1708 COPY_4FV(v
->value_float_4
, ctx
->Color
.ClearColor
.f
);
1710 case GL_BLEND_COLOR_EXT
:
1711 if(ctx
->Color
._ClampFragmentColor
)
1712 COPY_4FV(v
->value_float_4
, ctx
->Color
.BlendColor
);
1714 COPY_4FV(v
->value_float_4
, ctx
->Color
.BlendColorUnclamped
);
1716 case GL_ALPHA_TEST_REF
:
1717 if(ctx
->Color
._ClampFragmentColor
)
1718 v
->value_float
= ctx
->Color
.AlphaRef
;
1720 v
->value_float
= ctx
->Color
.AlphaRefUnclamped
;
1722 case GL_MAX_VERTEX_UNIFORM_VECTORS
:
1723 v
->value_int
= ctx
->Const
.VertexProgram
.MaxUniformComponents
/ 4;
1726 case GL_MAX_FRAGMENT_UNIFORM_VECTORS
:
1727 v
->value_int
= ctx
->Const
.FragmentProgram
.MaxUniformComponents
/ 4;
1730 /* GL_ARB_texture_buffer_object */
1731 case GL_TEXTURE_BUFFER_ARB
:
1732 v
->value_int
= ctx
->Texture
.BufferObject
->Name
;
1734 case GL_TEXTURE_BINDING_BUFFER_ARB
:
1735 unit
= ctx
->Texture
.CurrentUnit
;
1737 ctx
->Texture
.Unit
[unit
].CurrentTex
[TEXTURE_BUFFER_INDEX
]->Name
;
1739 case GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB
:
1741 struct gl_buffer_object
*buf
=
1742 ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
]
1743 .CurrentTex
[TEXTURE_BUFFER_INDEX
]->BufferObject
;
1744 v
->value_int
= buf
? buf
->Name
: 0;
1747 case GL_TEXTURE_BUFFER_FORMAT_ARB
:
1748 v
->value_int
= ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
]
1749 .CurrentTex
[TEXTURE_BUFFER_INDEX
]->BufferObjectFormat
;
1752 /* GL_ARB_sampler_objects */
1753 case GL_SAMPLER_BINDING
:
1755 struct gl_sampler_object
*samp
=
1756 ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
].Sampler
;
1757 v
->value_int
= samp
? samp
->Name
: 0;
1764 * Check extra constraints on a struct value_desc descriptor
1766 * If a struct value_desc has a non-NULL extra pointer, it means that
1767 * there are a number of extra constraints to check or actions to
1768 * perform. The extras is just an integer array where each integer
1769 * encode different constraints or actions.
1771 * \param ctx current context
1772 * \param func name of calling glGet*v() function for error reporting
1773 * \param d the struct value_desc that has the extra constraints
1775 * \return GL_FALSE if one of the constraints was not satisfied,
1776 * otherwise GL_TRUE.
1779 check_extra(struct gl_context
*ctx
, const char *func
, const struct value_desc
*d
)
1781 const GLuint version
= ctx
->VersionMajor
* 10 + ctx
->VersionMinor
;
1787 for (e
= d
->extra
; *e
!= EXTRA_END
; e
++)
1789 case EXTRA_VERSION_30
:
1790 if (version
>= 30) {
1795 case EXTRA_VERSION_31
:
1796 if (version
>= 31) {
1801 case EXTRA_VERSION_32
:
1802 if (version
>= 32) {
1807 case EXTRA_NEW_FRAG_CLAMP
:
1808 if (ctx
->NewState
& (_NEW_BUFFERS
| _NEW_FRAG_CLAMP
))
1809 _mesa_update_state(ctx
);
1811 case EXTRA_VERSION_ES2
:
1812 if (ctx
->API
== API_OPENGLES2
) {
1817 case EXTRA_NEW_BUFFERS
:
1818 if (ctx
->NewState
& _NEW_BUFFERS
)
1819 _mesa_update_state(ctx
);
1821 case EXTRA_FLUSH_CURRENT
:
1822 FLUSH_CURRENT(ctx
, 0);
1824 case EXTRA_VALID_DRAW_BUFFER
:
1825 if (d
->pname
- GL_DRAW_BUFFER0_ARB
>= ctx
->Const
.MaxDrawBuffers
) {
1826 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(draw buffer %u)",
1827 func
, d
->pname
- GL_DRAW_BUFFER0_ARB
);
1831 case EXTRA_VALID_TEXTURE_UNIT
:
1832 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxTextureCoordUnits
) {
1833 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(texture %u)",
1834 func
, ctx
->Texture
.CurrentUnit
);
1838 case EXTRA_VALID_CLIP_DISTANCE
:
1839 if (d
->pname
- GL_CLIP_DISTANCE0
>= ctx
->Const
.MaxClipPlanes
) {
1840 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(clip distance %u)",
1841 func
, d
->pname
- GL_CLIP_DISTANCE0
);
1845 case EXTRA_GLSL_130
:
1846 if (ctx
->Const
.GLSLVersion
>= 130) {
1853 default: /* *e is a offset into the extension struct */
1855 if (*(GLboolean
*) ((char *) &ctx
->Extensions
+ *e
))
1860 if (total
> 0 && enabled
== 0) {
1861 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(pname=%s)", func
,
1862 _mesa_lookup_enum_by_nr(d
->pname
));
1869 static const struct value_desc error_value
=
1870 { 0, 0, TYPE_INVALID
, NO_OFFSET
, NO_EXTRA
};
1873 * Find the struct value_desc corresponding to the enum 'pname'.
1875 * We hash the enum value to get an index into the 'table' array,
1876 * which holds the index in the 'values' array of struct value_desc.
1877 * Once we've found the entry, we do the extra checks, if any, then
1878 * look up the value and return a pointer to it.
1880 * If the value has to be computed (for example, it's the result of a
1881 * function call or we need to add 1 to it), we use the tmp 'v' to
1884 * \param func name of glGet*v() func for error reporting
1885 * \param pname the enum value we're looking up
1886 * \param p is were we return the pointer to the value
1887 * \param v a tmp union value variable in the calling glGet*v() function
1889 * \return the struct value_desc corresponding to the enum or a struct
1890 * value_desc of TYPE_INVALID if not found. This lets the calling
1891 * glGet*v() function jump right into a switch statement and
1892 * handle errors there instead of having to check for NULL.
1894 static const struct value_desc
*
1895 find_value(const char *func
, GLenum pname
, void **p
, union value
*v
)
1897 GET_CURRENT_CONTEXT(ctx
);
1898 struct gl_texture_unit
*unit
;
1900 const struct value_desc
*d
;
1902 mask
= Elements(table
) - 1;
1903 hash
= (pname
* prime_factor
);
1905 d
= &values
[table
[hash
& mask
]];
1907 /* If the enum isn't valid, the hash walk ends with index 0,
1908 * which is the API mask entry at the beginning of values[]. */
1909 if (unlikely(d
->type
== TYPE_API_MASK
)) {
1910 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(pname=%s)", func
,
1911 _mesa_lookup_enum_by_nr(pname
));
1912 return &error_value
;
1915 if (likely(d
->pname
== pname
))
1921 if (unlikely(d
->extra
&& !check_extra(ctx
, func
, d
)))
1922 return &error_value
;
1924 switch (d
->location
) {
1926 *p
= ((char *) ctx
->DrawBuffer
+ d
->offset
);
1929 *p
= ((char *) ctx
+ d
->offset
);
1932 *p
= ((char *) ctx
->Array
.ArrayObj
+ d
->offset
);
1935 unit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1936 *p
= ((char *) unit
+ d
->offset
);
1939 find_custom_value(ctx
, d
, v
);
1947 /* silence warning */
1948 return &error_value
;
1951 static const int transpose
[] = {
1959 _mesa_GetBooleanv(GLenum pname
, GLboolean
*params
)
1961 const struct value_desc
*d
;
1966 GET_CURRENT_CONTEXT(ctx
);
1968 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1970 d
= find_value("glGetBooleanv", pname
, &p
, &v
);
1975 params
[0] = INT_TO_BOOLEAN(d
->offset
);
1980 params
[3] = FLOAT_TO_BOOLEAN(((GLfloat
*) p
)[3]);
1983 params
[2] = FLOAT_TO_BOOLEAN(((GLfloat
*) p
)[2]);
1986 params
[1] = FLOAT_TO_BOOLEAN(((GLfloat
*) p
)[1]);
1989 params
[0] = FLOAT_TO_BOOLEAN(((GLfloat
*) p
)[0]);
1993 params
[0] = FLOAT_TO_BOOLEAN(((GLdouble
*) p
)[0]);
1997 params
[3] = INT_TO_BOOLEAN(((GLint
*) p
)[3]);
1999 params
[2] = INT_TO_BOOLEAN(((GLint
*) p
)[2]);
2002 params
[1] = INT_TO_BOOLEAN(((GLint
*) p
)[1]);
2005 params
[0] = INT_TO_BOOLEAN(((GLint
*) p
)[0]);
2009 for (i
= 0; i
< v
.value_int_n
.n
; i
++)
2010 params
[i
] = INT_TO_BOOLEAN(v
.value_int_n
.ints
[i
]);
2014 params
[0] = INT64_TO_BOOLEAN(((GLint64
*) p
)[0]);
2018 params
[0] = ((GLboolean
*) p
)[0];
2022 m
= *(GLmatrix
**) p
;
2023 for (i
= 0; i
< 16; i
++)
2024 params
[i
] = FLOAT_TO_BOOLEAN(m
->m
[i
]);
2028 m
= *(GLmatrix
**) p
;
2029 for (i
= 0; i
< 16; i
++)
2030 params
[i
] = FLOAT_TO_BOOLEAN(m
->m
[transpose
[i
]]);
2041 shift
= d
->type
- TYPE_BIT_0
;
2042 params
[0] = (*(GLbitfield
*) p
>> shift
) & 1;
2048 _mesa_GetFloatv(GLenum pname
, GLfloat
*params
)
2050 const struct value_desc
*d
;
2055 GET_CURRENT_CONTEXT(ctx
);
2057 ASSERT_OUTSIDE_BEGIN_END(ctx
);
2059 d
= find_value("glGetFloatv", pname
, &p
, &v
);
2064 params
[0] = (GLfloat
) d
->offset
;
2069 params
[3] = ((GLfloat
*) p
)[3];
2072 params
[2] = ((GLfloat
*) p
)[2];
2075 params
[1] = ((GLfloat
*) p
)[1];
2078 params
[0] = ((GLfloat
*) p
)[0];
2082 params
[0] = ((GLdouble
*) p
)[0];
2086 params
[3] = (GLfloat
) (((GLint
*) p
)[3]);
2088 params
[2] = (GLfloat
) (((GLint
*) p
)[2]);
2091 params
[1] = (GLfloat
) (((GLint
*) p
)[1]);
2094 params
[0] = (GLfloat
) (((GLint
*) p
)[0]);
2098 for (i
= 0; i
< v
.value_int_n
.n
; i
++)
2099 params
[i
] = INT_TO_FLOAT(v
.value_int_n
.ints
[i
]);
2103 params
[0] = ((GLint64
*) p
)[0];
2107 params
[0] = BOOLEAN_TO_FLOAT(*(GLboolean
*) p
);
2111 m
= *(GLmatrix
**) p
;
2112 for (i
= 0; i
< 16; i
++)
2113 params
[i
] = m
->m
[i
];
2117 m
= *(GLmatrix
**) p
;
2118 for (i
= 0; i
< 16; i
++)
2119 params
[i
] = m
->m
[transpose
[i
]];
2130 shift
= d
->type
- TYPE_BIT_0
;
2131 params
[0] = BOOLEAN_TO_FLOAT((*(GLbitfield
*) p
>> shift
) & 1);
2137 _mesa_GetIntegerv(GLenum pname
, GLint
*params
)
2139 const struct value_desc
*d
;
2144 GET_CURRENT_CONTEXT(ctx
);
2146 ASSERT_OUTSIDE_BEGIN_END(ctx
);
2148 d
= find_value("glGetIntegerv", pname
, &p
, &v
);
2153 params
[0] = d
->offset
;
2157 params
[3] = IROUND(((GLfloat
*) p
)[3]);
2159 params
[2] = IROUND(((GLfloat
*) p
)[2]);
2161 params
[1] = IROUND(((GLfloat
*) p
)[1]);
2163 params
[0] = IROUND(((GLfloat
*) p
)[0]);
2167 params
[3] = FLOAT_TO_INT(((GLfloat
*) p
)[3]);
2169 params
[2] = FLOAT_TO_INT(((GLfloat
*) p
)[2]);
2171 params
[1] = FLOAT_TO_INT(((GLfloat
*) p
)[1]);
2173 params
[0] = FLOAT_TO_INT(((GLfloat
*) p
)[0]);
2177 params
[0] = FLOAT_TO_INT(((GLdouble
*) p
)[0]);
2181 params
[3] = ((GLint
*) p
)[3];
2183 params
[2] = ((GLint
*) p
)[2];
2186 params
[1] = ((GLint
*) p
)[1];
2189 params
[0] = ((GLint
*) p
)[0];
2193 for (i
= 0; i
< v
.value_int_n
.n
; i
++)
2194 params
[i
] = v
.value_int_n
.ints
[i
];
2198 params
[0] = INT64_TO_INT(((GLint64
*) p
)[0]);
2202 params
[0] = BOOLEAN_TO_INT(*(GLboolean
*) p
);
2206 m
= *(GLmatrix
**) p
;
2207 for (i
= 0; i
< 16; i
++)
2208 params
[i
] = FLOAT_TO_INT(m
->m
[i
]);
2212 m
= *(GLmatrix
**) p
;
2213 for (i
= 0; i
< 16; i
++)
2214 params
[i
] = FLOAT_TO_INT(m
->m
[transpose
[i
]]);
2225 shift
= d
->type
- TYPE_BIT_0
;
2226 params
[0] = (*(GLbitfield
*) p
>> shift
) & 1;
2231 #if FEATURE_ARB_sync
2233 _mesa_GetInteger64v(GLenum pname
, GLint64
*params
)
2235 const struct value_desc
*d
;
2240 GET_CURRENT_CONTEXT(ctx
);
2242 ASSERT_OUTSIDE_BEGIN_END(ctx
);
2244 d
= find_value("glGetInteger64v", pname
, &p
, &v
);
2249 params
[0] = d
->offset
;
2253 params
[3] = IROUND64(((GLfloat
*) p
)[3]);
2255 params
[2] = IROUND64(((GLfloat
*) p
)[2]);
2257 params
[1] = IROUND64(((GLfloat
*) p
)[1]);
2259 params
[0] = IROUND64(((GLfloat
*) p
)[0]);
2263 params
[3] = FLOAT_TO_INT64(((GLfloat
*) p
)[3]);
2265 params
[2] = FLOAT_TO_INT64(((GLfloat
*) p
)[2]);
2267 params
[1] = FLOAT_TO_INT64(((GLfloat
*) p
)[1]);
2269 params
[0] = FLOAT_TO_INT64(((GLfloat
*) p
)[0]);
2273 params
[0] = FLOAT_TO_INT64(((GLdouble
*) p
)[0]);
2277 params
[3] = ((GLint
*) p
)[3];
2279 params
[2] = ((GLint
*) p
)[2];
2282 params
[1] = ((GLint
*) p
)[1];
2285 params
[0] = ((GLint
*) p
)[0];
2289 for (i
= 0; i
< v
.value_int_n
.n
; i
++)
2290 params
[i
] = INT_TO_BOOLEAN(v
.value_int_n
.ints
[i
]);
2294 params
[0] = ((GLint64
*) p
)[0];
2298 params
[0] = ((GLboolean
*) p
)[0];
2302 m
= *(GLmatrix
**) p
;
2303 for (i
= 0; i
< 16; i
++)
2304 params
[i
] = FLOAT_TO_INT64(m
->m
[i
]);
2308 m
= *(GLmatrix
**) p
;
2309 for (i
= 0; i
< 16; i
++)
2310 params
[i
] = FLOAT_TO_INT64(m
->m
[transpose
[i
]]);
2321 shift
= d
->type
- TYPE_BIT_0
;
2322 params
[0] = (*(GLbitfield
*) p
>> shift
) & 1;
2326 #endif /* FEATURE_ARB_sync */
2329 _mesa_GetDoublev(GLenum pname
, GLdouble
*params
)
2331 const struct value_desc
*d
;
2336 GET_CURRENT_CONTEXT(ctx
);
2338 ASSERT_OUTSIDE_BEGIN_END(ctx
);
2340 d
= find_value("glGetDoublev", pname
, &p
, &v
);
2345 params
[0] = d
->offset
;
2350 params
[3] = ((GLfloat
*) p
)[3];
2353 params
[2] = ((GLfloat
*) p
)[2];
2356 params
[1] = ((GLfloat
*) p
)[1];
2359 params
[0] = ((GLfloat
*) p
)[0];
2363 params
[0] = ((GLdouble
*) p
)[0];
2367 params
[3] = ((GLint
*) p
)[3];
2369 params
[2] = ((GLint
*) p
)[2];
2372 params
[1] = ((GLint
*) p
)[1];
2375 params
[0] = ((GLint
*) p
)[0];
2379 for (i
= 0; i
< v
.value_int_n
.n
; i
++)
2380 params
[i
] = v
.value_int_n
.ints
[i
];
2384 params
[0] = ((GLint64
*) p
)[0];
2388 params
[0] = *(GLboolean
*) p
;
2392 m
= *(GLmatrix
**) p
;
2393 for (i
= 0; i
< 16; i
++)
2394 params
[i
] = m
->m
[i
];
2398 m
= *(GLmatrix
**) p
;
2399 for (i
= 0; i
< 16; i
++)
2400 params
[i
] = m
->m
[transpose
[i
]];
2411 shift
= d
->type
- TYPE_BIT_0
;
2412 params
[0] = (*(GLbitfield
*) p
>> shift
) & 1;
2417 static enum value_type
2418 find_value_indexed(const char *func
, GLenum pname
, int index
, union value
*v
)
2420 GET_CURRENT_CONTEXT(ctx
);
2425 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2427 if (!ctx
->Extensions
.EXT_draw_buffers2
)
2429 v
->value_int
= (ctx
->Color
.BlendEnabled
>> index
) & 1;
2434 case GL_BLEND_SRC_RGB
:
2435 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2437 if (!ctx
->Extensions
.ARB_draw_buffers_blend
)
2439 v
->value_int
= ctx
->Color
.Blend
[index
].SrcRGB
;
2441 case GL_BLEND_SRC_ALPHA
:
2442 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2444 if (!ctx
->Extensions
.ARB_draw_buffers_blend
)
2446 v
->value_int
= ctx
->Color
.Blend
[index
].SrcA
;
2450 case GL_BLEND_DST_RGB
:
2451 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2453 if (!ctx
->Extensions
.ARB_draw_buffers_blend
)
2455 v
->value_int
= ctx
->Color
.Blend
[index
].DstRGB
;
2457 case GL_BLEND_DST_ALPHA
:
2458 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2460 if (!ctx
->Extensions
.ARB_draw_buffers_blend
)
2462 v
->value_int
= ctx
->Color
.Blend
[index
].DstA
;
2464 case GL_BLEND_EQUATION_RGB
:
2465 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2467 if (!ctx
->Extensions
.ARB_draw_buffers_blend
)
2469 v
->value_int
= ctx
->Color
.Blend
[index
].EquationRGB
;
2471 case GL_BLEND_EQUATION_ALPHA
:
2472 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2474 if (!ctx
->Extensions
.ARB_draw_buffers_blend
)
2476 v
->value_int
= ctx
->Color
.Blend
[index
].EquationA
;
2479 case GL_COLOR_WRITEMASK
:
2480 if (index
>= ctx
->Const
.MaxDrawBuffers
)
2482 if (!ctx
->Extensions
.EXT_draw_buffers2
)
2484 v
->value_int_4
[0] = ctx
->Color
.ColorMask
[index
][RCOMP
] ? 1 : 0;
2485 v
->value_int_4
[1] = ctx
->Color
.ColorMask
[index
][GCOMP
] ? 1 : 0;
2486 v
->value_int_4
[2] = ctx
->Color
.ColorMask
[index
][BCOMP
] ? 1 : 0;
2487 v
->value_int_4
[3] = ctx
->Color
.ColorMask
[index
][ACOMP
] ? 1 : 0;
2490 case GL_TRANSFORM_FEEDBACK_BUFFER_START
:
2491 if (index
>= ctx
->Const
.MaxTransformFeedbackSeparateAttribs
)
2493 if (!ctx
->Extensions
.EXT_transform_feedback
)
2495 v
->value_int64
= ctx
->TransformFeedback
.CurrentObject
->Offset
[index
];
2498 case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE
:
2499 if (index
>= ctx
->Const
.MaxTransformFeedbackSeparateAttribs
)
2501 if (!ctx
->Extensions
.EXT_transform_feedback
)
2503 v
->value_int64
= ctx
->TransformFeedback
.CurrentObject
->Size
[index
];
2506 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
:
2507 if (index
>= ctx
->Const
.MaxTransformFeedbackSeparateAttribs
)
2509 if (!ctx
->Extensions
.EXT_transform_feedback
)
2511 v
->value_int
= ctx
->TransformFeedback
.CurrentObject
->BufferNames
[index
];
2516 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(pname=%s)", func
,
2517 _mesa_lookup_enum_by_nr(pname
));
2518 return TYPE_INVALID
;
2520 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(pname=%s)", func
,
2521 _mesa_lookup_enum_by_nr(pname
));
2522 return TYPE_INVALID
;
2526 _mesa_GetBooleanIndexedv( GLenum pname
, GLuint index
, GLboolean
*params
)
2529 enum value_type type
=
2530 find_value_indexed("glGetBooleanIndexedv", pname
, index
, &v
);
2534 params
[0] = INT_TO_BOOLEAN(v
.value_int
);
2537 params
[0] = INT_TO_BOOLEAN(v
.value_int_4
[0]);
2538 params
[1] = INT_TO_BOOLEAN(v
.value_int_4
[1]);
2539 params
[2] = INT_TO_BOOLEAN(v
.value_int_4
[2]);
2540 params
[3] = INT_TO_BOOLEAN(v
.value_int_4
[3]);
2543 params
[0] = INT64_TO_BOOLEAN(v
.value_int
);
2546 ; /* nothing - GL error was recorded */
2551 _mesa_GetIntegerIndexedv( GLenum pname
, GLuint index
, GLint
*params
)
2554 enum value_type type
=
2555 find_value_indexed("glGetIntegerIndexedv", pname
, index
, &v
);
2559 params
[0] = v
.value_int
;
2562 params
[0] = v
.value_int_4
[0];
2563 params
[1] = v
.value_int_4
[1];
2564 params
[2] = v
.value_int_4
[2];
2565 params
[3] = v
.value_int_4
[3];
2568 params
[0] = INT64_TO_INT(v
.value_int
);
2571 ; /* nothing - GL error was recorded */
2575 #if FEATURE_ARB_sync
2577 _mesa_GetInteger64Indexedv( GLenum pname
, GLuint index
, GLint64
*params
)
2580 enum value_type type
=
2581 find_value_indexed("glGetIntegerIndexedv", pname
, index
, &v
);
2585 params
[0] = v
.value_int
;
2588 params
[0] = v
.value_int_4
[0];
2589 params
[1] = v
.value_int_4
[1];
2590 params
[2] = v
.value_int_4
[2];
2591 params
[3] = v
.value_int_4
[3];
2594 params
[0] = v
.value_int
;
2597 ; /* nothing - GL error was recorded */
2600 #endif /* FEATURE_ARB_sync */
2604 _mesa_GetFixedv(GLenum pname
, GLfixed
*params
)
2606 const struct value_desc
*d
;
2612 d
= find_value("glGetDoublev", pname
, &p
, &v
);
2617 params
[0] = INT_TO_FIXED(d
->offset
);
2622 params
[3] = FLOAT_TO_FIXED(((GLfloat
*) p
)[3]);
2625 params
[2] = FLOAT_TO_FIXED(((GLfloat
*) p
)[2]);
2628 params
[1] = FLOAT_TO_FIXED(((GLfloat
*) p
)[1]);
2631 params
[0] = FLOAT_TO_FIXED(((GLfloat
*) p
)[0]);
2635 params
[0] = FLOAT_TO_FIXED(((GLdouble
*) p
)[0]);
2639 params
[3] = INT_TO_FIXED(((GLint
*) p
)[3]);
2641 params
[2] = INT_TO_FIXED(((GLint
*) p
)[2]);
2644 params
[1] = INT_TO_FIXED(((GLint
*) p
)[1]);
2647 params
[0] = INT_TO_FIXED(((GLint
*) p
)[0]);
2651 for (i
= 0; i
< v
.value_int_n
.n
; i
++)
2652 params
[i
] = INT_TO_FIXED(v
.value_int_n
.ints
[i
]);
2656 params
[0] = ((GLint64
*) p
)[0];
2660 params
[0] = BOOLEAN_TO_FIXED(((GLboolean
*) p
)[0]);
2664 m
= *(GLmatrix
**) p
;
2665 for (i
= 0; i
< 16; i
++)
2666 params
[i
] = FLOAT_TO_FIXED(m
->m
[i
]);
2670 m
= *(GLmatrix
**) p
;
2671 for (i
= 0; i
< 16; i
++)
2672 params
[i
] = FLOAT_TO_FIXED(m
->m
[transpose
[i
]]);
2683 shift
= d
->type
- TYPE_BIT_0
;
2684 params
[0] = BOOLEAN_TO_FIXED((*(GLbitfield
*) p
>> shift
) & 1);