diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2010-05-11 12:07:10 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2010-05-11 14:06:22 -0400 |
commit | 199b0894b501607bf8d599ef5efc08cd6c08c79d (patch) | |
tree | 7c545c23739311eee3c8897b2a1d3b7ee09dae92 | |
parent | 08e443a1c8218e43dcd953859843d95d9020a892 (diff) |
mesa: Optimize get.c by using a table-driven approach
-rw-r--r-- | src/mesa/Makefile | 6 | ||||
-rw-r--r-- | src/mesa/main/APIspec.xml | 14 | ||||
-rw-r--r-- | src/mesa/main/compiler.h | 7 | ||||
-rw-r--r-- | src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/context.h | 2 | ||||
-rw-r--r-- | src/mesa/main/get.c | 10140 | ||||
-rw-r--r-- | src/mesa/main/get.h | 26 | ||||
-rw-r--r-- | src/mesa/main/get_gen.py | 1462 | ||||
-rw-r--r-- | src/mesa/main/get_gen_es.py | 823 | ||||
-rw-r--r-- | src/mesa/main/glheader.h | 15 | ||||
-rw-r--r-- | src/mesa/main/texcompress.c | 18 | ||||
-rw-r--r-- | src/mesa/sources.mak | 4 |
12 files changed, 2352 insertions, 10166 deletions
diff --git a/src/mesa/Makefile b/src/mesa/Makefile index ba03840c8e..1dc7139733 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -30,12 +30,6 @@ main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py m main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@ -main/get_es1.c: main/get_gen_es.py - $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@ - -main/get_es2.c: main/get_gen_es.py - $(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@ - ###################################################################### # Helper libraries used by many drivers: diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml index 268bd5d3db..b4ed18e75e 100644 --- a/src/mesa/main/APIspec.xml +++ b/src/mesa/main/APIspec.xml @@ -3939,15 +3939,15 @@ <function name="PixelStorei" template="PixelStore" gltype="GLint"/> <function name="ReadPixels" template="ReadPixels"/> - <function name="GetBooleanv" default_prefix="_es1_" template="GetState" gltype="GLboolean"/> + <function name="GetBooleanv" template="GetState" gltype="GLboolean"/> <function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/> <function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/> <function name="GetError" template="GetError"/> - <function name="GetFloatv" default_prefix="_es1_" template="GetState" gltype="GLfloat"/> - <function name="GetFixedv" default_prefix="_es1_" template="GetState" gltype="GLfixed"/> - <function name="GetIntegerv" default_prefix="_es1_" template="GetState" gltype="GLint"/> + <function name="GetFloatv" template="GetState" gltype="GLfloat"/> + <function name="GetFixedv" template="GetState" gltype="GLfixed"/> + <function name="GetIntegerv" template="GetState" gltype="GLint"/> <function name="GetLightfv" template="GetLight" gltype="GLfloat"/> <function name="GetLightxv" template="GetLight" gltype="GLfixed"/> @@ -4173,10 +4173,10 @@ <function name="PixelStorei" template="PixelStore" gltype="GLint"/> <function name="ReadPixels" template="ReadPixels"/> - <function name="GetBooleanv" default_prefix="_es2_" template="GetState" gltype="GLboolean"/> + <function name="GetBooleanv" template="GetState" gltype="GLboolean"/> <function name="GetError" template="GetError"/> - <function name="GetFloatv" default_prefix="_es2_" template="GetState" gltype="GLfloat"/> - <function name="GetIntegerv" default_prefix="_es2_" template="GetState" gltype="GLint"/> + <function name="GetFloatv" template="GetState" gltype="GLfloat"/> + <function name="GetIntegerv" template="GetState" gltype="GLint"/> <function name="GetString" template="GetString"/> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 81704ae2c1..efd8057608 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -200,6 +200,13 @@ extern "C" { # define __builtin_expect(x, y) x #endif +#ifdef __GNUC__ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) !!(x) +#define unlikely(x) !!(x) +#endif /** * The __FUNCTION__ gcc variable is generally only used for debugging. diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4dd448a698..e140a21b35 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -415,6 +415,7 @@ one_time_init( GLcontext *ctx ) } _mesa_init_sqrt_table(); + _mesa_init_get_hash(ctx); for (i = 0; i < 256; i++) { _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index c9f4d433a5..c61da62826 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -153,6 +153,8 @@ _mesa_get_current_context(void); /*@}*/ +extern void +_mesa_init_get_hash(GLcontext *ctx); extern void _mesa_notifySwapBuffers(__GLcontext *gc); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 8230723f26..cdcaceaeee 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,7 +1,26 @@ - -/*** - *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py - ***/ +/* + * Copyright (C) 2010 Brian Paul All Rights Reserved. + * Copyright (C) 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Kristian Høgsberg <krh@bitplanet.net> + */ #include "glheader.h" #include "context.h" @@ -14,10 +33,43 @@ #include "texcompress.h" #include "framebuffer.h" +/* This is a table driven implemetation of the glGet*v() functions. + * The basic idea is that most getters just look up an int somewhere + * in GLcontext and then convert it to a bool or float according to + * which of glGetIntegerv() glGetBooleanv() etc is being called. + * Instead of generating code to do this, we can just record the enum + * value and the offset into GLcontext in an array of structs. Then + * in glGet*(), we lookup the struct for the enum in question, and use + * the offset to get the int we need. + * + * Sometimes we need to look up a float, a boolean, a bit in a + * bitfield, a matrix or other types instead, so we need to track the + * type of the value in GLcontext. And sometimes the value isn't in + * GLcontext but in the drawbuffer, the array object, current texture + * unit, or maybe it's a computed value. So we need to also track + * where or how to find the value. Finally, we sometimes need to + * check that one of a number of extensions are enabled, the GL + * version or flush or call _mesa_update_state(). This is done by + * attaching optional extra information to the value description + * struct, it's sort of like an array of opcodes that describe extra + * checks or actions. + * + * Putting all this together we end up with struct value_desc below, + * and with a couple of macros to help, the table of struct value_desc + * is about as concise as the specification in the old python script. + */ + +#undef CONST #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) +#define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \ + ((F) * 65536.0f < INT_MIN) ? INT_MIN : \ + (GLint) ((F) * 65536.0f) ) #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) +#define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \ + ((I) < SHRT_MIN) ? INT_MIN : \ + (GLint) ((I) * 65536) ) #define INT64_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) #define INT64_TO_INT(I) ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) ) @@ -25,7921 +77,2325 @@ #define BOOLEAN_TO_INT(B) ( (GLint) (B) ) #define BOOLEAN_TO_INT64(B) ( (GLint64) (B) ) #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) +#define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 ) #define ENUM_TO_INT64(E) ( (GLint64) (E) ) +#define ENUM_TO_FIXED(E) (E) +enum value_type { + TYPE_INVALID, + TYPE_API_MASK, + TYPE_INT, + TYPE_INT_2, + TYPE_INT_3, + TYPE_INT_4, + TYPE_INT_N, + TYPE_INT64, + TYPE_ENUM, + TYPE_ENUM_2, + TYPE_BOOLEAN, + TYPE_BIT_0, + TYPE_BIT_1, + TYPE_BIT_2, + TYPE_BIT_3, + TYPE_BIT_4, + TYPE_BIT_5, + TYPE_FLOAT, + TYPE_FLOAT_2, + TYPE_FLOAT_3, + TYPE_FLOAT_4, + TYPE_FLOATN, + TYPE_FLOATN_2, + TYPE_FLOATN_3, + TYPE_FLOATN_4, + TYPE_DOUBLEN, + TYPE_MATRIX, + TYPE_MATRIX_T, + TYPE_CONST +}; -/* - * Check if named extension is enabled, if not generate error and return. - */ -#define CHECK_EXT1(EXT1) \ - if (!ctx->Extensions.EXT1) { \ - goto invalid_enum_error; \ +enum value_location { + LOC_BUFFER, + LOC_CONTEXT, + LOC_ARRAY, + LOC_TEXUNIT, + LOC_CUSTOM +}; + +enum value_extra { + EXTRA_END = 0x8000, + EXTRA_VERSION_30, + EXTRA_VERSION_31, + EXTRA_VERSION_32, + EXTRA_NEW_BUFFERS, + EXTRA_VALID_DRAW_BUFFER, + EXTRA_VALID_TEXTURE_UNIT, + EXTRA_FLUSH_CURRENT, +}; + +struct value_desc { + GLenum pname; + enum value_location location : 8; + enum value_type type : 8; + int offset; + const int *extra; +}; + +union value { + GLfloat value_float; + GLfloat value_float_4[4]; + GLmatrix *value_matrix; + GLint value_int; + GLint value_int_4[4]; + GLint64 value_int64; + GLenum value_enum; + + /* Sigh, see GL_COMPRESSED_TEXTURE_FORMATS_ARB handling */ + struct { + GLint n, ints[100]; + } value_int_n; + GLboolean value_bool; +}; + +#define BUFFER_FIELD(field, type) \ + LOC_BUFFER, type, offsetof(struct gl_framebuffer, field) +#define CONTEXT_FIELD(field, type) \ + LOC_CONTEXT, type, offsetof(GLcontext, field) +#define ARRAY_FIELD(field, type) \ + LOC_ARRAY, type, offsetof(struct gl_array_object, field) +#define CONST(value) \ + LOC_CONTEXT, TYPE_CONST, value + +#define BUFFER_INT(field) BUFFER_FIELD(field, TYPE_INT) +#define BUFFER_ENUM(field) BUFFER_FIELD(field, TYPE_ENUM) + +#define CONTEXT_INT(field) CONTEXT_FIELD(field, TYPE_INT) +#define CONTEXT_INT2(field) CONTEXT_FIELD(field, TYPE_INT_2) +#define CONTEXT_INT64(field) CONTEXT_FIELD(field, TYPE_INT64) +#define CONTEXT_ENUM(field) CONTEXT_FIELD(field, TYPE_ENUM) +#define CONTEXT_ENUM2(field) CONTEXT_FIELD(field, TYPE_ENUM_2) +#define CONTEXT_BOOL(field) CONTEXT_FIELD(field, TYPE_BOOLEAN) +#define CONTEXT_BIT0(field) CONTEXT_FIELD(field, TYPE_BIT_0) +#define CONTEXT_BIT1(field) CONTEXT_FIELD(field, TYPE_BIT_1) +#define CONTEXT_BIT2(field) CONTEXT_FIELD(field, TYPE_BIT_2) +#define CONTEXT_BIT3(field) CONTEXT_FIELD(field, TYPE_BIT_3) +#define CONTEXT_BIT4(field) CONTEXT_FIELD(field, TYPE_BIT_4) +#define CONTEXT_BIT5(field) CONTEXT_FIELD(field, TYPE_BIT_5) +#define CONTEXT_FLOAT(field) CONTEXT_FIELD(field, TYPE_FLOAT) +#define CONTEXT_FLOAT2(field) CONTEXT_FIELD(field, TYPE_FLOAT_2) +#define CONTEXT_FLOAT3(field) CONTEXT_FIELD(field, TYPE_FLOAT_3) +#define CONTEXT_FLOAT4(field) CONTEXT_FIELD(field, TYPE_FLOAT_4) +#define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX) +#define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T) + +#define ARRAY_INT(field) ARRAY_FIELD(field, TYPE_INT) +#define ARRAY_ENUM(field) ARRAY_FIELD(field, TYPE_ENUM) +#define ARRAY_BOOL(field) ARRAY_FIELD(field, TYPE_BOOLEAN) + +#define EXT(f) \ + offsetof(struct gl_extensions, f) + +#define EXTRA_EXT(e) \ + static const int extra_##e[] = { \ + EXT(e), EXTRA_END \ } -/* - * Check if either of two extensions is enabled. - */ -#define CHECK_EXT2(EXT1, EXT2) \ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ - goto invalid_enum_error; \ +#define EXTRA_EXT2(e1, e2) \ + static const int extra_##e1##_##e2[] = { \ + EXT(e1), EXT(e2), EXTRA_END \ } -/* - * Check if either of three extensions is enabled. - */ -#define CHECK_EXT3(EXT1, EXT2, EXT3) \ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \ - !ctx->Extensions.EXT3) { \ - goto invalid_enum_error; \ +/* The 'extra' mechanism is a way to specify extra checks (such as + * extensions or specific gl versions) or actions (flush current, new + * buffers) that we need to do before looking up an enum. We need to + * declare them all up front so we can refer to them in the value_desc + * structs below. */ + +static const int extra_new_buffers[] = { + EXTRA_NEW_BUFFERS, + EXTRA_END +}; + +static const int extra_valid_draw_buffer[] = { + EXTRA_VALID_DRAW_BUFFER, + EXTRA_END +}; + +static const int extra_valid_texture_unit[] = { + EXTRA_VALID_TEXTURE_UNIT, + EXTRA_END +}; + +static const int extra_flush_current_valid_texture_unit[] = { + EXTRA_FLUSH_CURRENT, + EXTRA_VALID_TEXTURE_UNIT, + EXTRA_END +}; + +static const int extra_flush_current[] = { + EXTRA_FLUSH_CURRENT, + EXTRA_END +}; + +static const int extra_new_buffers_OES_read_format[] = { + EXTRA_NEW_BUFFERS, + EXT(OES_read_format), + EXTRA_END +}; + +static const int extra_EXT_secondary_color_flush_current[] = { + EXT(EXT_secondary_color), + EXTRA_FLUSH_CURRENT, + EXTRA_END +}; + +static const int extra_EXT_fog_coord_flush_current[] = { + EXT(EXT_fog_coord), + EXTRA_FLUSH_CURRENT, + EXTRA_END +}; + +EXTRA_EXT(ARB_multitexture); +EXTRA_EXT(ARB_texture_cube_map); +EXTRA_EXT(MESA_texture_array); +EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program); +EXTRA_EXT(EXT_secondary_color); +EXTRA_EXT(EXT_fog_coord); +EXTRA_EXT(EXT_texture_lod_bias); +EXTRA_EXT(EXT_texture_filter_anisotropic); +EXTRA_EXT(IBM_rasterpos_clip); +EXTRA_EXT(NV_point_sprite); +EXTRA_EXT(SGIS_generate_mipmap); +EXTRA_EXT(NV_vertex_program); +EXTRA_EXT(NV_fragment_program); +EXTRA_EXT(NV_texture_rectangle); +EXTRA_EXT(EXT_stencil_two_side); +EXTRA_EXT(NV_light_max_exponent); +EXTRA_EXT(EXT_convolution); +EXTRA_EXT(EXT_histogram); +EXTRA_EXT(SGI_color_table); +EXTRA_EXT(SGI_texture_color_table); +EXTRA_EXT(EXT_depth_bounds_test); +EXTRA_EXT(ARB_depth_clamp); +EXTRA_EXT(ATI_fragment_shader); +EXTRA_EXT(EXT_framebuffer_blit); +EXTRA_EXT(ARB_shader_objects); +EXTRA_EXT(EXT_provoking_vertex); +EXTRA_EXT(ARB_fragment_shader); +EXTRA_EXT(ARB_fragment_program); +EXTRA_EXT(ARB_framebuffer_object); +EXTRA_EXT(EXT_framebuffer_object); +EXTRA_EXT(APPLE_vertex_array_object); +EXTRA_EXT(ARB_seamless_cube_map); +EXTRA_EXT(EXT_compiled_vertex_array); +EXTRA_EXT(ARB_sync); +EXTRA_EXT(ARB_vertex_shader); +EXTRA_EXT(EXT_transform_feedback); +EXTRA_EXT(EXT_pixel_buffer_object); +EXTRA_EXT(ARB_vertex_program); +EXTRA_EXT2(NV_point_sprite, ARB_point_sprite); +EXTRA_EXT2(ARB_fragment_program, NV_fragment_program); +EXTRA_EXT2(ARB_vertex_program, NV_vertex_program); +EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program); +EXTRA_EXT(ARB_vertex_buffer_object); + +static const int +extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { + EXT(ARB_vertex_program), + EXT(ARB_fragment_program), + EXT(NV_vertex_program), + EXTRA_END +}; + +static const int +extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { + EXT(NV_vertex_program), + EXT(ARB_vertex_program), + EXT(ARB_fragment_program), + EXT(NV_vertex_program), + EXTRA_END +}; + +static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END }; +static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END }; +static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END }; + +#define API_OPENGL_BIT (1 << API_OPENGL) +#define API_OPENGLES_BIT (1 << API_OPENGLES) +#define API_OPENGLES2_BIT (1 << API_OPENGLES2) + +/* This is the big table describing all the enums we accept in + * glGet*v(). The table is partitioned into six parts: enums + * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared + * between OpenGL and GLES, enums exclusive to GLES, etc for the + * remaining combinations. When we add the enums to the hash table in + * _mesa_init_get_hash(), we only add the enums for the API we're + * instantiating and the different sections are guarded by #if + * FEATURE_GL etc to make sure we only compile in the enums we may + * need. */ + +static const struct value_desc values[] = { + /* Enums shared between OpenGL, GLES1 and GLES2 */ + { 0, 0, TYPE_API_MASK, + API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT}, + { GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers }, + { GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled) }, + { GL_BLEND_SRC, CONTEXT_ENUM(Color.BlendSrcRGB) }, + { GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers }, + { GL_COLOR_CLEAR_VALUE, CONTEXT_FIELD(Color.ClearColor[0], TYPE_FLOATN_4) }, + { GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, }, + { GL_CULL_FACE, CONTEXT_BOOL(Polygon.CullFlag) }, + { GL_CULL_FACE_MODE, CONTEXT_ENUM(Polygon.CullFaceMode) }, + { GL_DEPTH_BITS, BUFFER_INT(Visual.depthBits) }, + { GL_DEPTH_CLEAR_VALUE, CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN) }, + { GL_DEPTH_FUNC, CONTEXT_ENUM(Depth.Func) }, + { GL_DEPTH_RANGE, CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2) }, + { GL_DEPTH_TEST, CONTEXT_BOOL(Depth.Test) }, + { GL_DEPTH_WRITEMASK, CONTEXT_BOOL(Depth.Mask) }, + { GL_DITHER, CONTEXT_BOOL(Color.DitherFlag) }, + { GL_FRONT_FACE, CONTEXT_ENUM(Polygon.FrontFace) }, + { GL_GREEN_BITS, BUFFER_INT(Visual.greenBits), extra_new_buffers }, + { GL_LINE_WIDTH, CONTEXT_FLOAT(Line.Width) }, + { GL_ALIASED_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidth) }, + { GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize) }, + { GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize) }, + { GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.MaxTextureLevels) }, + { GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth) }, + { GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment) }, + { GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize) }, + { GL_POLYGON_OFFSET_FACTOR, CONTEXT_FLOAT(Polygon.OffsetFactor ) }, + { GL_POLYGON_OFFSET_UNITS, CONTEXT_FLOAT(Polygon.OffsetUnits ) }, + { GL_POLYGON_OFFSET_FILL, CONTEXT_BOOL(Polygon.OffsetFill) }, + { GL_RED_BITS, BUFFER_INT(Visual.redBits), extra_new_buffers }, + { GL_SCISSOR_BOX, LOC_CUSTOM, TYPE_INT_4, 0 }, + { GL_SCISSOR_TEST, CONTEXT_BOOL(Scissor.Enabled) }, + { GL_STENCIL_BITS, BUFFER_INT(Visual.stencilBits) }, + { GL_STENCIL_CLEAR_VALUE, CONTEXT_INT(Stencil.Clear) }, + { GL_STENCIL_FAIL, LOC_CUSTOM, TYPE_ENUM }, + { GL_STENCIL_FUNC, LOC_CUSTOM, TYPE_ENUM }, + { GL_STENCIL_PASS_DEPTH_FAIL, LOC_CUSTOM, TYPE_ENUM }, + { GL_STENCIL_PASS_DEPTH_PASS, LOC_CUSTOM, TYPE_ENUM }, + { GL_STENCIL_REF, LOC_CUSTOM, TYPE_INT }, + { GL_STENCIL_TEST, CONTEXT_BOOL(Stencil.Enabled) }, + { GL_STENCIL_VALUE_MASK, LOC_CUSTOM, TYPE_INT }, + { GL_STENCIL_WRITEMASK, LOC_CUSTOM, TYPE_INT }, + { GL_SUBPIXEL_BITS, CONTEXT_INT(Const.SubPixelBits) }, + { GL_TEXTURE_BINDING_2D, LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX }, + { GL_UNPACK_ALIGNMENT, CONTEXT_INT(Unpack.Alignment) }, + { GL_VIEWPORT, LOC_CUSTOM, TYPE_INT_4, 0 }, + + /* GL_ARB_multitexture */ + { GL_ACTIVE_TEXTURE_ARB, + LOC_CUSTOM, TYPE_INT, 0, extra_ARB_multitexture }, + + /* Note that all the OES_* extensions require that the Mesa "struct + * gl_extensions" include a member with the name of the extension. + * That structure does not yet include OES extensions (and we're + * not sure whether it will). If it does, all the OES_* + * extensions below should mark the dependency. */ + + /* GL_ARB_texture_cube_map */ + { GL_TEXTURE_BINDING_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_INT, + TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map }, + { GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.MaxCubeTextureLevels), + extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */ + + /* XXX: OES_blend_subtract */ + { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.BlendSrcRGB) }, + { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.BlendDstRGB) }, + { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.BlendSrcA) }, + { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.BlendDstA) }, + + /* GL_BLEND_EQUATION_RGB, which is what we're really after, is + * defined identically to GL_BLEND_EQUATION. */ + { GL_BLEND_EQUATION, CONTEXT_ENUM(Color.BlendEquationRGB) }, + { GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.BlendEquationA) }, + + /* GL_ARB_texture_compression */ + { GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0 }, + { GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0 }, + + /* GL_ARB_multisample */ + { GL_SAMPLE_ALPHA_TO_COVERAGE_ARB, + CONTEXT_BOOL(Multisample.SampleAlphaToCoverage) }, + { GL_SAMPLE_COVERAGE_ARB, CONTEXT_BOOL(Multisample.SampleCoverage) }, + { GL_SAMPLE_COVERAGE_VALUE_ARB, + CONTEXT_FLOAT(Multisample.SampleCoverageValue) }, + { GL_SAMPLE_COVERAGE_INVERT_ARB, + CONTEXT_BOOL(Multisample.SampleCoverageInvert) }, + { GL_SAMPLE_BUFFERS_ARB, BUFFER_INT(Visual.sampleBuffers) }, + { GL_SAMPLES_ARB, BUFFER_INT(Visual.samples) }, + + /* GL_SGIS_generate_mipmap */ + { GL_GENERATE_MIPMAP_HINT_SGIS, CONTEXT_ENUM(Hint.GenerateMipmap), + extra_SGIS_generate_mipmap }, + + /* GL_ARB_vertex_buffer_object */ + { GL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0 }, + + /* GL_ARB_vertex_buffer_object */ + /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported */ + { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_vertex_buffer_object }, + + /* GL_OES_read_format */ + { GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, LOC_CUSTOM, TYPE_INT, 0, + extra_new_buffers_OES_read_format }, + { GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, LOC_CUSTOM, TYPE_INT, 0, + extra_new_buffers_OES_read_format }, + + /* GL_EXT_framebuffer_object */ + { GL_FRAMEBUFFER_BINDING_EXT, BUFFER_INT(Name), + extra_EXT_framebuffer_object }, + { GL_RENDERBUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_framebuffer_object }, + { GL_MAX_RENDERBUFFER_SIZE_EXT, CONTEXT_INT(Const.MaxRenderbufferSize), + extra_EXT_framebuffer_object }, + + /* This entry isn't spec'ed for GLES 2, but is needed for Mesa's + * GLSL: */ + { GL_MAX_CLIP_PLANES, CONTEXT_INT(Const.MaxClipPlanes) }, + +#if FEATURE_GL || FEATURE_ES1 + /* Enums in OpenGL and GLES1 */ + { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT }, + { GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled) }, + { GL_LIGHT1, CONTEXT_BOOL(Light.Light[1].Enabled) }, + { GL_LIGHT2, CONTEXT_BOOL(Light.Light[2].Enabled) }, + { GL_LIGHT3, CONTEXT_BOOL(Light.Light[3].Enabled) }, + { GL_LIGHT4, CONTEXT_BOOL(Light.Light[4].Enabled) }, + { GL_LIGHT5, CONTEXT_BOOL(Light.Light[5].Enabled) }, + { GL_LIGHT6, CONTEXT_BOOL(Light.Light[6].Enabled) }, + { GL_LIGHT7, CONTEXT_BOOL(Light.Light[7].Enabled) }, + { GL_LIGHTING, CONTEXT_BOOL(Light.Enabled) }, + { GL_LIGHT_MODEL_AMBIENT, + CONTEXT_FIELD(Light.Model.Ambient[0], TYPE_FLOATN_4) }, + { GL_LIGHT_MODEL_TWO_SIDE, CONTEXT_BOOL(Light.Model.TwoSide) }, + { GL_ALPHA_TEST, CONTEXT_BOOL(Color.AlphaEnabled) }, + { GL_ALPHA_TEST_FUNC, CONTEXT_ENUM(Color.AlphaFunc) }, + { GL_ALPHA_TEST_REF, CONTEXT_FIELD(Color.AlphaRef, TYPE_FLOATN) }, + { GL_BLEND_DST, CONTEXT_ENUM(Color.BlendDstRGB) }, + { GL_CLIP_PLANE0, CONTEXT_BIT0(Transform.ClipPlanesEnabled) }, + { GL_CLIP_PLANE1, CONTEXT_BIT1(Transform.ClipPlanesEnabled) }, + { GL_CLIP_PLANE2, CONTEXT_BIT2(Transform.ClipPlanesEnabled) }, + { GL_CLIP_PLANE3, CONTEXT_BIT3(Transform.ClipPlanesEnabled) }, + { GL_CLIP_PLANE4, CONTEXT_BIT4(Transform.ClipPlanesEnabled) }, + { GL_CLIP_PLANE5, CONTEXT_BIT5(Transform.ClipPlanesEnabled) }, + { GL_COLOR_MATERIAL, CONTEXT_BOOL(Light.ColorMaterialEnabled) }, + { GL_CURRENT_COLOR, + CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR0][0], TYPE_FLOATN_4), + extra_flush_current }, + { GL_CURRENT_NORMAL, + CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_NORMAL][0], TYPE_FLOATN_3), + extra_flush_current }, + { GL_CURRENT_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0, + extra_flush_current_valid_texture_unit }, + { GL_DISTANCE_ATTENUATION_EXT, CONTEXT_FLOAT3(Point.Params[0]) }, + { GL_FOG, CONTEXT_BOOL(Fog.Enabled) }, + { GL_FOG_COLOR, CONTEXT_FIELD(Fog.Color[0], TYPE_FLOATN_4) }, + { GL_FOG_DENSITY, CONTEXT_FLOAT(Fog.Density) }, + { GL_FOG_END, CONTEXT_FLOAT(Fog.End) }, + { GL_FOG_HINT, CONTEXT_ENUM(Hint.Fog) }, + { GL_FOG_MODE, CONTEXT_ENUM(Fog.Mode) }, + { GL_FOG_START, CONTEXT_FLOAT(Fog.Start) }, + { GL_LINE_SMOOTH, CONTEXT_BOOL(Line.SmoothFlag) }, + { GL_LINE_SMOOTH_HINT, CONTEXT_ENUM(Hint.LineSmooth) }, + { GL_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidthAA) }, + { GL_COLOR_LOGIC_OP, CONTEXT_BOOL(Color.ColorLogicOpEnabled) }, + { GL_LOGIC_OP_MODE, CONTEXT_ENUM(Color.LogicOp) }, + { GL_MATRIX_MODE, CONTEXT_ENUM(Transform.MatrixMode) }, + { GL_MAX_MODELVIEW_STACK_DEPTH, CONST(MAX_MODELVIEW_STACK_DEPTH) }, + { GL_MAX_PROJECTION_STACK_DEPTH, CONST(MAX_PROJECTION_STACK_DEPTH) }, + { GL_MAX_TEXTURE_STACK_DEPTH, CONST(MAX_TEXTURE_STACK_DEPTH), }, + { GL_MODELVIEW_MATRIX, CONTEXT_MATRIX(ModelviewMatrixStack.Top) }, + { GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, ModelviewMatrixStack.Depth) }, + { GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize) }, + { GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages) }, + { GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection) }, + { GL_POINT_SIZE, CONTEXT_FLOAT(Point.Size) }, + { GL_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSizeAA) }, + { GL_POINT_SMOOTH, CONTEXT_BOOL(Point.SmoothFlag) }, + { GL_POINT_SMOOTH_HINT, CONTEXT_ENUM(Hint.PointSmooth) }, + { GL_POINT_SIZE_MIN_EXT, CONTEXT_FLOAT(Point.MinSize) }, + { GL_POINT_SIZE_MAX_EXT, CONTEXT_FLOAT(Point.MaxSize) }, + { GL_POINT_FADE_THRESHOLD_SIZE_EXT, CONTEXT_FLOAT(Point.Threshold) }, + { GL_PROJECTION_MATRIX, CONTEXT_MATRIX(ProjectionMatrixStack.Top) }, + { GL_PROJECTION_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, ProjectionMatrixStack.Depth) }, + { GL_RESCALE_NORMAL, CONTEXT_BOOL(Transform.RescaleNormals) }, + { GL_SHADE_MODEL, CONTEXT_ENUM(Light.ShadeModel) }, + { GL_TEXTURE_2D, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + { GL_TEXTURE_MATRIX, LOC_CUSTOM, TYPE_MATRIX, 0, extra_valid_texture_unit }, + { GL_TEXTURE_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, 0, + extra_valid_texture_unit }, + + { GL_VERTEX_ARRAY, ARRAY_BOOL(Vertex.Enabled) }, + { GL_VERTEX_ARRAY_SIZE, ARRAY_INT(Vertex.Size) }, + { GL_VERTEX_ARRAY_TYPE, ARRAY_ENUM(Vertex.Type) }, + { GL_VERTEX_ARRAY_STRIDE, ARRAY_INT(Vertex.Stride) }, + { GL_NORMAL_ARRAY, ARRAY_ENUM(Normal.Enabled) }, + { GL_NORMAL_ARRAY_TYPE, ARRAY_ENUM(Normal.Type) }, + { GL_NORMAL_ARRAY_STRIDE, ARRAY_INT(Normal.Stride) }, + { GL_COLOR_ARRAY, ARRAY_BOOL(Color.Enabled) }, + { GL_COLOR_ARRAY_SIZE, ARRAY_INT(Color.Size) }, + { GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(Color.Type) }, + { GL_COLOR_ARRAY_STRIDE, ARRAY_INT(Color.Stride) }, + { GL_TEXTURE_COORD_ARRAY, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled) }, + { GL_TEXTURE_COORD_ARRAY_SIZE, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Size) }, + { GL_TEXTURE_COORD_ARRAY_TYPE, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Type) }, + { GL_TEXTURE_COORD_ARRAY_STRIDE, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Stride) }, + + /* GL_ARB_multitexture */ + { GL_MAX_TEXTURE_UNITS_ARB, + CONTEXT_INT(Const.MaxTextureUnits), extra_ARB_multitexture }, + { GL_CLIENT_ACTIVE_TEXTURE_ARB, + LOC_CUSTOM, TYPE_INT, 0, extra_ARB_multitexture }, + + /* GL_ARB_texture_cube_map */ + { GL_TEXTURE_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + /* S, T, and R are always set at the same time */ + { GL_TEXTURE_GEN_STR_OES, LOC_TEXUNIT, TYPE_BIT_0, + offsetof(struct gl_texture_unit, TexGenEnabled) }, + + /* GL_ARB_multisample */ + { GL_MULTISAMPLE_ARB, CONTEXT_BOOL(Multisample.Enabled) }, + { GL_SAMPLE_ALPHA_TO_ONE_ARB, CONTEXT_BOOL(Multisample.SampleAlphaToOne) }, + + /* GL_ARB_vertex_buffer_object */ + { GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Vertex.BufferObj) }, + { GL_NORMAL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Normal.BufferObj) }, + { GL_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Color.BufferObj) }, + { GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0 }, + + /* GL_OES_point_sprite */ + { GL_POINT_SPRITE_NV, + CONTEXT_BOOL(Point.PointSprite), + extra_NV_point_sprite_ARB_point_sprite }, + + /* GL_ARB_fragment_shader */ + { GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, + CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), + extra_ARB_fragment_shader }, + + /* GL_ARB_vertex_shader */ + { GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, + CONTEXT_INT(Const.VertexProgram.MaxUniformComponents), + extra_ARB_vertex_shader }, + { GL_MAX_VARYING_FLOATS_ARB, LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_vertex_shader }, + + /* GL_EXT_texture_lod_bias */ + { GL_MAX_TEXTURE_LOD_BIAS_EXT, CONTEXT_FLOAT(Const.MaxTextureLodBias), + extra_EXT_texture_lod_bias }, + + /* GL_EXT_texture_filter_anisotropic */ + { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, + CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy), + extra_EXT_texture_filter_anisotropic }, +#endif /* FEATURE_GL || FEATURE_ES1 */ + +#if FEATURE_ES1 + { 0, 0, TYPE_API_MASK, API_OPENGLES_BIT }, + /* XXX: OES_matrix_get */ + { GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES }, + { GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES }, + { GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES }, + + /* OES_point_size_array */ + { GL_POINT_SIZE_ARRAY_OES, ARRAY_FIELD(PointSize.Enabled, TYPE_BOOLEAN) }, + { GL_POINT_SIZE_ARRAY_TYPE_OES, ARRAY_FIELD(PointSize.Type, TYPE_ENUM) }, + { GL_POINT_SIZE_ARRAY_STRIDE_OES, ARRAY_FIELD(PointSize.Stride, TYPE_INT) }, + { GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES, LOC_CUSTOM, TYPE_INT, 0 }, +#endif /* FEATURE_ES1 */ + +#if FEATURE_GL || FEATURE_ES2 + { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES2_BIT }, + /* This entry isn't spec'ed for GLES 2, but is needed for Mesa's GLSL: */ + { GL_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights) }, + { GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */ + CONTEXT_INT(Const.MaxTextureCoordUnits), + extra_ARB_fragment_program_NV_fragment_program }, + + /* GL_ARB_draw_buffers */ + { GL_MAX_DRAW_BUFFERS_ARB, CONTEXT_INT(Const.MaxDrawBuffers) }, + + { GL_BLEND_COLOR_EXT, CONTEXT_FIELD(Color.BlendColor[0], TYPE_FLOATN_4) }, + /* GL_ARB_fragment_program */ + { GL_MAX_TEXTURE_IMAGE_UNITS_ARB, /* == GL_MAX_TEXTURE_IMAGE_UNITS_NV */ + CONTEXT_INT(Const.MaxTextureImageUnits), + extra_ARB_fragment_program_NV_fragment_program }, + { GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, + CONTEXT_INT(Const.MaxVertexTextureImageUnits), extra_ARB_vertex_shader }, + { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, + CONTEXT_INT(Const.MaxCombinedTextureImageUnits), + extra_ARB_vertex_shader }, + + /* GL_ARB_shader_objects + * Actually, this token isn't part of GL_ARB_shader_objects, but is + * close enough for now. */ + { GL_CURRENT_PROGRAM, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_objects }, + + /* OpenGL 2.0 */ + { GL_STENCIL_BACK_FUNC, CONTEXT_ENUM(Stencil.Function[1]) }, + { GL_STENCIL_BACK_VALUE_MASK, CONTEXT_INT(Stencil.ValueMask[1]) }, + { GL_STENCIL_BACK_WRITEMASK, CONTEXT_INT(Stencil.WriteMask[1]) }, + { GL_STENCIL_BACK_REF, CONTEXT_INT(Stencil.Ref[1]) }, + { GL_STENCIL_BACK_FAIL, CONTEXT_ENUM(Stencil.FailFunc[1]) }, + { GL_STENCIL_BACK_PASS_DEPTH_FAIL, CONTEXT_ENUM(Stencil.ZFailFunc[1]) }, + { GL_STENCIL_BACK_PASS_DEPTH_PASS, CONTEXT_ENUM(Stencil.ZPassFunc[1]) }, + + { GL_MAX_VERTEX_ATTRIBS_ARB, + CONTEXT_INT(Const.VertexProgram.MaxAttribs), extra_ARB_vertex_program }, + + /* OES_texture_3D */ + { GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX }, + { GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.Max3DTextureLevels) }, + + /* GL_ARB_fragment_shader/OES_standard_derivatives */ + { GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, + CONTEXT_ENUM(Hint.FragmentShaderDerivative), extra_ARB_fragment_shader }, +#endif /* FEATURE_GL || FEATURE_ES2 */ + +#if FEATURE_ES2 + /* Enums unique to OpenGL ES 2.0 */ + { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT }, + { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.FragmentProgram.MaxUniformComponents) }, + { GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.MaxVarying) }, + { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.VertexProgram.MaxUniformComponents) }, + { GL_SHADER_COMPILER, CONST(1) }, + /* OES_get_program_binary */ + { GL_NUM_SHADER_BINARY_FORMATS, CONST(0) }, + { GL_SHADER_BINARY_FORMATS, CONST(0) }, +#endif /* FEATURE_ES2 */ + +#if FEATURE_GL + /* Remaining enums are only in OpenGL */ + { 0, 0, TYPE_API_MASK, API_OPENGL_BIT }, + { GL_ACCUM_RED_BITS, BUFFER_INT(Visual.accumRedBits) }, + { GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits) }, + { GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits) }, + { GL_ACCUM_ALPHA_BITS, BUFFER_INT(Visual.accumAlphaBits) }, + { GL_ACCUM_CLEAR_VALUE, CONTEXT_FIELD(Accum.ClearColor[0], TYPE_FLOATN_4) }, + { GL_ALPHA_BIAS, CONTEXT_FLOAT(Pixel.AlphaBias) }, + { GL_ALPHA_SCALE, CONTEXT_FLOAT(Pixel.AlphaScale) }, + { GL_ATTRIB_STACK_DEPTH, CONTEXT_INT(AttribStackDepth) }, + { GL_AUTO_NORMAL, CONTEXT_BOOL(Eval.AutoNormal) }, + { GL_AUX_BUFFERS, BUFFER_INT(Visual.numAuxBuffers) }, + { GL_BLUE_BIAS, CONTEXT_FLOAT(Pixel.BlueBias) }, + { GL_BLUE_SCALE, CONTEXT_FLOAT(Pixel.BlueScale) }, + { GL_CLIENT_ATTRIB_STACK_DEPTH, CONTEXT_INT(ClientAttribStackDepth) }, + { GL_COLOR_MATERIAL_FACE, CONTEXT_ENUM(Light.ColorMaterialFace) }, + { GL_COLOR_MATERIAL_PARAMETER, CONTEXT_ENUM(Light.ColorMaterialMode) }, + { GL_CURRENT_INDEX, + CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]), + extra_flush_current }, + { GL_CURRENT_RASTER_COLOR, + CONTEXT_FIELD(Current.RasterColor[0], TYPE_FLOATN_4) }, + { GL_CURRENT_RASTER_DISTANCE, CONTEXT_FLOAT(Current.RasterDistance) }, + { GL_CURRENT_RASTER_INDEX, CONST(1) }, + { GL_CURRENT_RASTER_POSITION, CONTEXT_FLOAT4(Current.RasterPos[0]) }, + { GL_CURRENT_RASTER_SECONDARY_COLOR, + CONTEXT_FIELD(Current.RasterSecondaryColor[0], TYPE_FLOATN_4) }, + { GL_CURRENT_RASTER_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0, + extra_valid_texture_unit }, + { GL_CURRENT_RASTER_POSITION_VALID, CONTEXT_BOOL(Current.RasterPosValid) }, + { GL_DEPTH_BIAS, CONTEXT_FLOAT(Pixel.DepthBias) }, + { GL_DEPTH_SCALE, CONTEXT_FLOAT(Pixel.DepthScale) }, + { GL_DOUBLEBUFFER, BUFFER_INT(Visual.doubleBufferMode) }, + { GL_DRAW_BUFFER, BUFFER_ENUM(ColorDrawBuffer[0]) }, + { GL_EDGE_FLAG, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + { GL_FEEDBACK_BUFFER_SIZE, CONTEXT_INT(Feedback.BufferSize) }, + { GL_FEEDBACK_BUFFER_TYPE, CONTEXT_ENUM(Feedback.Type) }, + { GL_FOG_INDEX, CONTEXT_FLOAT(Fog.Index) }, + { GL_GREEN_BIAS, CONTEXT_FLOAT(Pixel.GreenBias) }, + { GL_GREEN_SCALE, CONTEXT_FLOAT(Pixel.GreenScale) }, + { GL_INDEX_BITS, BUFFER_INT(Visual.indexBits), extra_new_buffers }, + { GL_INDEX_CLEAR_VALUE, CONTEXT_INT(Color.ClearIndex) }, + { GL_INDEX_MODE, CONST(0) }, + { GL_INDEX_OFFSET, CONTEXT_INT(Pixel.IndexOffset) }, + { GL_INDEX_SHIFT, CONTEXT_INT(Pixel.IndexShift) }, + { GL_INDEX_WRITEMASK, CONTEXT_INT(Color.IndexMask) }, + { GL_LIGHT_MODEL_COLOR_CONTROL, CONTEXT_ENUM(Light.Model.ColorControl) }, + { GL_LIGHT_MODEL_LOCAL_VIEWER, CONTEXT_BOOL(Light.Model.LocalViewer) }, + { GL_LINE_STIPPLE, CONTEXT_BOOL(Line.StippleFlag) }, + { GL_LINE_STIPPLE_PATTERN, LOC_CUSTOM, TYPE_INT, 0 }, + { GL_LINE_STIPPLE_REPEAT, CONTEXT_INT(Line.StippleFactor) }, + { GL_LINE_WIDTH_GRANULARITY, CONTEXT_FLOAT(Const.LineWidthGranularity) }, + { GL_LIST_BASE, CONTEXT_INT(List.ListBase) }, + { GL_LIST_INDEX, LOC_CUSTOM, TYPE_INT, 0 }, + { GL_LIST_MODE, LOC_CUSTOM, TYPE_ENUM, 0 }, + { GL_INDEX_LOGIC_OP, CONTEXT_BOOL(Color.IndexLogicOpEnabled) }, + { GL_MAP1_COLOR_4, CONTEXT_BOOL(Eval.Map1Color4) }, + { GL_MAP1_GRID_DOMAIN, CONTEXT_FLOAT2(Eval.MapGrid1u1) }, + { GL_MAP1_GRID_SEGMENTS, CONTEXT_INT(Eval.MapGrid1un) }, + { GL_MAP1_INDEX, CONTEXT_BOOL(Eval.Map1Index) }, + { GL_MAP1_NORMAL, CONTEXT_BOOL(Eval.Map1Normal) }, + { GL_MAP1_TEXTURE_COORD_1, CONTEXT_BOOL(Eval.Map1TextureCoord1) }, + { GL_MAP1_TEXTURE_COORD_2, CONTEXT_BOOL(Eval.Map1TextureCoord2) }, + { GL_MAP1_TEXTURE_COORD_3, CONTEXT_BOOL(Eval.Map1TextureCoord3) }, + { GL_MAP1_TEXTURE_COORD_4, CONTEXT_BOOL(Eval.Map1TextureCoord4) }, + { GL_MAP1_VERTEX_3, CONTEXT_BOOL(Eval.Map1Vertex3) }, + { GL_MAP1_VERTEX_4, CONTEXT_BOOL(Eval.Map1Vertex4) }, + { GL_MAP2_COLOR_4, CONTEXT_BOOL(Eval.Map2Color4) }, + { GL_MAP2_GRID_DOMAIN, LOC_CUSTOM, TYPE_FLOAT_4, 0 }, + { GL_MAP2_GRID_SEGMENTS, CONTEXT_INT2(Eval.MapGrid2un) }, + { GL_MAP2_INDEX, CONTEXT_BOOL(Eval.Map2Index) }, + { GL_MAP2_NORMAL, CONTEXT_BOOL(Eval.Map2Normal) }, + { GL_MAP2_TEXTURE_COORD_1, CONTEXT_BOOL(Eval.Map2TextureCoord1) }, + { GL_MAP2_TEXTURE_COORD_2, CONTEXT_BOOL(Eval.Map2TextureCoord2) }, + { GL_MAP2_TEXTURE_COORD_3, CONTEXT_BOOL(Eval.Map2TextureCoord3) }, + { GL_MAP2_TEXTURE_COORD_4, CONTEXT_BOOL(Eval.Map2TextureCoord4) }, + { GL_MAP2_VERTEX_3, CONTEXT_BOOL(Eval.Map2Vertex3) }, + { GL_MAP2_VERTEX_4, CONTEXT_BOOL(Eval.Map2Vertex4) }, + { GL_MAP_COLOR, CONTEXT_BOOL(Pixel.MapColorFlag) }, + { GL_MAP_STENCIL, CONTEXT_BOOL(Pixel.MapStencilFlag) }, + { GL_MAX_ATTRIB_STACK_DEPTH, CONST(MAX_ATTRIB_STACK_DEPTH) }, + { GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, CONST(MAX_CLIENT_ATTRIB_STACK_DEPTH) }, + + { GL_MAX_EVAL_ORDER, CONST(MAX_EVAL_ORDER) }, + { GL_MAX_LIST_NESTING, CONST(MAX_LIST_NESTING) }, + { GL_MAX_NAME_STACK_DEPTH, CONST(MAX_NAME_STACK_DEPTH) }, + { GL_MAX_PIXEL_MAP_TABLE, CONST(MAX_PIXEL_MAP_TABLE) }, + { GL_NAME_STACK_DEPTH, CONTEXT_INT(Select.NameStackDepth) }, + { GL_PACK_LSB_FIRST, CONTEXT_BOOL(Pack.LsbFirst) }, + { GL_PACK_ROW_LENGTH, CONTEXT_INT(Pack.RowLength) }, + { GL_PACK_SKIP_PIXELS, CONTEXT_INT(Pack.SkipPixels) }, + { GL_PACK_SKIP_ROWS, CONTEXT_INT(Pack.SkipRows) }, + { GL_PACK_SWAP_BYTES, CONTEXT_BOOL(Pack.SwapBytes) }, + { GL_PACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Pack.ImageHeight) }, + { GL_PACK_INVERT_MESA, CONTEXT_BOOL(Pack.Invert) }, + { GL_PIXEL_MAP_A_TO_A_SIZE, CONTEXT_INT(PixelMaps.AtoA.Size) }, + { GL_PIXEL_MAP_B_TO_B_SIZE, CONTEXT_INT(PixelMaps.BtoB.Size) }, + { GL_PIXEL_MAP_G_TO_G_SIZE, CONTEXT_INT(PixelMaps.GtoG.Size) }, + { GL_PIXEL_MAP_I_TO_A_SIZE, CONTEXT_INT(PixelMaps.ItoA.Size) }, + { GL_PIXEL_MAP_I_TO_B_SIZE, CONTEXT_INT(PixelMaps.ItoB.Size) }, + { GL_PIXEL_MAP_I_TO_G_SIZE, CONTEXT_INT(PixelMaps.ItoG.Size) }, + { GL_PIXEL_MAP_I_TO_I_SIZE, CONTEXT_INT(PixelMaps.ItoI.Size) }, + { GL_PIXEL_MAP_I_TO_R_SIZE, CONTEXT_INT(PixelMaps.ItoR.Size) }, + { GL_PIXEL_MAP_R_TO_R_SIZE, CONTEXT_INT(PixelMaps.RtoR.Size) }, + { GL_PIXEL_MAP_S_TO_S_SIZE, CONTEXT_INT(PixelMaps.StoS.Size) }, + { GL_POINT_SIZE_GRANULARITY, CONTEXT_FLOAT(Const.PointSizeGranularity) }, + { GL_POLYGON_MODE, CONTEXT_ENUM2(Polygon.FrontMode) }, + { GL_POLYGON_OFFSET_BIAS_EXT, CONTEXT_FLOAT(Polygon.OffsetUnits) }, + { GL_POLYGON_OFFSET_POINT, CONTEXT_BOOL(Polygon.OffsetPoint) }, + { GL_POLYGON_OFFSET_LINE, CONTEXT_BOOL(Polygon.OffsetLine) }, + { GL_POLYGON_SMOOTH, CONTEXT_BOOL(Polygon.SmoothFlag) }, + { GL_POLYGON_SMOOTH_HINT, CONTEXT_ENUM(Hint.PolygonSmooth) }, + { GL_POLYGON_STIPPLE, CONTEXT_BOOL(Polygon.StippleFlag) }, + { GL_READ_BUFFER, LOC_CUSTOM, TYPE_ENUM }, + { GL_RED_BIAS, CONTEXT_FLOAT(Pixel.RedBias) }, + { GL_RED_SCALE, CONTEXT_FLOAT(Pixel.RedScale) }, + { GL_RENDER_MODE, CONTEXT_ENUM(RenderMode) }, + { GL_RGBA_MODE, CONST(1) }, + { GL_SELECTION_BUFFER_SIZE, CONTEXT_INT(Select.BufferSize) }, + { GL_SHARED_TEXTURE_PALETTE_EXT, CONTEXT_BOOL(Texture.SharedPalette) }, + + { GL_STEREO, BUFFER_INT(Visual.stereoMode) }, + + { GL_TEXTURE_1D, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + { GL_TEXTURE_3D, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + { GL_TEXTURE_1D_ARRAY_EXT, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + { GL_TEXTURE_2D_ARRAY_EXT, LOC_CUSTOM, TYPE_BOOLEAN, 0 }, + + { GL_TEXTURE_BINDING_1D, LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX }, + { GL_TEXTURE_BINDING_1D_ARRAY, LOC_CUSTOM, TYPE_INT, + TEXTURE_1D_ARRAY_INDEX, extra_MESA_texture_array }, + { GL_TEXTURE_BINDING_2D_ARRAY, LOC_CUSTOM, TYPE_INT, + TEXTURE_1D_ARRAY_INDEX, extra_MESA_texture_array }, + { GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, + CONTEXT_INT(Const.MaxArrayTextureLayers), extra_MESA_texture_array }, + + { GL_TEXTURE_GEN_S, LOC_TEXUNIT, TYPE_BIT_0, + offsetof(struct gl_texture_unit, TexGenEnabled) }, + { GL_TEXTURE_GEN_T, LOC_TEXUNIT, TYPE_BIT_1, + offsetof(struct gl_texture_unit, TexGenEnabled) }, + { GL_TEXTURE_GEN_R, LOC_TEXUNIT, TYPE_BIT_2, + offsetof(struct gl_texture_unit, TexGenEnabled) }, + { GL_TEXTURE_GEN_Q, LOC_TEXUNIT, TYPE_BIT_3, + offsetof(struct gl_texture_unit, TexGenEnabled) }, + { GL_UNPACK_LSB_FIRST, CONTEXT_BOOL(Unpack.LsbFirst) }, + { GL_UNPACK_ROW_LENGTH, CONTEXT_INT(Unpack.RowLength) }, + { GL_UNPACK_SKIP_PIXELS, CONTEXT_INT(Unpack.SkipPixels) }, + { GL_UNPACK_SKIP_ROWS, CONTEXT_INT(Unpack.SkipRows) }, + { GL_UNPACK_SWAP_BYTES, CONTEXT_BOOL(Unpack.SwapBytes) }, + { GL_UNPACK_SKIP_IMAGES_EXT, CONTEXT_INT(Unpack.SkipImages) }, + { GL_UNPACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Unpack.ImageHeight) }, + { GL_UNPACK_CLIENT_STORAGE_APPLE, CONTEXT_BOOL(Unpack.ClientStorage) }, + { GL_ZOOM_X, CONTEXT_FLOAT(Pixel.ZoomX) }, + { GL_ZOOM_Y, CONTEXT_FLOAT(Pixel.ZoomY) }, + + /* Vertex arrays */ + { GL_VERTEX_ARRAY_COUNT_EXT, CONST(0) }, + { GL_NORMAL_ARRAY_COUNT_EXT, CONST(0) }, + { GL_COLOR_ARRAY_COUNT_EXT, CONST(0) }, + { GL_INDEX_ARRAY, ARRAY_BOOL(Index.Enabled) }, + { GL_INDEX_ARRAY_TYPE, ARRAY_ENUM(Index.Type) }, + { GL_INDEX_ARRAY_STRIDE, ARRAY_INT(Index.Stride) }, + { GL_INDEX_ARRAY_COUNT_EXT, CONST(0) }, + { GL_TEXTURE_COORD_ARRAY_COUNT_EXT, CONST(0) }, + { GL_EDGE_FLAG_ARRAY, ARRAY_BOOL(EdgeFlag.Enabled) }, + { GL_EDGE_FLAG_ARRAY_STRIDE, ARRAY_INT(EdgeFlag.Stride) }, + { GL_EDGE_FLAG_ARRAY_COUNT_EXT, CONST(0) }, + + /* GL_ARB_texture_compression */ + { GL_TEXTURE_COMPRESSION_HINT_ARB, CONTEXT_INT(Hint.TextureCompression) }, + + /* GL_EXT_compiled_vertex_array */ + { GL_ARRAY_ELEMENT_LOCK_FIRST_EXT, CONTEXT_INT(Array.LockFirst), + extra_EXT_compiled_vertex_array }, + { GL_ARRAY_ELEMENT_LOCK_COUNT_EXT, CONTEXT_INT(Array.LockCount), + extra_EXT_compiled_vertex_array }, + + /* GL_ARB_transpose_matrix */ + { GL_TRANSPOSE_COLOR_MATRIX_ARB, CONTEXT_MATRIX_T(ColorMatrixStack.Top) }, + { GL_TRANSPOSE_MODELVIEW_MATRIX_ARB, + CONTEXT_MATRIX_T(ModelviewMatrixStack) }, + { GL_TRANSPOSE_PROJECTION_MATRIX_ARB, + CONTEXT_MATRIX_T(ProjectionMatrixStack.Top) }, + { GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack) }, + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + { GL_COLOR_MATRIX_SGI, CONTEXT_MATRIX(ColorMatrixStack.Top) }, + { GL_COLOR_MATRIX_STACK_DEPTH_SGI, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, ColorMatrixStack.Depth) }, + { GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI, + CONST(MAX_COLOR_STACK_DEPTH) }, + { GL_POST_COLOR_MATRIX_RED_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[0]) }, + { GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[1]) }, + { GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[2]) }, + { GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[3]) }, + { GL_POST_COLOR_MATRIX_RED_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[0]) }, + { GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[1]) }, + { GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[2]) }, + { GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[3]) }, + + /* GL_EXT_convolution (also in 1.2 imaging) */ + { GL_CONVOLUTION_1D_EXT, CONTEXT_BOOL(Pixel.Convolution1DEnabled), + extra_EXT_convolution }, + { GL_CONVOLUTION_2D_EXT, CONTEXT_BOOL(Pixel.Convolution2DEnabled), + extra_EXT_convolution }, + { GL_SEPARABLE_2D_EXT, CONTEXT_BOOL(Pixel.Separable2DEnabled), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_RED_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[0]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_GREEN_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[1]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_BLUE_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[2]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_ALPHA_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[3]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_RED_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[0]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_GREEN_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[1]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_BLUE_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[2]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_ALPHA_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]), + extra_EXT_convolution }, + + /* GL_EXT_histogram / GL_ARB_imaging */ + { GL_HISTOGRAM, CONTEXT_BOOL(Pixel.HistogramEnabled), + extra_EXT_histogram }, + { GL_MINMAX, CONTEXT_BOOL(Pixel.MinMaxEnabled), extra_EXT_histogram }, + + /* GL_SGI_color_table / GL_ARB_imaging */ + { GL_COLOR_TABLE_SGI, + CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]), + extra_SGI_color_table }, + { GL_POST_CONVOLUTION_COLOR_TABLE_SGI, + CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]), + extra_SGI_color_table }, + { GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI, + CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]), + extra_SGI_color_table }, + + /* GL_SGI_texture_color_table */ + { GL_TEXTURE_COLOR_TABLE_SGI, LOC_TEXUNIT, TYPE_BOOLEAN, + offsetof(struct gl_texture_unit, ColorTableEnabled), + extra_SGI_texture_color_table }, + + /* GL_EXT_secondary_color */ + { GL_COLOR_SUM_EXT, CONTEXT_BOOL(Fog.ColorSumEnabled), + extra_EXT_secondary_color_ARB_vertex_program }, + { GL_CURRENT_SECONDARY_COLOR_EXT, + CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR1][0], TYPE_FLOATN_4), + extra_EXT_secondary_color_flush_current }, + { GL_SECONDARY_COLOR_ARRAY_EXT, ARRAY_BOOL(SecondaryColor.Enabled), + extra_EXT_secondary_color }, + { GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, ARRAY_ENUM(SecondaryColor.Type), + extra_EXT_secondary_color }, + { GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, ARRAY_INT(SecondaryColor.Stride), + extra_EXT_secondary_color }, + { GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, ARRAY_INT(SecondaryColor.Size), + extra_EXT_secondary_color }, + + /* GL_EXT_fog_coord */ + { GL_CURRENT_FOG_COORDINATE_EXT, + CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), + extra_EXT_fog_coord_flush_current }, + { GL_FOG_COORDINATE_ARRAY_EXT, ARRAY_BOOL(FogCoord.Enabled), + extra_EXT_fog_coord }, + { GL_FOG_COORDINATE_ARRAY_TYPE_EXT, ARRAY_ENUM(FogCoord.Type), + extra_EXT_fog_coord }, + { GL_FOG_COORDINATE_ARRAY_STRIDE_EXT, ARRAY_INT(FogCoord.Stride), + extra_EXT_fog_coord }, + { GL_FOG_COORDINATE_SOURCE_EXT, CONTEXT_ENUM(Fog.FogCoordinateSource), + extra_EXT_fog_coord }, + + /* GL_IBM_rasterpos_clip */ + { GL_RASTER_POSITION_UNCLIPPED_IBM, + CONTEXT_BOOL(Transform.RasterPositionUnclipped), + extra_IBM_rasterpos_clip }, + + /* GL_NV_point_sprite */ + { GL_POINT_SPRITE_R_MODE_NV, + CONTEXT_ENUM(Point.SpriteRMode), extra_NV_point_sprite }, + { GL_POINT_SPRITE_COORD_ORIGIN, CONTEXT_ENUM(Point.SpriteOrigin), + extra_NV_point_sprite_ARB_point_sprite }, + + /* GL_NV_vertex_program */ + { GL_VERTEX_PROGRAM_BINDING_NV, LOC_CUSTOM, TYPE_INT, 0, + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY0_NV, ARRAY_BOOL(VertexAttrib[0].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY1_NV, ARRAY_BOOL(VertexAttrib[1].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY2_NV, ARRAY_BOOL(VertexAttrib[2].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY3_NV, ARRAY_BOOL(VertexAttrib[3].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY4_NV, ARRAY_BOOL(VertexAttrib[4].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY5_NV, ARRAY_BOOL(VertexAttrib[5].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY6_NV, ARRAY_BOOL(VertexAttrib[6].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY7_NV, ARRAY_BOOL(VertexAttrib[7].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY8_NV, ARRAY_BOOL(VertexAttrib[8].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY9_NV, ARRAY_BOOL(VertexAttrib[9].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY10_NV, ARRAY_BOOL(VertexAttrib[10].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY11_NV, ARRAY_BOOL(VertexAttrib[11].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY12_NV, ARRAY_BOOL(VertexAttrib[12].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY13_NV, ARRAY_BOOL(VertexAttrib[13].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY14_NV, ARRAY_BOOL(VertexAttrib[14].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY15_NV, ARRAY_BOOL(VertexAttrib[15].Enabled), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB0_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[0]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB1_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[1]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB2_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[2]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB3_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[3]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB4_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[4]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB5_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[5]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB6_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[6]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB7_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[7]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB8_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[8]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB9_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[9]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB10_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[10]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB11_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[11]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB12_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[12]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB13_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[13]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB14_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[14]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB15_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[15]), + extra_NV_vertex_program }, + + /* GL_NV_fragment_program */ + { GL_FRAGMENT_PROGRAM_NV, CONTEXT_BOOL(FragmentProgram.Enabled), + extra_NV_fragment_program }, + { GL_FRAGMENT_PROGRAM_BINDING_NV, LOC_CUSTOM, TYPE_INT, 0, + extra_NV_fragment_program }, + { GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV, + CONST(MAX_NV_FRAGMENT_PROGRAM_PARAMS), + extra_NV_fragment_program }, + + /* GL_NV_texture_rectangle */ + { GL_TEXTURE_RECTANGLE_NV, + LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_NV_texture_rectangle }, + { GL_TEXTURE_BINDING_RECTANGLE_NV, + LOC_CUSTOM, TYPE_INT, TEXTURE_RECT_INDEX, extra_NV_texture_rectangle }, + { GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, + CONTEXT_INT(Const.MaxTextureRectSize), extra_NV_texture_rectangle }, + + /* GL_EXT_stencil_two_side */ + { GL_STENCIL_TEST_TWO_SIDE_EXT, CONTEXT_BOOL(Stencil.TestTwoSide), + extra_EXT_stencil_two_side }, + { GL_ACTIVE_STENCIL_FACE_EXT, LOC_CUSTOM, TYPE_ENUM, 0 }, + + /* GL_NV_light_max_exponent */ + { GL_MAX_SHININESS_NV, CONTEXT_FLOAT(Const.MaxShininess), + extra_NV_light_max_exponent }, + { GL_MAX_SPOT_EXPONENT_NV, CONTEXT_FLOAT(Const.MaxSpotExponent), + extra_NV_light_max_exponent }, + + /* GL_ARB_vertex_buffer_object */ + { GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Index.BufferObj) }, + { GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, EdgeFlag.BufferObj) }, + { GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, SecondaryColor.BufferObj) }, + { GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, FogCoord.BufferObj) }, + + /* GL_EXT_pixel_buffer_object */ + { GL_PIXEL_PACK_BUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_pixel_buffer_object }, + { GL_PIXEL_UNPACK_BUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_pixel_buffer_object }, + + /* GL_ARB_vertex_program */ + { GL_VERTEX_PROGRAM_ARB, /* == GL_VERTEX_PROGRAM_NV */ + CONTEXT_BOOL(VertexProgram.Enabled), + extra_ARB_vertex_program_NV_vertex_program }, + { GL_VERTEX_PROGRAM_POINT_SIZE_ARB, /* == GL_VERTEX_PROGRAM_POINT_SIZE_NV*/ + CONTEXT_BOOL(VertexProgram.PointSizeEnabled), + extra_ARB_vertex_program_NV_vertex_program }, + { GL_VERTEX_PROGRAM_TWO_SIDE_ARB, /* == GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + CONTEXT_BOOL(VertexProgram.TwoSideEnabled), + extra_ARB_vertex_program_NV_vertex_program }, + { GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, /* == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + CONTEXT_INT(Const.MaxProgramMatrixStackDepth), + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + { GL_MAX_PROGRAM_MATRICES_ARB, /* == GL_MAX_TRACK_MATRICES_NV */ + CONTEXT_INT(Const.MaxProgramMatrices), + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + { GL_CURRENT_MATRIX_STACK_DEPTH_ARB, /* == GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + + { GL_CURRENT_MATRIX_ARB, /* == GL_CURRENT_MATRIX_NV */ + LOC_CUSTOM, TYPE_MATRIX, 0, + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + { GL_TRANSPOSE_CURRENT_MATRIX_ARB, /* == GL_CURRENT_MATRIX_NV */ + LOC_CUSTOM, TYPE_MATRIX, 0, + extra_ARB_vertex_program_ARB_fragment_program }, + + { GL_PROGRAM_ERROR_POSITION_ARB, /* == GL_PROGRAM_ERROR_POSITION_NV */ + CONTEXT_INT(Program.ErrorPos), + extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + + /* GL_ARB_fragment_program */ + { GL_FRAGMENT_PROGRAM_ARB, CONTEXT_BOOL(FragmentProgram.Enabled), + extra_ARB_fragment_program }, + + /* GL_EXT_depth_bounds_test */ + { GL_DEPTH_BOUNDS_TEST_EXT, CONTEXT_BOOL(Depth.BoundsTest), + extra_EXT_depth_bounds_test }, + { GL_DEPTH_BOUNDS_EXT, CONTEXT_FLOAT2(Depth.BoundsMin), + extra_EXT_depth_bounds_test }, + + /* GL_ARB_depth_clamp*/ + { GL_DEPTH_CLAMP, CONTEXT_BOOL(Transform.DepthClamp), + extra_ARB_depth_clamp }, + + /* GL_ARB_draw_buffers */ + { GL_DRAW_BUFFER0_ARB, BUFFER_ENUM(ColorDrawBuffer[0]) }, + { GL_DRAW_BUFFER1_ARB, BUFFER_ENUM(ColorDrawBuffer[1]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER2_ARB, BUFFER_ENUM(ColorDrawBuffer[2]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER3_ARB, BUFFER_ENUM(ColorDrawBuffer[3]), + extra_valid_draw_buffer }, + + /* GL_ATI_fragment_shader */ + { GL_NUM_FRAGMENT_REGISTERS_ATI, CONST(6), extra_ATI_fragment_shader }, + { GL_NUM_FRAGMENT_CONSTANTS_ATI, CONST(8), extra_ATI_fragment_shader }, + { GL_NUM_PASSES_ATI, CONST(2), extra_ATI_fragment_shader }, + { GL_NUM_INSTRUCTIONS_PER_PASS_ATI, CONST(8), extra_ATI_fragment_shader }, + { GL_NUM_INSTRUCTIONS_TOTAL_ATI, CONST(16), extra_ATI_fragment_shader }, + { GL_COLOR_ALPHA_PAIRING_ATI, CONST(GL_TRUE), extra_ATI_fragment_shader }, + { GL_NUM_LOOPBACK_COMPONENTS_ATI, CONST(3), extra_ATI_fragment_shader }, + { GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI, + CONST(3), extra_ATI_fragment_shader }, + + /* GL_EXT_framebuffer_object */ + { GL_MAX_COLOR_ATTACHMENTS_EXT, CONTEXT_INT(Const.MaxColorAttachments), + extra_EXT_framebuffer_object }, + + /* GL_EXT_framebuffer_blit + * NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT */ + { GL_READ_FRAMEBUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_framebuffer_blit }, + + /* GL_EXT_provoking_vertex */ + { GL_PROVOKING_VERTEX_EXT, + CONTEXT_BOOL(Light.ProvokingVertex), extra_EXT_provoking_vertex }, + { GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT, + CONTEXT_BOOL(Const.QuadsFollowProvokingVertexConvention), + extra_EXT_provoking_vertex }, + + /* GL_ARB_framebuffer_object */ + { GL_MAX_SAMPLES, CONTEXT_INT(Const.MaxSamples), + extra_ARB_framebuffer_object }, + + /* GL_APPLE_vertex_array_object */ + { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), + extra_APPLE_vertex_array_object }, + + /* GL_ARB_seamless_cube_map */ + { GL_TEXTURE_CUBE_MAP_SEAMLESS, + CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map }, + + /* GL_ARB_sync */ + { GL_MAX_SERVER_WAIT_TIMEOUT, + CONTEXT_INT64(Const.MaxServerWaitTimeout), extra_ARB_sync }, + + /* GL_EXT_transform_feedback */ + { GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_transform_feedback }, + { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(TransformFeedback.RasterDiscard), + extra_EXT_transform_feedback }, + { GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, + CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), + extra_EXT_transform_feedback }, + { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, + CONTEXT_INT(Const.MaxTransformFeedbackSeparateAttribs), + extra_EXT_transform_feedback }, + { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, + CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), + extra_EXT_transform_feedback }, + + /* GL 3.0 */ + { GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, + { GL_MAJOR_VERSION, CONTEXT_INT(VersionMajor), extra_version_30 }, + { GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 }, + { GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 }, + + /* GL 3.1 */ + { GL_PRIMITIVE_RESTART, CONTEXT_BOOL(Array.PrimitiveRestart), + extra_version_31 }, + { GL_PRIMITIVE_RESTART_INDEX, CONTEXT_INT(Array.RestartIndex), + extra_version_31 }, + + /* GL 3.2 */ + { GL_CONTEXT_PROFILE_MASK, CONTEXT_INT(Const.ProfileMask), + extra_version_32 }, +#endif /* FEATURE_GL */ +}; + +/* All we need now is a way to look up the value struct from the enum. + * The code generated by gcc for the old generated big switch + * statement is a big, balanced, open coded if/else tree, essentially + * an unrolled binary search. It would be natural to sort the new + * enum table and use bsearch(), but we will use a read-only hash + * table instead. bsearch() has a nice guaranteed worst case + * performance, but we're also guaranteed to hit that worst case + * (log2(n) iterations) for about half the enums. Instead, using an + * open addressing hash table, we can find the enum on the first try + * for 80% of the enums, 1 collision for 10% and never more than 5 + * collisions for any enum (typical numbers). And the code is very + * simple, even though it feels a little magic. */ + +static unsigned short table[1024]; +static const int prime_factor = 89, prime_step = 281; + +#ifdef GET_DEBUG +static void +print_table_stats(void) +{ + int i, j, collisions[11], count, hash, mask; + const struct value_desc *d; + + count = 0; + mask = Elements(table) - 1; + memset(collisions, 0, sizeof collisions); + + for (i = 0; i < Elements(table); i++) { + if (!table[i]) + continue; + count++; + d = &values[table[i]]; + hash = (d->pname * prime_factor); + j = 0; + while (1) { + if (values[table[hash & mask]].pname == d->pname) + break; + hash += prime_step; + j++; + } + + if (j < 10) + collisions[j]++; + else + collisions[10]++; } -/* - * Check if either of four extensions is enabled. + printf("number of enums: %d (total %d)\n", count, Elements(values)); + for (i = 0; i < Elements(collisions) - 1; i++) + if (collisions[i] > 0) + printf(" %d enums with %d %scollisions\n", + collisions[i], i, i == 10 ? "or more " : ""); +} +#endif + +/** + * Initialize the enum hash for a given API + * + * This is called from one_time_init() to insert the enum values that + * are valid for the API in question into the enum hash table. + * + * \param the current context, for determining the API in question */ -#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4) \ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \ - !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \ - goto invalid_enum_error; \ +void _mesa_init_get_hash(GLcontext *ctx) +{ + int i, hash, index, mask; + int api_mask = 0, api_bit; + + mask = Elements(table) - 1; + api_bit = 1 << ctx->API; + + for (i = 0; i < Elements(values); i++) { + if (values[i].type == TYPE_API_MASK) { + api_mask = values[i].offset; + continue; + } + if (!(api_mask & api_bit)) + continue; + + hash = (values[i].pname * prime_factor) & mask; + while (1) { + index = hash & mask; + if (!table[index]) { + table[index] = i; + break; + } + hash += prime_step; + } } -/* - * Check GL version. +#ifdef GET_DEBUG + print_table_stats(); +#endif +} + +/** + * Handle irregular enums + * + * Some values don't conform to the "well-known type at context + * pointer + offset" pattern, so we have this function to catch all + * the corner cases. Typically, it's a computed value or a one-off + * pointer to a custom struct or something. + * + * In this case we can't return a pointer to the value, so we'll have + * to use the temporary variable 'v' declared back in the calling + * glGet*v() function to store the result. + * + * \param ctx the current context + * \param d the struct value_desc that describes the enum + * \param v pointer to the tmp declared in the calling glGet*v() function */ -#define CHECK_VERSION(VERSION) \ - if (version < VERSION) { \ - goto invalid_enum_error; \ - } +static void +find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v) +{ + struct gl_buffer_object *buffer_obj; + struct gl_client_array *array; + GLuint unit, *p; + switch (d->pname) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_RECTANGLE_NV: + v->value_bool = _mesa_IsEnabled(d->pname); + break; -void GLAPIENTRY -_mesa_GetBooleanv( GLenum pname, GLboolean *params ) + case GL_LINE_STIPPLE_PATTERN: + /* This is the only GLushort, special case it here by promoting + * to an int rather than introducing a new type. */ + v->value_int = ctx->Line.StipplePattern; + break; + + case GL_CURRENT_RASTER_TEXTURE_COORDS: + unit = ctx->Texture.CurrentUnit; + v->value_float_4[0] = ctx->Current.RasterTexCoords[unit][0]; + v->value_float_4[1] = ctx->Current.RasterTexCoords[unit][1]; + v->value_float_4[2] = ctx->Current.RasterTexCoords[unit][2]; + v->value_float_4[3] = ctx->Current.RasterTexCoords[unit][3]; + break; + + case GL_CURRENT_TEXTURE_COORDS: + unit = ctx->Texture.CurrentUnit; + v->value_float_4[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]; + v->value_float_4[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]; + v->value_float_4[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]; + v->value_float_4[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]; + break; + + case GL_COLOR_WRITEMASK: + v->value_int_4[0] = ctx->Color.ColorMask[0][RCOMP] ? 1 : 0; + v->value_int_4[1] = ctx->Color.ColorMask[0][GCOMP] ? 1 : 0; + v->value_int_4[2] = ctx->Color.ColorMask[0][BCOMP] ? 1 : 0; + v->value_int_4[3] = ctx->Color.ColorMask[0][ACOMP] ? 1 : 0; + break; + + case GL_EDGE_FLAG: + v->value_bool = ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0; + break; + + case GL_READ_BUFFER: + v->value_enum = ctx->ReadBuffer->ColorReadBuffer; + break; + + case GL_MAP2_GRID_DOMAIN: + v->value_float_4[0] = ctx->Eval.MapGrid2u1; + v->value_float_4[1] = ctx->Eval.MapGrid2u2; + v->value_float_4[2] = ctx->Eval.MapGrid2v1; + v->value_float_4[3] = ctx->Eval.MapGrid2v2; + break; + + case GL_TEXTURE_STACK_DEPTH: + unit = ctx->Texture.CurrentUnit; + v->value_int = ctx->TextureMatrixStack[unit].Depth + 1; + break; + case GL_TEXTURE_MATRIX: + unit = ctx->Texture.CurrentUnit; + v->value_matrix = ctx->TextureMatrixStack[unit].Top; + break; + + case GL_TEXTURE_COORD_ARRAY: + case GL_TEXTURE_COORD_ARRAY_SIZE: + case GL_TEXTURE_COORD_ARRAY_TYPE: + case GL_TEXTURE_COORD_ARRAY_STRIDE: + array = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture]; + v->value_int = *(GLuint *) ((char *) array + d->offset); + break; + + case GL_ACTIVE_TEXTURE_ARB: + v->value_int = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; + break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + v->value_int = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; + break; + + case GL_MODELVIEW_STACK_DEPTH: + case GL_PROJECTION_STACK_DEPTH: + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + v->value_int = *(GLint *) ((char *) ctx + d->offset) + 1; + break; + + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_3D_TEXTURE_SIZE: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + p = (GLuint *) ((char *) ctx + d->offset); + v->value_int = 1 << (*p - 1); + break; + + case GL_SCISSOR_BOX: + v->value_int_4[0] = ctx->Scissor.X; + v->value_int_4[1] = ctx->Scissor.Y; + v->value_int_4[2] = ctx->Scissor.Width; + v->value_int_4[3] = ctx->Scissor.Height; + break; + + case GL_LIST_INDEX: + v->value_int = + ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0; + break; + case GL_LIST_MODE: + if (!ctx->CompileFlag) + v->value_enum = 0; + else if (ctx->ExecuteFlag) + v->value_enum = GL_COMPILE_AND_EXECUTE; + else + v->value_enum = GL_COMPILE; + break; + + case GL_VIEWPORT: + v->value_int_4[0] = ctx->Viewport.X; + v->value_int_4[1] = ctx->Viewport.Y; + v->value_int_4[2] = ctx->Viewport.Width; + v->value_int_4[3] = ctx->Viewport.Height; + break; + + case GL_ACTIVE_STENCIL_FACE_EXT: + v->value_enum = ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT; + break; + + case GL_STENCIL_FAIL: + v->value_enum = ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_FUNC: + v->value_enum = ctx->Stencil.Function[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_PASS_DEPTH_FAIL: + v->value_enum = ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_PASS_DEPTH_PASS: + v->value_enum = ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_REF: + v->value_int = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_VALUE_MASK: + v->value_int = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_WRITEMASK: + v->value_int = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; + break; + + case GL_NUM_EXTENSIONS: + v->value_int = _mesa_get_extension_count(ctx); + break; + + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: + v->value_int = _mesa_get_color_read_type(ctx); + break; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: + v->value_int = _mesa_get_color_read_format(ctx); + break; + + case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: + v->value_int = ctx->CurrentStack->Depth + 1; + break; + case GL_CURRENT_MATRIX_ARB: + case GL_TRANSPOSE_CURRENT_MATRIX_ARB: + v->value_matrix = ctx->CurrentStack->Top; + break; + + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + v->value_int = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + v->value_int_n.n = + _mesa_get_compressed_formats(ctx, v->value_int_n.ints, GL_FALSE); + ASSERT(v->value_int_n.n <= 100); + break; + + case GL_MAX_VARYING_FLOATS_ARB: + v->value_int = ctx->Const.MaxVarying * 4; + break; + + /* Various object names */ + + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + unit = ctx->Texture.CurrentUnit; + v->value_int = + ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name; + break; + + /* GL_ARB_vertex_buffer_object */ + case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: + case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: + case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: + case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: + case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: + buffer_obj = (struct gl_buffer_object *) + ((char *) ctx->Array.ArrayObj + d->offset); + v->value_int = buffer_obj->Name; + break; + case GL_ARRAY_BUFFER_BINDING_ARB: + v->value_int = ctx->Array.ArrayBufferObj->Name; + break; + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: + v->value_int = + ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; + break; + case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: + v->value_int = ctx->Array.ElementArrayBufferObj->Name; + break; + + case GL_FRAGMENT_PROGRAM_BINDING_NV: + v->value_int = + ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + v->value_int = + ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0; + break; + case GL_PIXEL_PACK_BUFFER_BINDING_EXT: + v->value_int = ctx->Pack.BufferObj->Name; + break; + case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: + v->value_int = ctx->Unpack.BufferObj->Name; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + v->value_int = ctx->TransformFeedback.CurrentBuffer->Name; + break; + case GL_CURRENT_PROGRAM: + v->value_int = + ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; + break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + v->value_int = ctx->ReadBuffer->Name; + break; + case GL_RENDERBUFFER_BINDING_EXT: + v->value_int = + ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; + break; + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: + v->value_int = ctx->Array.ArrayObj->PointSize.BufferObj->Name; + break; + } +} + +/** + * Check extra constraints on a struct value_desc descriptor + * + * If a struct value_desc has a non-NULL extra pointer, it means that + * there are a number of extra constraints to check or actions to + * perform. The extras is just an integer array where each integer + * encode different constraints or actions. + * + * \param ctx current context + * \param func name of calling glGet*v() function for error reporting + * \param d the struct value_desc that has the extra constraints + * + * \return GL_FALSE if one of the constraints was not satisfied, + * otherwise GL_TRUE. + */ +static GLboolean +check_extra(GLcontext *ctx, const char *func, const struct value_desc *d) { - GET_CURRENT_CONTEXT(ctx); const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; + int total, enabled; + const int *e; - if (!params) - return; + total = 0; + enabled = 0; + for (e = d->extra; *e != EXTRA_END; e++) + switch (*e) { + case EXTRA_VERSION_30: + if (version < 30) + return GL_FALSE; + break; + case EXTRA_VERSION_31: + if (version < 31) + return GL_FALSE; + break; + case EXTRA_VERSION_32: + if (version < 32) + return GL_FALSE; + break; + case EXTRA_NEW_BUFFERS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); + break; + case EXTRA_FLUSH_CURRENT: + FLUSH_CURRENT(ctx, 0); + break; + case EXTRA_VALID_DRAW_BUFFER: + if (d->pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(draw buffer %u)", + func, d->pname - GL_DRAW_BUFFER0_ARB); + return GL_FALSE; + } + break; + case EXTRA_VALID_TEXTURE_UNIT: + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture %u)", + func, ctx->Texture.CurrentUnit); + return GL_FALSE; + } + break; + case EXTRA_END: + break; + default: /* *e is a offset into the extension struct */ + total++; + if (*(GLboolean *) ((char *) &ctx->Extensions + *e)) + enabled++; + break; + } - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumRedBits); - break; - case GL_ACCUM_GREEN_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumGreenBits); - break; - case GL_ACCUM_BLUE_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumBlueBits); - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumAlphaBits); - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[3]); - break; - case GL_ALPHA_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias); - break; - case GL_ALPHA_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits); - break; - case GL_ALPHA_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaScale); - break; - case GL_ALPHA_TEST: - params[0] = ctx->Color.AlphaEnabled; - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = FLOAT_TO_BOOLEAN(ctx->Color.AlphaRef); - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->AttribStackDepth); - break; - case GL_AUTO_NORMAL: - params[0] = ctx->Eval.AutoNormal; - break; - case GL_AUX_BUFFERS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.numAuxBuffers); - break; - case GL_BLEND: - params[0] = (ctx->Color.BlendEnabled & 1); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[3]); - break; - case GL_BLUE_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias); - break; - case GL_BLUE_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits); - break; - case GL_BLUE_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueScale); - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->ClientAttribStackDepth); - break; - case GL_CLIP_PLANE0: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 0) & 1; - break; - case GL_CLIP_PLANE1: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 1) & 1; - break; - case GL_CLIP_PLANE2: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 2) & 1; - break; - case GL_CLIP_PLANE3: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 3) & 1; - break; - case GL_CLIP_PLANE4: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 4) & 1; - break; - case GL_CLIP_PLANE5: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 5) & 1; - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[3]); - break; - case GL_COLOR_MATERIAL: - params[0] = ctx->Light.ColorMaterialEnabled; - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][RCOMP] ? 1 : 0); - params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][GCOMP] ? 1 : 0); - params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][BCOMP] ? 1 : 0); - params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][ACOMP] ? 1 : 0); - break; - case GL_CULL_FACE: - params[0] = ctx->Polygon.CullFlag; - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - break; - case GL_CURRENT_INDEX: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - break; - case GL_CURRENT_NORMAL: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[3]); - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterDistance); - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = FLOAT_TO_BOOLEAN(1.0); - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[3]); - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[3]); - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][3]); - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = ctx->Current.RasterPosValid; - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]); - } - break; - case GL_DEPTH_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthBias); - break; - case GL_DEPTH_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.depthBits); - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(((GLfloat) ctx->Depth.Clear)); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Viewport.Near); - params[1] = FLOAT_TO_BOOLEAN(ctx->Viewport.Far); - break; - case GL_DEPTH_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthScale); - break; - case GL_DEPTH_TEST: - params[0] = ctx->Depth.Test; - break; - case GL_DEPTH_WRITEMASK: - params[0] = ctx->Depth.Mask; - break; - case GL_DITHER: - params[0] = ctx->Color.DitherFlag; - break; - case GL_DOUBLEBUFFER: - params[0] = ctx->DrawBuffer->Visual.doubleBufferMode; - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0); - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize); - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = ctx->Fog.Enabled; - break; - case GL_FOG_COLOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[3]); - break; - case GL_FOG_DENSITY: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Density); - break; - case GL_FOG_END: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.End); - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Index); - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Start); - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias); - break; - case GL_GREEN_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits); - break; - case GL_GREEN_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale); - break; - case GL_INDEX_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits); - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = INT_TO_BOOLEAN(ctx->Color.ClearIndex); - break; - case GL_INDEX_MODE: - params[0] = GL_FALSE; - break; - case GL_INDEX_OFFSET: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexOffset); - break; - case GL_INDEX_SHIFT: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexShift); - break; - case GL_INDEX_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Color.IndexMask); - break; - case GL_LIGHT0: - params[0] = ctx->Light.Light[0].Enabled; - break; - case GL_LIGHT1: - params[0] = ctx->Light.Light[1].Enabled; - break; - case GL_LIGHT2: - params[0] = ctx->Light.Light[2].Enabled; - break; - case GL_LIGHT3: - params[0] = ctx->Light.Light[3].Enabled; - break; - case GL_LIGHT4: - params[0] = ctx->Light.Light[4].Enabled; - break; - case GL_LIGHT5: - params[0] = ctx->Light.Light[5].Enabled; - break; - case GL_LIGHT6: - params[0] = ctx->Light.Light[6].Enabled; - break; - case GL_LIGHT7: - params[0] = ctx->Light.Light[7].Enabled; - break; - case GL_LIGHTING: - params[0] = ctx->Light.Enabled; - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[3]); - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = ctx->Light.Model.LocalViewer; - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = ctx->Light.Model.TwoSide; - break; - case GL_LINE_SMOOTH: - params[0] = ctx->Line.SmoothFlag; - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = ctx->Line.StippleFlag; - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = INT_TO_BOOLEAN(ctx->Line.StipplePattern); - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = INT_TO_BOOLEAN(ctx->Line.StippleFactor); - break; - case GL_LINE_WIDTH: - params[0] = FLOAT_TO_BOOLEAN(ctx->Line.Width); - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.LineWidthGranularity); - break; - case GL_LINE_WIDTH_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidthAA); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidthAA); - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidth); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidth); - break; - case GL_LIST_BASE: - params[0] = INT_TO_BOOLEAN(ctx->List.ListBase); - break; - case GL_LIST_INDEX: - params[0] = INT_TO_BOOLEAN((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_BOOLEAN(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = ctx->Color.IndexLogicOpEnabled; - break; - case GL_COLOR_LOGIC_OP: - params[0] = ctx->Color.ColorLogicOpEnabled; - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = ctx->Eval.Map1Color4; - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u1); - params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u2); - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid1un); - break; - case GL_MAP1_INDEX: - params[0] = ctx->Eval.Map1Index; - break; - case GL_MAP1_NORMAL: - params[0] = ctx->Eval.Map1Normal; - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = ctx->Eval.Map1TextureCoord1; - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = ctx->Eval.Map1TextureCoord2; - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = ctx->Eval.Map1TextureCoord3; - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = ctx->Eval.Map1TextureCoord4; - break; - case GL_MAP1_VERTEX_3: - params[0] = ctx->Eval.Map1Vertex3; - break; - case GL_MAP1_VERTEX_4: - params[0] = ctx->Eval.Map1Vertex4; - break; - case GL_MAP2_COLOR_4: - params[0] = ctx->Eval.Map2Color4; - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u1); - params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u2); - params[2] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v1); - params[3] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v2); - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2un); - params[1] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2vn); - break; - case GL_MAP2_INDEX: - params[0] = ctx->Eval.Map2Index; - break; - case GL_MAP2_NORMAL: - params[0] = ctx->Eval.Map2Normal; - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = ctx->Eval.Map2TextureCoord1; - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = ctx->Eval.Map2TextureCoord2; - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = ctx->Eval.Map2TextureCoord3; - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = ctx->Eval.Map2TextureCoord4; - break; - case GL_MAP2_VERTEX_3: - params[0] = ctx->Eval.Map2Vertex3; - break; - case GL_MAP2_VERTEX_4: - params[0] = ctx->Eval.Map2Vertex4; - break; - case GL_MAP_COLOR: - params[0] = ctx->Pixel.MapColorFlag; - break; - case GL_MAP_STENCIL: - params[0] = ctx->Pixel.MapStencilFlag; - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_CLIENT_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIP_PLANES: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxClipPlanes); - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_EVAL_ORDER: - params[0] = INT_TO_BOOLEAN(MAX_EVAL_ORDER); - break; - case GL_MAX_LIGHTS: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxLights); - break; - case GL_MAX_LIST_NESTING: - params[0] = INT_TO_BOOLEAN(MAX_LIST_NESTING); - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_MODELVIEW_STACK_DEPTH); - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_NAME_STACK_DEPTH); - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = INT_TO_BOOLEAN(MAX_PIXEL_MAP_TABLE); - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_PROJECTION_STACK_DEPTH); - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.MaxTextureLevels - 1)); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.Max3DTextureLevels - 1)); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_TEXTURE_STACK_DEPTH); - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxViewportWidth); - params[1] = INT_TO_BOOLEAN(ctx->Const.MaxViewportHeight); - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->ModelviewMatrixStack.Depth + 1); - break; - case GL_NAME_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->Select.NameStackDepth); - break; - case GL_NORMALIZE: - params[0] = ctx->Transform.Normalize; - break; - case GL_PACK_ALIGNMENT: - params[0] = INT_TO_BOOLEAN(ctx->Pack.Alignment); - break; - case GL_PACK_LSB_FIRST: - params[0] = ctx->Pack.LsbFirst; - break; - case GL_PACK_ROW_LENGTH: - params[0] = INT_TO_BOOLEAN(ctx->Pack.RowLength); - break; - case GL_PACK_SKIP_PIXELS: - params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipPixels); - break; - case GL_PACK_SKIP_ROWS: - params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipRows); - break; - case GL_PACK_SWAP_BYTES: - params[0] = ctx->Pack.SwapBytes; - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipImages); - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Pack.ImageHeight); - break; - case GL_PACK_INVERT_MESA: - params[0] = ctx->Pack.Invert; - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.AtoA.Size); - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.BtoB.Size); - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.GtoG.Size); - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoA.Size); - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoB.Size); - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoG.Size); - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoI.Size); - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoR.Size); - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.RtoR.Size); - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.StoS.Size); - break; - case GL_POINT_SIZE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size); - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.PointSizeGranularity); - break; - case GL_POINT_SIZE_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSizeAA); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSizeAA); - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSize); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSize); - break; - case GL_POINT_SMOOTH: - params[0] = ctx->Point.SmoothFlag; - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MinSize); - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MaxSize); - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Threshold); - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Params[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Point.Params[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Point.Params[2]); - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_BOOLEAN(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits); - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetFactor ); - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits ); - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = ctx->Polygon.OffsetPoint; - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = ctx->Polygon.OffsetLine; - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = ctx->Polygon.OffsetFill; - break; - case GL_POLYGON_SMOOTH: - params[0] = ctx->Polygon.SmoothFlag; - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = ctx->Polygon.StippleFlag; - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->ProjectionMatrixStack.Depth + 1); - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_BOOLEAN(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias); - break; - case GL_RED_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.redBits); - break; - case GL_RED_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale); - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = ctx->Transform.RescaleNormals; - break; - case GL_RGBA_MODE: - params[0] = GL_TRUE; - break; - case GL_SCISSOR_BOX: - params[0] = INT_TO_BOOLEAN(ctx->Scissor.X); - params[1] = INT_TO_BOOLEAN(ctx->Scissor.Y); - params[2] = INT_TO_BOOLEAN(ctx->Scissor.Width); - params[3] = INT_TO_BOOLEAN(ctx->Scissor.Height); - break; - case GL_SCISSOR_TEST: - params[0] = ctx->Scissor.Enabled; - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Select.BufferSize); - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = ctx->Texture.SharedPalette; - break; - case GL_STENCIL_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.stencilBits); - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.Clear); - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_TEST: - params[0] = ctx->Stencil.Enabled; - break; - case GL_STENCIL_VALUE_MASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); - break; - case GL_STEREO: - params[0] = ctx->DrawBuffer->Visual.stereoMode; - break; - case GL_SUBPIXEL_BITS: - params[0] = INT_TO_BOOLEAN(ctx->Const.SubPixelBits); - break; - case GL_TEXTURE_1D: - params[0] = _mesa_IsEnabled(GL_TEXTURE_1D); - break; - case GL_TEXTURE_2D: - params[0] = _mesa_IsEnabled(GL_TEXTURE_2D); - break; - case GL_TEXTURE_3D: - params[0] = _mesa_IsEnabled(GL_TEXTURE_3D); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = _mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_3D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); - break; - case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayTextureLayers); - break; - case GL_TEXTURE_GEN_S: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); - break; - case GL_TEXTURE_GEN_T: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0); - break; - case GL_TEXTURE_GEN_R: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0); - break; - case GL_TEXTURE_GEN_Q: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = INT_TO_BOOLEAN(ctx->TextureMatrixStack[unit].Depth + 1); - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.Alignment); - break; - case GL_UNPACK_LSB_FIRST: - params[0] = ctx->Unpack.LsbFirst; - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.RowLength); - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipPixels); - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipRows); - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = ctx->Unpack.SwapBytes; - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipImages); - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.ImageHeight); - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = ctx->Unpack.ClientStorage; - break; - case GL_VIEWPORT: - params[0] = INT_TO_BOOLEAN(ctx->Viewport.X); - params[1] = INT_TO_BOOLEAN(ctx->Viewport.Y); - params[2] = INT_TO_BOOLEAN(ctx->Viewport.Width); - params[3] = INT_TO_BOOLEAN(ctx->Viewport.Height); - break; - case GL_ZOOM_X: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomX); - break; - case GL_ZOOM_Y: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomY); - break; - case GL_VERTEX_ARRAY: - params[0] = ctx->Array.ArrayObj->Vertex.Enabled; - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.Size); - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.Stride); - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.Stride); - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_COLOR_ARRAY: - params[0] = ctx->Array.ArrayObj->Color.Enabled; - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Color.Size); - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Color.Stride); - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_INDEX_ARRAY: - params[0] = ctx->Array.ArrayObj->Index.Enabled; - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Index.Stride); - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled; - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = ctx->Array.ArrayObj->EdgeFlag.Enabled; - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->EdgeFlag.Stride); - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureUnits); - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = INT_TO_BOOLEAN((1 << (ctx->Const.MaxCubeTextureLevels - 1))); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Hint.TextureCompression); - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_BOOLEAN(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = INT_TO_BOOLEAN(ctx->Array.LockFirst); - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = INT_TO_BOOLEAN(ctx->Array.LockCount); - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = INT_TO_BOOLEAN(ctx->ColorMatrixStack.Depth + 1); - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = INT_TO_BOOLEAN(MAX_COLOR_STACK_DEPTH); - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[3]); - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[3]); - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.Convolution1DEnabled; - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.Convolution2DEnabled; - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.Separable2DEnabled; - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[0]); - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[1]); - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[3]); - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[0]); - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[1]); - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[3]); - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram); - params[0] = ctx->Pixel.HistogramEnabled; - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram); - params[0] = ctx->Pixel.MinMaxEnabled; - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]; - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]; - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program); - params[0] = ctx->Fog.ColorSumEnabled; - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color); - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Enabled; - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.Stride); - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.Size); - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord); - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ctx->Array.ArrayObj->FogCoord.Enabled; - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->FogCoord.Stride); - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_BOOLEAN(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureLodBias); - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureMaxAnisotropy); - break; - case GL_MULTISAMPLE_ARB: - params[0] = ctx->Multisample.Enabled; - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = ctx->Multisample.SampleAlphaToCoverage; - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = ctx->Multisample.SampleAlphaToOne; - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = ctx->Multisample.SampleCoverage; - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = FLOAT_TO_BOOLEAN(ctx->Multisample.SampleCoverageValue); - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = ctx->Multisample.SampleCoverageInvert; - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.sampleBuffers); - break; - case GL_SAMPLES_ARB: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.samples); - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip); - params[0] = ctx->Transform.RasterPositionUnclipped; - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = ctx->Point.PointSprite; - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite); - params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap); - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = INT_TO_BOOLEAN((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[0].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[1].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[2].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[3].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[4].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[5].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[6].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[7].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[8].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[9].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[10].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[11].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[12].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[13].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[14].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Array.ArrayObj->VertexAttrib[15].Enabled; - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[0]; - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[1]; - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[2]; - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[3]; - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[4]; - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[5]; - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[6]; - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[7]; - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[8]; - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[9]; - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[10]; - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[11]; - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[12]; - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[13]; - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[14]; - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = ctx->Eval.Map1Attrib[15]; - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = ctx->FragmentProgram.Enabled; - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = INT_TO_BOOLEAN(MAX_NV_FRAGMENT_PROGRAM_PARAMS); - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureRectSize); - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = ctx->Stencil.TestTwoSide; - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxShininess); - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxSpotExponent); - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayBufferObj->Name); - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.BufferObj->Name); - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.BufferObj->Name); - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Color.BufferObj->Name); - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Index.BufferObj->Name); - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ElementArrayBufferObj->Name); - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = INT_TO_BOOLEAN(ctx->Pack.BufferObj->Name); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = INT_TO_BOOLEAN(ctx->Unpack.BufferObj->Name); - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = ctx->VertexProgram.Enabled; - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = ctx->VertexProgram.PointSizeEnabled; - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = ctx->VertexProgram.TwoSideEnabled; - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrixStackDepth); - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrices); - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = ctx->CurrentStack->Depth + 1; - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program); - params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxAttribs); - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program); - params[0] = INT_TO_BOOLEAN(ctx->Program.ErrorPos); - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program); - params[0] = ctx->FragmentProgram.Enabled; - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureCoordUnits); - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureImageUnits); - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = ctx->Depth.BoundsTest; - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin); - params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax); - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp); - params[0] = ctx->Transform.DepthClamp; - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers); - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_BOOLEAN(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_BOOLEAN(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_BOOLEAN(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx)); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx)); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(6); - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(8); - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(2); - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(8); - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(16); - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = GL_TRUE; - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(3); - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = INT_TO_BOOLEAN(3); - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]); - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[1]); - break; - case GL_STENCIL_BACK_REF: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]); - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Name); - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = INT_TO_BOOLEAN(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxColorAttachments); - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize); - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit); - params[0] = INT_TO_BOOLEAN(ctx->ReadBuffer->Name); - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = ctx->Light.ProvokingVertex; - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = ctx->Const.QuadsFollowProvokingVertexConvention; - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = INT_TO_BOOLEAN(ctx->Const.FragmentProgram.MaxUniformComponents); - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxUniformComponents); - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVarying * 4); - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexTextureImageUnits); - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxCombinedTextureImageUnits); - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects); - params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxSamples); - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Name); - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map); - params[0] = ctx->Texture.CubeMapSeamless; - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync); - params[0] = INT64_TO_BOOLEAN(ctx->Const.MaxServerWaitTimeout); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - params[0] = INT_TO_BOOLEAN(ctx->TransformFeedback.CurrentBuffer->Name); - break; - case GL_RASTERIZER_DISCARD: - CHECK_EXT1(EXT_transform_feedback); - params[0] = ctx->TransformFeedback.RasterDiscard; - break; - case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackInterleavedComponents); - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateAttribs); - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateComponents); - break; - case GL_NUM_EXTENSIONS: - CHECK_VERSION(30); - params[0] = INT_TO_BOOLEAN(_mesa_get_extension_count(ctx)); - break; - case GL_MAJOR_VERSION: - CHECK_VERSION(30); - params[0] = INT_TO_BOOLEAN(ctx->VersionMajor); - break; - case GL_MINOR_VERSION: - CHECK_VERSION(30); - params[0] = INT_TO_BOOLEAN(ctx->VersionMinor); - break; - case GL_CONTEXT_FLAGS: - CHECK_VERSION(30); - params[0] = INT_TO_BOOLEAN(ctx->Const.ContextFlags); - break; - case GL_PRIMITIVE_RESTART: - CHECK_VERSION(31); - params[0] = ctx->Array.PrimitiveRestart; - break; - case GL_PRIMITIVE_RESTART_INDEX: - CHECK_VERSION(31); - params[0] = INT_TO_BOOLEAN(ctx->Array.RestartIndex); - break; - case GL_CONTEXT_PROFILE_MASK: - CHECK_VERSION(32); - params[0] = INT_TO_BOOLEAN(ctx->Const.ProfileMask); - break; - default: - goto invalid_enum_error; + if (total > 0 && enabled == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, d->pname); + return GL_FALSE; } - return; -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); + return GL_TRUE; } -void GLAPIENTRY -_mesa_GetFloatv( GLenum pname, GLfloat *params ) +static const struct value_desc error_value = { 0, 0, TYPE_INVALID }; + +/** + * Find the struct value_desc corresponding to the enum 'pname'. + * + * We hash the enum value to get an index into the 'table' array, + * which holds the index in the 'values' array of struct value_desc. + * Once we've found the entry, we do the extra checks, if any, then + * look up the value and return a pointer to it. + * + * If the value has to be computed (for example, it's the result of a + * function call or we need to add 1 to it), we use the tmp 'v' to + * store the result. + * + * \param func name of glGet*v() func for error reporting + * \param pname the enum value we're looking up + * \param p is were we return the pointer to the value + * \param v a tmp union value variable in the calling glGet*v() function + * + * \return the struct value_desc corresponding to the enum or a struct + * value_desc of TYPE_INVALID if not found. This lets the calling + * glGet*v() function jump right into a switch statement and + * handle errors there instead of having to check for NULL. + */ +static const struct value_desc * +find_value(const char *func, GLenum pname, void **p, union value *v) { GET_CURRENT_CONTEXT(ctx); - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; + struct gl_texture_unit *unit; + int mask, hash; + const struct value_desc *d; - if (!params) - return; + mask = Elements(table) - 1; + hash = (pname * prime_factor); + while (1) { + d = &values[table[hash & mask]]; + if (likely(d->pname == pname)) + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumRedBits); - break; - case GL_ACCUM_GREEN_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumGreenBits); - break; - case GL_ACCUM_BLUE_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumBlueBits); - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumAlphaBits); - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = ctx->Accum.ClearColor[0]; - params[1] = ctx->Accum.ClearColor[1]; - params[2] = ctx->Accum.ClearColor[2]; - params[3] = ctx->Accum.ClearColor[3]; - break; - case GL_ALPHA_BIAS: - params[0] = ctx->Pixel.AlphaBias; - break; - case GL_ALPHA_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits); - break; - case GL_ALPHA_SCALE: - params[0] = ctx->Pixel.AlphaScale; - break; - case GL_ALPHA_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.AlphaEnabled); - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = ctx->Color.AlphaRef; - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(ctx->AttribStackDepth); - break; - case GL_AUTO_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.AutoNormal); - break; - case GL_AUX_BUFFERS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.numAuxBuffers); - break; - case GL_BLEND: - params[0] = BOOLEAN_TO_FLOAT((ctx->Color.BlendEnabled & 1)); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = ctx->Color.BlendColor[0]; - params[1] = ctx->Color.BlendColor[1]; - params[2] = ctx->Color.BlendColor[2]; - params[3] = ctx->Color.BlendColor[3]; - break; - case GL_BLUE_BIAS: - params[0] = ctx->Pixel.BlueBias; - break; - case GL_BLUE_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits); - break; - case GL_BLUE_SCALE: - params[0] = ctx->Pixel.BlueScale; - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(ctx->ClientAttribStackDepth); - break; - case GL_CLIP_PLANE0: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); - break; - case GL_CLIP_PLANE1: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); - break; - case GL_CLIP_PLANE2: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); - break; - case GL_CLIP_PLANE3: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); - break; - case GL_CLIP_PLANE4: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); - break; - case GL_CLIP_PLANE5: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = ctx->Color.ClearColor[0]; - params[1] = ctx->Color.ClearColor[1]; - params[2] = ctx->Color.ClearColor[2]; - params[3] = ctx->Color.ClearColor[3]; - break; - case GL_COLOR_MATERIAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ColorMaterialEnabled); - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = (GLfloat)(ctx->Color.ColorMask[0][RCOMP] ? 1 : 0); - params[1] = (GLfloat)(ctx->Color.ColorMask[0][GCOMP] ? 1 : 0); - params[2] = (GLfloat)(ctx->Color.ColorMask[0][BCOMP] ? 1 : 0); - params[3] = (GLfloat)(ctx->Color.ColorMask[0][ACOMP] ? 1 : 0); - break; - case GL_CULL_FACE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.CullFlag); - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; - params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; - break; - case GL_CURRENT_INDEX: - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; - break; - case GL_CURRENT_NORMAL: - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = ctx->Current.RasterColor[0]; - params[1] = ctx->Current.RasterColor[1]; - params[2] = ctx->Current.RasterColor[2]; - params[3] = ctx->Current.RasterColor[3]; - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = ctx->Current.RasterDistance; - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = 1.0; - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = ctx->Current.RasterPos[0]; - params[1] = ctx->Current.RasterPos[1]; - params[2] = ctx->Current.RasterPos[2]; - params[3] = ctx->Current.RasterPos[3]; - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = ctx->Current.RasterSecondaryColor[0]; - params[1] = ctx->Current.RasterSecondaryColor[1]; - params[2] = ctx->Current.RasterSecondaryColor[2]; - params[3] = ctx->Current.RasterSecondaryColor[3]; - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = ctx->Current.RasterTexCoords[unit][0]; - params[1] = ctx->Current.RasterTexCoords[unit][1]; - params[2] = ctx->Current.RasterTexCoords[unit][2]; - params[3] = ctx->Current.RasterTexCoords[unit][3]; - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = BOOLEAN_TO_FLOAT(ctx->Current.RasterPosValid); - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]; - params[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]; - } - break; - case GL_DEPTH_BIAS: - params[0] = ctx->Pixel.DepthBias; - break; - case GL_DEPTH_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = ((GLfloat) ctx->Depth.Clear); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = ctx->Viewport.Near; - params[1] = ctx->Viewport.Far; - break; - case GL_DEPTH_SCALE: - params[0] = ctx->Pixel.DepthScale; - break; - case GL_DEPTH_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Test); - break; - case GL_DEPTH_WRITEMASK: - params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Mask); - break; - case GL_DITHER: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.DitherFlag); - break; - case GL_DOUBLEBUFFER: - params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.doubleBufferMode); - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = (GLfloat)(ctx->Feedback.BufferSize); - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.Enabled); - break; - case GL_FOG_COLOR: - params[0] = ctx->Fog.Color[0]; - params[1] = ctx->Fog.Color[1]; - params[2] = ctx->Fog.Color[2]; - params[3] = ctx->Fog.Color[3]; - break; - case GL_FOG_DENSITY: - params[0] = ctx->Fog.Density; - break; - case GL_FOG_END: - params[0] = ctx->Fog.End; - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = ctx->Fog.Index; - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = ctx->Fog.Start; - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = ctx->Pixel.GreenBias; - break; - case GL_GREEN_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits); - break; - case GL_GREEN_SCALE: - params[0] = ctx->Pixel.GreenScale; - break; - case GL_INDEX_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits); - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = (GLfloat)(ctx->Color.ClearIndex); - break; - case GL_INDEX_MODE: - params[0] = BOOLEAN_TO_FLOAT(GL_FALSE); - break; - case GL_INDEX_OFFSET: - params[0] = (GLfloat)(ctx->Pixel.IndexOffset); - break; - case GL_INDEX_SHIFT: - params[0] = (GLfloat)(ctx->Pixel.IndexShift); - break; - case GL_INDEX_WRITEMASK: - params[0] = (GLfloat)(ctx->Color.IndexMask); - break; - case GL_LIGHT0: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[0].Enabled); - break; - case GL_LIGHT1: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[1].Enabled); - break; - case GL_LIGHT2: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[2].Enabled); - break; - case GL_LIGHT3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[3].Enabled); - break; - case GL_LIGHT4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[4].Enabled); - break; - case GL_LIGHT5: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[5].Enabled); - break; - case GL_LIGHT6: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[6].Enabled); - break; - case GL_LIGHT7: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[7].Enabled); - break; - case GL_LIGHTING: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Enabled); - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = ctx->Light.Model.Ambient[0]; - params[1] = ctx->Light.Model.Ambient[1]; - params[2] = ctx->Light.Model.Ambient[2]; - params[3] = ctx->Light.Model.Ambient[3]; - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.LocalViewer); - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.TwoSide); - break; - case GL_LINE_SMOOTH: - params[0] = BOOLEAN_TO_FLOAT(ctx->Line.SmoothFlag); - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Line.StippleFlag); - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = (GLfloat)(ctx->Line.StipplePattern); - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = (GLfloat)(ctx->Line.StippleFactor); - break; - case GL_LINE_WIDTH: - params[0] = ctx->Line.Width; - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = ctx->Const.LineWidthGranularity; - break; - case GL_LINE_WIDTH_RANGE: - params[0] = ctx->Const.MinLineWidthAA; - params[1] = ctx->Const.MaxLineWidthAA; - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = ctx->Const.MinLineWidth; - params[1] = ctx->Const.MaxLineWidth; - break; - case GL_LIST_BASE: - params[0] = (GLfloat)(ctx->List.ListBase); - break; - case GL_LIST_INDEX: - params[0] = (GLfloat)((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_FLOAT(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.IndexLogicOpEnabled); - break; - case GL_COLOR_LOGIC_OP: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.ColorLogicOpEnabled); - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Color4); - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = ctx->Eval.MapGrid1u1; - params[1] = ctx->Eval.MapGrid1u2; - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = (GLfloat)(ctx->Eval.MapGrid1un); - break; - case GL_MAP1_INDEX: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Index); - break; - case GL_MAP1_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Normal); - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord1); - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord2); - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord3); - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord4); - break; - case GL_MAP1_VERTEX_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex3); - break; - case GL_MAP1_VERTEX_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex4); - break; - case GL_MAP2_COLOR_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Color4); - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = ctx->Eval.MapGrid2u1; - params[1] = ctx->Eval.MapGrid2u2; - params[2] = ctx->Eval.MapGrid2v1; - params[3] = ctx->Eval.MapGrid2v2; - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = (GLfloat)(ctx->Eval.MapGrid2un); - params[1] = (GLfloat)(ctx->Eval.MapGrid2vn); - break; - case GL_MAP2_INDEX: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Index); - break; - case GL_MAP2_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Normal); - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord1); - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord2); - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord3); - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord4); - break; - case GL_MAP2_VERTEX_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex3); - break; - case GL_MAP2_VERTEX_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex4); - break; - case GL_MAP_COLOR: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapColorFlag); - break; - case GL_MAP_STENCIL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapStencilFlag); - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(MAX_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(MAX_CLIENT_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIP_PLANES: - params[0] = (GLfloat)(ctx->Const.MaxClipPlanes); - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_EVAL_ORDER: - params[0] = (GLfloat)(MAX_EVAL_ORDER); - break; - case GL_MAX_LIGHTS: - params[0] = (GLfloat)(ctx->Const.MaxLights); - break; - case GL_MAX_LIST_NESTING: - params[0] = (GLfloat)(MAX_LIST_NESTING); - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = (GLfloat)(MAX_MODELVIEW_STACK_DEPTH); - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = (GLfloat)(MAX_NAME_STACK_DEPTH); - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = (GLfloat)(MAX_PIXEL_MAP_TABLE); - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = (GLfloat)(MAX_PROJECTION_STACK_DEPTH); - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = (GLfloat)(1 << (ctx->Const.MaxTextureLevels - 1)); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = (GLfloat)(1 << (ctx->Const.Max3DTextureLevels - 1)); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = (GLfloat)(MAX_TEXTURE_STACK_DEPTH); - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = (GLfloat)(ctx->Const.MaxViewportWidth); - params[1] = (GLfloat)(ctx->Const.MaxViewportHeight); - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = (GLfloat)(ctx->ModelviewMatrixStack.Depth + 1); - break; - case GL_NAME_STACK_DEPTH: - params[0] = (GLfloat)(ctx->Select.NameStackDepth); - break; - case GL_NORMALIZE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.Normalize); - break; - case GL_PACK_ALIGNMENT: - params[0] = (GLfloat)(ctx->Pack.Alignment); - break; - case GL_PACK_LSB_FIRST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.LsbFirst); - break; - case GL_PACK_ROW_LENGTH: - params[0] = (GLfloat)(ctx->Pack.RowLength); - break; - case GL_PACK_SKIP_PIXELS: - params[0] = (GLfloat)(ctx->Pack.SkipPixels); - break; - case GL_PACK_SKIP_ROWS: - params[0] = (GLfloat)(ctx->Pack.SkipRows); - break; - case GL_PACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.SwapBytes); - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = (GLfloat)(ctx->Pack.SkipImages); - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = (GLfloat)(ctx->Pack.ImageHeight); - break; - case GL_PACK_INVERT_MESA: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.Invert); - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.AtoA.Size); - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.BtoB.Size); - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.GtoG.Size); - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoA.Size); - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoB.Size); - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoG.Size); - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoI.Size); - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoR.Size); - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.RtoR.Size); - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.StoS.Size); - break; - case GL_POINT_SIZE: - params[0] = ctx->Point.Size; - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = ctx->Const.PointSizeGranularity; - break; - case GL_POINT_SIZE_RANGE: - params[0] = ctx->Const.MinPointSizeAA; - params[1] = ctx->Const.MaxPointSizeAA; - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = ctx->Const.MinPointSize; - params[1] = ctx->Const.MaxPointSize; - break; - case GL_POINT_SMOOTH: - params[0] = BOOLEAN_TO_FLOAT(ctx->Point.SmoothFlag); - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = ctx->Point.MinSize; - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = ctx->Point.MaxSize; - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = ctx->Point.Threshold; - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = ctx->Point.Params[0]; - params[1] = ctx->Point.Params[1]; - params[2] = ctx->Point.Params[2]; - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = ctx->Polygon.OffsetUnits; - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = ctx->Polygon.OffsetFactor ; - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = ctx->Polygon.OffsetUnits ; - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetPoint); - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetLine); - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetFill); - break; - case GL_POLYGON_SMOOTH: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag); - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.StippleFlag); - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = (GLfloat)(ctx->ProjectionMatrixStack.Depth + 1); - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_FLOAT(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = ctx->Pixel.RedBias; - break; - case GL_RED_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.redBits); - break; - case GL_RED_SCALE: - params[0] = ctx->Pixel.RedScale; - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_FLOAT(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RescaleNormals); - break; - case GL_RGBA_MODE: - params[0] = BOOLEAN_TO_FLOAT(GL_TRUE); - break; - case GL_SCISSOR_BOX: - params[0] = (GLfloat)(ctx->Scissor.X); - params[1] = (GLfloat)(ctx->Scissor.Y); - params[2] = (GLfloat)(ctx->Scissor.Width); - params[3] = (GLfloat)(ctx->Scissor.Height); - break; - case GL_SCISSOR_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Scissor.Enabled); - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = (GLfloat)(ctx->Select.BufferSize); - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_FLOAT(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.SharedPalette); - break; - case GL_STENCIL_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.stencilBits); - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = (GLfloat)(ctx->Stencil.Clear); - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = (GLfloat)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.Enabled); - break; - case GL_STENCIL_VALUE_MASK: - params[0] = (GLfloat)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_WRITEMASK: - params[0] = (GLfloat)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); - break; - case GL_STEREO: - params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.stereoMode); - break; - case GL_SUBPIXEL_BITS: - params[0] = (GLfloat)(ctx->Const.SubPixelBits); - break; - case GL_TEXTURE_1D: - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D)); - break; - case GL_TEXTURE_2D: - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D)); - break; - case GL_TEXTURE_3D: - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D)); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_3D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); - break; - case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = (GLfloat)(ctx->Const.MaxArrayTextureLayers); - break; - case GL_TEXTURE_GEN_S: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_T: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_R: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_Q: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = (GLfloat)(ctx->TextureMatrixStack[unit].Depth + 1); - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = (GLfloat)(ctx->Unpack.Alignment); - break; - case GL_UNPACK_LSB_FIRST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.LsbFirst); - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = (GLfloat)(ctx->Unpack.RowLength); - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = (GLfloat)(ctx->Unpack.SkipPixels); - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = (GLfloat)(ctx->Unpack.SkipRows); - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.SwapBytes); - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = (GLfloat)(ctx->Unpack.SkipImages); - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = (GLfloat)(ctx->Unpack.ImageHeight); - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.ClientStorage); - break; - case GL_VIEWPORT: - params[0] = (GLfloat)(ctx->Viewport.X); - params[1] = (GLfloat)(ctx->Viewport.Y); - params[2] = (GLfloat)(ctx->Viewport.Width); - params[3] = (GLfloat)(ctx->Viewport.Height); - break; - case GL_ZOOM_X: - params[0] = ctx->Pixel.ZoomX; - break; - case GL_ZOOM_Y: - params[0] = ctx->Pixel.ZoomY; - break; - case GL_VERTEX_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->Vertex.Enabled); - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Vertex.Size); - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Vertex.Stride); - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Normal.Stride); - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_COLOR_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->Color.Enabled); - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Color.Size); - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Color.Stride); - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_INDEX_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->Index.Enabled); - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Index.Stride); - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->EdgeFlag.Enabled); - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->EdgeFlag.Stride); - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = (GLfloat)(ctx->Const.MaxTextureUnits); - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = (GLfloat)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = (GLfloat)(ctx->Hint.TextureCompression); - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_FLOAT(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = (GLfloat)(ctx->Array.LockFirst); - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = (GLfloat)(ctx->Array.LockCount); - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLfloat)(ctx->ColorMatrixStack.Depth + 1); - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLfloat)(MAX_COLOR_STACK_DEPTH); - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[0]; - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[1]; - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[2]; - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[3]; - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[0]; - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[1]; - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[2]; - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[3]; - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution1DEnabled); - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution2DEnabled); - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Separable2DEnabled); - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionScale[0]; - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionScale[1]; - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionScale[2]; - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionScale[3]; - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionBias[0]; - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionBias[1]; - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionBias[2]; - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = ctx->Pixel.PostConvolutionBias[3]; - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.HistogramEnabled); - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MinMaxEnabled); - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table); - params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled); - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color); - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; - params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]; - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->SecondaryColor.Enabled); - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = (GLfloat)(ctx->Array.ArrayObj->SecondaryColor.Stride); - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = (GLfloat)(ctx->Array.ArrayObj->SecondaryColor.Size); - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord); - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->FogCoord.Enabled); - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = (GLfloat)(ctx->Array.ArrayObj->FogCoord.Stride); - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_FLOAT(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias); - params[0] = ctx->Const.MaxTextureLodBias; - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic); - params[0] = ctx->Const.MaxTextureMaxAnisotropy; - break; - case GL_MULTISAMPLE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.Enabled); - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToCoverage); - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToOne); - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverage); - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = ctx->Multisample.SampleCoverageValue; - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverageInvert); - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.sampleBuffers); - break; - case GL_SAMPLES_ARB: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.samples); - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip); - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped); - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite); - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite); - params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap); - params[0] = ENUM_TO_FLOAT(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = (GLfloat)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[0].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[1].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[2].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[3].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[4].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[5].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[6].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[7].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[8].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[9].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[10].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[11].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[12].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[13].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[14].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[15].Enabled); - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[0]); - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[1]); - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[2]); - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[3]); - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[4]); - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[5]); - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[6]); - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[7]); - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[8]); - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[9]); - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[10]); - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[11]); - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[12]); - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[13]); - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[14]); - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[15]); - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = (GLfloat)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = (GLfloat)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = (GLfloat)(ctx->Const.MaxTextureRectSize); - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.TestTwoSide); - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = ctx->Const.MaxShininess; - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = ctx->Const.MaxSpotExponent; - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayBufferObj->Name); - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Vertex.BufferObj->Name); - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Normal.BufferObj->Name); - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Color.BufferObj->Name); - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Index.BufferObj->Name); - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ElementArrayBufferObj->Name); - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = (GLfloat)(ctx->Pack.BufferObj->Name); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = (GLfloat)(ctx->Unpack.BufferObj->Name); - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.Enabled); - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.PointSizeEnabled); - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.TwoSideEnabled); - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = (GLfloat)(ctx->Const.MaxProgramMatrixStackDepth); - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = (GLfloat)(ctx->Const.MaxProgramMatrices); - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->CurrentStack->Depth + 1); - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program); - params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxAttribs); - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program); - params[0] = (GLfloat)(ctx->Program.ErrorPos); - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program); - params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = (GLfloat)(ctx->Const.MaxTextureCoordUnits); - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = (GLfloat)(ctx->Const.MaxTextureImageUnits); - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest); - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = ctx->Depth.BoundsMin; - params[1] = ctx->Depth.BoundsMax; - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp); - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.DepthClamp); - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers); - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_FLOAT(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_FLOAT(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_FLOAT(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(_mesa_get_color_read_type(ctx)); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLfloat)(_mesa_get_color_read_format(ctx)); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(6); - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(8); - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(2); - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(8); - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(16); - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = BOOLEAN_TO_FLOAT(GL_TRUE); - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(3); - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLfloat)(3); - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]); - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = (GLfloat)(ctx->Stencil.WriteMask[1]); - break; - case GL_STENCIL_BACK_REF: - params[0] = (GLfloat)(ctx->Stencil.Ref[1]); - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLfloat)(ctx->DrawBuffer->Name); - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLfloat)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLfloat)(ctx->Const.MaxColorAttachments); - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize); - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit); - params[0] = (GLfloat)(ctx->ReadBuffer->Name); - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ProvokingVertex); - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = BOOLEAN_TO_FLOAT(ctx->Const.QuadsFollowProvokingVertexConvention); - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = (GLfloat)(ctx->Const.FragmentProgram.MaxUniformComponents); - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = ENUM_TO_FLOAT(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxUniformComponents); - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLfloat)(ctx->Const.MaxVarying * 4); - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLfloat)(ctx->Const.MaxVertexTextureImageUnits); - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLfloat)(ctx->Const.MaxCombinedTextureImageUnits); - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects); - params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object); - params[0] = (GLfloat)(ctx->Const.MaxSamples); - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object); - params[0] = (GLfloat)(ctx->Array.ArrayObj->Name); - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map); - params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.CubeMapSeamless); - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync); - params[0] = (GLfloat)(ctx->Const.MaxServerWaitTimeout); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLfloat)(ctx->TransformFeedback.CurrentBuffer->Name); - break; - case GL_RASTERIZER_DISCARD: - CHECK_EXT1(EXT_transform_feedback); - params[0] = BOOLEAN_TO_FLOAT(ctx->TransformFeedback.RasterDiscard); - break; - case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackInterleavedComponents); - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateAttribs); - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateComponents); - break; - case GL_NUM_EXTENSIONS: - CHECK_VERSION(30); - params[0] = (GLfloat)(_mesa_get_extension_count(ctx)); - break; - case GL_MAJOR_VERSION: - CHECK_VERSION(30); - params[0] = (GLfloat)(ctx->VersionMajor); - break; - case GL_MINOR_VERSION: - CHECK_VERSION(30); - params[0] = (GLfloat)(ctx->VersionMinor); - break; - case GL_CONTEXT_FLAGS: - CHECK_VERSION(30); - params[0] = (GLfloat)(ctx->Const.ContextFlags); - break; - case GL_PRIMITIVE_RESTART: - CHECK_VERSION(31); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.PrimitiveRestart); - break; - case GL_PRIMITIVE_RESTART_INDEX: - CHECK_VERSION(31); - params[0] = (GLfloat)(ctx->Array.RestartIndex); - break; - case GL_CONTEXT_PROFILE_MASK: - CHECK_VERSION(32); - params[0] = (GLfloat)(ctx->Const.ProfileMask); - break; - default: - goto invalid_enum_error; + /* If the enum isn't valid, the hash walk ends with index 0, + * which is the API mask entry at the beginning of values[]. */ + if (d->type == TYPE_API_MASK) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname); + return &error_value; + } + hash += prime_step; } - return; -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); + if (unlikely(d->extra && !check_extra(ctx, func, d))) + return &error_value; + + switch (d->location) { + case LOC_BUFFER: + *p = ((char *) ctx->DrawBuffer + d->offset); + return d; + case LOC_CONTEXT: + *p = ((char *) ctx + d->offset); + return d; + case LOC_ARRAY: + *p = ((char *) ctx->Array.ArrayObj + d->offset); + return d; + case LOC_TEXUNIT: + unit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + *p = ((char *) unit + d->offset); + return d; + case LOC_CUSTOM: + find_custom_value(ctx, d, v); + *p = v; + return d; + default: + assert(0); + break; + + } } +static const int transpose[] = { + 0, 4, 8, 12, + 1, 5, 9, 13, + 2, 6, 10, 14, + 3, 7, 11, 15 +}; + void GLAPIENTRY -_mesa_GetIntegerv( GLenum pname, GLint *params ) +_mesa_GetBooleanv(GLenum pname, GLboolean *params) { - GET_CURRENT_CONTEXT(ctx); - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetBooleanv", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = INT_TO_BOOLEAN(d->offset); + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.accumRedBits; - break; - case GL_ACCUM_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.accumGreenBits; - break; - case GL_ACCUM_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.accumBlueBits; - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.accumAlphaBits; - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(ctx->Accum.ClearColor[0]); - params[1] = FLOAT_TO_INT(ctx->Accum.ClearColor[1]); - params[2] = FLOAT_TO_INT(ctx->Accum.ClearColor[2]); - params[3] = FLOAT_TO_INT(ctx->Accum.ClearColor[3]); - break; - case GL_ALPHA_BIAS: - params[0] = IROUND(ctx->Pixel.AlphaBias); - break; - case GL_ALPHA_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = ctx->DrawBuffer->Visual.alphaBits; - break; - case GL_ALPHA_SCALE: - params[0] = IROUND(ctx->Pixel.AlphaScale); - break; - case GL_ALPHA_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Color.AlphaEnabled); - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_INT(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = FLOAT_TO_INT(ctx->Color.AlphaRef); - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = ctx->AttribStackDepth; - break; - case GL_AUTO_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Eval.AutoNormal); - break; - case GL_AUX_BUFFERS: - params[0] = ctx->DrawBuffer->Visual.numAuxBuffers; - break; - case GL_BLEND: - params[0] = BOOLEAN_TO_INT((ctx->Color.BlendEnabled & 1)); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_INT(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = FLOAT_TO_INT(ctx->Color.BlendColor[0]); - params[1] = FLOAT_TO_INT(ctx->Color.BlendColor[1]); - params[2] = FLOAT_TO_INT(ctx->Color.BlendColor[2]); - params[3] = FLOAT_TO_INT(ctx->Color.BlendColor[3]); - break; - case GL_BLUE_BIAS: - params[0] = IROUND(ctx->Pixel.BlueBias); - break; - case GL_BLUE_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = ctx->DrawBuffer->Visual.blueBits; - break; - case GL_BLUE_SCALE: - params[0] = IROUND(ctx->Pixel.BlueScale); - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = ctx->ClientAttribStackDepth; - break; - case GL_CLIP_PLANE0: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); - break; - case GL_CLIP_PLANE1: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); - break; - case GL_CLIP_PLANE2: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); - break; - case GL_CLIP_PLANE3: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); - break; - case GL_CLIP_PLANE4: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); - break; - case GL_CLIP_PLANE5: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(ctx->Color.ClearColor[0]); - params[1] = FLOAT_TO_INT(ctx->Color.ClearColor[1]); - params[2] = FLOAT_TO_INT(ctx->Color.ClearColor[2]); - params[3] = FLOAT_TO_INT(ctx->Color.ClearColor[3]); - break; - case GL_COLOR_MATERIAL: - params[0] = BOOLEAN_TO_INT(ctx->Light.ColorMaterialEnabled); - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = ctx->Color.ColorMask[0][RCOMP] ? 1 : 0; - params[1] = ctx->Color.ColorMask[0][GCOMP] ? 1 : 0; - params[2] = ctx->Color.ColorMask[0][BCOMP] ? 1 : 0; - params[3] = ctx->Color.ColorMask[0][ACOMP] ? 1 : 0; - break; - case GL_CULL_FACE: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.CullFlag); - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); - params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); - params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); - params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - break; - case GL_CURRENT_INDEX: - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - break; - case GL_CURRENT_NORMAL: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); - params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); - params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]); - params[1] = FLOAT_TO_INT(ctx->Current.RasterColor[1]); - params[2] = FLOAT_TO_INT(ctx->Current.RasterColor[2]); - params[3] = FLOAT_TO_INT(ctx->Current.RasterColor[3]); - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = IROUND(ctx->Current.RasterDistance); - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = IROUND(1.0); - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = IROUND(ctx->Current.RasterPos[0]); - params[1] = IROUND(ctx->Current.RasterPos[1]); - params[2] = IROUND(ctx->Current.RasterPos[2]); - params[3] = IROUND(ctx->Current.RasterPos[3]); - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[0]); - params[1] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[1]); - params[2] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[2]); - params[3] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[3]); - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = IROUND(ctx->Current.RasterTexCoords[unit][0]); - params[1] = IROUND(ctx->Current.RasterTexCoords[unit][1]); - params[2] = IROUND(ctx->Current.RasterTexCoords[unit][2]); - params[3] = IROUND(ctx->Current.RasterTexCoords[unit][3]); - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = BOOLEAN_TO_INT(ctx->Current.RasterPosValid); - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]); - params[1] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]); - params[2] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]); - params[3] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]); - } - break; - case GL_DEPTH_BIAS: - params[0] = IROUND(ctx->Pixel.DepthBias); - break; - case GL_DEPTH_BITS: - params[0] = ctx->DrawBuffer->Visual.depthBits; - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(((GLfloat) ctx->Depth.Clear)); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_INT(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = FLOAT_TO_INT(ctx->Viewport.Near); - params[1] = FLOAT_TO_INT(ctx->Viewport.Far); - break; - case GL_DEPTH_SCALE: - params[0] = IROUND(ctx->Pixel.DepthScale); - break; - case GL_DEPTH_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Depth.Test); - break; - case GL_DEPTH_WRITEMASK: - params[0] = BOOLEAN_TO_INT(ctx->Depth.Mask); - break; - case GL_DITHER: - params[0] = BOOLEAN_TO_INT(ctx->Color.DitherFlag); - break; - case GL_DOUBLEBUFFER: - params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.doubleBufferMode); - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = ctx->Feedback.BufferSize; - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_INT(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = BOOLEAN_TO_INT(ctx->Fog.Enabled); - break; - case GL_FOG_COLOR: - params[0] = FLOAT_TO_INT(ctx->Fog.Color[0]); - params[1] = FLOAT_TO_INT(ctx->Fog.Color[1]); - params[2] = FLOAT_TO_INT(ctx->Fog.Color[2]); - params[3] = FLOAT_TO_INT(ctx->Fog.Color[3]); - break; - case GL_FOG_DENSITY: - params[0] = IROUND(ctx->Fog.Density); - break; - case GL_FOG_END: - params[0] = IROUND(ctx->Fog.End); - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = IROUND(ctx->Fog.Index); - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_INT(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = IROUND(ctx->Fog.Start); - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_INT(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = IROUND(ctx->Pixel.GreenBias); - break; - case GL_GREEN_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = ctx->DrawBuffer->Visual.greenBits; - break; - case GL_GREEN_SCALE: - params[0] = IROUND(ctx->Pixel.GreenScale); - break; - case GL_INDEX_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = ctx->DrawBuffer->Visual.indexBits; - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = ctx->Color.ClearIndex; - break; - case GL_INDEX_MODE: - params[0] = BOOLEAN_TO_INT(GL_FALSE); - break; - case GL_INDEX_OFFSET: - params[0] = ctx->Pixel.IndexOffset; - break; - case GL_INDEX_SHIFT: - params[0] = ctx->Pixel.IndexShift; - break; - case GL_INDEX_WRITEMASK: - params[0] = ctx->Color.IndexMask; - break; - case GL_LIGHT0: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[0].Enabled); - break; - case GL_LIGHT1: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[1].Enabled); - break; - case GL_LIGHT2: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[2].Enabled); - break; - case GL_LIGHT3: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[3].Enabled); - break; - case GL_LIGHT4: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[4].Enabled); - break; - case GL_LIGHT5: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[5].Enabled); - break; - case GL_LIGHT6: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[6].Enabled); - break; - case GL_LIGHT7: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[7].Enabled); - break; - case GL_LIGHTING: - params[0] = BOOLEAN_TO_INT(ctx->Light.Enabled); - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = FLOAT_TO_INT(ctx->Light.Model.Ambient[0]); - params[1] = FLOAT_TO_INT(ctx->Light.Model.Ambient[1]); - params[2] = FLOAT_TO_INT(ctx->Light.Model.Ambient[2]); - params[3] = FLOAT_TO_INT(ctx->Light.Model.Ambient[3]); - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_INT(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = BOOLEAN_TO_INT(ctx->Light.Model.LocalViewer); - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = BOOLEAN_TO_INT(ctx->Light.Model.TwoSide); - break; - case GL_LINE_SMOOTH: - params[0] = BOOLEAN_TO_INT(ctx->Line.SmoothFlag); - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = BOOLEAN_TO_INT(ctx->Line.StippleFlag); - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = ctx->Line.StipplePattern; - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = ctx->Line.StippleFactor; - break; - case GL_LINE_WIDTH: - params[0] = IROUND(ctx->Line.Width); - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = IROUND(ctx->Const.LineWidthGranularity); - break; - case GL_LINE_WIDTH_RANGE: - params[0] = IROUND(ctx->Const.MinLineWidthAA); - params[1] = IROUND(ctx->Const.MaxLineWidthAA); - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = IROUND(ctx->Const.MinLineWidth); - params[1] = IROUND(ctx->Const.MaxLineWidth); - break; - case GL_LIST_BASE: - params[0] = ctx->List.ListBase; - break; - case GL_LIST_INDEX: - params[0] = (ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_INT(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = BOOLEAN_TO_INT(ctx->Color.IndexLogicOpEnabled); - break; - case GL_COLOR_LOGIC_OP: - params[0] = BOOLEAN_TO_INT(ctx->Color.ColorLogicOpEnabled); - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_INT(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Color4); - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = IROUND(ctx->Eval.MapGrid1u1); - params[1] = IROUND(ctx->Eval.MapGrid1u2); - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid1un; - break; - case GL_MAP1_INDEX: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Index); - break; - case GL_MAP1_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Normal); - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord1); - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord2); - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord3); - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord4); - break; - case GL_MAP1_VERTEX_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex3); - break; - case GL_MAP1_VERTEX_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex4); - break; - case GL_MAP2_COLOR_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Color4); - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = IROUND(ctx->Eval.MapGrid2u1); - params[1] = IROUND(ctx->Eval.MapGrid2u2); - params[2] = IROUND(ctx->Eval.MapGrid2v1); - params[3] = IROUND(ctx->Eval.MapGrid2v2); - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid2un; - params[1] = ctx->Eval.MapGrid2vn; - break; - case GL_MAP2_INDEX: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Index); - break; - case GL_MAP2_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Normal); - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord1); - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord2); - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord3); - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord4); - break; - case GL_MAP2_VERTEX_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex3); - break; - case GL_MAP2_VERTEX_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex4); - break; - case GL_MAP_COLOR: - params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapColorFlag); - break; - case GL_MAP_STENCIL: - params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapStencilFlag); - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_INT(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = MAX_ATTRIB_STACK_DEPTH; - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH; - break; - case GL_MAX_CLIP_PLANES: - params[0] = ctx->Const.MaxClipPlanes; - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = ctx->Const.MaxArrayLockSize; - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = ctx->Const.MaxArrayLockSize; - break; - case GL_MAX_EVAL_ORDER: - params[0] = MAX_EVAL_ORDER; - break; - case GL_MAX_LIGHTS: - params[0] = ctx->Const.MaxLights; - break; - case GL_MAX_LIST_NESTING: - params[0] = MAX_LIST_NESTING; - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = MAX_MODELVIEW_STACK_DEPTH; - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = MAX_NAME_STACK_DEPTH; - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = MAX_PIXEL_MAP_TABLE; - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = MAX_PROJECTION_STACK_DEPTH; - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.MaxTextureLevels - 1); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = MAX_TEXTURE_STACK_DEPTH; - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = ctx->Const.MaxViewportWidth; - params[1] = ctx->Const.MaxViewportHeight; - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = ctx->ModelviewMatrixStack.Depth + 1; - break; - case GL_NAME_STACK_DEPTH: - params[0] = ctx->Select.NameStackDepth; - break; - case GL_NORMALIZE: - params[0] = BOOLEAN_TO_INT(ctx->Transform.Normalize); - break; - case GL_PACK_ALIGNMENT: - params[0] = ctx->Pack.Alignment; - break; - case GL_PACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT(ctx->Pack.LsbFirst); - break; - case GL_PACK_ROW_LENGTH: - params[0] = ctx->Pack.RowLength; - break; - case GL_PACK_SKIP_PIXELS: - params[0] = ctx->Pack.SkipPixels; - break; - case GL_PACK_SKIP_ROWS: - params[0] = ctx->Pack.SkipRows; - break; - case GL_PACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT(ctx->Pack.SwapBytes); - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = ctx->Pack.SkipImages; - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Pack.ImageHeight; - break; - case GL_PACK_INVERT_MESA: - params[0] = BOOLEAN_TO_INT(ctx->Pack.Invert); - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = ctx->PixelMaps.AtoA.Size; - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = ctx->PixelMaps.BtoB.Size; - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = ctx->PixelMaps.GtoG.Size; - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = ctx->PixelMaps.ItoA.Size; - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = ctx->PixelMaps.ItoB.Size; - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = ctx->PixelMaps.ItoG.Size; - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = ctx->PixelMaps.ItoI.Size; - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = ctx->PixelMaps.ItoR.Size; - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = ctx->PixelMaps.RtoR.Size; - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = ctx->PixelMaps.StoS.Size; - break; - case GL_POINT_SIZE: - params[0] = IROUND(ctx->Point.Size); - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = IROUND(ctx->Const.PointSizeGranularity); - break; - case GL_POINT_SIZE_RANGE: - params[0] = IROUND(ctx->Const.MinPointSizeAA); - params[1] = IROUND(ctx->Const.MaxPointSizeAA); - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = IROUND(ctx->Const.MinPointSize); - params[1] = IROUND(ctx->Const.MaxPointSize); - break; - case GL_POINT_SMOOTH: - params[0] = BOOLEAN_TO_INT(ctx->Point.SmoothFlag); - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = IROUND(ctx->Point.MinSize); - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = IROUND(ctx->Point.MaxSize); - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = IROUND(ctx->Point.Threshold); - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = IROUND(ctx->Point.Params[0]); - params[1] = IROUND(ctx->Point.Params[1]); - params[2] = IROUND(ctx->Point.Params[2]); - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_INT(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_INT(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = IROUND(ctx->Polygon.OffsetUnits); - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = IROUND(ctx->Polygon.OffsetFactor ); - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = IROUND(ctx->Polygon.OffsetUnits ); - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetPoint); - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetLine); - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetFill); - break; - case GL_POLYGON_SMOOTH: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag); - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.StippleFlag); - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = ctx->ProjectionMatrixStack.Depth + 1; - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_INT(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = IROUND(ctx->Pixel.RedBias); - break; - case GL_RED_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = ctx->DrawBuffer->Visual.redBits; - break; - case GL_RED_SCALE: - params[0] = IROUND(ctx->Pixel.RedScale); - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_INT(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Transform.RescaleNormals); - break; - case GL_RGBA_MODE: - params[0] = BOOLEAN_TO_INT(GL_TRUE); - break; - case GL_SCISSOR_BOX: - params[0] = ctx->Scissor.X; - params[1] = ctx->Scissor.Y; - params[2] = ctx->Scissor.Width; - params[3] = ctx->Scissor.Height; - break; - case GL_SCISSOR_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Scissor.Enabled); - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = ctx->Select.BufferSize; - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_INT(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = BOOLEAN_TO_INT(ctx->Texture.SharedPalette); - break; - case GL_STENCIL_BITS: - params[0] = ctx->DrawBuffer->Visual.stencilBits; - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = ctx->Stencil.Clear; - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_INT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; - break; - case GL_STENCIL_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Stencil.Enabled); - break; - case GL_STENCIL_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; - break; - case GL_STENCIL_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; - break; - case GL_STEREO: - params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.stereoMode); - break; - case GL_SUBPIXEL_BITS: - params[0] = ctx->Const.SubPixelBits; - break; - case GL_TEXTURE_1D: - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D)); - break; - case GL_TEXTURE_2D: - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D)); - break; - case GL_TEXTURE_3D: - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D)); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_2D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_3D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name; - break; - case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = ctx->Const.MaxArrayTextureLayers; - break; - case GL_TEXTURE_GEN_S: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_T: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_R: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_Q: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = ctx->TextureMatrixStack[unit].Depth + 1; - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = ctx->Unpack.Alignment; - break; - case GL_UNPACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT(ctx->Unpack.LsbFirst); - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = ctx->Unpack.RowLength; - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = ctx->Unpack.SkipPixels; - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = ctx->Unpack.SkipRows; - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT(ctx->Unpack.SwapBytes); - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = ctx->Unpack.SkipImages; - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Unpack.ImageHeight; - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = BOOLEAN_TO_INT(ctx->Unpack.ClientStorage); - break; - case GL_VIEWPORT: - params[0] = ctx->Viewport.X; - params[1] = ctx->Viewport.Y; - params[2] = ctx->Viewport.Width; - params[3] = ctx->Viewport.Height; - break; - case GL_ZOOM_X: - params[0] = IROUND(ctx->Pixel.ZoomX); - break; - case GL_ZOOM_Y: - params[0] = IROUND(ctx->Pixel.ZoomY); - break; - case GL_VERTEX_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->Vertex.Enabled); - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Vertex.Size; - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Vertex.Stride; - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Normal.Stride; - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_COLOR_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->Color.Enabled); - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Color.Size; - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Color.Stride; - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_INDEX_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->Index.Enabled); - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Index.Stride; - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size; - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride; - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->EdgeFlag.Enabled); - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->EdgeFlag.Stride; - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = ctx->Const.MaxTextureUnits; - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name; - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = ctx->Hint.TextureCompression; - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = ctx->Array.LockFirst; - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = ctx->Array.LockCount; - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = ctx->ColorMatrixStack.Depth + 1; - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = MAX_COLOR_STACK_DEPTH; - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[3]); - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[3]); - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution1DEnabled); - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution2DEnabled); - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.Separable2DEnabled); - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[0]); - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[1]); - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[3]); - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[0]); - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[1]); - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[3]); - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.HistogramEnabled); - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.MinMaxEnabled); - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table); - params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled); - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color); - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); - params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); - params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); - params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->SecondaryColor.Enabled); - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Stride; - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Size; - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord); - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->FogCoord.Enabled); - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ctx->Array.ArrayObj->FogCoord.Stride; - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_INT(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias); - params[0] = IROUND(ctx->Const.MaxTextureLodBias); - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic); - params[0] = IROUND(ctx->Const.MaxTextureMaxAnisotropy); - break; - case GL_MULTISAMPLE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.Enabled); - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToCoverage); - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToOne); - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverage); - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = IROUND(ctx->Multisample.SampleCoverageValue); - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverageInvert); - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = ctx->DrawBuffer->Visual.sampleBuffers; - break; - case GL_SAMPLES_ARB: - params[0] = ctx->DrawBuffer->Visual.samples; - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip); - params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped); - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite); - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite); - params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap); - params[0] = ENUM_TO_INT(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[0].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[1].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[2].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[3].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[4].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[5].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[6].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[7].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[8].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[9].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[10].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[11].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[12].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[13].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[14].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[15].Enabled); - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[0]); - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[1]); - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[2]); - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[3]); - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[4]); - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[5]); - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[6]); - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[7]); - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[8]); - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[9]); - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[10]); - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[11]); - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[12]); - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[13]); - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[14]); - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[15]); - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name; - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = ctx->Const.MaxTextureRectSize; - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = BOOLEAN_TO_INT(ctx->Stencil.TestTwoSide); - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = ENUM_TO_INT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = IROUND(ctx->Const.MaxShininess); - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = IROUND(ctx->Const.MaxSpotExponent); - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayBufferObj->Name; - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Vertex.BufferObj->Name; - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Normal.BufferObj->Name; - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Color.BufferObj->Name; - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Index.BufferObj->Name; - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name; - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name; - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->FogCoord.BufferObj->Name; - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ElementArrayBufferObj->Name; - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = ctx->Pack.BufferObj->Name; - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = ctx->Unpack.BufferObj->Name; - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.Enabled); - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.PointSizeEnabled); - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.TwoSideEnabled); - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = ctx->Const.MaxProgramMatrixStackDepth; - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = ctx->Const.MaxProgramMatrices; - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT(ctx->CurrentStack->Depth + 1); - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program); - params[0] = ctx->Const.VertexProgram.MaxAttribs; - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program); - params[0] = ctx->Program.ErrorPos; - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program); - params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = ctx->Const.MaxTextureCoordUnits; - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = ctx->Const.MaxTextureImageUnits; - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest); - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = IROUND(ctx->Depth.BoundsMin); - params[1] = IROUND(ctx->Depth.BoundsMax); - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp); - params[0] = BOOLEAN_TO_INT(ctx->Transform.DepthClamp); - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = ctx->Const.MaxDrawBuffers; - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_INT(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_INT(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_INT(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = _mesa_get_color_read_type(ctx); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = _mesa_get_color_read_format(ctx); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 6; - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 8; - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 2; - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 8; - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 16; - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = BOOLEAN_TO_INT(GL_TRUE); - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 3; - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = 3; - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_INT(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[1]; - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[1]; - break; - case GL_STENCIL_BACK_REF: - params[0] = ctx->Stencil.Ref[1]; - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = ctx->DrawBuffer->Name; - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = ctx->Const.MaxColorAttachments; - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = ctx->Const.MaxRenderbufferSize; - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit); - params[0] = ctx->ReadBuffer->Name; - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = BOOLEAN_TO_INT(ctx->Light.ProvokingVertex); - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = BOOLEAN_TO_INT(ctx->Const.QuadsFollowProvokingVertexConvention); - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = ENUM_TO_INT(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = ctx->Const.VertexProgram.MaxUniformComponents; - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = ctx->Const.MaxVarying * 4; - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = ctx->Const.MaxVertexTextureImageUnits; - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = ctx->Const.MaxCombinedTextureImageUnits; - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects); - params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object); - params[0] = ctx->Const.MaxSamples; - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object); - params[0] = ctx->Array.ArrayObj->Name; - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map); - params[0] = BOOLEAN_TO_INT(ctx->Texture.CubeMapSeamless); - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync); - params[0] = INT64_TO_INT(ctx->Const.MaxServerWaitTimeout); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - params[0] = ctx->TransformFeedback.CurrentBuffer->Name; - break; - case GL_RASTERIZER_DISCARD: - CHECK_EXT1(EXT_transform_feedback); - params[0] = BOOLEAN_TO_INT(ctx->TransformFeedback.RasterDiscard); - break; - case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = ctx->Const.MaxTransformFeedbackInterleavedComponents; - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = ctx->Const.MaxTransformFeedbackSeparateAttribs; - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = ctx->Const.MaxTransformFeedbackSeparateComponents; - break; - case GL_NUM_EXTENSIONS: - CHECK_VERSION(30); - params[0] = _mesa_get_extension_count(ctx); - break; - case GL_MAJOR_VERSION: - CHECK_VERSION(30); - params[0] = ctx->VersionMajor; - break; - case GL_MINOR_VERSION: - CHECK_VERSION(30); - params[0] = ctx->VersionMinor; - break; - case GL_CONTEXT_FLAGS: - CHECK_VERSION(30); - params[0] = ctx->Const.ContextFlags; - break; - case GL_PRIMITIVE_RESTART: - CHECK_VERSION(31); - params[0] = BOOLEAN_TO_INT(ctx->Array.PrimitiveRestart); - break; - case GL_PRIMITIVE_RESTART_INDEX: - CHECK_VERSION(31); - params[0] = ctx->Array.RestartIndex; - break; - case GL_CONTEXT_PROFILE_MASK: - CHECK_VERSION(32); - params[0] = ctx->Const.ProfileMask; - break; - default: - goto invalid_enum_error; + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[1]); + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[0]); + break; + + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_BOOLEAN(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = INT_TO_BOOLEAN(((GLint *) p)[3]); + case TYPE_INT_3: + params[2] = INT_TO_BOOLEAN(((GLint *) p)[2]); + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = INT_TO_BOOLEAN(((GLint *) p)[1]); + case TYPE_INT: + case TYPE_ENUM: + params[0] = INT_TO_BOOLEAN(((GLint *) p)[0]); + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_BOOLEAN(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = INT64_TO_BOOLEAN(((GLint64 *) p)[0]); + break; + + case TYPE_BOOLEAN: + params[0] = ((GLboolean*) p)[0]; + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_BOOLEAN(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_BOOLEAN(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; } - return; +} + +void GLAPIENTRY +_mesa_GetFloatv(GLenum pname, GLfloat *params) +{ + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; + + d = find_value("glGetFloatv", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = (GLfloat) d->offset; + break; + + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = ((GLfloat *) p)[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = ((GLfloat *) p)[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = ((GLfloat *) p)[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = ((GLfloat *) p)[0]; + break; + + case TYPE_DOUBLEN: + params[0] = ((GLdouble *) p)[0]; + break; -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); + case TYPE_INT_4: + params[3] = (GLfloat) (((GLint *) p)[3]); + case TYPE_INT_3: + params[2] = (GLfloat) (((GLint *) p)[2]); + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = (GLfloat) (((GLint *) p)[1]); + case TYPE_INT: + case TYPE_ENUM: + params[0] = (GLfloat) (((GLint *) p)[0]); + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_FLOAT(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_FLOAT(*(GLboolean*) p); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[transpose[i]]; + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = BOOLEAN_TO_FLOAT((*(GLbitfield *) p >> shift) & 1); + break; + } } -#if FEATURE_ARB_sync void GLAPIENTRY -_mesa_GetInteger64v( GLenum pname, GLint64 *params ) +_mesa_GetIntegerv(GLenum pname, GLint *params) { - GET_CURRENT_CONTEXT(ctx); - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetIntegerv", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = d->offset; + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumRedBits); - break; - case GL_ACCUM_GREEN_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumGreenBits); - break; - case GL_ACCUM_BLUE_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumBlueBits); - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumAlphaBits); - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = FLOAT_TO_INT64(ctx->Accum.ClearColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Accum.ClearColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Accum.ClearColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Accum.ClearColor[3]); - break; - case GL_ALPHA_BIAS: - params[0] = IROUND64(ctx->Pixel.AlphaBias); - break; - case GL_ALPHA_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits); - break; - case GL_ALPHA_SCALE: - params[0] = IROUND64(ctx->Pixel.AlphaScale); - break; - case GL_ALPHA_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Color.AlphaEnabled); - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_INT64(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = FLOAT_TO_INT64(ctx->Color.AlphaRef); - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(ctx->AttribStackDepth); - break; - case GL_AUTO_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.AutoNormal); - break; - case GL_AUX_BUFFERS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.numAuxBuffers); - break; - case GL_BLEND: - params[0] = BOOLEAN_TO_INT64((ctx->Color.BlendEnabled & 1)); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_INT64(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_INT64(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_INT64(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = FLOAT_TO_INT64(ctx->Color.BlendColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Color.BlendColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Color.BlendColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Color.BlendColor[3]); - break; - case GL_BLUE_BIAS: - params[0] = IROUND64(ctx->Pixel.BlueBias); - break; - case GL_BLUE_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits); - break; - case GL_BLUE_SCALE: - params[0] = IROUND64(ctx->Pixel.BlueScale); - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(ctx->ClientAttribStackDepth); - break; - case GL_CLIP_PLANE0: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 0) & 1); - break; - case GL_CLIP_PLANE1: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 1) & 1); - break; - case GL_CLIP_PLANE2: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 2) & 1); - break; - case GL_CLIP_PLANE3: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 3) & 1); - break; - case GL_CLIP_PLANE4: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 4) & 1); - break; - case GL_CLIP_PLANE5: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 5) & 1); - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = FLOAT_TO_INT64(ctx->Color.ClearColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Color.ClearColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Color.ClearColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Color.ClearColor[3]); - break; - case GL_COLOR_MATERIAL: - params[0] = BOOLEAN_TO_INT64(ctx->Light.ColorMaterialEnabled); - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_INT64(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_INT64(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = (GLint64)(ctx->Color.ColorMask[0][RCOMP] ? 1 : 0); - params[1] = (GLint64)(ctx->Color.ColorMask[0][GCOMP] ? 1 : 0); - params[2] = (GLint64)(ctx->Color.ColorMask[0][BCOMP] ? 1 : 0); - params[3] = (GLint64)(ctx->Color.ColorMask[0][ACOMP] ? 1 : 0); - break; - case GL_CULL_FACE: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.CullFlag); - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_INT64(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); - params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); - params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); - params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - break; - case GL_CURRENT_INDEX: - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - break; - case GL_CURRENT_NORMAL: - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); - params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); - params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = FLOAT_TO_INT64(ctx->Current.RasterColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Current.RasterColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Current.RasterColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Current.RasterColor[3]); - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = IROUND64(ctx->Current.RasterDistance); - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = IROUND64(1.0); - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = IROUND64(ctx->Current.RasterPos[0]); - params[1] = IROUND64(ctx->Current.RasterPos[1]); - params[2] = IROUND64(ctx->Current.RasterPos[2]); - params[3] = IROUND64(ctx->Current.RasterPos[3]); - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[3]); - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = IROUND64(ctx->Current.RasterTexCoords[unit][0]); - params[1] = IROUND64(ctx->Current.RasterTexCoords[unit][1]); - params[2] = IROUND64(ctx->Current.RasterTexCoords[unit][2]); - params[3] = IROUND64(ctx->Current.RasterTexCoords[unit][3]); - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = BOOLEAN_TO_INT64(ctx->Current.RasterPosValid); - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]); - params[1] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]); - params[2] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]); - params[3] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]); - } - break; - case GL_DEPTH_BIAS: - params[0] = IROUND64(ctx->Pixel.DepthBias); - break; - case GL_DEPTH_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.depthBits); - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_INT64(((GLfloat) ctx->Depth.Clear)); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_INT64(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = FLOAT_TO_INT64(ctx->Viewport.Near); - params[1] = FLOAT_TO_INT64(ctx->Viewport.Far); - break; - case GL_DEPTH_SCALE: - params[0] = IROUND64(ctx->Pixel.DepthScale); - break; - case GL_DEPTH_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Depth.Test); - break; - case GL_DEPTH_WRITEMASK: - params[0] = BOOLEAN_TO_INT64(ctx->Depth.Mask); - break; - case GL_DITHER: - params[0] = BOOLEAN_TO_INT64(ctx->Color.DitherFlag); - break; - case GL_DOUBLEBUFFER: - params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.doubleBufferMode); - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_INT64((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = (GLint64)(ctx->Feedback.BufferSize); - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_INT64(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = BOOLEAN_TO_INT64(ctx->Fog.Enabled); - break; - case GL_FOG_COLOR: - params[0] = FLOAT_TO_INT64(ctx->Fog.Color[0]); - params[1] = FLOAT_TO_INT64(ctx->Fog.Color[1]); - params[2] = FLOAT_TO_INT64(ctx->Fog.Color[2]); - params[3] = FLOAT_TO_INT64(ctx->Fog.Color[3]); - break; - case GL_FOG_DENSITY: - params[0] = IROUND64(ctx->Fog.Density); - break; - case GL_FOG_END: - params[0] = IROUND64(ctx->Fog.End); - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = IROUND64(ctx->Fog.Index); - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_INT64(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = IROUND64(ctx->Fog.Start); - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_INT64(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = IROUND64(ctx->Pixel.GreenBias); - break; - case GL_GREEN_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits); - break; - case GL_GREEN_SCALE: - params[0] = IROUND64(ctx->Pixel.GreenScale); - break; - case GL_INDEX_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits); - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = (GLint64)(ctx->Color.ClearIndex); - break; - case GL_INDEX_MODE: - params[0] = BOOLEAN_TO_INT64(GL_FALSE); - break; - case GL_INDEX_OFFSET: - params[0] = (GLint64)(ctx->Pixel.IndexOffset); - break; - case GL_INDEX_SHIFT: - params[0] = (GLint64)(ctx->Pixel.IndexShift); - break; - case GL_INDEX_WRITEMASK: - params[0] = (GLint64)(ctx->Color.IndexMask); - break; - case GL_LIGHT0: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[0].Enabled); - break; - case GL_LIGHT1: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[1].Enabled); - break; - case GL_LIGHT2: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[2].Enabled); - break; - case GL_LIGHT3: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[3].Enabled); - break; - case GL_LIGHT4: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[4].Enabled); - break; - case GL_LIGHT5: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[5].Enabled); - break; - case GL_LIGHT6: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[6].Enabled); - break; - case GL_LIGHT7: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[7].Enabled); - break; - case GL_LIGHTING: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Enabled); - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[0]); - params[1] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[1]); - params[2] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[2]); - params[3] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[3]); - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_INT64(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Model.LocalViewer); - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Model.TwoSide); - break; - case GL_LINE_SMOOTH: - params[0] = BOOLEAN_TO_INT64(ctx->Line.SmoothFlag); - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = BOOLEAN_TO_INT64(ctx->Line.StippleFlag); - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = (GLint64)(ctx->Line.StipplePattern); - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = (GLint64)(ctx->Line.StippleFactor); - break; - case GL_LINE_WIDTH: - params[0] = IROUND64(ctx->Line.Width); - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = IROUND64(ctx->Const.LineWidthGranularity); - break; - case GL_LINE_WIDTH_RANGE: - params[0] = IROUND64(ctx->Const.MinLineWidthAA); - params[1] = IROUND64(ctx->Const.MaxLineWidthAA); - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = IROUND64(ctx->Const.MinLineWidth); - params[1] = IROUND64(ctx->Const.MaxLineWidth); - break; - case GL_LIST_BASE: - params[0] = (GLint64)(ctx->List.ListBase); - break; - case GL_LIST_INDEX: - params[0] = (GLint64)((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_INT64(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = BOOLEAN_TO_INT64(ctx->Color.IndexLogicOpEnabled); - break; - case GL_COLOR_LOGIC_OP: - params[0] = BOOLEAN_TO_INT64(ctx->Color.ColorLogicOpEnabled); - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_INT64(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Color4); - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = IROUND64(ctx->Eval.MapGrid1u1); - params[1] = IROUND64(ctx->Eval.MapGrid1u2); - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = (GLint64)(ctx->Eval.MapGrid1un); - break; - case GL_MAP1_INDEX: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Index); - break; - case GL_MAP1_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Normal); - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord1); - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord2); - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord3); - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord4); - break; - case GL_MAP1_VERTEX_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Vertex3); - break; - case GL_MAP1_VERTEX_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Vertex4); - break; - case GL_MAP2_COLOR_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Color4); - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = IROUND64(ctx->Eval.MapGrid2u1); - params[1] = IROUND64(ctx->Eval.MapGrid2u2); - params[2] = IROUND64(ctx->Eval.MapGrid2v1); - params[3] = IROUND64(ctx->Eval.MapGrid2v2); - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = (GLint64)(ctx->Eval.MapGrid2un); - params[1] = (GLint64)(ctx->Eval.MapGrid2vn); - break; - case GL_MAP2_INDEX: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Index); - break; - case GL_MAP2_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Normal); - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord1); - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord2); - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord3); - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord4); - break; - case GL_MAP2_VERTEX_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Vertex3); - break; - case GL_MAP2_VERTEX_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Vertex4); - break; - case GL_MAP_COLOR: - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.MapColorFlag); - break; - case GL_MAP_STENCIL: - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.MapStencilFlag); - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_INT64(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(MAX_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(MAX_CLIENT_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIP_PLANES: - params[0] = (GLint64)(ctx->Const.MaxClipPlanes); - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_EVAL_ORDER: - params[0] = (GLint64)(MAX_EVAL_ORDER); - break; - case GL_MAX_LIGHTS: - params[0] = (GLint64)(ctx->Const.MaxLights); - break; - case GL_MAX_LIST_NESTING: - params[0] = (GLint64)(MAX_LIST_NESTING); - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = (GLint64)(MAX_MODELVIEW_STACK_DEPTH); - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = (GLint64)(MAX_NAME_STACK_DEPTH); - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = (GLint64)(MAX_PIXEL_MAP_TABLE); - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = (GLint64)(MAX_PROJECTION_STACK_DEPTH); - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = (GLint64)(1 << (ctx->Const.MaxTextureLevels - 1)); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = (GLint64)(1 << (ctx->Const.Max3DTextureLevels - 1)); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = (GLint64)(MAX_TEXTURE_STACK_DEPTH); - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = (GLint64)(ctx->Const.MaxViewportWidth); - params[1] = (GLint64)(ctx->Const.MaxViewportHeight); - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = (GLint64)(ctx->ModelviewMatrixStack.Depth + 1); - break; - case GL_NAME_STACK_DEPTH: - params[0] = (GLint64)(ctx->Select.NameStackDepth); - break; - case GL_NORMALIZE: - params[0] = BOOLEAN_TO_INT64(ctx->Transform.Normalize); - break; - case GL_PACK_ALIGNMENT: - params[0] = (GLint64)(ctx->Pack.Alignment); - break; - case GL_PACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT64(ctx->Pack.LsbFirst); - break; - case GL_PACK_ROW_LENGTH: - params[0] = (GLint64)(ctx->Pack.RowLength); - break; - case GL_PACK_SKIP_PIXELS: - params[0] = (GLint64)(ctx->Pack.SkipPixels); - break; - case GL_PACK_SKIP_ROWS: - params[0] = (GLint64)(ctx->Pack.SkipRows); - break; - case GL_PACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT64(ctx->Pack.SwapBytes); - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = (GLint64)(ctx->Pack.SkipImages); - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = (GLint64)(ctx->Pack.ImageHeight); - break; - case GL_PACK_INVERT_MESA: - params[0] = BOOLEAN_TO_INT64(ctx->Pack.Invert); - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.AtoA.Size); - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.BtoB.Size); - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.GtoG.Size); - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoA.Size); - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoB.Size); - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoG.Size); - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoI.Size); - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoR.Size); - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.RtoR.Size); - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.StoS.Size); - break; - case GL_POINT_SIZE: - params[0] = IROUND64(ctx->Point.Size); - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = IROUND64(ctx->Const.PointSizeGranularity); - break; - case GL_POINT_SIZE_RANGE: - params[0] = IROUND64(ctx->Const.MinPointSizeAA); - params[1] = IROUND64(ctx->Const.MaxPointSizeAA); - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = IROUND64(ctx->Const.MinPointSize); - params[1] = IROUND64(ctx->Const.MaxPointSize); - break; - case GL_POINT_SMOOTH: - params[0] = BOOLEAN_TO_INT64(ctx->Point.SmoothFlag); - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = IROUND64(ctx->Point.MinSize); - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = IROUND64(ctx->Point.MaxSize); - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = IROUND64(ctx->Point.Threshold); - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = IROUND64(ctx->Point.Params[0]); - params[1] = IROUND64(ctx->Point.Params[1]); - params[2] = IROUND64(ctx->Point.Params[2]); - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_INT64(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_INT64(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = IROUND64(ctx->Polygon.OffsetUnits); - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = IROUND64(ctx->Polygon.OffsetFactor ); - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = IROUND64(ctx->Polygon.OffsetUnits ); - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.OffsetPoint); - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.OffsetLine); - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.OffsetFill); - break; - case GL_POLYGON_SMOOTH: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.SmoothFlag); - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.StippleFlag); - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = (GLint64)(ctx->ProjectionMatrixStack.Depth + 1); - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_INT64(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = IROUND64(ctx->Pixel.RedBias); - break; - case GL_RED_BITS: - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits); - break; - case GL_RED_SCALE: - params[0] = IROUND64(ctx->Pixel.RedScale); - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_INT64(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Transform.RescaleNormals); - break; - case GL_RGBA_MODE: - params[0] = BOOLEAN_TO_INT64(GL_TRUE); - break; - case GL_SCISSOR_BOX: - params[0] = (GLint64)(ctx->Scissor.X); - params[1] = (GLint64)(ctx->Scissor.Y); - params[2] = (GLint64)(ctx->Scissor.Width); - params[3] = (GLint64)(ctx->Scissor.Height); - break; - case GL_SCISSOR_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Scissor.Enabled); - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = (GLint64)(ctx->Select.BufferSize); - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_INT64(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = BOOLEAN_TO_INT64(ctx->Texture.SharedPalette); - break; - case GL_STENCIL_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.stencilBits); - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = (GLint64)(ctx->Stencil.Clear); - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_INT64(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = (GLint64)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Stencil.Enabled); - break; - case GL_STENCIL_VALUE_MASK: - params[0] = (GLint64)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_WRITEMASK: - params[0] = (GLint64)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); - break; - case GL_STEREO: - params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.stereoMode); - break; - case GL_SUBPIXEL_BITS: - params[0] = (GLint64)(ctx->Const.SubPixelBits); - break; - case GL_TEXTURE_1D: - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_1D)); - break; - case GL_TEXTURE_2D: - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_2D)); - break; - case GL_TEXTURE_3D: - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_3D)); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D: - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_3D: - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); - break; - case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: - CHECK_EXT1(MESA_texture_array); - params[0] = (GLint64)(ctx->Const.MaxArrayTextureLayers); - break; - case GL_TEXTURE_GEN_S: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_T: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_R: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_Q: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = (GLint64)(ctx->TextureMatrixStack[unit].Depth + 1); - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = (GLint64)(ctx->Unpack.Alignment); - break; - case GL_UNPACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT64(ctx->Unpack.LsbFirst); - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = (GLint64)(ctx->Unpack.RowLength); - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = (GLint64)(ctx->Unpack.SkipPixels); - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = (GLint64)(ctx->Unpack.SkipRows); - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT64(ctx->Unpack.SwapBytes); - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = (GLint64)(ctx->Unpack.SkipImages); - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = (GLint64)(ctx->Unpack.ImageHeight); - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = BOOLEAN_TO_INT64(ctx->Unpack.ClientStorage); - break; - case GL_VIEWPORT: - params[0] = (GLint64)(ctx->Viewport.X); - params[1] = (GLint64)(ctx->Viewport.Y); - params[2] = (GLint64)(ctx->Viewport.Width); - params[3] = (GLint64)(ctx->Viewport.Height); - break; - case GL_ZOOM_X: - params[0] = IROUND64(ctx->Pixel.ZoomX); - break; - case GL_ZOOM_Y: - params[0] = IROUND64(ctx->Pixel.ZoomY); - break; - case GL_VERTEX_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Vertex.Enabled); - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Size); - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Stride); - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.Stride); - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_COLOR_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Color.Enabled); - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Size); - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Stride); - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_INDEX_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Index.Enabled); - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Index.Stride); - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->EdgeFlag.Enabled); - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.Stride); - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = (GLint64)(ctx->Const.MaxTextureUnits); - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture); - params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map); - params[0] = (GLint64)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = (GLint64)(ctx->Hint.TextureCompression); - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = (GLint64)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT64(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = (GLint64)(ctx->Array.LockFirst); - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array); - params[0] = (GLint64)(ctx->Array.LockCount); - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLint64)(ctx->ColorMatrixStack.Depth + 1); - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLint64)(MAX_COLOR_STACK_DEPTH); - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[3]); - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[3]); - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.Convolution1DEnabled); - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.Convolution2DEnabled); - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.Separable2DEnabled); - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[0]); - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[1]); - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[3]); - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[0]); - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[1]); - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[3]); - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.HistogramEnabled); - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.MinMaxEnabled); - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table); - params[0] = BOOLEAN_TO_INT64(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Fog.ColorSumEnabled); - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color); - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); - params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); - params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); - params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->SecondaryColor.Enabled); - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Stride); - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color); - params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Size); - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord); - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->FogCoord.Enabled); - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.Stride); - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord); - params[0] = ENUM_TO_INT64(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias); - params[0] = IROUND64(ctx->Const.MaxTextureLodBias); - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic); - params[0] = IROUND64(ctx->Const.MaxTextureMaxAnisotropy); - break; - case GL_MULTISAMPLE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.Enabled); - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleAlphaToCoverage); - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleAlphaToOne); - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleCoverage); - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = IROUND64(ctx->Multisample.SampleCoverageValue); - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleCoverageInvert); - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.sampleBuffers); - break; - case GL_SAMPLES_ARB: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.samples); - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip); - params[0] = BOOLEAN_TO_INT64(ctx->Transform.RasterPositionUnclipped); - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = BOOLEAN_TO_INT64(ctx->Point.PointSprite); - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite); - params[0] = ENUM_TO_INT64(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite); - params[0] = ENUM_TO_INT64(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap); - params[0] = ENUM_TO_INT64(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = (GLint64)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[0].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[1].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[2].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[3].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[4].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[5].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[6].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[7].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[8].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[9].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[10].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[11].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[12].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[13].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[14].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[15].Enabled); - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[0]); - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[1]); - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[2]); - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[3]); - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[4]); - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[5]); - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[6]); - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[7]); - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[8]); - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[9]); - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[10]); - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[11]); - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[12]); - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[13]); - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[14]); - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[15]); - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = BOOLEAN_TO_INT64(ctx->FragmentProgram.Enabled); - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = (GLint64)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program); - params[0] = (GLint64)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle); - params[0] = (GLint64)(ctx->Const.MaxTextureRectSize); - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = BOOLEAN_TO_INT64(ctx->Stencil.TestTwoSide); - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side); - params[0] = ENUM_TO_INT64(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = IROUND64(ctx->Const.MaxShininess); - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent); - params[0] = IROUND64(ctx->Const.MaxSpotExponent); - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayBufferObj->Name); - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.BufferObj->Name); - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.BufferObj->Name); - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Color.BufferObj->Name); - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Index.BufferObj->Name); - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ElementArrayBufferObj->Name); - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = (GLint64)(ctx->Pack.BufferObj->Name); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object); - params[0] = (GLint64)(ctx->Unpack.BufferObj->Name); - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->VertexProgram.Enabled); - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->VertexProgram.PointSizeEnabled); - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->VertexProgram.TwoSideEnabled); - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = (GLint64)(ctx->Const.MaxProgramMatrixStackDepth); - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = (GLint64)(ctx->Const.MaxProgramMatrices); - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program); - params[0] = BOOLEAN_TO_INT64(ctx->CurrentStack->Depth + 1); - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program); - params[0] = (GLint64)(ctx->Const.VertexProgram.MaxAttribs); - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program); - params[0] = (GLint64)(ctx->Program.ErrorPos); - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program); - params[0] = BOOLEAN_TO_INT64(ctx->FragmentProgram.Enabled); - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = (GLint64)(ctx->Const.MaxTextureCoordUnits); - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program); - params[0] = (GLint64)(ctx->Const.MaxTextureImageUnits); - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = BOOLEAN_TO_INT64(ctx->Depth.BoundsTest); - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test); - params[0] = IROUND64(ctx->Depth.BoundsMin); - params[1] = IROUND64(ctx->Depth.BoundsMax); - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp); - params[0] = BOOLEAN_TO_INT64(ctx->Transform.DepthClamp); - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = (GLint64)(ctx->Const.MaxDrawBuffers); - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_INT64(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_INT64(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_INT64(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(_mesa_get_color_read_type(ctx)); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format); - if (ctx->NewState & _NEW_BUFFERS) - _mesa_update_state(ctx); - params[0] = (GLint64)(_mesa_get_color_read_format(ctx)); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(6); - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(8); - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(2); - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(8); - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(16); - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = BOOLEAN_TO_INT64(GL_TRUE); - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(3); - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader); - params[0] = (GLint64)(3); - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_INT64(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = (GLint64)(ctx->Stencil.ValueMask[1]); - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = (GLint64)(ctx->Stencil.WriteMask[1]); - break; - case GL_STENCIL_BACK_REF: - params[0] = (GLint64)(ctx->Stencil.Ref[1]); - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLint64)(ctx->DrawBuffer->Name); - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLint64)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLint64)(ctx->Const.MaxColorAttachments); - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object); - params[0] = (GLint64)(ctx->Const.MaxRenderbufferSize); - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit); - params[0] = (GLint64)(ctx->ReadBuffer->Name); - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = BOOLEAN_TO_INT64(ctx->Light.ProvokingVertex); - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex); - params[0] = BOOLEAN_TO_INT64(ctx->Const.QuadsFollowProvokingVertexConvention); - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = (GLint64)(ctx->Const.FragmentProgram.MaxUniformComponents); - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader); - params[0] = ENUM_TO_INT64(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLint64)(ctx->Const.VertexProgram.MaxUniformComponents); - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLint64)(ctx->Const.MaxVarying * 4); - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLint64)(ctx->Const.MaxVertexTextureImageUnits); - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader); - params[0] = (GLint64)(ctx->Const.MaxCombinedTextureImageUnits); - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects); - params[0] = (GLint64)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object); - params[0] = (GLint64)(ctx->Const.MaxSamples); - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object); - params[0] = (GLint64)(ctx->Array.ArrayObj->Name); - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map); - params[0] = BOOLEAN_TO_INT64(ctx->Texture.CubeMapSeamless); - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync); - params[0] = ctx->Const.MaxServerWaitTimeout; - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLint64)(ctx->TransformFeedback.CurrentBuffer->Name); - break; - case GL_RASTERIZER_DISCARD: - CHECK_EXT1(EXT_transform_feedback); - params[0] = BOOLEAN_TO_INT64(ctx->TransformFeedback.RasterDiscard); - break; - case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackInterleavedComponents); - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateAttribs); - break; - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: - CHECK_EXT1(EXT_transform_feedback); - params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateComponents); - break; - case GL_NUM_EXTENSIONS: - CHECK_VERSION(30); - params[0] = (GLint64)(_mesa_get_extension_count(ctx)); - break; - case GL_MAJOR_VERSION: - CHECK_VERSION(30); - params[0] = (GLint64)(ctx->VersionMajor); - break; - case GL_MINOR_VERSION: - CHECK_VERSION(30); - params[0] = (GLint64)(ctx->VersionMinor); - break; - case GL_CONTEXT_FLAGS: - CHECK_VERSION(30); - params[0] = (GLint64)(ctx->Const.ContextFlags); - break; - case GL_PRIMITIVE_RESTART: - CHECK_VERSION(31); - params[0] = BOOLEAN_TO_INT64(ctx->Array.PrimitiveRestart); - break; - case GL_PRIMITIVE_RESTART_INDEX: - CHECK_VERSION(31); - params[0] = (GLint64)(ctx->Array.RestartIndex); - break; - case GL_CONTEXT_PROFILE_MASK: - CHECK_VERSION(32); - params[0] = (GLint64)(ctx->Const.ProfileMask); - break; - default: - goto invalid_enum_error; + case TYPE_FLOAT_4: + params[3] = IROUND(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + params[2] = IROUND(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + params[1] = IROUND(((GLfloat *) p)[1]); + case TYPE_FLOAT: + params[0] = IROUND(((GLfloat *) p)[0]); + break; + + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_INT(((GLfloat *) p)[3]); + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_INT(((GLfloat *) p)[2]); + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_INT(((GLfloat *) p)[1]); + case TYPE_FLOATN: + params[0] = FLOAT_TO_INT(((GLfloat *) p)[0]); + break; + + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_INT(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = ((GLint *) p)[3]; + case TYPE_INT_3: + params[2] = ((GLint *) p)[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = ((GLint *) p)[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = ((GLint *) p)[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = v.value_int_n.ints[i]; + break; + + case TYPE_INT64: + params[0] = INT64_TO_INT(((GLint64 *) p)[0]); + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_INT(*(GLboolean*) p); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; } - return; +} + +#if FEATURE_ARB_sync +void GLAPIENTRY +_mesa_GetInteger64v(GLenum pname, GLint64 *params) +{ + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; + + d = find_value("glGetInteger64v", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = d->offset; + break; + + case TYPE_FLOAT_4: + params[3] = IROUND64(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + params[2] = IROUND64(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + params[1] = IROUND64(((GLfloat *) p)[1]); + case TYPE_FLOAT: + params[0] = IROUND64(((GLfloat *) p)[0]); + break; + + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_INT64(((GLfloat *) p)[3]); + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_INT64(((GLfloat *) p)[2]); + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_INT64(((GLfloat *) p)[1]); + case TYPE_FLOATN: + params[0] = FLOAT_TO_INT64(((GLfloat *) p)[0]); + break; + + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_INT64(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = ((GLint *) p)[3]; + case TYPE_INT_3: + params[2] = ((GLint *) p)[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = ((GLint *) p)[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = ((GLint *) p)[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_BOOLEAN(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = ((GLboolean*) p)[0]; + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT64(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT64(m->m[transpose[i]]); + break; -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64v(pname=0x%x)", pname); + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; + } } #endif /* FEATURE_ARB_sync */ - void GLAPIENTRY -_mesa_GetDoublev( GLenum pname, GLdouble *params ) +_mesa_GetDoublev(GLenum pname, GLdouble *params) { - const GLfloat magic = -1234.5F; - GLfloat values[16]; - GLuint i; + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetDoublev", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = d->offset; + break; - /* Init temp array to magic numbers so we can figure out how many values - * are returned by the GetFloatv() call. - */ - for (i = 0; i < 16; i++) - values[i] = magic; + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = ((GLfloat *) p)[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = ((GLfloat *) p)[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = ((GLfloat *) p)[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = ((GLfloat *) p)[0]; + break; - _mesa_GetFloatv(pname, values); - - for (i = 0; i < 16 && values[i] != magic; i++) - params[i] = (GLdouble) values[i]; + case TYPE_DOUBLEN: + params[0] = ((GLdouble *) p)[0]; + break; + + case TYPE_INT_4: + params[3] = ((GLint *) p)[3]; + case TYPE_INT_3: + params[2] = ((GLint *) p)[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = ((GLint *) p)[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = ((GLint *) p)[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = v.value_int_n.ints[i]; + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = *(GLboolean*) p; + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[transpose[i]]; + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; + } } -void GLAPIENTRY -_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) +static enum value_type +find_value_indexed(const char *func, GLenum pname, int index, union value *v) { GET_CURRENT_CONTEXT(ctx); - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; - - if (!params) - return; switch (pname) { - case GL_BLEND: - CHECK_EXT1(EXT_draw_buffers2); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - return; - } - params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1)); - break; - case GL_COLOR_WRITEMASK: - CHECK_EXT1(EXT_draw_buffers2); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - return; - } - params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0); - params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0); - params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0); - params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_START: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - return; - } - params[0] = INT64_TO_BOOLEAN(ctx->TransformFeedback.CurrentObject->Offset[index]); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - return; - } - params[0] = INT64_TO_BOOLEAN(ctx->TransformFeedback.CurrentObject->Size[index]); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - return; - } - params[0] = INT_TO_BOOLEAN(ctx->TransformFeedback.CurrentObject->Buffers[index]->Name); - break; - default: - goto invalid_enum_error; + + case GL_BLEND: + if (index >= ctx->Const.MaxDrawBuffers) + goto invalid_value; + if (!ctx->Extensions.EXT_draw_buffers2) + goto invalid_enum; + v->value_int = (ctx->Color.BlendEnabled >> index) & 1; + return TYPE_INT; + + case GL_COLOR_WRITEMASK: + if (index >= ctx->Const.MaxDrawBuffers) + goto invalid_value; + if (!ctx->Extensions.EXT_draw_buffers2) + goto invalid_enum; + v->value_int_4[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0; + v->value_int_4[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0; + v->value_int_4[2] = ctx->Color.ColorMask[index][BCOMP] ? 1 : 0; + v->value_int_4[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; + return TYPE_INT_4; + + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) + goto invalid_value; + if (!ctx->Extensions.EXT_transform_feedback) + goto invalid_enum; + v->value_int64 = ctx->TransformFeedback.CurrentObject->Offset[index]; + return TYPE_INT64; + + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) + goto invalid_value; + if (!ctx->Extensions.EXT_transform_feedback) + goto invalid_enum; + v->value_int64 = ctx->TransformFeedback.CurrentObject->Size[index]; + return TYPE_INT64; + + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) + goto invalid_value; + if (!ctx->Extensions.EXT_transform_feedback) + goto invalid_enum; + v->value_int = ctx->TransformFeedback.CurrentObject->Buffers[index]->Name; + return TYPE_INT; } - return; -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanIndexedv(pname=0x%x)", pname); + invalid_enum: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname); + return TYPE_INVALID; + invalid_value: + _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=0x%x)", func, pname); + return TYPE_INVALID; } void GLAPIENTRY -_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) +_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) { - GET_CURRENT_CONTEXT(ctx); - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; + union value v; - if (!params) - return; - - switch (pname) { - case GL_BLEND: - CHECK_EXT1(EXT_draw_buffers2); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - return; - } - params[0] = ((ctx->Color.BlendEnabled >> index) & 1); - break; - case GL_COLOR_WRITEMASK: - CHECK_EXT1(EXT_draw_buffers2); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - return; - } - params[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0; - params[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0; - params[2] = ctx->Color.ColorMask[index][BCOMP] ? 1 : 0; - params[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_START: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - return; - } - params[0] = INT64_TO_INT(ctx->TransformFeedback.CurrentObject->Offset[index]); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - return; - } - params[0] = INT64_TO_INT(ctx->TransformFeedback.CurrentObject->Size[index]); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - return; - } - params[0] = ctx->TransformFeedback.CurrentObject->Buffers[index]->Name; - break; - default: - goto invalid_enum_error; + switch (find_value_indexed("glGetBooleanIndexedv", pname, index, &v)) { + case TYPE_INT: + params[0] = INT_TO_BOOLEAN(v.value_int); + break; + case TYPE_INT_4: + params[0] = INT_TO_BOOLEAN(v.value_int_4[0]); + params[1] = INT_TO_BOOLEAN(v.value_int_4[1]); + params[2] = INT_TO_BOOLEAN(v.value_int_4[2]); + params[3] = INT_TO_BOOLEAN(v.value_int_4[3]); + break; + case TYPE_INT64: + params[0] = INT64_TO_BOOLEAN(v.value_int); + break; + default: + assert(0); } - return; +} + +void GLAPIENTRY +_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) +{ + union value v; -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerIndexedv(pname=0x%x)", pname); + switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) { + case TYPE_INT: + params[0] = v.value_int; + break; + case TYPE_INT_4: + params[0] = v.value_int_4[0]; + params[1] = v.value_int_4[1]; + params[2] = v.value_int_4[2]; + params[3] = v.value_int_4[3]; + break; + case TYPE_INT64: + params[0] = INT64_TO_INT(v.value_int); + break; + default: + assert(0); + } } #if FEATURE_ARB_sync void GLAPIENTRY _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params ) { - GET_CURRENT_CONTEXT(ctx); - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; - ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) version; + union value v; - if (!params) - return; - - switch (pname) { - case GL_BLEND: - CHECK_EXT1(EXT_draw_buffers2); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - return; - } - params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1)); - break; - case GL_COLOR_WRITEMASK: - CHECK_EXT1(EXT_draw_buffers2); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - return; - } - params[0] = (GLint64)(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0); - params[1] = (GLint64)(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0); - params[2] = (GLint64)(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0); - params[3] = (GLint64)(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_START: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - return; - } - params[0] = ctx->TransformFeedback.CurrentObject->Offset[index]; - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - return; - } - params[0] = ctx->TransformFeedback.CurrentObject->Size[index]; - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - CHECK_EXT1(EXT_transform_feedback); - if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - return; - } - params[0] = (GLint64)(ctx->TransformFeedback.CurrentObject->Buffers[index]->Name); - break; - default: - goto invalid_enum_error; + switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) { + case TYPE_INT: + params[0] = v.value_int; + break; + case TYPE_INT_4: + params[0] = v.value_int_4[0]; + params[1] = v.value_int_4[1]; + params[2] = v.value_int_4[2]; + params[3] = v.value_int_4[3]; + break; + case TYPE_INT64: + params[0] = v.value_int; + break; + default: + assert(0); } - return; - -invalid_enum_error: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64Indexedv(pname=0x%x)", pname); } #endif /* FEATURE_ARB_sync */ +#if FEATURE_ES1 +void GLAPIENTRY +_mesa_GetFixedv(GLenum pname, GLfixed *params) +{ + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; + + d = find_value("glGetDoublev", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = INT_TO_FIXED(d->offset); + break; + + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_FIXED(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_FIXED(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_FIXED(((GLfloat *) p)[1]); + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = FLOAT_TO_FIXED(((GLfloat *) p)[0]); + break; + + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_FIXED(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = INT_TO_FIXED(((GLint *) p)[3]); + case TYPE_INT_3: + params[2] = INT_TO_FIXED(((GLint *) p)[2]); + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = INT_TO_FIXED(((GLint *) p)[1]); + case TYPE_INT: + case TYPE_ENUM: + params[0] = INT_TO_FIXED(((GLint *) p)[0]); + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_FIXED(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_FIXED(((GLboolean*) p)[0]); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_FIXED(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_FIXED(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = BOOLEAN_TO_FIXED((*(GLbitfield *) p >> shift) & 1); + break; + } +} +#endif diff --git a/src/mesa/main/get.h b/src/mesa/main/get.h index 47e549e396..320492b4ce 100644 --- a/src/mesa/main/get.h +++ b/src/mesa/main/get.h @@ -51,6 +51,9 @@ extern void GLAPIENTRY _mesa_GetInteger64v( GLenum pname, GLint64 *params ); extern void GLAPIENTRY +_mesa_GetFixedv(GLenum pname, GLfixed *params); + +extern void GLAPIENTRY _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ); extern void GLAPIENTRY @@ -71,27 +74,4 @@ _mesa_GetStringi(GLenum name, GLuint index); extern GLenum GLAPIENTRY _mesa_GetError( void ); - -extern void GLAPIENTRY -_es1_GetBooleanv( GLenum pname, GLboolean *params ); - -extern void GLAPIENTRY -_es1_GetFloatv( GLenum pname, GLfloat *params ); - -extern void GLAPIENTRY -_es1_GetIntegerv( GLenum pname, GLint *params ); - -extern void GLAPIENTRY -_es1_GetFixedv( GLenum pname, GLfixed *params ); - - -extern void GLAPIENTRY -_es2_GetBooleanv( GLenum pname, GLboolean *params ); - -extern void GLAPIENTRY -_es2_GetFloatv( GLenum pname, GLfloat *params ); - -extern void GLAPIENTRY -_es2_GetIntegerv( GLenum pname, GLint *params ); - #endif diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py deleted file mode 100644 index 0e9c9a8666..0000000000 --- a/src/mesa/main/get_gen.py +++ /dev/null @@ -1,1462 +0,0 @@ -#!/usr/bin/env python - -# Mesa 3-D graphics library -# -# Copyright (C) 1999-2006 Brian Paul All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -# This script is used to generate the get.c file: -# python get_gen.py > get.c - - -import string -import sys - - -GLint = 1 -GLenum = 2 -GLfloat = 3 -GLdouble = 4 -GLboolean = 5 -GLfloatN = 6 # A normalized value, such as a color or depth range -GLint64 = 7 - - -TypeStrings = { - GLint : "GLint", - GLenum : "GLenum", - GLfloat : "GLfloat", - GLdouble : "GLdouble", - GLboolean : "GLboolean", - GLint64 : "GLint64" -} - - -NoState = None -NoExt = None -FlushCurrent = 1 - - -# Each entry is a tuple of: -# - the GL state name, such as GL_CURRENT_COLOR -# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum -# - list of code fragments to get the state, such as ["ctx->Foo.Bar"] -# - optional extra code or empty string. If present, "CONVERSION" will be -# replaced by ENUM_TO_FLOAT, INT_TO_FLOAT, etc. -# - state flags: either NoExt, FlushCurrent or "_NEW_xxx" -# if NoExt, do nothing special -# if FlushCurrent, emit FLUSH_CURRENT() call -# if "_NEW_xxx", call _mesa_update_state() if that dirty state flag is set -# - optional extensions to check, or NoExt -# -StateVars = [ - ( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"], - "", NoState, NoExt ), - ( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"], - "", NoState, NoExt ), - ( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"], - "", NoState, NoExt ), - ( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"], - "", NoState, NoExt ), - ( "GL_ACCUM_CLEAR_VALUE", GLfloatN, - [ "ctx->Accum.ClearColor[0]", - "ctx->Accum.ClearColor[1]", - "ctx->Accum.ClearColor[2]", - "ctx->Accum.ClearColor[3]" ], - "", NoState, NoExt ), - ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", NoState, NoExt ), - ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"], - "", "_NEW_BUFFERS", NoExt ), - ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", NoState, NoExt ), - ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", NoState, NoExt ), - ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", NoState, NoExt ), - ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", NoState, NoExt ), - ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", NoState, NoExt ), - ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", NoState, NoExt ), - ( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"], - "", NoState, NoExt ), - ( "GL_BLEND", GLboolean, ["(ctx->Color.BlendEnabled & 1)"], "", NoState, NoExt ), - ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", NoState, NoExt ), - ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", NoState, NoExt ), - ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", NoState, NoExt ), - ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", NoState, NoExt ), - ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", NoState, NoExt ), - ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", NoState, NoExt ), - ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", NoState, NoExt), - ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "], - "", NoState, NoExt ), - ( "GL_BLEND_COLOR_EXT", GLfloatN, - [ "ctx->Color.BlendColor[0]", - "ctx->Color.BlendColor[1]", - "ctx->Color.BlendColor[2]", - "ctx->Color.BlendColor[3]"], "", NoState, NoExt ), - ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", NoState, NoExt ), - ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", "_NEW_BUFFERS", NoExt ), - ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", NoState, NoExt ), - ( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint, - ["ctx->ClientAttribStackDepth"], "", NoState, NoExt ), - ( "GL_CLIP_PLANE0", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", NoState, NoExt ), - ( "GL_CLIP_PLANE1", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", NoState, NoExt ), - ( "GL_CLIP_PLANE2", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", NoState, NoExt ), - ( "GL_CLIP_PLANE3", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", NoState, NoExt ), - ( "GL_CLIP_PLANE4", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", NoState, NoExt ), - ( "GL_CLIP_PLANE5", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", NoState, NoExt ), - ( "GL_COLOR_CLEAR_VALUE", GLfloatN, - [ "ctx->Color.ClearColor[0]", - "ctx->Color.ClearColor[1]", - "ctx->Color.ClearColor[2]", - "ctx->Color.ClearColor[3]" ], "", NoState, NoExt ), - ( "GL_COLOR_MATERIAL", GLboolean, - ["ctx->Light.ColorMaterialEnabled"], "", NoState, NoExt ), - ( "GL_COLOR_MATERIAL_FACE", GLenum, - ["ctx->Light.ColorMaterialFace"], "", NoState, NoExt ), - ( "GL_COLOR_MATERIAL_PARAMETER", GLenum, - ["ctx->Light.ColorMaterialMode"], "", NoState, NoExt ), - ( "GL_COLOR_WRITEMASK", GLint, - [ "ctx->Color.ColorMask[0][RCOMP] ? 1 : 0", - "ctx->Color.ColorMask[0][GCOMP] ? 1 : 0", - "ctx->Color.ColorMask[0][BCOMP] ? 1 : 0", - "ctx->Color.ColorMask[0][ACOMP] ? 1 : 0" ], "", NoState, NoExt ), - ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", NoState, NoExt ), - ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", NoState, NoExt ), - ( "GL_CURRENT_COLOR", GLfloatN, - [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ], - "", FlushCurrent, NoExt ), - ( "GL_CURRENT_INDEX", GLfloat, - [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ], - "", FlushCurrent, NoExt ), - ( "GL_CURRENT_NORMAL", GLfloatN, - [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]", - "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]", - "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"], - "", FlushCurrent, NoExt ), - ( "GL_CURRENT_RASTER_COLOR", GLfloatN, - ["ctx->Current.RasterColor[0]", - "ctx->Current.RasterColor[1]", - "ctx->Current.RasterColor[2]", - "ctx->Current.RasterColor[3]"], "", NoState, NoExt ), - ( "GL_CURRENT_RASTER_DISTANCE", GLfloat, - ["ctx->Current.RasterDistance"], "", NoState, NoExt ), - ( "GL_CURRENT_RASTER_INDEX", GLfloat, - ["1.0"], "", NoState, NoExt ), - ( "GL_CURRENT_RASTER_POSITION", GLfloat, - ["ctx->Current.RasterPos[0]", - "ctx->Current.RasterPos[1]", - "ctx->Current.RasterPos[2]", - "ctx->Current.RasterPos[3]"], "", NoState, NoExt ), - ( "GL_CURRENT_RASTER_SECONDARY_COLOR", GLfloatN, - ["ctx->Current.RasterSecondaryColor[0]", - "ctx->Current.RasterSecondaryColor[1]", - "ctx->Current.RasterSecondaryColor[2]", - "ctx->Current.RasterSecondaryColor[3]"], "", NoState, NoExt ), - ( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat, - ["ctx->Current.RasterTexCoords[unit][0]", - "ctx->Current.RasterTexCoords[unit][1]", - "ctx->Current.RasterTexCoords[unit][2]", - "ctx->Current.RasterTexCoords[unit][3]"], - """const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - }""", - NoState, NoExt ), - ( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean, - ["ctx->Current.RasterPosValid"], "", NoState, NoExt ), - ( "GL_CURRENT_TEXTURE_COORDS", GLfloat, - ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]"], - """const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0);""", - NoState, NoExt ), - ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", NoState, NoExt ), - ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"], - "", NoState, NoExt ), - ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", NoState, NoExt ), - ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", NoState, NoExt ), - ( "GL_DEPTH_RANGE", GLfloatN, - [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", NoState, NoExt ), - ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", NoState, NoExt ), - ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", NoState, NoExt ), - ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", NoState, NoExt ), - ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", NoState, NoExt ), - ( "GL_DOUBLEBUFFER", GLboolean, - ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", NoState, NoExt ), - ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", NoState, NoExt ), - ( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"], - "", FlushCurrent, NoExt ), - ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", NoState, NoExt ), - ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", NoState, NoExt ), - ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", NoState, NoExt ), - ( "GL_FOG_COLOR", GLfloatN, - [ "ctx->Fog.Color[0]", - "ctx->Fog.Color[1]", - "ctx->Fog.Color[2]", - "ctx->Fog.Color[3]" ], "", NoState, NoExt ), - ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", NoState, NoExt ), - ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", NoState, NoExt ), - ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", NoState, NoExt ), - ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", NoState, NoExt ), - ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", NoState, NoExt ), - ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", NoState, NoExt ), - ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", NoState, NoExt ), - ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", NoState, NoExt ), - ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"], - "", "_NEW_BUFFERS", NoExt ), - ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", NoState, NoExt ), - ( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"], - "", "_NEW_BUFFERS", NoExt ), - ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", NoState, NoExt ), - ( "GL_INDEX_MODE", GLboolean, ["GL_FALSE"], - "", NoState, NoExt ), - ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", NoState, NoExt ), - ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", NoState, NoExt ), - ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", NoState, NoExt ), - ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", NoState, NoExt ), - ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", NoState, NoExt ), - ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN, - ["ctx->Light.Model.Ambient[0]", - "ctx->Light.Model.Ambient[1]", - "ctx->Light.Model.Ambient[2]", - "ctx->Light.Model.Ambient[3]"], "", NoState, NoExt ), - ( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum, - ["ctx->Light.Model.ColorControl"], "", NoState, NoExt ), - ( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean, - ["ctx->Light.Model.LocalViewer"], "", NoState, NoExt ), - ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", NoState, NoExt ), - ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", NoState, NoExt ), - ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", NoState, NoExt ), - ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", NoState, NoExt ), - ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", NoState, NoExt ), - ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", NoState, NoExt ), - ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", NoState, NoExt ), - ( "GL_LINE_WIDTH_GRANULARITY", GLfloat, - ["ctx->Const.LineWidthGranularity"], "", NoState, NoExt ), - ( "GL_LINE_WIDTH_RANGE", GLfloat, - ["ctx->Const.MinLineWidthAA", - "ctx->Const.MaxLineWidthAA"], "", NoState, NoExt ), - ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat, - ["ctx->Const.MinLineWidth", - "ctx->Const.MaxLineWidth"], "", NoState, NoExt ), - ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", NoState, NoExt ), - ( "GL_LIST_INDEX", GLint, ["(ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)"], "", NoState, NoExt ), - ( "GL_LIST_MODE", GLenum, ["mode"], - """GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE;""", NoState, NoExt ), - ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", NoState, NoExt ), - ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", NoState, NoExt ), - ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", NoState, NoExt ), - ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", NoState, NoExt ), - ( "GL_MAP1_GRID_DOMAIN", GLfloat, - ["ctx->Eval.MapGrid1u1", - "ctx->Eval.MapGrid1u2"], "", NoState, NoExt ), - ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", NoState, NoExt ), - ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", NoState, NoExt ), - ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", NoState, NoExt ), - ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", NoState, NoExt ), - ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", NoState, NoExt ), - ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", NoState, NoExt ), - ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", NoState, NoExt ), - ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", NoState, NoExt ), - ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", NoState, NoExt ), - ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", NoState, NoExt ), - ( "GL_MAP2_GRID_DOMAIN", GLfloat, - ["ctx->Eval.MapGrid2u1", - "ctx->Eval.MapGrid2u2", - "ctx->Eval.MapGrid2v1", - "ctx->Eval.MapGrid2v2"], "", NoState, NoExt ), - ( "GL_MAP2_GRID_SEGMENTS", GLint, - ["ctx->Eval.MapGrid2un", - "ctx->Eval.MapGrid2vn"], "", NoState, NoExt ), - ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", NoState, NoExt ), - ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", NoState, NoExt ), - ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", NoState, NoExt ), - ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", NoState, NoExt ), - ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", NoState, NoExt ), - ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", NoState, NoExt ), - ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", NoState, NoExt ), - ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", NoState, NoExt ), - ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", NoState, NoExt ), - ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", NoState, NoExt ), - ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", NoState, NoExt ), - - ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", NoState, NoExt ), - ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", NoState, NoExt ), - ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", NoState, NoExt ), - ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", NoState, NoExt ), - ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", NoState, NoExt ), - ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", NoState, NoExt ), - ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", NoState, NoExt ), - ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", NoState, NoExt ), - ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", NoState, NoExt ), - ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_MAX_VIEWPORT_DIMS", GLint, - ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"], - "", NoState, NoExt ), - ( "GL_MODELVIEW_MATRIX", GLfloat, - [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", NoState, NoExt ), - ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", NoState, NoExt ), - ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", NoState, NoExt ), - ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", NoState, NoExt ), - ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", NoState, NoExt ), - ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", NoState, NoExt ), - ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", NoState, NoExt ), - ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", NoState, NoExt ), - ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", NoState, NoExt ), - ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", NoState, NoExt ), - ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", NoState, NoExt ), - ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", NoState, NoExt ), - ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", NoState, NoExt ), - ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum, - ["ctx->Hint.PerspectiveCorrection"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", NoState, NoExt ), - ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", NoState, NoExt ), - ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", NoState, NoExt ), - ( "GL_POINT_SIZE_GRANULARITY", GLfloat, - ["ctx->Const.PointSizeGranularity"], "", NoState, NoExt ), - ( "GL_POINT_SIZE_RANGE", GLfloat, - ["ctx->Const.MinPointSizeAA", - "ctx->Const.MaxPointSizeAA"], "", NoState, NoExt ), - ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat, - ["ctx->Const.MinPointSize", - "ctx->Const.MaxPointSize"], "", NoState, NoExt ), - ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", NoState, NoExt ), - ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", NoState, NoExt ), - ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", NoState, NoExt ), - ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", NoState, NoExt ), - ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat, - ["ctx->Point.Threshold"], "", NoState, NoExt ), - ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat, - ["ctx->Point.Params[0]", - "ctx->Point.Params[1]", - "ctx->Point.Params[2]"], "", NoState, NoExt ), - ( "GL_POLYGON_MODE", GLenum, - ["ctx->Polygon.FrontMode", - "ctx->Polygon.BackMode"], "", NoState, NoExt ), - ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", NoState, NoExt ), - ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", NoState, NoExt ), - ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", NoState, NoExt ), - ( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", NoState, NoExt ), - ( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", NoState, NoExt ), - ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", NoState, NoExt ), - ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", NoState, NoExt ), - ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", NoState, NoExt ), - ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", NoState, NoExt ), - ( "GL_PROJECTION_MATRIX", GLfloat, - [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", NoState, NoExt ), - ( "GL_PROJECTION_STACK_DEPTH", GLint, - ["ctx->ProjectionMatrixStack.Depth + 1"], "", NoState, NoExt ), - ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", NoState, NoExt ), - ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", NoState, NoExt ), - ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", "_NEW_BUFFERS", NoExt ), - ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", NoState, NoExt ), - ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", NoState, NoExt ), - ( "GL_RESCALE_NORMAL", GLboolean, - ["ctx->Transform.RescaleNormals"], "", NoState, NoExt ), - ( "GL_RGBA_MODE", GLboolean, ["GL_TRUE"], - "", NoState, NoExt ), - ( "GL_SCISSOR_BOX", GLint, - ["ctx->Scissor.X", - "ctx->Scissor.Y", - "ctx->Scissor.Width", - "ctx->Scissor.Height"], "", NoState, NoExt ), - ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", NoState, NoExt ), - ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", NoState, NoExt ), - ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", NoState, NoExt ), - ( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean, - ["ctx->Texture.SharedPalette"], "", NoState, NoExt ), - ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", NoState, NoExt ), - ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", NoState, NoExt ), - ( "GL_STENCIL_FAIL", GLenum, - ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STENCIL_FUNC", GLenum, - ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum, - ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum, - ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STENCIL_REF", GLint, - ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", NoState, NoExt ), - ( "GL_STENCIL_VALUE_MASK", GLint, - ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STENCIL_WRITEMASK", GLint, - ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ), - ( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"], - "", NoState, NoExt ), - ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", NoState, NoExt ), - ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", NoState, NoExt ), - ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", NoState, NoExt ), - ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", NoState, NoExt ), - ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", NoState, ["MESA_texture_array"] ), - ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", NoState, ["MESA_texture_array"] ), - ( "GL_TEXTURE_BINDING_1D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", NoState, NoExt ), - ( "GL_TEXTURE_BINDING_2D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", NoState, NoExt ), - ( "GL_TEXTURE_BINDING_3D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", NoState, NoExt ), - ( "GL_TEXTURE_BINDING_1D_ARRAY_EXT", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", NoState, ["MESA_texture_array"] ), - ( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", NoState, ["MESA_texture_array"] ), - ( "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT", GLint, - ["ctx->Const.MaxArrayTextureLayers"], "", NoState, ["MESA_texture_array"] ), - ( "GL_TEXTURE_GEN_S", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", NoState, NoExt ), - ( "GL_TEXTURE_GEN_T", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", NoState, NoExt ), - ( "GL_TEXTURE_GEN_R", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", NoState, NoExt ), - ( "GL_TEXTURE_GEN_Q", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", NoState, NoExt ), - ( "GL_TEXTURE_MATRIX", GLfloat, - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - """const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m;""", - NoState, NoExt ), - ( "GL_TEXTURE_STACK_DEPTH", GLint, - ["ctx->TextureMatrixStack[unit].Depth + 1"], - """const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - }""", - NoState, NoExt ), - ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", NoState, NoExt ), - ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", NoState, NoExt ), - ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", NoState, NoExt ), - ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", NoState, NoExt ), - ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", NoState, NoExt ), - ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", NoState, NoExt ), - ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", NoState, NoExt ), - ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", NoState, NoExt ), - ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", NoState, NoExt ), - ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y", - "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", NoState, NoExt ), - ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", NoState, NoExt ), - ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", NoState, NoExt ), - - # Vertex arrays - ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", NoState, NoExt ), - ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", NoState, NoExt ), - ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", NoState, NoExt ), - ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", NoState, NoExt ), - ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ), - ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", NoState, NoExt ), - ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", NoState, NoExt ), - ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", NoState, NoExt ), - ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ), - ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", NoState, NoExt ), - ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", NoState, NoExt ), - ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", NoState, NoExt ), - ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", NoState, NoExt ), - ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ), - ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", NoState, NoExt ), - ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", NoState, NoExt ), - ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", NoState, NoExt ), - ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ), - ( "GL_TEXTURE_COORD_ARRAY", GLboolean, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", NoState, NoExt ), - ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", NoState, NoExt ), - ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", NoState, NoExt ), - ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", NoState, NoExt ), - ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ), - ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", NoState, NoExt ), - ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", NoState, NoExt ), - ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ), - - # GL_ARB_multitexture - ( "GL_MAX_TEXTURE_UNITS_ARB", GLint, - ["ctx->Const.MaxTextureUnits"], "", NoState, ["ARB_multitexture"] ), - ( "GL_ACTIVE_TEXTURE_ARB", GLint, - [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", NoState, ["ARB_multitexture"] ), - ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint, - ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", NoState, ["ARB_multitexture"] ), - - # GL_ARB_texture_cube_map - ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean, - ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", NoState, ["ARB_texture_cube_map"] ), - ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"], - "", NoState, ["ARB_texture_cube_map"] ), - ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint, - ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"], - "", NoState, ["ARB_texture_cube_map"]), - - # GL_ARB_texture_compression */ - ( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint, - ["ctx->Hint.TextureCompression"], "", NoState, NoExt ), - ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint, - ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"], - "", NoState, NoExt ), - ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum, - [], - """GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = CONVERSION(formats[i]);""", - NoState, NoExt ), - - # GL_EXT_compiled_vertex_array - ( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"], - "", NoState, ["EXT_compiled_vertex_array"] ), - ( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"], - "", NoState, ["EXT_compiled_vertex_array"] ), - - # GL_ARB_transpose_matrix - ( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", - NoState, NoExt ), - ( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", - NoState, NoExt ), - ( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", - NoState, NoExt ), - ( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", - NoState, NoExt ), - - # GL_SGI_color_matrix (also in 1.2 imaging) - ( "GL_COLOR_MATRIX_SGI", GLfloat, - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", - NoState, NoExt ), - ( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint, - ["ctx->ColorMatrixStack.Depth + 1"], "", NoState, NoExt ), - ( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint, - ["MAX_COLOR_STACK_DEPTH"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[0]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[1]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[2]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[3]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[0]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[1]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[2]"], "", NoState, NoExt ), - ( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[3]"], "", NoState, NoExt ), - - # GL_EXT_convolution (also in 1.2 imaging) - ( "GL_CONVOLUTION_1D_EXT", GLboolean, - ["ctx->Pixel.Convolution1DEnabled"], "", NoState, ["EXT_convolution"] ), - ( "GL_CONVOLUTION_2D_EXT", GLboolean, - ["ctx->Pixel.Convolution2DEnabled"], "", NoState, ["EXT_convolution"] ), - ( "GL_SEPARABLE_2D_EXT", GLboolean, - ["ctx->Pixel.Separable2DEnabled"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[0]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[1]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[2]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[3]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[0]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[1]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[2]"], "", NoState, ["EXT_convolution"] ), - ( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[3]"], "", NoState, ["EXT_convolution"] ), - - # GL_EXT_histogram / GL_ARB_imaging - ( "GL_HISTOGRAM", GLboolean, - [ "ctx->Pixel.HistogramEnabled" ], "", NoState, ["EXT_histogram"] ), - ( "GL_MINMAX", GLboolean, - [ "ctx->Pixel.MinMaxEnabled" ], "", NoState, ["EXT_histogram"] ), - - # GL_SGI_color_table / GL_ARB_imaging - ( "GL_COLOR_TABLE_SGI", GLboolean, - ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", - NoState, ["SGI_color_table"] ), - ( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean, - ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", - NoState, ["SGI_color_table"] ), - ( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean, - ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", - NoState, ["SGI_color_table"] ), - - # GL_SGI_texture_color_table - ( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"], - "", NoState, ["SGI_texture_color_table"] ), - - # GL_EXT_secondary_color - ( "GL_COLOR_SUM_EXT", GLboolean, - ["ctx->Fog.ColorSumEnabled"], "", NoState, - ["EXT_secondary_color", "ARB_vertex_program"] ), - ( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN, - ["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"], - "", FlushCurrent, ["EXT_secondary_color"] ), - ( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean, - ["ctx->Array.ArrayObj->SecondaryColor.Enabled"], - "", NoState, ["EXT_secondary_color"] ), - ( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum, - ["ctx->Array.ArrayObj->SecondaryColor.Type"], - "", NoState, ["EXT_secondary_color"] ), - ( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint, - ["ctx->Array.ArrayObj->SecondaryColor.Stride"], - "", NoState, ["EXT_secondary_color"] ), - ( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint, - ["ctx->Array.ArrayObj->SecondaryColor.Size"], - "", NoState, ["EXT_secondary_color"] ), - - # GL_EXT_fog_coord - ( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat, - ["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"], - "", FlushCurrent, ["EXT_fog_coord"] ), - ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, - ["ctx->Array.ArrayObj->FogCoord.Enabled"], - "", NoState, ["EXT_fog_coord"] ), - ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, - ["ctx->Array.ArrayObj->FogCoord.Type"], - "", NoState, ["EXT_fog_coord"] ), - ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, - ["ctx->Array.ArrayObj->FogCoord.Stride"], - "", NoState, ["EXT_fog_coord"] ), - ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, - ["ctx->Fog.FogCoordinateSource"], - "", NoState, ["EXT_fog_coord"] ), - - # GL_EXT_texture_lod_bias - ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat, - ["ctx->Const.MaxTextureLodBias"], "", NoState, ["EXT_texture_lod_bias"]), - - # GL_EXT_texture_filter_anisotropic - ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat, - ["ctx->Const.MaxTextureMaxAnisotropy"], - "", NoState, ["EXT_texture_filter_anisotropic"]), - - # GL_ARB_multisample - ( "GL_MULTISAMPLE_ARB", GLboolean, - ["ctx->Multisample.Enabled"], "", NoState, NoExt ), - ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean, - ["ctx->Multisample.SampleAlphaToCoverage"], "", NoState, NoExt ), - ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean, - ["ctx->Multisample.SampleAlphaToOne"], "", NoState, NoExt ), - ( "GL_SAMPLE_COVERAGE_ARB", GLboolean, - ["ctx->Multisample.SampleCoverage"], "", NoState, NoExt ), - ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat, - ["ctx->Multisample.SampleCoverageValue"], "", NoState, NoExt ), - ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean, - ["ctx->Multisample.SampleCoverageInvert"], "", NoState, NoExt ), - ( "GL_SAMPLE_BUFFERS_ARB", GLint, - ["ctx->DrawBuffer->Visual.sampleBuffers"], "", NoState, NoExt ), - ( "GL_SAMPLES_ARB", GLint, - ["ctx->DrawBuffer->Visual.samples"], "", NoState, NoExt ), - - # GL_IBM_rasterpos_clip - ( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean, - ["ctx->Transform.RasterPositionUnclipped"], - "", NoState, ["IBM_rasterpos_clip"] ), - - # GL_NV_point_sprite - ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB - "", NoState, ["NV_point_sprite", "ARB_point_sprite"] ), - ( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"], - "", NoState, ["NV_point_sprite"] ), - ( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"], - "", NoState, ["NV_point_sprite", "ARB_point_sprite"] ), - - # GL_SGIS_generate_mipmap - ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"], - "", NoState, ["SGIS_generate_mipmap"] ), - - # GL_NV_vertex_program - ( "GL_VERTEX_PROGRAM_BINDING_NV", GLint, - ["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean, - ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"], - "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[0]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[1]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[2]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[3]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[4]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[5]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[6]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[7]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[8]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[9]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[10]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[11]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[12]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[13]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[14]"], "", NoState, ["NV_vertex_program"] ), - ( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[15]"], "", NoState, ["NV_vertex_program"] ), - - # GL_NV_fragment_program - ( "GL_FRAGMENT_PROGRAM_NV", GLboolean, - ["ctx->FragmentProgram.Enabled"], "", NoState, ["NV_fragment_program"] ), - ( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint, - ["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"], - "", NoState, ["NV_fragment_program"] ), - ( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint, - ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", NoState, ["NV_fragment_program"] ), - - # GL_NV_texture_rectangle - ( "GL_TEXTURE_RECTANGLE_NV", GLboolean, - ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", NoState, ["NV_texture_rectangle"] ), - ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name"], - "", NoState, ["NV_texture_rectangle"] ), - ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint, - ["ctx->Const.MaxTextureRectSize"], "", NoState, ["NV_texture_rectangle"] ), - - # GL_EXT_stencil_two_side - ( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean, - ["ctx->Stencil.TestTwoSide"], "", NoState, ["EXT_stencil_two_side"] ), - ( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum, - ["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"], - "", NoState, ["EXT_stencil_two_side"] ), - - # GL_NV_light_max_exponent - ( "GL_MAX_SHININESS_NV", GLfloat, - ["ctx->Const.MaxShininess"], "", NoState, ["NV_light_max_exponent"] ), - ( "GL_MAX_SPOT_EXPONENT_NV", GLfloat, - ["ctx->Const.MaxSpotExponent"], "", NoState, ["NV_light_max_exponent"] ), - - # GL_ARB_vertex_buffer_object - ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayBufferObj->Name"], "", NoState, NoExt ), - ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", NoState, NoExt ), - ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", NoState, NoExt ), - ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", NoState, NoExt ), - ( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", NoState, NoExt ), - ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"], - "", NoState, NoExt ), - ( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", NoState, NoExt ), - ( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name"], - "", NoState, NoExt ), - ( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->FogCoord.BufferObj->Name"], - "", NoState, NoExt ), - # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported - ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ElementArrayBufferObj->Name"], - "", NoState, NoExt ), - - # GL_EXT_pixel_buffer_object - ( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint, - ["ctx->Pack.BufferObj->Name"], "", NoState, ["EXT_pixel_buffer_object"] ), - ( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint, - ["ctx->Unpack.BufferObj->Name"], "", NoState, ["EXT_pixel_buffer_object"] ), - - # GL_ARB_vertex_program - ( "GL_VERTEX_PROGRAM_ARB", GLboolean, # == GL_VERTEX_PROGRAM_NV - ["ctx->VertexProgram.Enabled"], "", NoState, - ["ARB_vertex_program", "NV_vertex_program"] ), - ( "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_POINT_SIZE_NV - ["ctx->VertexProgram.PointSizeEnabled"], "", NoState, - ["ARB_vertex_program", "NV_vertex_program"] ), - ( "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_TWO_SIDE_NV - ["ctx->VertexProgram.TwoSideEnabled"], "", NoState, - ["ARB_vertex_program", "NV_vertex_program"] ), - ( "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", GLint, # == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV - ["ctx->Const.MaxProgramMatrixStackDepth"], "", NoState, - ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ), - ( "GL_MAX_PROGRAM_MATRICES_ARB", GLint, # == GL_MAX_TRACK_MATRICES_NV - ["ctx->Const.MaxProgramMatrices"], "", NoState, - ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ), - ( "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", GLboolean, # == GL_CURRENT_MATRIX_STACK_DEPTH_NV - ["ctx->CurrentStack->Depth + 1"], "", NoState, - ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ), - ( "GL_CURRENT_MATRIX_ARB", GLfloat, # == GL_CURRENT_MATRIX_NV - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->CurrentStack->Top->m;", NoState, - ["ARB_vertex_program", "ARB_fragment_program", "NV_fragment_program"] ), - ( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->CurrentStack->Top->m;", NoState, - ["ARB_vertex_program", "ARB_fragment_program"] ), - ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint, - ["ctx->Const.VertexProgram.MaxAttribs"], "", NoState, ["ARB_vertex_program"] ), - ( "GL_PROGRAM_ERROR_POSITION_ARB", GLint, # == GL_PROGRAM_ERROR_POSITION_NV - ["ctx->Program.ErrorPos"], "", NoState, ["NV_vertex_program", - "ARB_vertex_program", "NV_fragment_program", "ARB_fragment_program"] ), - - # GL_ARB_fragment_program - ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean, - ["ctx->FragmentProgram.Enabled"], "", NoState, ["ARB_fragment_program"] ), - ( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV - ["ctx->Const.MaxTextureCoordUnits"], "", NoState, - ["ARB_fragment_program", "NV_fragment_program"] ), - ( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNITS_NV - ["ctx->Const.MaxTextureImageUnits"], "", NoState, - ["ARB_fragment_program", "NV_fragment_program"] ), - - # GL_EXT_depth_bounds_test - ( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean, - ["ctx->Depth.BoundsTest"], "", NoState, ["EXT_depth_bounds_test"] ), - ( "GL_DEPTH_BOUNDS_EXT", GLfloat, - ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"], - "", NoState, ["EXT_depth_bounds_test"] ), - - # GL_ARB_depth_clamp - ( "GL_DEPTH_CLAMP", GLboolean, ["ctx->Transform.DepthClamp"], "", - NoState, ["ARB_depth_clamp"] ), - - # GL_ARB_draw_buffers - ( "GL_MAX_DRAW_BUFFERS_ARB", GLint, - ["ctx->Const.MaxDrawBuffers"], "", NoState, NoExt ), - ( "GL_DRAW_BUFFER0_ARB", GLenum, - ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", NoState, NoExt ), - ( "GL_DRAW_BUFFER1_ARB", GLenum, - ["buffer"], - """GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", NoState, NoExt ), - ( "GL_DRAW_BUFFER2_ARB", GLenum, - ["buffer"], - """GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", NoState, NoExt ), - ( "GL_DRAW_BUFFER3_ARB", GLenum, - ["buffer"], - """GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", NoState, NoExt ), - # XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future - - # GL_OES_read_format - ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint, - ["_mesa_get_color_read_type(ctx)"], "", "_NEW_BUFFERS", ["OES_read_format"] ), - ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint, - ["_mesa_get_color_read_format(ctx)"], "", "_NEW_BUFFERS", ["OES_read_format"] ), - - # GL_ATI_fragment_shader - ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_NUM_PASSES_ATI", GLint, ["2"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], - "", NoState, ["ATI_fragment_shader"] ), - ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], - "", NoState, ["ATI_fragment_shader"] ), - - # OpenGL 2.0 - ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], - "", NoState, NoExt ), - ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], - "", NoState, NoExt ), - ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], - "", NoState, NoExt ), - ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], - "", NoState, NoExt ), - ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], - "", NoState, NoExt ), - ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], - "", NoState, NoExt ), - ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], - "", NoState, NoExt ), - - # GL_EXT_framebuffer_object - ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "", - NoState, ["EXT_framebuffer_object"] ), - ( "GL_RENDERBUFFER_BINDING_EXT", GLint, - ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "", - NoState, ["EXT_framebuffer_object"] ), - ( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint, - ["ctx->Const.MaxColorAttachments"], "", - NoState, ["EXT_framebuffer_object"] ), - ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint, - ["ctx->Const.MaxRenderbufferSize"], "", - NoState, ["EXT_framebuffer_object"] ), - - # GL_EXT_framebuffer_blit - # NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT - ( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "", - NoState, ["EXT_framebuffer_blit"] ), - - # GL_EXT_provoking_vertex - ( "GL_PROVOKING_VERTEX_EXT", GLboolean, - ["ctx->Light.ProvokingVertex"], "", NoState, ["EXT_provoking_vertex"] ), - ( "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", GLboolean, - ["ctx->Const.QuadsFollowProvokingVertexConvention"], "", - NoState, ["EXT_provoking_vertex"] ), - - # GL_ARB_fragment_shader - ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint, - ["ctx->Const.FragmentProgram.MaxUniformComponents"], "", - NoState, ["ARB_fragment_shader"] ), - ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum, - ["ctx->Hint.FragmentShaderDerivative"], - "", NoState, ["ARB_fragment_shader"] ), - - # GL_ARB_vertex_shader - ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint, - ["ctx->Const.VertexProgram.MaxUniformComponents"], "", - NoState, ["ARB_vertex_shader"] ), - ( "GL_MAX_VARYING_FLOATS_ARB", GLint, - ["ctx->Const.MaxVarying * 4"], "", NoState, ["ARB_vertex_shader"] ), - ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["ctx->Const.MaxVertexTextureImageUnits"], - "", NoState, ["ARB_vertex_shader"] ), - ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["ctx->Const.MaxCombinedTextureImageUnits"], - "", NoState, ["ARB_vertex_shader"] ), - - # GL_ARB_shader_objects - # Actually, this token isn't part of GL_ARB_shader_objects, but is - # close enough for now. - ( "GL_CURRENT_PROGRAM", GLint, - ["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"], - "", NoState, ["ARB_shader_objects"] ), - - # GL_ARB_framebuffer_object - ( "GL_MAX_SAMPLES", GLint, ["ctx->Const.MaxSamples"], "", - NoState, ["ARB_framebuffer_object"] ), - - # GL_APPLE_vertex_array_object - ( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "", - NoState, ["APPLE_vertex_array_object"] ), - - # GL_ARB_seamless_cube_map - ( "GL_TEXTURE_CUBE_MAP_SEAMLESS", GLboolean, ["ctx->Texture.CubeMapSeamless"], "", - NoState, ["ARB_seamless_cube_map"] ), - - # GL_ARB_sync - ( "GL_MAX_SERVER_WAIT_TIMEOUT", GLint64, ["ctx->Const.MaxServerWaitTimeout"], "", - NoState, ["ARB_sync"] ), - - # GL_EXT_transform_feedback - ( "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", GLint, - ["ctx->TransformFeedback.CurrentBuffer->Name"], "", - NoState, ["EXT_transform_feedback"] ), - ( "GL_RASTERIZER_DISCARD", GLboolean, - ["ctx->TransformFeedback.RasterDiscard"], "", - NoState, ["EXT_transform_feedback"] ), - ( "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", GLint, - ["ctx->Const.MaxTransformFeedbackInterleavedComponents"], "", - NoState, ["EXT_transform_feedback"] ), - ( "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", GLint, - ["ctx->Const.MaxTransformFeedbackSeparateAttribs"], "", - NoState, ["EXT_transform_feedback"] ), - ( "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", GLint, - ["ctx->Const.MaxTransformFeedbackSeparateComponents"], "", - NoState, ["EXT_transform_feedback"] ), - - # GL 3.0 - ( "GL_NUM_EXTENSIONS", GLint, - ["_mesa_get_extension_count(ctx)"], "", NoState, "30" ), - ( "GL_MAJOR_VERSION", GLint, - ["ctx->VersionMajor"], "", NoState, "30" ), - ( "GL_MINOR_VERSION", GLint, - ["ctx->VersionMinor"], "", NoState, "30" ), - ( "GL_CONTEXT_FLAGS", GLint, - ["ctx->Const.ContextFlags"], "", NoState, "30" ), - - # GL 3.1 - ( "GL_PRIMITIVE_RESTART", GLboolean, - ["ctx->Array.PrimitiveRestart"], "", NoState, "31" ), - ( "GL_PRIMITIVE_RESTART_INDEX", GLint, - ["ctx->Array.RestartIndex"], "", NoState, "31" ), - - # GL 3.2 - ( "GL_CONTEXT_PROFILE_MASK", GLint, ["ctx->Const.ProfileMask"], "", - NoState, "32" ) - -] - - -# These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v() -# The tuples are the same as above, with one exception: the "optional" -# code field is instead the max legal index value. -IndexedStateVars = [ - # GL_EXT_draw_buffers2 / GL3 - ( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"], - "ctx->Const.MaxDrawBuffers", NoState, ["EXT_draw_buffers2"] ), - ( "GL_COLOR_WRITEMASK", GLint, - [ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0", - "ctx->Color.ColorMask[index][GCOMP] ? 1 : 0", - "ctx->Color.ColorMask[index][BCOMP] ? 1 : 0", - "ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ], - "ctx->Const.MaxDrawBuffers", NoState, ["EXT_draw_buffers2"] ), - - # GL_EXT_transform_feedback - ( "GL_TRANSFORM_FEEDBACK_BUFFER_START", GLint64, - ["ctx->TransformFeedback.CurrentObject->Offset[index]"], - "ctx->Const.MaxTransformFeedbackSeparateAttribs", - NoState, ["EXT_transform_feedback"] ), - ( "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE", GLint64, - ["ctx->TransformFeedback.CurrentObject->Size[index]"], - "ctx->Const.MaxTransformFeedbackSeparateAttribs", - NoState, ["EXT_transform_feedback"] ), - ( "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", GLint, - ["ctx->TransformFeedback.CurrentObject->Buffers[index]->Name"], - "ctx->Const.MaxTransformFeedbackSeparateAttribs", - NoState, ["EXT_transform_feedback"] ), - - # XXX more to come... -] - - - -def ConversionFunc(fromType, toType): - """Return the name of the macro to convert between two data types.""" - if fromType == toType: - return "" - elif fromType == GLfloat and toType == GLint: - return "IROUND" - elif fromType == GLfloat and toType == GLint64: - return "IROUND64" - elif fromType == GLfloatN and toType == GLfloat: - return "" - elif fromType == GLint and toType == GLfloat: # but not GLfloatN! - return "(GLfloat)" - elif fromType == GLint and toType == GLint64: - return "(GLint64)" - elif fromType == GLint64 and toType == GLfloat: # but not GLfloatN! - return "(GLfloat)" - else: - if fromType == GLfloatN: - fromType = GLfloat - fromStr = TypeStrings[fromType] - fromStr = string.upper(fromStr[2:]) - toStr = TypeStrings[toType] - toStr = string.upper(toStr[2:]) - return fromStr + "_TO_" + toStr - - -def EmitGetFunction(stateVars, returnType, indexed): - """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv.""" - assert (returnType == GLboolean or - returnType == GLint or - returnType == GLint64 or - returnType == GLfloat) - - strType = TypeStrings[returnType] - # Capitalize first letter of return type - if indexed: - if returnType == GLint: - function = "GetIntegerIndexedv" - elif returnType == GLboolean: - function = "GetBooleanIndexedv" - elif returnType == GLint64: - function = "GetInteger64Indexedv" - else: - function = "Foo" - else: - if returnType == GLint: - function = "GetIntegerv" - elif returnType == GLboolean: - function = "GetBooleanv" - elif returnType == GLfloat: - function = "GetFloatv" - elif returnType == GLint64: - function = "GetInteger64v" - else: - sys.exit(1) - - if returnType == GLint64: - print "#if FEATURE_ARB_sync" - - print "void GLAPIENTRY" - if indexed: - print "_mesa_%s( GLenum pname, GLuint index, %s *params )" % (function, strType) - else: - print "_mesa_%s( GLenum pname, %s *params )" % (function, strType) - print "{" - print " GET_CURRENT_CONTEXT(ctx);" - print " const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;" - print " ASSERT_OUTSIDE_BEGIN_END(ctx);" - print " (void) version;" - print "" - print " if (!params)" - print " return;" - print "" - print " switch (pname) {" - - for state in stateVars: - if indexed: - (name, varType, state, indexMax, dirtyFlags, extensions) = state - optionalCode = 0 - else: - (name, varType, state, optionalCode, dirtyFlags, extensions) = state - indexMax = 0 - print " case " + name + ":" - - # Do extension check - if extensions: - if extensions == "30" or extensions == "31" or extensions == "32": - print (' CHECK_VERSION(%s);' % extensions) - elif len(extensions) == 1: - print (' CHECK_EXT1(%s);' % extensions[0]) - elif len(extensions) == 2: - print (' CHECK_EXT2(%s, %s);' % (extensions[0], extensions[1])) - elif len(extensions) == 3: - print (' CHECK_EXT3(%s, %s, %s);' % - (extensions[0], extensions[1], extensions[2])) - else: - assert len(extensions) == 4 - print (' CHECK_EXT4(%s, %s, %s, %s);' % - (extensions[0], extensions[1], extensions[2], extensions[3])) - - # Do dirty state check - if dirtyFlags: - if dirtyFlags == FlushCurrent: - print (' FLUSH_CURRENT(ctx, 0);') - else: - print (' if (ctx->NewState & %s)' % dirtyFlags) - print (' _mesa_update_state(ctx);') - - # Do index validation for glGet*Indexed() calls - if indexMax: - print (' if (index >= %s) {' % indexMax) - print (' _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(index=%%u), index", pname);' % function) - print (' return;') - print (' }') - - conversion = ConversionFunc(varType, returnType) - if optionalCode: - optionalCode = string.replace(optionalCode, "CONVERSION", conversion); - print " {" - print " " + optionalCode - n = len(state) - for i in range(n): - if conversion: - print " params[%d] = %s(%s);" % (i, conversion, state[i]) - else: - print " params[%d] = %s;" % (i, state[i]) - if optionalCode: - print " }" - print " break;" - - print " default:" - print " goto invalid_enum_error;" - print " }" - print " return;" - print "" - print "invalid_enum_error:" - print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function - print "}" - if returnType == GLint64: - print "#endif /* FEATURE_ARB_sync */" - print "" - return - - - -def EmitHeader(): - """Print the get.c file header.""" - print """ -/*** - *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py - ***/ - -#include "glheader.h" -#include "context.h" -#include "enable.h" -#include "extensions.h" -#include "get.h" -#include "macros.h" -#include "mtypes.h" -#include "state.h" -#include "texcompress.h" -#include "framebuffer.h" - - -#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) - -#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) - -#define INT64_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) -#define INT64_TO_INT(I) ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) ) - -#define BOOLEAN_TO_INT(B) ( (GLint) (B) ) -#define BOOLEAN_TO_INT64(B) ( (GLint64) (B) ) -#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) - -#define ENUM_TO_INT64(E) ( (GLint64) (E) ) - - -/* - * Check if named extension is enabled, if not generate error and return. - */ -#define CHECK_EXT1(EXT1) \\ - if (!ctx->Extensions.EXT1) { \\ - goto invalid_enum_error; \\ - } - -/* - * Check if either of two extensions is enabled. - */ -#define CHECK_EXT2(EXT1, EXT2) \\ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \\ - goto invalid_enum_error; \\ - } - -/* - * Check if either of three extensions is enabled. - */ -#define CHECK_EXT3(EXT1, EXT2, EXT3) \\ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\ - !ctx->Extensions.EXT3) { \\ - goto invalid_enum_error; \\ - } - -/* - * Check if either of four extensions is enabled. - */ -#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4) \\ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\ - !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \\ - goto invalid_enum_error; \\ - } - -/* - * Check GL version. - */ -#define CHECK_VERSION(VERSION) \\ - if (version < VERSION) { \\ - goto invalid_enum_error; \\ - } - -""" - return - - - -def EmitGetDoublev(): - print """ -void GLAPIENTRY -_mesa_GetDoublev( GLenum pname, GLdouble *params ) -{ - const GLfloat magic = -1234.5F; - GLfloat values[16]; - GLuint i; - - if (!params) - return; - - /* Init temp array to magic numbers so we can figure out how many values - * are returned by the GetFloatv() call. - */ - for (i = 0; i < 16; i++) - values[i] = magic; - - _mesa_GetFloatv(pname, values); - - for (i = 0; i < 16 && values[i] != magic; i++) - params[i] = (GLdouble) values[i]; -} -""" - - - - -EmitHeader() -# XXX Maybe sort the StateVars list -EmitGetFunction(StateVars, GLboolean, 0) -EmitGetFunction(StateVars, GLfloat, 0) -EmitGetFunction(StateVars, GLint, 0) -EmitGetFunction(StateVars, GLint64, 0) -EmitGetDoublev() - -EmitGetFunction(IndexedStateVars, GLboolean, 1) -EmitGetFunction(IndexedStateVars, GLint, 1) -EmitGetFunction(IndexedStateVars, GLint64, 1) - diff --git a/src/mesa/main/get_gen_es.py b/src/mesa/main/get_gen_es.py deleted file mode 100644 index b12e2e66c3..0000000000 --- a/src/mesa/main/get_gen_es.py +++ /dev/null @@ -1,823 +0,0 @@ -#!/usr/bin/env python - -# Mesa 3-D graphics library -# -# Copyright (C) 1999-2006 Brian Paul All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -# This script is used to generate the get.c file: -# python get_gen_es.py > get.c - - -import string -import sys - - -GLint = 1 -GLenum = 2 -GLfloat = 3 -GLdouble = 4 -GLboolean = 5 -GLfloatN = 6 # A normalized value, such as a color or depth range -GLfixed = 7 - - -TypeStrings = { - GLint : "GLint", - GLenum : "GLenum", - GLfloat : "GLfloat", - GLdouble : "GLdouble", - GLboolean : "GLboolean", - GLfixed : "GLfixed" -} - - -# Each entry is a tuple of: -# - the GL state name, such as GL_CURRENT_COLOR -# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum -# - list of code fragments to get the state, such as ["ctx->Foo.Bar"] -# - optional extra code or empty string -# - optional extensions to check, or None -# - -# Present in ES 1.x and 2.x: -StateVars_common = [ - ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"], - "", None ), - ( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ), - ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ), - ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ), - ( "GL_COLOR_CLEAR_VALUE", GLfloatN, - [ "ctx->Color.ClearColor[0]", - "ctx->Color.ClearColor[1]", - "ctx->Color.ClearColor[2]", - "ctx->Color.ClearColor[3]" ], "", None ), - ( "GL_COLOR_WRITEMASK", GLint, - [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0", - "ctx->Color.ColorMask[GCOMP] ? 1 : 0", - "ctx->Color.ColorMask[BCOMP] ? 1 : 0", - "ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ), - ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ), - ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ), - ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"], - "", None ), - ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["ctx->Depth.Clear"], "", None ), - ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ), - ( "GL_DEPTH_RANGE", GLfloatN, - [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ), - ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ), - ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ), - ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ), - ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ), - ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"], - "", None ), - ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ), - ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat, - ["ctx->Const.MinLineWidth", - "ctx->Const.MaxLineWidth"], "", None ), - ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ), - ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ), - - ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ), - ( "GL_MAX_VIEWPORT_DIMS", GLint, - ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"], - "", None ), - ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ), - ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat, - ["ctx->Const.MinPointSize", - "ctx->Const.MaxPointSize"], "", None ), - ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ), - ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ), - ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", None ), - ( "GL_SCISSOR_BOX", GLint, - ["ctx->Scissor.X", - "ctx->Scissor.Y", - "ctx->Scissor.Width", - "ctx->Scissor.Height"], "", None ), - ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ), - ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ), - ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ), - ( "GL_STENCIL_FAIL", GLenum, - ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_FUNC", GLenum, - ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum, - ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum, - ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_REF", GLint, - ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ), - ( "GL_STENCIL_VALUE_MASK", GLint, - ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_WRITEMASK", GLint, - ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ), - ( "GL_TEXTURE_BINDING_2D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ), - ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ), - ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y", - "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ), - - # GL_ARB_multitexture - ( "GL_ACTIVE_TEXTURE_ARB", GLint, - [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ), - - # Note that all the OES_* extensions require that the Mesa - # "struct gl_extensions" include a member with the name of - # the extension. That structure does not yet include OES - # extensions (and we're not sure whether it will). If - # it does, all the OES_* extensions below should mark the - # dependency. - - # OES_texture_cube_map - ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"], - "", None), - ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint, - ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"], - "", None), - - # OES_blend_subtract - ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None), - ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None), - ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None), - ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None), - - # GL_BLEND_EQUATION_RGB, which is what we're really after, - # is defined identically to GL_BLEND_EQUATION. - ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None), - ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "], - "", None), - - # GL_ARB_texture_compression */ -# ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint, -# ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"], -# "", ["ARB_texture_compression"] ), -# ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum, -# [], -# """GLint formats[100]; -# GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); -# ASSERT(n <= 100); -# for (i = 0; i < n; i++) -# params[i] = ENUM_TO_INT(formats[i]);""", -# ["ARB_texture_compression"] ), - - # GL_ARB_multisample - ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean, - ["ctx->Multisample.SampleAlphaToCoverage"], "", ["ARB_multisample"] ), - ( "GL_SAMPLE_COVERAGE_ARB", GLboolean, - ["ctx->Multisample.SampleCoverage"], "", ["ARB_multisample"] ), - ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat, - ["ctx->Multisample.SampleCoverageValue"], "", ["ARB_multisample"] ), - ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean, - ["ctx->Multisample.SampleCoverageInvert"], "", ["ARB_multisample"] ), - ( "GL_SAMPLE_BUFFERS_ARB", GLint, - ["ctx->DrawBuffer->Visual.sampleBuffers"], "", ["ARB_multisample"] ), - ( "GL_SAMPLES_ARB", GLint, - ["ctx->DrawBuffer->Visual.samples"], "", ["ARB_multisample"] ), - - - # GL_SGIS_generate_mipmap - ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"], - "", ["SGIS_generate_mipmap"] ), - - # GL_ARB_vertex_buffer_object - ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayBufferObj->Name"], "", ["ARB_vertex_buffer_object"] ), - # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported - ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ElementArrayBufferObj->Name"], - "", ["ARB_vertex_buffer_object"] ), - - # GL_OES_read_format - ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint, - ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ), - ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint, - ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ), - - # GL_OES_framebuffer_object - ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "", - None), - ( "GL_RENDERBUFFER_BINDING_EXT", GLint, - ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "", - None), - ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint, - ["ctx->Const.MaxRenderbufferSize"], "", - None), - - # OpenGL ES 1/2 special: - ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint, - [ "ARRAY_SIZE(compressed_formats)" ], - "", - None ), - - ("GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLint, - [], - """ - int i; - for (i = 0; i < ARRAY_SIZE(compressed_formats); i++) { - params[i] = compressed_formats[i]; - }""", - None ), - - ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ), - -] - -# Only present in ES 1.x: -StateVars_es1 = [ - ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ), - ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ), - ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ), - ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ), - ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ), - ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ), - ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ), - ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ), - ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ), - ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ), - ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN, - ["ctx->Light.Model.Ambient[0]", - "ctx->Light.Model.Ambient[1]", - "ctx->Light.Model.Ambient[2]", - "ctx->Light.Model.Ambient[3]"], "", None ), - ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ), - ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ), - ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ), - ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ), - ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ), - ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ), - ( "GL_CLIP_PLANE0", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ), - ( "GL_CLIP_PLANE1", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ), - ( "GL_CLIP_PLANE2", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ), - ( "GL_CLIP_PLANE3", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ), - ( "GL_CLIP_PLANE4", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ), - ( "GL_CLIP_PLANE5", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ), - ( "GL_COLOR_MATERIAL", GLboolean, - ["ctx->Light.ColorMaterialEnabled"], "", None ), - ( "GL_CURRENT_COLOR", GLfloatN, - [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ], - "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_CURRENT_NORMAL", GLfloatN, - [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]", - "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]", - "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"], - "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_CURRENT_TEXTURE_COORDS", GLfloat, - ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]"], - "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ), - ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat, - ["ctx->Point.Params[0]", - "ctx->Point.Params[1]", - "ctx->Point.Params[2]"], "", None ), - ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ), - ( "GL_FOG_COLOR", GLfloatN, - [ "ctx->Fog.Color[0]", - "ctx->Fog.Color[1]", - "ctx->Fog.Color[2]", - "ctx->Fog.Color[3]" ], "", None ), - ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ), - ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ), - ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ), - ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ), - ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ), - ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ), - ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ), - ( "GL_LINE_WIDTH_RANGE", GLfloat, - ["ctx->Const.MinLineWidthAA", - "ctx->Const.MaxLineWidthAA"], "", None ), - ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ), - ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ), - ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ), - - ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ), - ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ), - ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ), - ( "GL_MODELVIEW_MATRIX", GLfloat, - [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ), - ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ), - ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ), - ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ), - ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum, - ["ctx->Hint.PerspectiveCorrection"], "", None ), - ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ), - ( "GL_POINT_SIZE_RANGE", GLfloat, - ["ctx->Const.MinPointSizeAA", - "ctx->Const.MaxPointSizeAA"], "", None ), - ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ), - ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ), - ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ), - ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ), - ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat, - ["ctx->Point.Threshold"], "", None ), - ( "GL_PROJECTION_MATRIX", GLfloat, - [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ), - ( "GL_PROJECTION_STACK_DEPTH", GLint, - ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ), - ( "GL_RESCALE_NORMAL", GLboolean, - ["ctx->Transform.RescaleNormals"], "", None ), - ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ), - ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ), - ( "GL_TEXTURE_MATRIX", GLfloat, - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ), - ( "GL_TEXTURE_STACK_DEPTH", GLint, - ["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ), - ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", None ), - ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", None ), - ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", None ), - ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", None ), - ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", None ), - ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", None ), - ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", None ), - ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", None ), - ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", None ), - ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", None ), - ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY", GLboolean, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ), - # GL_ARB_multitexture - ( "GL_MAX_TEXTURE_UNITS_ARB", GLint, - ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ), - ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint, - ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ), - # OES_texture_cube_map - ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean, - ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", None), - ( "GL_TEXTURE_GEN_STR_OES", GLboolean, - # S, T, and R are always set at the same time - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None), - # ARB_multisample - ( "GL_MULTISAMPLE_ARB", GLboolean, - ["ctx->Multisample.Enabled"], "", ["ARB_multisample"] ), - ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean, - ["ctx->Multisample.SampleAlphaToOne"], "", ["ARB_multisample"] ), - - ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ), - ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ), - ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ), - ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"], - "", ["ARB_vertex_buffer_object"] ), - - # OES_point_sprite - ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB - "", None), - - # GL_ARB_fragment_shader - ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint, - ["ctx->Const.FragmentProgram.MaxUniformComponents"], "", - ["ARB_fragment_shader"] ), - - # GL_ARB_vertex_shader - ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint, - ["ctx->Const.VertexProgram.MaxUniformComponents"], "", - ["ARB_vertex_shader"] ), - ( "GL_MAX_VARYING_FLOATS_ARB", GLint, - ["ctx->Const.MaxVarying * 4"], "", ["ARB_vertex_shader"] ), - - # OES_matrix_get - ( "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES", GLint, [], - """ - /* See GL_OES_matrix_get */ - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - memcpy(params, matrix, 16 * sizeof(GLint)); - }""", - None), - - ( "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES", GLint, [], - """ - /* See GL_OES_matrix_get */ - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - memcpy(params, matrix, 16 * sizeof(GLint)); - }""", - None), - - ( "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES", GLint, [], - """ - /* See GL_OES_matrix_get */ - { - const GLfloat *matrix = - ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - memcpy(params, matrix, 16 * sizeof(GLint)); - }""", - None), - - # OES_point_size_array - ("GL_POINT_SIZE_ARRAY_OES", GLboolean, - ["ctx->Array.ArrayObj->PointSize.Enabled"], "", None), - ("GL_POINT_SIZE_ARRAY_TYPE_OES", GLenum, - ["ctx->Array.ArrayObj->PointSize.Type"], "", None), - ("GL_POINT_SIZE_ARRAY_STRIDE_OES", GLint, - ["ctx->Array.ArrayObj->PointSize.Stride"], "", None), - ("GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES", GLint, - ["ctx->Array.ArrayObj->PointSize.BufferObj->Name"], "", None), - - # GL_EXT_texture_lod_bias - ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat, - ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]), - - # GL_EXT_texture_filter_anisotropic - ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat, - ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]), - -] - -# Only present in ES 2.x: -StateVars_es2 = [ - # XXX These entries are not spec'ed for GLES 2, but are - # needed for Mesa's GLSL: - ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ), - ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ), - ( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV - ["ctx->Const.MaxTextureCoordUnits"], "", - ["ARB_fragment_program", "NV_fragment_program"] ), - ( "GL_MAX_DRAW_BUFFERS_ARB", GLint, - ["ctx->Const.MaxDrawBuffers"], "", ["ARB_draw_buffers"] ), - ( "GL_BLEND_COLOR_EXT", GLfloatN, - [ "ctx->Color.BlendColor[0]", - "ctx->Color.BlendColor[1]", - "ctx->Color.BlendColor[2]", - "ctx->Color.BlendColor[3]"], "", None ), - - # This is required for GLES2, but also needed for GLSL: - ( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNI - ["ctx->Const.MaxTextureImageUnits"], "", - ["ARB_fragment_program", "NV_fragment_program"] ), - - ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ), - ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ), - - # GL_ARB_shader_objects - # Actually, this token isn't part of GL_ARB_shader_objects, but is - # close enough for now. - ( "GL_CURRENT_PROGRAM", GLint, - ["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"], - "", ["ARB_shader_objects"] ), - - # OpenGL 2.0 - ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ), - ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ), - ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], "", None ), - ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ), - ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ), - ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ), - ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ), - - ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint, - ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ), - - # OES_texture_3D - ( "GL_TEXTURE_BINDING_3D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None), - ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None), - - # OES_standard_derivatives - ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum, - ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ), - - # Unique to ES 2 (not in full GL) - ( "GL_MAX_FRAGMENT_UNIFORM_VECTORS", GLint, - ["ctx->Const.FragmentProgram.MaxUniformComponents / 4"], "", None), - ( "GL_MAX_VARYING_VECTORS", GLint, - ["ctx->Const.MaxVarying"], "", None), - ( "GL_MAX_VERTEX_UNIFORM_VECTORS", GLint, - ["ctx->Const.VertexProgram.MaxUniformComponents / 4"], "", None), - ( "GL_SHADER_COMPILER", GLint, ["1"], "", None), - # OES_get_program_binary - ( "GL_NUM_SHADER_BINARY_FORMATS", GLint, ["0"], "", None), - ( "GL_SHADER_BINARY_FORMATS", GLint, [], "", None), -] - - - -def ConversionFunc(fromType, toType): - """Return the name of the macro to convert between two data types.""" - if fromType == toType: - return "" - elif fromType == GLfloat and toType == GLint: - return "IROUND" - elif fromType == GLfloatN and toType == GLfloat: - return "" - elif fromType == GLint and toType == GLfloat: # but not GLfloatN! - return "(GLfloat)" - else: - if fromType == GLfloatN: - fromType = GLfloat - fromStr = TypeStrings[fromType] - fromStr = string.upper(fromStr[2:]) - toStr = TypeStrings[toType] - toStr = string.upper(toStr[2:]) - return fromStr + "_TO_" + toStr - - -def EmitGetFunction(stateVars, returnType, API): - """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv.""" - assert (returnType == GLboolean or - returnType == GLint or - returnType == GLfloat or - returnType == GLfixed) - - strType = TypeStrings[returnType] - # Capitalize first letter of return type - if returnType == GLint: - function = "_es%d_GetIntegerv" % API - elif returnType == GLboolean: - function = "_es%d_GetBooleanv" % API - elif returnType == GLfloat: - function = "_es%d_GetFloatv" % API - elif returnType == GLfixed: - function = "_es%d_GetFixedv" % API - else: - abort() - mesa_function = "_mesa_" + function[5:] - - print "void GLAPIENTRY" - print "%s( GLenum pname, %s *params )" % (function, strType) - print "{" - print " GET_CURRENT_CONTEXT(ctx);" - print " ASSERT_OUTSIDE_BEGIN_END(ctx);" - print "" - print " if (!params)" - print " return;" - print "" - print " if (ctx->NewState)" - print " _mesa_update_state(ctx);" - print "" - print " switch (pname) {" - - for (name, varType, state, optionalCode, extensions) in stateVars: - print " case " + name + ":" - if extensions: - if len(extensions) == 1: - print (' CHECK_EXT1(%s, "%s");' % - (extensions[0], function)) - elif len(extensions) == 2: - print (' CHECK_EXT2(%s, %s, "%s");' % - (extensions[0], extensions[1], function)) - elif len(extensions) == 3: - print (' CHECK_EXT3(%s, %s, %s, "%s");' % - (extensions[0], extensions[1], extensions[2], function)) - else: - assert len(extensions) == 4 - print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' % - (extensions[0], extensions[1], extensions[2], extensions[3], function)) - if optionalCode: - print " {" - print " " + optionalCode - conversion = ConversionFunc(varType, returnType) - n = len(state) - for i in range(n): - if conversion: - print " params[%d] = %s(%s);" % (i, conversion, state[i]) - else: - print " params[%d] = %s;" % (i, state[i]) - if optionalCode: - print " }" - print " break;" - - print " default:" - print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function - print " }" - print "}" - print "" - - print "#if !FEATURE_GL" - print "/* define _mesa_ version for internal use */" - print "void GLAPIENTRY" - print "%s( GLenum pname, %s *params )" % (mesa_function, strType) - print "{" - print " %s(pname, params);" % (function) - print "}" - print "#endif /* !FEATURE_GL */" - return - - - -def EmitHeader(API): - """Print the get.c file header.""" - print """ -/*** - *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen_es.py - ***/ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/enable.h" -#include "main/extensions.h" -#include "main/fbobject.h" -#include "main/get.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "main/state.h" -#include "main/texcompress.h" -#include "main/framebuffer.h" -""" - - print "#if FEATURE_ES%d" % (API) - - print """ -/* ES1 tokens that should be in gl.h but aren't */ -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 - - -/* ES2 special tokens */ -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_SHADER_COMPILER 0x8DFA -#define GL_PLATFORM_BINARY 0x8D63 -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 - - -#ifndef GL_OES_matrix_get -#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D -#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E -#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F -#endif - -#ifndef GL_OES_compressed_paletted_texture -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif - -/* GL_OES_texture_cube_map */ -#ifndef GL_OES_texture_cube_map -#define GL_TEXTURE_GEN_STR_OES 0x8D60 -#endif - -#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) -#define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \\ - ((F) * 65536.0f < INT_MIN) ? INT_MIN : \\ - (GLint) ((F) * 65536.0f) ) - -#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) -#define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \\ - ((I) < SHRT_MIN) ? INT_MIN : \\ - (GLint) ((I) * 65536) ) - -#define BOOLEAN_TO_INT(B) ( (GLint) (B) ) -#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) -#define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 ) - -#define ENUM_TO_FIXED(E) (E) - - -/* - * Check if named extension is enabled, if not generate error and return. - */ -#define CHECK_EXT1(EXT1, FUNC) \\ - if (!ctx->Extensions.EXT1) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ - } - -/* - * Check if either of two extensions is enabled. - */ -#define CHECK_EXT2(EXT1, EXT2, FUNC) \\ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ - } - -/* - * Check if either of three extensions is enabled. - */ -#define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC) \\ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\ - !ctx->Extensions.EXT3) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ - } - -/* - * Check if either of four extensions is enabled. - */ -#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC) \\ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\ - !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \\ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\ - return; \\ - } - - - -/** - * List of compressed texture formats supported by ES. - */ -static GLenum compressed_formats[] = { - GL_PALETTE4_RGB8_OES, - GL_PALETTE4_RGBA8_OES, - GL_PALETTE4_R5_G6_B5_OES, - GL_PALETTE4_RGBA4_OES, - GL_PALETTE4_RGB5_A1_OES, - GL_PALETTE8_RGB8_OES, - GL_PALETTE8_RGBA8_OES, - GL_PALETTE8_R5_G6_B5_OES, - GL_PALETTE8_RGBA4_OES, - GL_PALETTE8_RGB5_A1_OES -}; - -#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0])) - -""" - return - - -def EmitAll(stateVars, API): - EmitHeader(API) - EmitGetFunction(stateVars, GLboolean, API) - EmitGetFunction(stateVars, GLfloat, API) - EmitGetFunction(stateVars, GLint, API) - if API == 1: - EmitGetFunction(stateVars, GLfixed, API) - - # close the #if emitted in EmitHeader - print "#endif /* FEATURE_ES%d */" % (API) - - -def main(args): - # Determine whether to generate ES1 or ES2 queries - if len(args) > 1 and args[1] == "1": - API = 1 - elif len(args) > 1 and args[1] == "2": - API = 2 - else: - API = 1 - #print "len args = %d API = %d" % (len(args), API) - - if API == 1: - vars = StateVars_common + StateVars_es1 - else: - vars = StateVars_common + StateVars_es2 - - EmitAll(vars, API) - - -main(sys.argv) diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 5b8e2f2d81..a4044ff5cb 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -107,6 +107,21 @@ typedef void *GLeglImageOES; #define GL_PALETTE8_RGB5_A1_OES 0x8B99 #endif +#ifndef GL_OES_matrix_get +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F +#endif + +#ifndef GL_ES_VERSION_2_0 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#endif + /** * Special, internal token */ diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index cff6de89ee..f4b1119eb1 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -107,6 +107,24 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) } #endif /* FEATURE_EXT_texture_sRGB */ return n; + +#if FEATURE_ES1 || FEATURE_ES2 + if (formats) { + formats[n++] = GL_PALETTE4_RGB8_OES; + formats[n++] = GL_PALETTE4_RGBA8_OES; + formats[n++] = GL_PALETTE4_R5_G6_B5_OES; + formats[n++] = GL_PALETTE4_RGBA4_OES; + formats[n++] = GL_PALETTE4_RGB5_A1_OES; + formats[n++] = GL_PALETTE8_RGB8_OES; + formats[n++] = GL_PALETTE8_RGBA8_OES; + formats[n++] = GL_PALETTE8_R5_G6_B5_OES; + formats[n++] = GL_PALETTE8_RGBA4_OES; + formats[n++] = GL_PALETTE8_RGB5_A1_OES; + } + else { + n += 10; + } +#endif } diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 5c2aa92132..af125d79aa 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -3,9 +3,7 @@ # this is part of MAIN_SOURCES MAIN_ES_SOURCES = \ main/api_exec_es1.c \ - main/api_exec_es2.c \ - main/get_es1.c \ - main/get_es2.c + main/api_exec_es2.c MAIN_SOURCES = \ main/api_arrayelt.c \ |