diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/.gitignore | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/get.c | 1053 | ||||
-rw-r--r-- | mesalib/src/mesa/main/get_hash_generator.py | 235 | ||||
-rw-r--r-- | mesalib/src/mesa/main/get_hash_params.py | 730 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 3 |
7 files changed, 1006 insertions, 1026 deletions
diff --git a/mesalib/src/mesa/main/.gitignore b/mesalib/src/mesa/main/.gitignore index 8b94c55af..edbdfb598 100644 --- a/mesalib/src/mesa/main/.gitignore +++ b/mesalib/src/mesa/main/.gitignore @@ -8,4 +8,6 @@ git_sha1.h.tmp api_exec_es1_dispatch.h
api_exec_es1_remap_helper.h
remap_helper.h
+get_hash.h
+get_hash.h.tmp
glapitable.h
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index d3fced946..29f28bd18 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx ) _mesa_get_cpu_features(); - /* context dependence is never a one-time thing... */ - _mesa_init_get_hash(ctx); - for (i = 0; i < 256; i++) { _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; } @@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx ) /* per-API one-time init */ if (!(api_init_mask & (1 << ctx->API))) { + _mesa_init_get_hash(ctx); + /* * This is fine as ES does not use the remap table, but it may not be * future-proof. We cannot always initialize the remap table because diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 14208504b..7570fab96 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -84,7 +84,6 @@ enum value_type { TYPE_INVALID, - TYPE_API_MASK, TYPE_INT, TYPE_INT_2, TYPE_INT_3, @@ -173,6 +172,7 @@ union value { LOC_CONTEXT, type, offsetof(struct gl_context, field) #define ARRAY_FIELD(field, type) \ LOC_ARRAY, type, offsetof(struct gl_array_object, field) +#undef CONST /* already defined through windows.h */ #define CONST(value) \ LOC_CONTEXT, TYPE_CONST, value @@ -386,991 +386,17 @@ extra_NV_read_buffer_api_gl[] = { EXTRA_END }; -#define API_OPENGL_BIT (1 << API_OPENGL) -#define API_OPENGLES_BIT (1 << API_OPENGLES) -#define API_OPENGLES2_BIT (1 << API_OPENGLES2) -#define API_OPENGL_CORE_BIT (1 << API_OPENGL_CORE) - /* 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 | - API_OPENGL_CORE_BIT, - NO_EXTRA}, - { GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers }, - { GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA }, - { GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA }, - { GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers }, - { GL_COLOR_CLEAR_VALUE, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp }, - { GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA }, - { GL_CULL_FACE, CONTEXT_BOOL(Polygon.CullFlag), NO_EXTRA }, - { GL_CULL_FACE_MODE, CONTEXT_ENUM(Polygon.CullFaceMode), NO_EXTRA }, - { GL_DEPTH_BITS, BUFFER_INT(Visual.depthBits), NO_EXTRA }, - { GL_DEPTH_CLEAR_VALUE, CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), NO_EXTRA }, - { GL_DEPTH_FUNC, CONTEXT_ENUM(Depth.Func), NO_EXTRA }, - { GL_DEPTH_RANGE, CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA }, - { GL_DEPTH_TEST, CONTEXT_BOOL(Depth.Test), NO_EXTRA }, - { GL_DEPTH_WRITEMASK, CONTEXT_BOOL(Depth.Mask), NO_EXTRA }, - { GL_DITHER, CONTEXT_BOOL(Color.DitherFlag), NO_EXTRA }, - { GL_FRONT_FACE, CONTEXT_ENUM(Polygon.FrontFace), NO_EXTRA }, - { GL_GREEN_BITS, BUFFER_INT(Visual.greenBits), extra_new_buffers }, - { GL_LINE_WIDTH, CONTEXT_FLOAT(Line.Width), NO_EXTRA }, - { GL_ALIASED_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidth), NO_EXTRA }, - { GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA }, - { GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA }, - { GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA }, - { GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA }, - { GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA }, - { GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA }, - { GL_POLYGON_OFFSET_FACTOR, CONTEXT_FLOAT(Polygon.OffsetFactor ), NO_EXTRA }, - { GL_POLYGON_OFFSET_UNITS, CONTEXT_FLOAT(Polygon.OffsetUnits ), NO_EXTRA }, - { GL_POLYGON_OFFSET_FILL, CONTEXT_BOOL(Polygon.OffsetFill), NO_EXTRA }, - { GL_RED_BITS, BUFFER_INT(Visual.redBits), extra_new_buffers }, - { GL_SCISSOR_BOX, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA }, - { GL_SCISSOR_TEST, CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA }, - { GL_STENCIL_BITS, BUFFER_INT(Visual.stencilBits), NO_EXTRA }, - { GL_STENCIL_CLEAR_VALUE, CONTEXT_INT(Stencil.Clear), NO_EXTRA }, - { GL_STENCIL_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, - { GL_STENCIL_FUNC, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, - { GL_STENCIL_PASS_DEPTH_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, - { GL_STENCIL_PASS_DEPTH_PASS, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, - { GL_STENCIL_REF, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, - { GL_STENCIL_TEST, CONTEXT_BOOL(Stencil.Enabled), NO_EXTRA }, - { GL_STENCIL_VALUE_MASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, - { GL_STENCIL_WRITEMASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, - { GL_SUBPIXEL_BITS, CONTEXT_INT(Const.SubPixelBits), NO_EXTRA }, - { GL_TEXTURE_BINDING_2D, LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA }, - { GL_UNPACK_ALIGNMENT, CONTEXT_INT(Unpack.Alignment), NO_EXTRA }, - { GL_VIEWPORT, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA }, - - /* GL_ARB_multitexture */ - { GL_ACTIVE_TEXTURE, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - - /* 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(struct gl_context, Const.MaxCubeTextureLevels), - extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */ - - /* XXX: OES_blend_subtract */ - { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA }, - { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA }, - { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA }, - { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA }, - - /* GL_BLEND_EQUATION_RGB, which is what we're really after, is - * defined identically to GL_BLEND_EQUATION. */ - { GL_BLEND_EQUATION, CONTEXT_ENUM(Color.Blend[0].EquationRGB), NO_EXTRA }, - { GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].EquationA), NO_EXTRA }, - - /* GL_ARB_texture_compression */ - { GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - { GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA }, - - /* GL_ARB_multisample */ - { GL_SAMPLE_ALPHA_TO_COVERAGE_ARB, - CONTEXT_BOOL(Multisample.SampleAlphaToCoverage), NO_EXTRA }, - { GL_SAMPLE_COVERAGE_ARB, CONTEXT_BOOL(Multisample.SampleCoverage), NO_EXTRA }, - { GL_SAMPLE_COVERAGE_VALUE_ARB, - CONTEXT_FLOAT(Multisample.SampleCoverageValue), NO_EXTRA }, - { GL_SAMPLE_COVERAGE_INVERT_ARB, - CONTEXT_BOOL(Multisample.SampleCoverageInvert), NO_EXTRA }, - { GL_SAMPLE_BUFFERS_ARB, BUFFER_INT(Visual.sampleBuffers), NO_EXTRA }, - { GL_SAMPLES_ARB, BUFFER_INT(Visual.samples), NO_EXTRA }, - - /* GL_SGIS_generate_mipmap */ - { GL_GENERATE_MIPMAP_HINT_SGIS, CONTEXT_ENUM(Hint.GenerateMipmap), NO_EXTRA }, - - /* GL_ARB_vertex_buffer_object */ - { GL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - - /* GL_ARB_vertex_buffer_object */ - /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported */ - { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - - /* GL_ARB_color_buffer_float */ - { GL_CLAMP_VERTEX_COLOR, CONTEXT_ENUM(Light.ClampVertexColor), extra_ARB_color_buffer_float }, - { GL_CLAMP_FRAGMENT_COLOR, CONTEXT_ENUM(Color.ClampFragmentColor), extra_ARB_color_buffer_float }, - { GL_CLAMP_READ_COLOR, CONTEXT_ENUM(Color.ClampReadColor), extra_ARB_color_buffer_float }, - - /* GL_ARB_copy_buffer */ - { GL_COPY_READ_BUFFER, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer }, - { GL_COPY_WRITE_BUFFER, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer }, - - /* GL_OES_read_format */ - { GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, LOC_CUSTOM, TYPE_INT, 0, - extra_new_buffers }, - { GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, LOC_CUSTOM, TYPE_INT, 0, - extra_new_buffers }, - - /* 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), NO_EXTRA }, - - /* GL_{APPLE,ARB,OES}_vertex_array_object */ - { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), NO_EXTRA }, - - /* GL_EXT_texture_filter_anisotropic */ - { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, - CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy), - extra_EXT_texture_filter_anisotropic }, - -#if FEATURE_GL || FEATURE_ES1 - /* Enums in OpenGL and GLES1 */ - { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGL_CORE_BIT, NO_EXTRA }, - { GL_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights), NO_EXTRA }, - { GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA }, - { GL_LIGHT1, CONTEXT_BOOL(Light.Light[1].Enabled), NO_EXTRA }, - { GL_LIGHT2, CONTEXT_BOOL(Light.Light[2].Enabled), NO_EXTRA }, - { GL_LIGHT3, CONTEXT_BOOL(Light.Light[3].Enabled), NO_EXTRA }, - { GL_LIGHT4, CONTEXT_BOOL(Light.Light[4].Enabled), NO_EXTRA }, - { GL_LIGHT5, CONTEXT_BOOL(Light.Light[5].Enabled), NO_EXTRA }, - { GL_LIGHT6, CONTEXT_BOOL(Light.Light[6].Enabled), NO_EXTRA }, - { GL_LIGHT7, CONTEXT_BOOL(Light.Light[7].Enabled), NO_EXTRA }, - { GL_LIGHTING, CONTEXT_BOOL(Light.Enabled), NO_EXTRA }, - { GL_LIGHT_MODEL_AMBIENT, - CONTEXT_FIELD(Light.Model.Ambient[0], TYPE_FLOATN_4), NO_EXTRA }, - { GL_LIGHT_MODEL_TWO_SIDE, CONTEXT_BOOL(Light.Model.TwoSide), NO_EXTRA }, - { GL_ALPHA_TEST, CONTEXT_BOOL(Color.AlphaEnabled), NO_EXTRA }, - { GL_ALPHA_TEST_FUNC, CONTEXT_ENUM(Color.AlphaFunc), NO_EXTRA }, - { GL_ALPHA_TEST_REF, LOC_CUSTOM, TYPE_FLOATN, 0, extra_new_frag_clamp }, - { GL_BLEND_DST, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA }, - { GL_CLIP_DISTANCE0, CONTEXT_BIT0(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE1, CONTEXT_BIT1(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE2, CONTEXT_BIT2(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE3, CONTEXT_BIT3(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE4, CONTEXT_BIT4(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE5, CONTEXT_BIT5(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE6, CONTEXT_BIT6(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_CLIP_DISTANCE7, CONTEXT_BIT7(Transform.ClipPlanesEnabled), extra_valid_clip_distance }, - { GL_COLOR_MATERIAL, CONTEXT_BOOL(Light.ColorMaterialEnabled), NO_EXTRA }, - { 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]), NO_EXTRA }, - { GL_FOG, CONTEXT_BOOL(Fog.Enabled), NO_EXTRA }, - { GL_FOG_COLOR, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp }, - { GL_FOG_DENSITY, CONTEXT_FLOAT(Fog.Density), NO_EXTRA }, - { GL_FOG_END, CONTEXT_FLOAT(Fog.End), NO_EXTRA }, - { GL_FOG_HINT, CONTEXT_ENUM(Hint.Fog), NO_EXTRA }, - { GL_FOG_MODE, CONTEXT_ENUM(Fog.Mode), NO_EXTRA }, - { GL_FOG_START, CONTEXT_FLOAT(Fog.Start), NO_EXTRA }, - { GL_LINE_SMOOTH, CONTEXT_BOOL(Line.SmoothFlag), NO_EXTRA }, - { GL_LINE_SMOOTH_HINT, CONTEXT_ENUM(Hint.LineSmooth), NO_EXTRA }, - { GL_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidthAA), NO_EXTRA }, - { GL_COLOR_LOGIC_OP, CONTEXT_BOOL(Color.ColorLogicOpEnabled), NO_EXTRA }, - { GL_LOGIC_OP_MODE, CONTEXT_ENUM(Color.LogicOp), NO_EXTRA }, - { GL_MATRIX_MODE, CONTEXT_ENUM(Transform.MatrixMode), NO_EXTRA }, - { GL_MAX_MODELVIEW_STACK_DEPTH, CONST(MAX_MODELVIEW_STACK_DEPTH), NO_EXTRA }, - { GL_MAX_PROJECTION_STACK_DEPTH, CONST(MAX_PROJECTION_STACK_DEPTH), NO_EXTRA }, - { GL_MAX_TEXTURE_STACK_DEPTH, CONST(MAX_TEXTURE_STACK_DEPTH), NO_EXTRA }, - { GL_MODELVIEW_MATRIX, CONTEXT_MATRIX(ModelviewMatrixStack.Top), NO_EXTRA }, - { GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA }, - { GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA }, - { GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA }, - { GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA }, - { GL_POINT_SIZE, CONTEXT_FLOAT(Point.Size), NO_EXTRA }, - { GL_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSizeAA), NO_EXTRA }, - { GL_POINT_SMOOTH, CONTEXT_BOOL(Point.SmoothFlag), NO_EXTRA }, - { GL_POINT_SMOOTH_HINT, CONTEXT_ENUM(Hint.PointSmooth), NO_EXTRA }, - { GL_POINT_SIZE_MIN_EXT, CONTEXT_FLOAT(Point.MinSize), NO_EXTRA }, - { GL_POINT_SIZE_MAX_EXT, CONTEXT_FLOAT(Point.MaxSize), NO_EXTRA }, - { GL_POINT_FADE_THRESHOLD_SIZE_EXT, CONTEXT_FLOAT(Point.Threshold), NO_EXTRA }, - { GL_PROJECTION_MATRIX, CONTEXT_MATRIX(ProjectionMatrixStack.Top), NO_EXTRA }, - { GL_PROJECTION_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, ProjectionMatrixStack.Depth), NO_EXTRA }, - { GL_RESCALE_NORMAL, CONTEXT_BOOL(Transform.RescaleNormals), NO_EXTRA }, - { GL_SHADE_MODEL, CONTEXT_ENUM(Light.ShadeModel), NO_EXTRA }, - { GL_TEXTURE_2D, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, - { 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(VertexAttrib[VERT_ATTRIB_POS].Enabled), NO_EXTRA }, - { GL_VERTEX_ARRAY_SIZE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Size), NO_EXTRA }, - { GL_VERTEX_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_POS].Type), NO_EXTRA }, - { GL_VERTEX_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Stride), NO_EXTRA }, - { GL_NORMAL_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_NORMAL].Enabled), NO_EXTRA }, - { GL_NORMAL_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA }, - { GL_NORMAL_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA }, - { GL_COLOR_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA }, - { GL_COLOR_ARRAY_SIZE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Size), NO_EXTRA }, - { GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA }, - { GL_COLOR_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA }, - { GL_TEXTURE_COORD_ARRAY, - LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA }, - { GL_TEXTURE_COORD_ARRAY_SIZE, - LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Size), NO_EXTRA }, - { GL_TEXTURE_COORD_ARRAY_TYPE, - LOC_CUSTOM, TYPE_ENUM, offsetof(struct gl_client_array, Type), NO_EXTRA }, - { GL_TEXTURE_COORD_ARRAY_STRIDE, - LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Stride), NO_EXTRA }, - - /* GL_ARB_ES2_compatibility */ - { GL_SHADER_COMPILER, CONST(1), extra_ARB_ES2_compatibility }, - { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying), - extra_ARB_ES2_compatibility }, - { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, - extra_ARB_ES2_compatibility }, - { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, - extra_ARB_ES2_compatibility }, - - /* GL_ARB_multitexture */ - { GL_MAX_TEXTURE_UNITS, CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA }, - { GL_CLIENT_ACTIVE_TEXTURE, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - - /* GL_ARB_texture_cube_map */ - { GL_TEXTURE_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, - /* 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), NO_EXTRA }, - - /* GL_ARB_multisample */ - { GL_MULTISAMPLE_ARB, CONTEXT_BOOL(Multisample.Enabled), NO_EXTRA }, - { GL_SAMPLE_ALPHA_TO_ONE_ARB, CONTEXT_BOOL(Multisample.SampleAlphaToOne), NO_EXTRA }, + * remaining combinations. To look up the enums valid in a given API + * we will use a hash table specific to that API. These tables are in + * turn generated at build time and included through get_hash.h. + * The different sections are guarded by #if FEATURE_GL etc to make + * sure we only compile in the enums we may need. */ - /* GL_ARB_vertex_buffer_object */ - { GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_POS].BufferObj), NO_EXTRA }, - { GL_NORMAL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA }, - { GL_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA }, - { GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, - - /* 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), - NO_EXTRA }, -#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(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled, TYPE_BOOLEAN) }, - { GL_POINT_SIZE_ARRAY_TYPE_OES, ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Type, TYPE_ENUM) }, - { GL_POINT_SIZE_ARRAY_STRIDE_OES, ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].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_OPENGL_CORE_BIT | API_OPENGLES2_BIT, NO_EXTRA }, - { GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */ - CONTEXT_INT(Const.MaxTextureCoordUnits), - extra_ARB_fragment_program_NV_fragment_program }, - { GL_PACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Pack.ImageHeight), NO_EXTRA }, - { GL_PACK_ROW_LENGTH, CONTEXT_INT(Pack.RowLength), NO_EXTRA }, - { GL_PACK_SKIP_PIXELS, CONTEXT_INT(Pack.SkipPixels), NO_EXTRA }, - { GL_PACK_SKIP_ROWS, CONTEXT_INT(Pack.SkipRows), NO_EXTRA }, - { GL_UNPACK_ROW_LENGTH, CONTEXT_INT(Unpack.RowLength), NO_EXTRA }, - { GL_UNPACK_SKIP_PIXELS, CONTEXT_INT(Unpack.SkipPixels), NO_EXTRA }, - { GL_UNPACK_SKIP_ROWS, CONTEXT_INT(Unpack.SkipRows), NO_EXTRA }, - { GL_UNPACK_SKIP_IMAGES_EXT, CONTEXT_INT(Unpack.SkipImages), NO_EXTRA }, - { GL_UNPACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Unpack.ImageHeight), NO_EXTRA }, - - /* GL_ARB_draw_buffers */ - { GL_MAX_DRAW_BUFFERS_ARB, CONTEXT_INT(Const.MaxDrawBuffers), NO_EXTRA }, - - /* GL_EXT_framebuffer_object / GL_NV_fbo_color_attachments */ - { GL_MAX_COLOR_ATTACHMENTS, CONTEXT_INT(Const.MaxColorAttachments), - extra_EXT_framebuffer_object }, - - /* GL_ARB_draw_buffers / GL_NV_draw_buffers (for ES 2.0) */ - { GL_DRAW_BUFFER0_ARB, BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA }, - { 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_DRAW_BUFFER4_ARB, BUFFER_ENUM(ColorDrawBuffer[4]), - extra_valid_draw_buffer }, - { GL_DRAW_BUFFER5_ARB, BUFFER_ENUM(ColorDrawBuffer[5]), - extra_valid_draw_buffer }, - { GL_DRAW_BUFFER6_ARB, BUFFER_ENUM(ColorDrawBuffer[6]), - extra_valid_draw_buffer }, - { GL_DRAW_BUFFER7_ARB, BUFFER_ENUM(ColorDrawBuffer[7]), - extra_valid_draw_buffer }, - - { GL_BLEND_COLOR_EXT, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp }, - /* 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]), NO_EXTRA }, - { GL_STENCIL_BACK_VALUE_MASK, CONTEXT_INT(Stencil.ValueMask[1]), NO_EXTRA }, - { GL_STENCIL_BACK_WRITEMASK, CONTEXT_INT(Stencil.WriteMask[1]), NO_EXTRA }, - { GL_STENCIL_BACK_REF, CONTEXT_INT(Stencil.Ref[1]), NO_EXTRA }, - { GL_STENCIL_BACK_FAIL, CONTEXT_ENUM(Stencil.FailFunc[1]), NO_EXTRA }, - { GL_STENCIL_BACK_PASS_DEPTH_FAIL, CONTEXT_ENUM(Stencil.ZFailFunc[1]), NO_EXTRA }, - { GL_STENCIL_BACK_PASS_DEPTH_PASS, CONTEXT_ENUM(Stencil.ZPassFunc[1]), NO_EXTRA }, - - { GL_MAX_VERTEX_ATTRIBS_ARB, - CONTEXT_INT(Const.VertexProgram.MaxAttribs), - extra_ARB_vertex_program_api_es2 }, - - /* OES_texture_3D */ - { GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA }, - { GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA }, - - /* GL_ARB_fragment_program/OES_standard_derivatives */ - { GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, - CONTEXT_ENUM(Hint.FragmentShaderDerivative), extra_ARB_fragment_shader }, - - /* GL_NV_read_buffer */ - { GL_READ_BUFFER, - LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, extra_NV_read_buffer_api_gl }, - -#endif /* FEATURE_GL || FEATURE_ES2 */ - -#if FEATURE_ES1 || FEATURE_ES2 - { 0, 0, TYPE_API_MASK, API_OPENGLES | API_OPENGLES2_BIT, NO_EXTRA }, - /* GL_OES_EGL_image_external */ - { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM, - TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external }, - { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM, - TYPE_BOOLEAN, 0, extra_OES_EGL_image_external }, -#endif - -#if FEATURE_ES2 - /* Enums unique to OpenGL ES 2.0 */ - { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA }, - { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying), NO_EXTRA }, - { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - { GL_SHADER_COMPILER, CONST(1), NO_EXTRA }, - /* OES_get_program_binary */ - { GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, - { GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, -#endif /* FEATURE_ES2 */ - -#if FEATURE_GL - /* Remaining enums are only in OpenGL */ - { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGL_CORE_BIT, NO_EXTRA }, - { GL_ACCUM_RED_BITS, BUFFER_INT(Visual.accumRedBits), NO_EXTRA }, - { GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA }, - { GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits), NO_EXTRA }, - { GL_ACCUM_ALPHA_BITS, BUFFER_INT(Visual.accumAlphaBits), NO_EXTRA }, - { GL_ACCUM_CLEAR_VALUE, CONTEXT_FIELD(Accum.ClearColor[0], TYPE_FLOATN_4), NO_EXTRA }, - { GL_ALPHA_BIAS, CONTEXT_FLOAT(Pixel.AlphaBias), NO_EXTRA }, - { GL_ALPHA_SCALE, CONTEXT_FLOAT(Pixel.AlphaScale), NO_EXTRA }, - { GL_ATTRIB_STACK_DEPTH, CONTEXT_INT(AttribStackDepth), NO_EXTRA }, - { GL_AUTO_NORMAL, CONTEXT_BOOL(Eval.AutoNormal), NO_EXTRA }, - { GL_AUX_BUFFERS, BUFFER_INT(Visual.numAuxBuffers), NO_EXTRA }, - { GL_BLUE_BIAS, CONTEXT_FLOAT(Pixel.BlueBias), NO_EXTRA }, - { GL_BLUE_SCALE, CONTEXT_FLOAT(Pixel.BlueScale), NO_EXTRA }, - { GL_CLIENT_ATTRIB_STACK_DEPTH, CONTEXT_INT(ClientAttribStackDepth), NO_EXTRA }, - { GL_COLOR_MATERIAL_FACE, CONTEXT_ENUM(Light.ColorMaterialFace), NO_EXTRA }, - { GL_COLOR_MATERIAL_PARAMETER, CONTEXT_ENUM(Light.ColorMaterialMode), NO_EXTRA }, - { 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), NO_EXTRA }, - { GL_CURRENT_RASTER_DISTANCE, CONTEXT_FLOAT(Current.RasterDistance), NO_EXTRA }, - { GL_CURRENT_RASTER_INDEX, CONST(1), NO_EXTRA }, - { GL_CURRENT_RASTER_POSITION, CONTEXT_FLOAT4(Current.RasterPos[0]), NO_EXTRA }, - { GL_CURRENT_RASTER_SECONDARY_COLOR, - CONTEXT_FIELD(Current.RasterSecondaryColor[0], TYPE_FLOATN_4), NO_EXTRA }, - { GL_CURRENT_RASTER_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0, - extra_valid_texture_unit }, - { GL_CURRENT_RASTER_POSITION_VALID, CONTEXT_BOOL(Current.RasterPosValid), NO_EXTRA }, - { GL_DEPTH_BIAS, CONTEXT_FLOAT(Pixel.DepthBias), NO_EXTRA }, - { GL_DEPTH_SCALE, CONTEXT_FLOAT(Pixel.DepthScale), NO_EXTRA }, - { GL_DOUBLEBUFFER, BUFFER_INT(Visual.doubleBufferMode), NO_EXTRA }, - { GL_DRAW_BUFFER, BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA }, - { GL_EDGE_FLAG, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, - { GL_FEEDBACK_BUFFER_SIZE, CONTEXT_INT(Feedback.BufferSize), NO_EXTRA }, - { GL_FEEDBACK_BUFFER_TYPE, CONTEXT_ENUM(Feedback.Type), NO_EXTRA }, - { GL_FOG_INDEX, CONTEXT_FLOAT(Fog.Index), NO_EXTRA }, - { GL_GREEN_BIAS, CONTEXT_FLOAT(Pixel.GreenBias), NO_EXTRA }, - { GL_GREEN_SCALE, CONTEXT_FLOAT(Pixel.GreenScale), NO_EXTRA }, - { GL_INDEX_BITS, BUFFER_INT(Visual.indexBits), extra_new_buffers }, - { GL_INDEX_CLEAR_VALUE, CONTEXT_INT(Color.ClearIndex), NO_EXTRA }, - { GL_INDEX_MODE, CONST(0) , NO_EXTRA}, - { GL_INDEX_OFFSET, CONTEXT_INT(Pixel.IndexOffset), NO_EXTRA }, - { GL_INDEX_SHIFT, CONTEXT_INT(Pixel.IndexShift), NO_EXTRA }, - { GL_INDEX_WRITEMASK, CONTEXT_INT(Color.IndexMask), NO_EXTRA }, - { GL_LIGHT_MODEL_COLOR_CONTROL, CONTEXT_ENUM(Light.Model.ColorControl), NO_EXTRA }, - { GL_LIGHT_MODEL_LOCAL_VIEWER, CONTEXT_BOOL(Light.Model.LocalViewer), NO_EXTRA }, - { GL_LINE_STIPPLE, CONTEXT_BOOL(Line.StippleFlag), NO_EXTRA }, - { GL_LINE_STIPPLE_PATTERN, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - { GL_LINE_STIPPLE_REPEAT, CONTEXT_INT(Line.StippleFactor), NO_EXTRA }, - { GL_LINE_WIDTH_GRANULARITY, CONTEXT_FLOAT(Const.LineWidthGranularity), NO_EXTRA }, - { GL_LIST_BASE, CONTEXT_INT(List.ListBase), NO_EXTRA }, - { GL_LIST_INDEX, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, - { GL_LIST_MODE, LOC_CUSTOM, TYPE_ENUM, 0, NO_EXTRA }, - { GL_INDEX_LOGIC_OP, CONTEXT_BOOL(Color.IndexLogicOpEnabled), NO_EXTRA }, - { GL_MAP1_COLOR_4, CONTEXT_BOOL(Eval.Map1Color4), NO_EXTRA }, - { GL_MAP1_GRID_DOMAIN, CONTEXT_FLOAT2(Eval.MapGrid1u1), NO_EXTRA }, - { GL_MAP1_GRID_SEGMENTS, CONTEXT_INT(Eval.MapGrid1un), NO_EXTRA }, - { GL_MAP1_INDEX, CONTEXT_BOOL(Eval.Map1Index), NO_EXTRA }, - { GL_MAP1_NORMAL, CONTEXT_BOOL(Eval.Map1Normal), NO_EXTRA }, - { GL_MAP1_TEXTURE_COORD_1, CONTEXT_BOOL(Eval.Map1TextureCoord1), NO_EXTRA }, - { GL_MAP1_TEXTURE_COORD_2, CONTEXT_BOOL(Eval.Map1TextureCoord2), NO_EXTRA }, - { GL_MAP1_TEXTURE_COORD_3, CONTEXT_BOOL(Eval.Map1TextureCoord3), NO_EXTRA }, - { GL_MAP1_TEXTURE_COORD_4, CONTEXT_BOOL(Eval.Map1TextureCoord4), NO_EXTRA }, - { GL_MAP1_VERTEX_3, CONTEXT_BOOL(Eval.Map1Vertex3), NO_EXTRA }, - { GL_MAP1_VERTEX_4, CONTEXT_BOOL(Eval.Map1Vertex4), NO_EXTRA }, - { GL_MAP2_COLOR_4, CONTEXT_BOOL(Eval.Map2Color4), NO_EXTRA }, - { GL_MAP2_GRID_DOMAIN, LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA }, - { GL_MAP2_GRID_SEGMENTS, CONTEXT_INT2(Eval.MapGrid2un), NO_EXTRA }, - { GL_MAP2_INDEX, CONTEXT_BOOL(Eval.Map2Index), NO_EXTRA }, - { GL_MAP2_NORMAL, CONTEXT_BOOL(Eval.Map2Normal), NO_EXTRA }, - { GL_MAP2_TEXTURE_COORD_1, CONTEXT_BOOL(Eval.Map2TextureCoord1), NO_EXTRA }, - { GL_MAP2_TEXTURE_COORD_2, CONTEXT_BOOL(Eval.Map2TextureCoord2), NO_EXTRA }, - { GL_MAP2_TEXTURE_COORD_3, CONTEXT_BOOL(Eval.Map2TextureCoord3), NO_EXTRA }, - { GL_MAP2_TEXTURE_COORD_4, CONTEXT_BOOL(Eval.Map2TextureCoord4), NO_EXTRA }, - { GL_MAP2_VERTEX_3, CONTEXT_BOOL(Eval.Map2Vertex3), NO_EXTRA }, - { GL_MAP2_VERTEX_4, CONTEXT_BOOL(Eval.Map2Vertex4), NO_EXTRA }, - { GL_MAP_COLOR, CONTEXT_BOOL(Pixel.MapColorFlag), NO_EXTRA }, - { GL_MAP_STENCIL, CONTEXT_BOOL(Pixel.MapStencilFlag), NO_EXTRA }, - { GL_MAX_ATTRIB_STACK_DEPTH, CONST(MAX_ATTRIB_STACK_DEPTH), NO_EXTRA }, - { GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, CONST(MAX_CLIENT_ATTRIB_STACK_DEPTH), NO_EXTRA }, - - { GL_MAX_EVAL_ORDER, CONST(MAX_EVAL_ORDER), NO_EXTRA }, - { GL_MAX_LIST_NESTING, CONST(MAX_LIST_NESTING), NO_EXTRA }, - { GL_MAX_NAME_STACK_DEPTH, CONST(MAX_NAME_STACK_DEPTH), NO_EXTRA }, - { GL_MAX_PIXEL_MAP_TABLE, CONST(MAX_PIXEL_MAP_TABLE), NO_EXTRA }, - { GL_NAME_STACK_DEPTH, CONTEXT_INT(Select.NameStackDepth), NO_EXTRA }, - { GL_PACK_LSB_FIRST, CONTEXT_BOOL(Pack.LsbFirst), NO_EXTRA }, - { GL_PACK_SWAP_BYTES, CONTEXT_BOOL(Pack.SwapBytes), NO_EXTRA }, - { GL_PACK_INVERT_MESA, CONTEXT_BOOL(Pack.Invert), NO_EXTRA }, - { GL_PIXEL_MAP_A_TO_A_SIZE, CONTEXT_INT(PixelMaps.AtoA.Size), NO_EXTRA }, - { GL_PIXEL_MAP_B_TO_B_SIZE, CONTEXT_INT(PixelMaps.BtoB.Size), NO_EXTRA }, - { GL_PIXEL_MAP_G_TO_G_SIZE, CONTEXT_INT(PixelMaps.GtoG.Size), NO_EXTRA }, - { GL_PIXEL_MAP_I_TO_A_SIZE, CONTEXT_INT(PixelMaps.ItoA.Size), NO_EXTRA }, - { GL_PIXEL_MAP_I_TO_B_SIZE, CONTEXT_INT(PixelMaps.ItoB.Size), NO_EXTRA }, - { GL_PIXEL_MAP_I_TO_G_SIZE, CONTEXT_INT(PixelMaps.ItoG.Size), NO_EXTRA }, - { GL_PIXEL_MAP_I_TO_I_SIZE, CONTEXT_INT(PixelMaps.ItoI.Size), NO_EXTRA }, - { GL_PIXEL_MAP_I_TO_R_SIZE, CONTEXT_INT(PixelMaps.ItoR.Size), NO_EXTRA }, - { GL_PIXEL_MAP_R_TO_R_SIZE, CONTEXT_INT(PixelMaps.RtoR.Size), NO_EXTRA }, - { GL_PIXEL_MAP_S_TO_S_SIZE, CONTEXT_INT(PixelMaps.StoS.Size), NO_EXTRA }, - { GL_POINT_SIZE_GRANULARITY, CONTEXT_FLOAT(Const.PointSizeGranularity), NO_EXTRA }, - { GL_POLYGON_MODE, CONTEXT_ENUM2(Polygon.FrontMode), NO_EXTRA }, - { GL_POLYGON_OFFSET_BIAS_EXT, CONTEXT_FLOAT(Polygon.OffsetUnits), NO_EXTRA }, - { GL_POLYGON_OFFSET_POINT, CONTEXT_BOOL(Polygon.OffsetPoint), NO_EXTRA }, - { GL_POLYGON_OFFSET_LINE, CONTEXT_BOOL(Polygon.OffsetLine), NO_EXTRA }, - { GL_POLYGON_SMOOTH, CONTEXT_BOOL(Polygon.SmoothFlag), NO_EXTRA }, - { GL_POLYGON_SMOOTH_HINT, CONTEXT_ENUM(Hint.PolygonSmooth), NO_EXTRA }, - { GL_POLYGON_STIPPLE, CONTEXT_BOOL(Polygon.StippleFlag), NO_EXTRA }, - { GL_RED_BIAS, CONTEXT_FLOAT(Pixel.RedBias), NO_EXTRA }, - { GL_RED_SCALE, CONTEXT_FLOAT(Pixel.RedScale), NO_EXTRA }, - { GL_RENDER_MODE, CONTEXT_ENUM(RenderMode), NO_EXTRA }, - { GL_RGBA_MODE, CONST(1), NO_EXTRA }, - { GL_SELECTION_BUFFER_SIZE, CONTEXT_INT(Select.BufferSize), NO_EXTRA }, - - { GL_STEREO, BUFFER_INT(Visual.stereoMode), NO_EXTRA }, - - { GL_TEXTURE_1D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, - { GL_TEXTURE_3D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, - { GL_TEXTURE_1D_ARRAY_EXT, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, - { GL_TEXTURE_2D_ARRAY_EXT, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, - - { GL_TEXTURE_BINDING_1D, LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX, NO_EXTRA }, - { 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), NO_EXTRA }, - { GL_TEXTURE_GEN_T, LOC_TEXUNIT, TYPE_BIT_1, - offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, - { GL_TEXTURE_GEN_R, LOC_TEXUNIT, TYPE_BIT_2, - offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, - { GL_TEXTURE_GEN_Q, LOC_TEXUNIT, TYPE_BIT_3, - offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, - { GL_UNPACK_LSB_FIRST, CONTEXT_BOOL(Unpack.LsbFirst), NO_EXTRA }, - { GL_UNPACK_SWAP_BYTES, CONTEXT_BOOL(Unpack.SwapBytes), NO_EXTRA }, - { GL_ZOOM_X, CONTEXT_FLOAT(Pixel.ZoomX), NO_EXTRA }, - { GL_ZOOM_Y, CONTEXT_FLOAT(Pixel.ZoomY), NO_EXTRA }, - - /* Vertex arrays */ - { GL_VERTEX_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, - { GL_NORMAL_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, - { GL_COLOR_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, - { GL_INDEX_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled), NO_EXTRA }, - { GL_INDEX_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Type), NO_EXTRA }, - { GL_INDEX_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Stride), NO_EXTRA }, - { GL_INDEX_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, - { GL_TEXTURE_COORD_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, - { GL_EDGE_FLAG_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled), NO_EXTRA }, - { GL_EDGE_FLAG_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Stride), NO_EXTRA }, - { GL_EDGE_FLAG_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, - - /* GL_ARB_texture_compression */ - { GL_TEXTURE_COMPRESSION_HINT_ARB, CONTEXT_INT(Hint.TextureCompression), NO_EXTRA }, - - /* 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_MODELVIEW_MATRIX_ARB, - CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA }, - { GL_TRANSPOSE_PROJECTION_MATRIX_ARB, - CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA }, - { GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA }, - - /* 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(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled), - extra_EXT_secondary_color }, - { GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR1].Type), - extra_EXT_secondary_color }, - { GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride), - extra_EXT_secondary_color }, - { GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].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(VertexAttrib[VERT_ATTRIB_FOG].Enabled), - extra_EXT_fog_coord }, - { GL_FOG_COORDINATE_ARRAY_TYPE_EXT, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_FOG].Type), - extra_EXT_fog_coord }, - { GL_FOG_COORDINATE_ARRAY_STRIDE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_FOG].Stride), - extra_EXT_fog_coord }, - { GL_FOG_COORDINATE_SOURCE_EXT, CONTEXT_ENUM(Fog.FogCoordinateSource), - extra_EXT_fog_coord }, - - /* GL_NV_fog_distance */ - { GL_FOG_DISTANCE_MODE_NV, CONTEXT_ENUM(Fog.FogDistanceMode), - extra_NV_fog_distance }, - - /* 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[VERT_ATTRIB_GENERIC(0)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY1_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(1)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY2_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(2)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY3_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(3)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY4_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(4)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY5_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(5)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY6_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(6)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY7_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(7)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY8_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(8)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY9_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(9)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY10_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(10)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY11_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(11)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY12_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(12)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY13_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(13)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY14_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(14)].Enabled), - extra_NV_vertex_program }, - { GL_VERTEX_ATTRIB_ARRAY15_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(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, NO_OFFSET, NO_EXTRA }, - - /* 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_NV_primitive_restart */ - { GL_PRIMITIVE_RESTART_NV, CONTEXT_BOOL(Array.PrimitiveRestart), - extra_NV_primitive_restart }, - { GL_PRIMITIVE_RESTART_INDEX_NV, CONTEXT_INT(Array.RestartIndex), - extra_NV_primitive_restart }, - - /* GL_ARB_vertex_buffer_object */ - { GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA }, - { GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA }, - { GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA }, - { GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA }, - - /* 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_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_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_ENUM(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_EXT_framebuffer_multisample }, - - /* 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_texture_integer */ - { GL_RGBA_INTEGER_MODE_EXT, BUFFER_BOOL(_IntegerColor), - extra_EXT_texture_integer }, - - /* GL_EXT_transform_feedback */ - { GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, - extra_EXT_transform_feedback }, - { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(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.MaxTransformFeedbackBuffers), - extra_EXT_transform_feedback }, - { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, - CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), - extra_EXT_transform_feedback }, - - /* GL_ARB_transform_feedback2 */ - { GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED, LOC_CUSTOM, TYPE_BOOLEAN, 0, - extra_ARB_transform_feedback2 }, - { GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE, LOC_CUSTOM, TYPE_BOOLEAN, 0, - extra_ARB_transform_feedback2 }, - { GL_TRANSFORM_FEEDBACK_BINDING, LOC_CUSTOM, TYPE_INT, 0, - extra_ARB_transform_feedback2 }, - - /* GL_ARB_transform_feedback3 */ - { GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, - CONTEXT_INT(Const.MaxTransformFeedbackBuffers), - extra_ARB_transform_feedback3 }, - { GL_MAX_VERTEX_STREAMS, - CONTEXT_INT(Const.MaxVertexStreams), - extra_ARB_transform_feedback3 }, - - /* GL_ARB_geometry_shader4 */ - { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB, - CONTEXT_INT(Const.MaxGeometryTextureImageUnits), - extra_ARB_geometry_shader4 }, - { GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB, - CONTEXT_INT(Const.MaxGeometryOutputVertices), - extra_ARB_geometry_shader4 }, - { GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB, - CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), - extra_ARB_geometry_shader4 }, - { GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB, - CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), - extra_ARB_geometry_shader4 }, - { GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB, - CONTEXT_INT(Const.MaxGeometryVaryingComponents), - extra_ARB_geometry_shader4 }, - { GL_MAX_VERTEX_VARYING_COMPONENTS_ARB, - CONTEXT_INT(Const.MaxVertexVaryingComponents), - extra_ARB_geometry_shader4 }, - - /* GL_ARB_color_buffer_float */ - { GL_RGBA_FLOAT_MODE_ARB, BUFFER_FIELD(Visual.floatMode, TYPE_BOOLEAN), 0 }, - - /* GL_EXT_gpu_shader4 / GLSL 1.30 */ - { GL_MIN_PROGRAM_TEXEL_OFFSET, - CONTEXT_INT(Const.MinProgramTexelOffset), - extra_GLSL_130 }, - { GL_MAX_PROGRAM_TEXEL_OFFSET, - CONTEXT_INT(Const.MaxProgramTexelOffset), - extra_GLSL_130 }, - - /* GL_ARB_texture_buffer_object */ - { GL_MAX_TEXTURE_BUFFER_SIZE_ARB, CONTEXT_INT(Const.MaxTextureBufferSize), - extra_texture_buffer_object }, - { GL_TEXTURE_BINDING_BUFFER_ARB, LOC_CUSTOM, TYPE_INT, 0, - extra_texture_buffer_object }, - { GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB, LOC_CUSTOM, TYPE_INT, - TEXTURE_BUFFER_INDEX, extra_texture_buffer_object }, - { GL_TEXTURE_BUFFER_FORMAT_ARB, LOC_CUSTOM, TYPE_INT, 0, - extra_texture_buffer_object }, - { GL_TEXTURE_BUFFER_ARB, LOC_CUSTOM, TYPE_INT, 0, - extra_texture_buffer_object }, - - /* GL_ARB_sampler_objects / GL 3.3 */ - { GL_SAMPLER_BINDING, - LOC_CUSTOM, TYPE_INT, GL_SAMPLER_BINDING, NO_EXTRA }, - - /* GL 3.0 */ - { GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, - { GL_MAJOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, - { GL_MINOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, - { GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 }, - - /* GL3.0 / GL_EXT_framebuffer_sRGB */ - { GL_FRAMEBUFFER_SRGB_EXT, CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB }, - { GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB }, - - /* GL 3.1 */ - /* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV - * vs. GL_PRIMITIVE_RESTART! - */ - { 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 }, - - /* GL_ARB_robustness */ - { GL_RESET_NOTIFICATION_STRATEGY_ARB, CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA }, - - /* GL_ARB_debug_output */ - { GL_DEBUG_LOGGED_MESSAGES_ARB, CONTEXT_INT(Debug.NumMessages), NO_EXTRA }, - { GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB, CONTEXT_INT(Debug.NextMsgLength), NO_EXTRA }, - { GL_MAX_DEBUG_LOGGED_MESSAGES_ARB, CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA }, - { GL_MAX_DEBUG_MESSAGE_LENGTH_ARB, CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA }, - - { GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended }, - - /* GL_ARB_uniform_buffer_object */ - { GL_MAX_VERTEX_UNIFORM_BLOCKS, CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks), - extra_ARB_uniform_buffer_object }, - { GL_MAX_FRAGMENT_UNIFORM_BLOCKS, CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks), - extra_ARB_uniform_buffer_object }, - { GL_MAX_GEOMETRY_UNIFORM_BLOCKS, CONTEXT_INT(Const.GeometryProgram.MaxUniformBlocks), - extra_ARB_uniform_buffer_object_and_geometry_shader }, - { GL_MAX_COMBINED_UNIFORM_BLOCKS, CONTEXT_INT(Const.MaxCombinedUniformBlocks), - extra_ARB_uniform_buffer_object }, - { GL_MAX_UNIFORM_BLOCK_SIZE, CONTEXT_INT(Const.MaxUniformBlockSize), - extra_ARB_uniform_buffer_object }, - { GL_MAX_UNIFORM_BUFFER_BINDINGS, CONTEXT_INT(Const.MaxUniformBufferBindings), - extra_ARB_uniform_buffer_object }, - - { GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents), - extra_ARB_uniform_buffer_object }, - { GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents), - extra_ARB_uniform_buffer_object }, - { GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, CONTEXT_INT(Const.GeometryProgram.MaxCombinedUniformComponents), - extra_ARB_uniform_buffer_object_and_geometry_shader }, - { GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, CONTEXT_INT(Const.UniformBufferOffsetAlignment), - extra_ARB_uniform_buffer_object }, - - { GL_UNIFORM_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object }, - - /* GL_ARB_timer_query */ - { GL_TIMESTAMP, LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query } - -#endif /* FEATURE_GL */ -}; +#include "get_hash.h" /* 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 @@ -1385,29 +411,34 @@ static const struct value_desc values[] = { * 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) +print_table_stats(int api) { int i, j, collisions[11], count, hash, mask; const struct value_desc *d; - + const char *api_names[] = { + [API_OPENGL] = "GL", + [API_OPENGL_CORE] = "GL_CORE", + [API_OPENGLES] = "GLES", + [API_OPENGLES2] = "GLES2", + }; + const char *api_name; + + api_name = api < Elements(api_names) ? api_names[api] : "N/A"; count = 0; - mask = Elements(table) - 1; + mask = Elements(table(api)) - 1; memset(collisions, 0, sizeof collisions); - for (i = 0; i < Elements(table); i++) { - if (!table[i]) + for (i = 0; i < Elements(table(api)); i++) { + if (!table(api)[i]) continue; count++; - d = &values[table[i]]; + d = &values[table(api)[i]]; hash = (d->pname * prime_factor); j = 0; while (1) { - if (values[table[hash & mask]].pname == d->pname) + if (values[table(api)[hash & mask]].pname == d->pname) break; hash += prime_step; j++; @@ -1419,7 +450,8 @@ print_table_stats(void) collisions[10]++; } - printf("number of enums: %d (total %d)\n", count, Elements(values)); + printf("number of enums for %s: %d (total %ld)\n", + api_name, count, Elements(values)); for (i = 0; i < Elements(collisions) - 1; i++) if (collisions[i] > 0) printf(" %d enums with %d %scollisions\n", @@ -1437,31 +469,6 @@ print_table_stats(void) */ void _mesa_init_get_hash(struct gl_context *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; - } - } - #ifdef GET_DEBUG print_table_stats(); #endif @@ -1986,20 +993,24 @@ find_value(const char *func, GLenum pname, void **p, union value *v) struct gl_texture_unit *unit; int mask, hash; const struct value_desc *d; + int api; - mask = Elements(table) - 1; + api = ctx->API; + mask = Elements(table(api)) - 1; hash = (pname * prime_factor); while (1) { - d = &values[table[hash & mask]]; + int idx = table(api)[hash & mask]; /* 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 (unlikely(d->type == TYPE_API_MASK)) { + * pointing to the first entry of values[] which doesn't hold + * any valid enum. */ + if (unlikely(idx == 0)) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, _mesa_lookup_enum_by_nr(pname)); return &error_value; } + d = &values[idx]; if (likely(d->pname == pname)) break; diff --git a/mesalib/src/mesa/main/get_hash_generator.py b/mesalib/src/mesa/main/get_hash_generator.py new file mode 100644 index 000000000..4b3f5f490 --- /dev/null +++ b/mesalib/src/mesa/main/get_hash_generator.py @@ -0,0 +1,235 @@ +#!/usr/bin/python2 +# coding=utf-8 +# -*- Mode: Python; py-indent-offset: 4 -*- +# +# Copyright © 2012 Intel Corporation +# +# Based on code by Kristian Høgsberg <krh@bitplanet.net>, +# extracted from mesa/main/get.c +# +# 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 +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, 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 (including the next +# paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS 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. + +# Generate a C header file containing hash tables of glGet parameter +# names for each GL API. The generated file is to be included by glGet.c + +import os, sys, imp, getopt +from collections import defaultdict +import get_hash_params + +cur_dir = os.path.dirname(sys.argv[0]) +param_desc_file = "%s/get_hash_params.py" % cur_dir + +GLAPI = "%s/../../mapi/glapi/gen" % cur_dir +sys.path.append(GLAPI) +import gl_XML + +prime_factor = 89 +prime_step = 281 +hash_table_size = 1024 + +gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2"]) + +def print_header(): + print "typedef const unsigned short table_t[%d];\n" % (hash_table_size) + print "static const int prime_factor = %d, prime_step = %d;\n" % \ + (prime_factor, prime_step) + +def print_params(params): + print "static struct value_desc values[] = {" + for p in params: + print " { %s, %s }," % (p[0], p[1]) + + print "};\n" + +def api_name(api): + return "API_OPEN%s" % api + +# This must match gl_api enum in src/mesa/main/mtypes.h +api_enum = [ + 'GL', + 'GLES', + 'GLES2', + 'GL_CORE', +] + +def api_index(api): + return api_enum.index(api) + +def table_name(api): + return "table_" + api_name(api) + +def print_table(api, table): + print "static table_t %s = {" % (table_name(api)) + + # convert sparse (index, value) table into a dense table + dense_table = [0] * hash_table_size + for i, v in table: + dense_table[i] = v + + row_size = 4 + for i in range(0, hash_table_size, row_size): + row = dense_table[i : i + row_size] + idx_val = ["%4d" % v for v in row] + print " " * 4 + ", ".join(idx_val) + "," + + print "};\n" + +def print_tables(tables): + for table in tables: + print_table(table["apis"][0], table["indices"]) + + dense_tables = ['NULL'] * len(api_enum) + for table in tables: + tname = table_name(table["apis"][0]) + for api in table["apis"]: + i = api_index(api) + dense_tables[i] = "&%s" % (tname) + + print "static table_t *table_set[] = {" + for expr in dense_tables: + print " %s," % expr + print "};\n" + + print "#define table(api) (*table_set[api])" + +# Merge tables with matching parameter lists (i.e. GL and GL_CORE) +def merge_tables(tables): + merged_tables = [] + for api, indices in sorted(tables.items()): + matching_table = filter(lambda mt:mt["indices"] == indices, + merged_tables) + if matching_table: + matching_table[0]["apis"].append(api) + else: + merged_tables.append({"apis": [api], "indices": indices}) + + return merged_tables + +def add_to_hash_table(table, hash_val, value): + while True: + index = hash_val & (hash_table_size - 1) + if index not in table: + table[index] = value + break + hash_val += prime_step + +def die(msg): + sys.stderr.write("%s: %s\n" % (program, msg)) + exit(1) + +program = os.path.basename(sys.argv[0]) + +def generate_hash_tables(enum_list, enabled_apis, param_descriptors): + tables = defaultdict(lambda:{}) + + # the first entry should be invalid, so that get.c:find_value can use + # its index for the 'enum not found' condition. + params = [[0, ""]] + + for param_block in param_descriptors: + if set(["apis", "params"]) != set(param_block): + die("missing fields (%s) in param descriptor file (%s)" % + (", ".join(set(["apis", "params"]) - set(param_block)), + param_desc_file)) + + valid_apis = set(param_block["apis"]) + if valid_apis - gl_apis: + die("unknown API(s) in param descriptor file (%s): %s\n" % + (param_desc_file, ",".join(valid_apis - gl_apis))) + + if not (valid_apis & enabled_apis): + continue + + valid_apis &= enabled_apis + + for param in param_block["params"]: + enum_name = param[0] + enum_val = enum_list[enum_name].value + hash_val = enum_val * prime_factor + + for api in valid_apis: + add_to_hash_table(tables[api], hash_val, len(params)) + + params.append(["GL_" + enum_name, param[1]]) + + sorted_tables={} + for api, indices in tables.items(): + sorted_tables[api] = sorted(indices.items()) + + return params, merge_tables(sorted_tables) + +def opt_to_apis(feature): + _map = {"ES1": "GLES", "ES2": "GLES2", "GL": "GL"} + if feature not in _map: + return None + + apis = set([_map[feature]]) + if "GL" in apis: + apis.add("GL_CORE") + + return apis + +def show_usage(): + sys.stderr.write( +"""Usage: %s [OPTIONS] + -f <file> specify GL API XML file + -a [GL|ES1|ES2] specify APIs to generate hash tables for +""" % (program)) + exit(1) + +if __name__ == '__main__': + try: + (opts, args) = getopt.getopt(sys.argv[1:], "f:a:") + except Exception,e: + show_usage() + + if len(args) != 0: + show_usage() + + enabled_apis = set([]) + api_desc_file = "" + + for opt_name, opt_val in opts: + if opt_name == "-f": + api_desc_file = opt_val + if opt_name == "-a": + apis = opt_to_apis(opt_val.upper()) + if not apis: + die("invalid API %s\n" % opt_val) + + enabled_apis |= apis + + if not api_desc_file: + die("missing descriptor file (-f)\n") + + if len(enabled_apis) == 0: + die("need at least a single enabled API\n") + + try: + api_desc = gl_XML.parse_GL_API(api_desc_file) + except Exception: + die("couldn't parse API specification file %s\n" % api_desc_file) + + (params, hash_tables) = generate_hash_tables(api_desc.enums_by_name, + enabled_apis, get_hash_params.descriptor) + + print_header() + print_params(params) + print_tables(hash_tables) diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py new file mode 100644 index 000000000..7dde0f9e8 --- /dev/null +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -0,0 +1,730 @@ +descriptor=[ +{ "apis": ["GL", "GLES", "GLES2", "GL_CORE"], "params": [ + [ "ALPHA_BITS", "BUFFER_INT(Visual.alphaBits), extra_new_buffers" ], + [ "BLEND", "CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA" ], + [ "BLEND_SRC", "CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA" ], + [ "BLUE_BITS", "BUFFER_INT(Visual.blueBits), extra_new_buffers" ], + [ "COLOR_CLEAR_VALUE", "LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp" ], + [ "COLOR_WRITEMASK", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], + [ "CULL_FACE", "CONTEXT_BOOL(Polygon.CullFlag), NO_EXTRA" ], + [ "CULL_FACE_MODE", "CONTEXT_ENUM(Polygon.CullFaceMode), NO_EXTRA" ], + [ "DEPTH_BITS", "BUFFER_INT(Visual.depthBits), NO_EXTRA" ], + [ "DEPTH_CLEAR_VALUE", "CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), NO_EXTRA" ], + [ "DEPTH_FUNC", "CONTEXT_ENUM(Depth.Func), NO_EXTRA" ], + [ "DEPTH_RANGE", "CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA" ], + [ "DEPTH_TEST", "CONTEXT_BOOL(Depth.Test), NO_EXTRA" ], + [ "DEPTH_WRITEMASK", "CONTEXT_BOOL(Depth.Mask), NO_EXTRA" ], + [ "DITHER", "CONTEXT_BOOL(Color.DitherFlag), NO_EXTRA" ], + [ "FRONT_FACE", "CONTEXT_ENUM(Polygon.FrontFace), NO_EXTRA" ], + [ "GREEN_BITS", "BUFFER_INT(Visual.greenBits), extra_new_buffers" ], + [ "LINE_WIDTH", "CONTEXT_FLOAT(Line.Width), NO_EXTRA" ], + [ "ALIASED_LINE_WIDTH_RANGE", "CONTEXT_FLOAT2(Const.MinLineWidth), NO_EXTRA" ], + [ "MAX_ELEMENTS_VERTICES", "CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA" ], + [ "MAX_ELEMENTS_INDICES", "CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA" ], + [ "MAX_TEXTURE_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA" ], + [ "MAX_VIEWPORT_DIMS", "CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA" ], + [ "PACK_ALIGNMENT", "CONTEXT_INT(Pack.Alignment), NO_EXTRA" ], + [ "ALIASED_POINT_SIZE_RANGE", "CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA" ], + [ "POLYGON_OFFSET_FACTOR", "CONTEXT_FLOAT(Polygon.OffsetFactor ), NO_EXTRA" ], + [ "POLYGON_OFFSET_UNITS", "CONTEXT_FLOAT(Polygon.OffsetUnits ), NO_EXTRA" ], + [ "POLYGON_OFFSET_FILL", "CONTEXT_BOOL(Polygon.OffsetFill), NO_EXTRA" ], + [ "RED_BITS", "BUFFER_INT(Visual.redBits), extra_new_buffers" ], + [ "SCISSOR_BOX", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], + [ "SCISSOR_TEST", "CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA" ], + [ "STENCIL_BITS", "BUFFER_INT(Visual.stencilBits), NO_EXTRA" ], + [ "STENCIL_CLEAR_VALUE", "CONTEXT_INT(Stencil.Clear), NO_EXTRA" ], + [ "STENCIL_FAIL", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], + [ "STENCIL_FUNC", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], + [ "STENCIL_PASS_DEPTH_FAIL", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], + [ "STENCIL_PASS_DEPTH_PASS", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], + [ "STENCIL_REF", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ], + [ "STENCIL_TEST", "CONTEXT_BOOL(Stencil.Enabled), NO_EXTRA" ], + [ "STENCIL_VALUE_MASK", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ], + [ "STENCIL_WRITEMASK", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ], + [ "SUBPIXEL_BITS", "CONTEXT_INT(Const.SubPixelBits), NO_EXTRA" ], + [ "TEXTURE_BINDING_2D", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA" ], + [ "UNPACK_ALIGNMENT", "CONTEXT_INT(Unpack.Alignment), NO_EXTRA" ], + [ "VIEWPORT", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], + +# GL_ARB_multitexture + [ "ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + +# 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 + [ "TEXTURE_BINDING_CUBE_MAP_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map" ], +# XXX: OES_texture_cube_map + [ "MAX_CUBE_MAP_TEXTURE_SIZE_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, Const.MaxCubeTextureLevels), extra_ARB_texture_cube_map" ], + +# XXX: OES_blend_subtract + [ "BLEND_SRC_RGB", "CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA" ], + [ "BLEND_DST_RGB", "CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA" ], + [ "BLEND_SRC_ALPHA", "CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA" ], + [ "BLEND_DST_ALPHA", "CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA" ], + +# GL_BLEND_EQUATION_RGB, which is what we're really after, is +# defined identically to GL_BLEND_EQUATION. + [ "BLEND_EQUATION", "CONTEXT_ENUM(Color.Blend[0].EquationRGB), NO_EXTRA" ], + [ "BLEND_EQUATION_ALPHA_EXT", "CONTEXT_ENUM(Color.Blend[0].EquationA), NO_EXTRA" ], + +# GL_ARB_texture_compression + [ "NUM_COMPRESSED_TEXTURE_FORMATS_ARB", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + [ "COMPRESSED_TEXTURE_FORMATS", "LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA" ], + +# GL_ARB_multisample + [ "SAMPLE_ALPHA_TO_COVERAGE_ARB", "CONTEXT_BOOL(Multisample.SampleAlphaToCoverage), NO_EXTRA" ], + [ "SAMPLE_COVERAGE_ARB", "CONTEXT_BOOL(Multisample.SampleCoverage), NO_EXTRA" ], + [ "SAMPLE_COVERAGE_VALUE_ARB", "CONTEXT_FLOAT(Multisample.SampleCoverageValue), NO_EXTRA" ], + [ "SAMPLE_COVERAGE_INVERT_ARB", "CONTEXT_BOOL(Multisample.SampleCoverageInvert), NO_EXTRA" ], + [ "SAMPLE_BUFFERS_ARB", "BUFFER_INT(Visual.sampleBuffers), NO_EXTRA" ], + [ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), NO_EXTRA" ], + +# GL_SGIS_generate_mipmap + [ "GENERATE_MIPMAP_HINT_SGIS", "CONTEXT_ENUM(Hint.GenerateMipmap), NO_EXTRA" ], + +# GL_ARB_vertex_buffer_object + [ "ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + +# GL_ARB_vertex_buffer_object +# GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported + [ "ELEMENT_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + +# GL_ARB_color_buffer_float + [ "CLAMP_VERTEX_COLOR", "CONTEXT_ENUM(Light.ClampVertexColor), extra_ARB_color_buffer_float" ], + [ "CLAMP_FRAGMENT_COLOR", "CONTEXT_ENUM(Color.ClampFragmentColor), extra_ARB_color_buffer_float" ], + [ "CLAMP_READ_COLOR", "CONTEXT_ENUM(Color.ClampReadColor), extra_ARB_color_buffer_float" ], + +# GL_ARB_copy_buffer + [ "COPY_READ_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer" ], + [ "COPY_WRITE_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer" ], + +# GL_OES_read_format + [ "IMPLEMENTATION_COLOR_READ_TYPE_OES", "LOC_CUSTOM, TYPE_INT, 0, extra_new_buffers" ], + [ "IMPLEMENTATION_COLOR_READ_FORMAT_OES", "LOC_CUSTOM, TYPE_INT, 0, extra_new_buffers" ], + +# GL_EXT_framebuffer_object + [ "FRAMEBUFFER_BINDING_EXT", "BUFFER_INT(Name), extra_EXT_framebuffer_object" ], + [ "RENDERBUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_framebuffer_object" ], + [ "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: + [ "MAX_CLIP_PLANES", "CONTEXT_INT(Const.MaxClipPlanes), NO_EXTRA" ], + +# GL_{APPLE,ARB,OES}_vertex_array_object + [ "VERTEX_ARRAY_BINDING_APPLE", "ARRAY_INT(Name), NO_EXTRA" ], + +# GL_EXT_texture_filter_anisotropic + [ "MAX_TEXTURE_MAX_ANISOTROPY_EXT", "CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy), extra_EXT_texture_filter_anisotropic" ], +]}, + +# Enums in OpenGL and GLES1 +{ "apis": ["GL", "GLES", "GL_CORE"], "params": [ + [ "MAX_LIGHTS", "CONTEXT_INT(Const.MaxLights), NO_EXTRA" ], + [ "LIGHT0", "CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA" ], + [ "LIGHT1", "CONTEXT_BOOL(Light.Light[1].Enabled), NO_EXTRA" ], + [ "LIGHT2", "CONTEXT_BOOL(Light.Light[2].Enabled), NO_EXTRA" ], + [ "LIGHT3", "CONTEXT_BOOL(Light.Light[3].Enabled), NO_EXTRA" ], + [ "LIGHT4", "CONTEXT_BOOL(Light.Light[4].Enabled), NO_EXTRA" ], + [ "LIGHT5", "CONTEXT_BOOL(Light.Light[5].Enabled), NO_EXTRA" ], + [ "LIGHT6", "CONTEXT_BOOL(Light.Light[6].Enabled), NO_EXTRA" ], + [ "LIGHT7", "CONTEXT_BOOL(Light.Light[7].Enabled), NO_EXTRA" ], + [ "LIGHTING", "CONTEXT_BOOL(Light.Enabled), NO_EXTRA" ], + [ "LIGHT_MODEL_AMBIENT", "CONTEXT_FIELD(Light.Model.Ambient[0], TYPE_FLOATN_4), NO_EXTRA" ], + [ "LIGHT_MODEL_TWO_SIDE", "CONTEXT_BOOL(Light.Model.TwoSide), NO_EXTRA" ], + [ "ALPHA_TEST", "CONTEXT_BOOL(Color.AlphaEnabled), NO_EXTRA" ], + [ "ALPHA_TEST_FUNC", "CONTEXT_ENUM(Color.AlphaFunc), NO_EXTRA" ], + [ "ALPHA_TEST_REF", "LOC_CUSTOM, TYPE_FLOATN, 0, extra_new_frag_clamp" ], + [ "BLEND_DST", "CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA" ], + [ "CLIP_DISTANCE0", "CONTEXT_BIT0(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE1", "CONTEXT_BIT1(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE2", "CONTEXT_BIT2(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE3", "CONTEXT_BIT3(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE4", "CONTEXT_BIT4(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE5", "CONTEXT_BIT5(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE6", "CONTEXT_BIT6(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "CLIP_DISTANCE7", "CONTEXT_BIT7(Transform.ClipPlanesEnabled), extra_valid_clip_distance" ], + [ "COLOR_MATERIAL", "CONTEXT_BOOL(Light.ColorMaterialEnabled), NO_EXTRA" ], + [ "CURRENT_COLOR", "CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR0][0], TYPE_FLOATN_4), extra_flush_current" ], + [ "CURRENT_NORMAL", "CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_NORMAL][0], TYPE_FLOATN_3), extra_flush_current" ], + [ "CURRENT_TEXTURE_COORDS", "LOC_CUSTOM, TYPE_FLOAT_4, 0, extra_flush_current_valid_texture_unit" ], + [ "POINT_DISTANCE_ATTENUATION", "CONTEXT_FLOAT3(Point.Params[0]), NO_EXTRA" ], + [ "FOG", "CONTEXT_BOOL(Fog.Enabled), NO_EXTRA" ], + [ "FOG_COLOR", "LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp" ], + [ "FOG_DENSITY", "CONTEXT_FLOAT(Fog.Density), NO_EXTRA" ], + [ "FOG_END", "CONTEXT_FLOAT(Fog.End), NO_EXTRA" ], + [ "FOG_HINT", "CONTEXT_ENUM(Hint.Fog), NO_EXTRA" ], + [ "FOG_MODE", "CONTEXT_ENUM(Fog.Mode), NO_EXTRA" ], + [ "FOG_START", "CONTEXT_FLOAT(Fog.Start), NO_EXTRA" ], + [ "LINE_SMOOTH", "CONTEXT_BOOL(Line.SmoothFlag), NO_EXTRA" ], + [ "LINE_SMOOTH_HINT", "CONTEXT_ENUM(Hint.LineSmooth), NO_EXTRA" ], + [ "LINE_WIDTH_RANGE", "CONTEXT_FLOAT2(Const.MinLineWidthAA), NO_EXTRA" ], + [ "COLOR_LOGIC_OP", "CONTEXT_BOOL(Color.ColorLogicOpEnabled), NO_EXTRA" ], + [ "LOGIC_OP_MODE", "CONTEXT_ENUM(Color.LogicOp), NO_EXTRA" ], + [ "MATRIX_MODE", "CONTEXT_ENUM(Transform.MatrixMode), NO_EXTRA" ], + [ "MAX_MODELVIEW_STACK_DEPTH", "CONST(MAX_MODELVIEW_STACK_DEPTH), NO_EXTRA" ], + [ "MAX_PROJECTION_STACK_DEPTH", "CONST(MAX_PROJECTION_STACK_DEPTH), NO_EXTRA" ], + [ "MAX_TEXTURE_STACK_DEPTH", "CONST(MAX_TEXTURE_STACK_DEPTH), NO_EXTRA" ], + [ "MODELVIEW_MATRIX", "CONTEXT_MATRIX(ModelviewMatrixStack.Top), NO_EXTRA" ], + [ "MODELVIEW_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA" ], + [ "NORMALIZE", "CONTEXT_BOOL(Transform.Normalize), NO_EXTRA" ], + [ "PACK_SKIP_IMAGES", "CONTEXT_INT(Pack.SkipImages), NO_EXTRA" ], + [ "PERSPECTIVE_CORRECTION_HINT", "CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA" ], + [ "POINT_SIZE", "CONTEXT_FLOAT(Point.Size), NO_EXTRA" ], + [ "POINT_SIZE_RANGE", "CONTEXT_FLOAT2(Const.MinPointSizeAA), NO_EXTRA" ], + [ "POINT_SMOOTH", "CONTEXT_BOOL(Point.SmoothFlag), NO_EXTRA" ], + [ "POINT_SMOOTH_HINT", "CONTEXT_ENUM(Hint.PointSmooth), NO_EXTRA" ], + [ "POINT_SIZE_MIN_EXT", "CONTEXT_FLOAT(Point.MinSize), NO_EXTRA" ], + [ "POINT_SIZE_MAX_EXT", "CONTEXT_FLOAT(Point.MaxSize), NO_EXTRA" ], + [ "POINT_FADE_THRESHOLD_SIZE_EXT", "CONTEXT_FLOAT(Point.Threshold), NO_EXTRA" ], + [ "PROJECTION_MATRIX", "CONTEXT_MATRIX(ProjectionMatrixStack.Top), NO_EXTRA" ], + [ "PROJECTION_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, ProjectionMatrixStack.Depth), NO_EXTRA" ], + [ "RESCALE_NORMAL", "CONTEXT_BOOL(Transform.RescaleNormals), NO_EXTRA" ], + [ "SHADE_MODEL", "CONTEXT_ENUM(Light.ShadeModel), NO_EXTRA" ], + [ "TEXTURE_2D", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ], + [ "TEXTURE_MATRIX", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_valid_texture_unit" ], + [ "TEXTURE_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, extra_valid_texture_unit" ], + [ "VERTEX_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_POS].Enabled), NO_EXTRA" ], + [ "VERTEX_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Size), NO_EXTRA" ], + [ "VERTEX_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_POS].Type), NO_EXTRA" ], + [ "VERTEX_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Stride), NO_EXTRA" ], + [ "NORMAL_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_NORMAL].Enabled), NO_EXTRA" ], + [ "NORMAL_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA" ], + [ "NORMAL_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ], + [ "COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA" ], + [ "COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Size), NO_EXTRA" ], + [ "COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA" ], + [ "COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Size), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM, offsetof(struct gl_client_array, Type), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Stride), NO_EXTRA" ], + +# GL_ARB_ES2_compatibility + [ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility" ], + [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility" ], + [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ], + [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ], + +# GL_ARB_multitexture + [ "MAX_TEXTURE_UNITS", "CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA" ], + [ "CLIENT_ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + +# GL_ARB_texture_cube_map + [ "TEXTURE_CUBE_MAP_ARB", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ], +# S, T, and R are always set at the same time + [ "TEXTURE_GEN_STR_OES", "LOC_TEXUNIT, TYPE_BIT_0, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ], + +# GL_ARB_multisample + [ "MULTISAMPLE_ARB", "CONTEXT_BOOL(Multisample.Enabled), NO_EXTRA" ], + [ "SAMPLE_ALPHA_TO_ONE_ARB", "CONTEXT_BOOL(Multisample.SampleAlphaToOne), NO_EXTRA" ], + +# GL_ARB_vertex_buffer_object + [ "VERTEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_POS].BufferObj), NO_EXTRA" ], + [ "NORMAL_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA" ], + [ "COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ], + +# GL_OES_point_sprite + [ "POINT_SPRITE_NV", "CONTEXT_BOOL(Point.PointSprite), extra_NV_point_sprite_ARB_point_sprite" ], + +# GL_ARB_fragment_shader + [ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), extra_ARB_fragment_shader" ], + +# GL_ARB_vertex_shader + [ "MAX_VERTEX_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxUniformComponents), extra_ARB_vertex_shader" ], + [ "MAX_VARYING_FLOATS_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_shader" ], + +# GL_EXT_texture_lod_bias + [ "MAX_TEXTURE_LOD_BIAS_EXT", "CONTEXT_FLOAT(Const.MaxTextureLodBias), NO_EXTRA" ], +]}, + + +{ "apis": ["GLES"], "params": [ +# XXX: OES_matrix_get + [ "MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES", "" ], + [ "PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES", "" ], + [ "TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES", "" ], + +# OES_point_size_array + [ "POINT_SIZE_ARRAY_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled, TYPE_BOOLEAN)" ], + [ "POINT_SIZE_ARRAY_TYPE_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Type, TYPE_ENUM)" ], + [ "POINT_SIZE_ARRAY_STRIDE_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Stride, TYPE_INT)" ], + [ "POINT_SIZE_ARRAY_BUFFER_BINDING_OES", "LOC_CUSTOM, TYPE_INT, 0" ], +]}, + +{ "apis": ["GL", "GL_CORE", "GLES2"], "params": [ +# == GL_MAX_TEXTURE_COORDS_NV + [ "MAX_TEXTURE_COORDS_ARB", "CONTEXT_INT(Const.MaxTextureCoordUnits), extra_ARB_fragment_program_NV_fragment_program" ], + [ "PACK_IMAGE_HEIGHT", "CONTEXT_INT(Pack.ImageHeight), NO_EXTRA" ], + [ "PACK_ROW_LENGTH", "CONTEXT_INT(Pack.RowLength), NO_EXTRA" ], + [ "PACK_SKIP_PIXELS", "CONTEXT_INT(Pack.SkipPixels), NO_EXTRA" ], + [ "PACK_SKIP_ROWS", "CONTEXT_INT(Pack.SkipRows), NO_EXTRA" ], + [ "UNPACK_ROW_LENGTH", "CONTEXT_INT(Unpack.RowLength), NO_EXTRA" ], + [ "UNPACK_SKIP_PIXELS", "CONTEXT_INT(Unpack.SkipPixels), NO_EXTRA" ], + [ "UNPACK_SKIP_ROWS", "CONTEXT_INT(Unpack.SkipRows), NO_EXTRA" ], + [ "UNPACK_SKIP_IMAGES", "CONTEXT_INT(Unpack.SkipImages), NO_EXTRA" ], + [ "UNPACK_IMAGE_HEIGHT", "CONTEXT_INT(Unpack.ImageHeight), NO_EXTRA" ], + +# GL_ARB_draw_buffers + [ "MAX_DRAW_BUFFERS_ARB", "CONTEXT_INT(Const.MaxDrawBuffers), NO_EXTRA" ], + +# GL_EXT_framebuffer_object / GL_NV_fbo_color_attachments + [ "MAX_COLOR_ATTACHMENTS", "CONTEXT_INT(Const.MaxColorAttachments), extra_EXT_framebuffer_object" ], + +# GL_ARB_draw_buffers / GL_NV_draw_buffers (for ES 2.0) + [ "DRAW_BUFFER0_ARB", "BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA" ], + [ "DRAW_BUFFER1_ARB", "BUFFER_ENUM(ColorDrawBuffer[1]), extra_valid_draw_buffer" ], + [ "DRAW_BUFFER2_ARB", "BUFFER_ENUM(ColorDrawBuffer[2]), extra_valid_draw_buffer" ], + [ "DRAW_BUFFER3_ARB", "BUFFER_ENUM(ColorDrawBuffer[3]), extra_valid_draw_buffer" ], + [ "DRAW_BUFFER4_ARB", "BUFFER_ENUM(ColorDrawBuffer[4]), extra_valid_draw_buffer" ], + [ "DRAW_BUFFER5_ARB", "BUFFER_ENUM(ColorDrawBuffer[5]), extra_valid_draw_buffer" ], + [ "DRAW_BUFFER6_ARB", "BUFFER_ENUM(ColorDrawBuffer[6]), extra_valid_draw_buffer" ], + [ "DRAW_BUFFER7_ARB", "BUFFER_ENUM(ColorDrawBuffer[7]), extra_valid_draw_buffer" ], + [ "BLEND_COLOR_EXT", "LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp" ], + +# GL_ARB_fragment_program +# == GL_MAX_TEXTURE_IMAGE_UNITS_NV + [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxTextureImageUnits), extra_ARB_fragment_program_NV_fragment_program" ], + [ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxVertexTextureImageUnits), extra_ARB_vertex_shader" ], + [ "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. + [ "CURRENT_PROGRAM", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_objects" ], + +# OpenGL 2.0 + [ "STENCIL_BACK_FUNC", "CONTEXT_ENUM(Stencil.Function[1]), NO_EXTRA" ], + [ "STENCIL_BACK_VALUE_MASK", "CONTEXT_INT(Stencil.ValueMask[1]), NO_EXTRA" ], + [ "STENCIL_BACK_WRITEMASK", "CONTEXT_INT(Stencil.WriteMask[1]), NO_EXTRA" ], + [ "STENCIL_BACK_REF", "CONTEXT_INT(Stencil.Ref[1]), NO_EXTRA" ], + [ "STENCIL_BACK_FAIL", "CONTEXT_ENUM(Stencil.FailFunc[1]), NO_EXTRA" ], + [ "STENCIL_BACK_PASS_DEPTH_FAIL", "CONTEXT_ENUM(Stencil.ZFailFunc[1]), NO_EXTRA" ], + [ "STENCIL_BACK_PASS_DEPTH_PASS", "CONTEXT_ENUM(Stencil.ZPassFunc[1]), NO_EXTRA" ], + [ "MAX_VERTEX_ATTRIBS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxAttribs), extra_ARB_vertex_program_api_es2" ], + +# OES_texture_3D + [ "TEXTURE_BINDING_3D", "LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA" ], + [ "MAX_3D_TEXTURE_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA" ], + +# GL_ARB_fragment_program/OES_standard_derivatives + [ "FRAGMENT_SHADER_DERIVATIVE_HINT", "CONTEXT_ENUM(Hint.FragmentShaderDerivative), extra_ARB_fragment_shader" ], + +# GL_NV_read_buffer + [ "READ_BUFFER", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, extra_NV_read_buffer_api_gl" ], +]}, + +{ "apis": ["GLES", "GLES2"], "params": [ +# GL_OES_EGL_image_external + [ "TEXTURE_BINDING_EXTERNAL_OES", "LOC_CUSTOM, TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external" ], + [ "TEXTURE_EXTERNAL_OES", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_OES_EGL_image_external" ], +]}, + +# Enums unique to OpenGL ES 2.0 +{ "apis": ["GLES2"], "params": [ + [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), NO_EXTRA" ], + [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + [ "SHADER_COMPILER", "CONST(1), NO_EXTRA" ], +# OES_get_program_binary + [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ], + [ "SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ], +]}, + + +# Remaining enums are only in OpenGL +{ "apis": ["GL", "GL_CORE"], "params": [ + [ "ACCUM_RED_BITS", "BUFFER_INT(Visual.accumRedBits), NO_EXTRA" ], + [ "ACCUM_GREEN_BITS", "BUFFER_INT(Visual.accumGreenBits), NO_EXTRA" ], + [ "ACCUM_BLUE_BITS", "BUFFER_INT(Visual.accumBlueBits), NO_EXTRA" ], + [ "ACCUM_ALPHA_BITS", "BUFFER_INT(Visual.accumAlphaBits), NO_EXTRA" ], + [ "ACCUM_CLEAR_VALUE", "CONTEXT_FIELD(Accum.ClearColor[0], TYPE_FLOATN_4), NO_EXTRA" ], + [ "ALPHA_BIAS", "CONTEXT_FLOAT(Pixel.AlphaBias), NO_EXTRA" ], + [ "ALPHA_SCALE", "CONTEXT_FLOAT(Pixel.AlphaScale), NO_EXTRA" ], + [ "ATTRIB_STACK_DEPTH", "CONTEXT_INT(AttribStackDepth), NO_EXTRA" ], + [ "AUTO_NORMAL", "CONTEXT_BOOL(Eval.AutoNormal), NO_EXTRA" ], + [ "AUX_BUFFERS", "BUFFER_INT(Visual.numAuxBuffers), NO_EXTRA" ], + [ "BLUE_BIAS", "CONTEXT_FLOAT(Pixel.BlueBias), NO_EXTRA" ], + [ "BLUE_SCALE", "CONTEXT_FLOAT(Pixel.BlueScale), NO_EXTRA" ], + [ "CLIENT_ATTRIB_STACK_DEPTH", "CONTEXT_INT(ClientAttribStackDepth), NO_EXTRA" ], + [ "COLOR_MATERIAL_FACE", "CONTEXT_ENUM(Light.ColorMaterialFace), NO_EXTRA" ], + [ "COLOR_MATERIAL_PARAMETER", "CONTEXT_ENUM(Light.ColorMaterialMode), NO_EXTRA" ], + [ "CURRENT_INDEX", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]), extra_flush_current" ], + [ "CURRENT_RASTER_COLOR", "CONTEXT_FIELD(Current.RasterColor[0], TYPE_FLOATN_4), NO_EXTRA" ], + [ "CURRENT_RASTER_DISTANCE", "CONTEXT_FLOAT(Current.RasterDistance), NO_EXTRA" ], + [ "CURRENT_RASTER_INDEX", "CONST(1), NO_EXTRA" ], + [ "CURRENT_RASTER_POSITION", "CONTEXT_FLOAT4(Current.RasterPos[0]), NO_EXTRA" ], + [ "CURRENT_RASTER_SECONDARY_COLOR", "CONTEXT_FIELD(Current.RasterSecondaryColor[0], TYPE_FLOATN_4), NO_EXTRA" ], + [ "CURRENT_RASTER_TEXTURE_COORDS", "LOC_CUSTOM, TYPE_FLOAT_4, 0, extra_valid_texture_unit" ], + [ "CURRENT_RASTER_POSITION_VALID", "CONTEXT_BOOL(Current.RasterPosValid), NO_EXTRA" ], + [ "DEPTH_BIAS", "CONTEXT_FLOAT(Pixel.DepthBias), NO_EXTRA" ], + [ "DEPTH_SCALE", "CONTEXT_FLOAT(Pixel.DepthScale), NO_EXTRA" ], + [ "DOUBLEBUFFER", "BUFFER_INT(Visual.doubleBufferMode), NO_EXTRA" ], + [ "DRAW_BUFFER", "BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA" ], + [ "EDGE_FLAG", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ], + [ "FEEDBACK_BUFFER_SIZE", "CONTEXT_INT(Feedback.BufferSize), NO_EXTRA" ], + [ "FEEDBACK_BUFFER_TYPE", "CONTEXT_ENUM(Feedback.Type), NO_EXTRA" ], + [ "FOG_INDEX", "CONTEXT_FLOAT(Fog.Index), NO_EXTRA" ], + [ "GREEN_BIAS", "CONTEXT_FLOAT(Pixel.GreenBias), NO_EXTRA" ], + [ "GREEN_SCALE", "CONTEXT_FLOAT(Pixel.GreenScale), NO_EXTRA" ], + [ "INDEX_BITS", "BUFFER_INT(Visual.indexBits), extra_new_buffers" ], + [ "INDEX_CLEAR_VALUE", "CONTEXT_INT(Color.ClearIndex), NO_EXTRA" ], + [ "INDEX_MODE", "CONST(0) , NO_EXTRA" ], + [ "INDEX_OFFSET", "CONTEXT_INT(Pixel.IndexOffset), NO_EXTRA" ], + [ "INDEX_SHIFT", "CONTEXT_INT(Pixel.IndexShift), NO_EXTRA" ], + [ "INDEX_WRITEMASK", "CONTEXT_INT(Color.IndexMask), NO_EXTRA" ], + [ "LIGHT_MODEL_COLOR_CONTROL", "CONTEXT_ENUM(Light.Model.ColorControl), NO_EXTRA" ], + [ "LIGHT_MODEL_LOCAL_VIEWER", "CONTEXT_BOOL(Light.Model.LocalViewer), NO_EXTRA" ], + [ "LINE_STIPPLE", "CONTEXT_BOOL(Line.StippleFlag), NO_EXTRA" ], + [ "LINE_STIPPLE_PATTERN", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + [ "LINE_STIPPLE_REPEAT", "CONTEXT_INT(Line.StippleFactor), NO_EXTRA" ], + [ "LINE_WIDTH_GRANULARITY", "CONTEXT_FLOAT(Const.LineWidthGranularity), NO_EXTRA" ], + [ "LIST_BASE", "CONTEXT_INT(List.ListBase), NO_EXTRA" ], + [ "LIST_INDEX", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + [ "LIST_MODE", "LOC_CUSTOM, TYPE_ENUM, 0, NO_EXTRA" ], + [ "INDEX_LOGIC_OP", "CONTEXT_BOOL(Color.IndexLogicOpEnabled), NO_EXTRA" ], + [ "MAP1_COLOR_4", "CONTEXT_BOOL(Eval.Map1Color4), NO_EXTRA" ], + [ "MAP1_GRID_DOMAIN", "CONTEXT_FLOAT2(Eval.MapGrid1u1), NO_EXTRA" ], + [ "MAP1_GRID_SEGMENTS", "CONTEXT_INT(Eval.MapGrid1un), NO_EXTRA" ], + [ "MAP1_INDEX", "CONTEXT_BOOL(Eval.Map1Index), NO_EXTRA" ], + [ "MAP1_NORMAL", "CONTEXT_BOOL(Eval.Map1Normal), NO_EXTRA" ], + [ "MAP1_TEXTURE_COORD_1", "CONTEXT_BOOL(Eval.Map1TextureCoord1), NO_EXTRA" ], + [ "MAP1_TEXTURE_COORD_2", "CONTEXT_BOOL(Eval.Map1TextureCoord2), NO_EXTRA" ], + [ "MAP1_TEXTURE_COORD_3", "CONTEXT_BOOL(Eval.Map1TextureCoord3), NO_EXTRA" ], + [ "MAP1_TEXTURE_COORD_4", "CONTEXT_BOOL(Eval.Map1TextureCoord4), NO_EXTRA" ], + [ "MAP1_VERTEX_3", "CONTEXT_BOOL(Eval.Map1Vertex3), NO_EXTRA" ], + [ "MAP1_VERTEX_4", "CONTEXT_BOOL(Eval.Map1Vertex4), NO_EXTRA" ], + [ "MAP2_COLOR_4", "CONTEXT_BOOL(Eval.Map2Color4), NO_EXTRA" ], + [ "MAP2_GRID_DOMAIN", "LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA" ], + [ "MAP2_GRID_SEGMENTS", "CONTEXT_INT2(Eval.MapGrid2un), NO_EXTRA" ], + [ "MAP2_INDEX", "CONTEXT_BOOL(Eval.Map2Index), NO_EXTRA" ], + [ "MAP2_NORMAL", "CONTEXT_BOOL(Eval.Map2Normal), NO_EXTRA" ], + [ "MAP2_TEXTURE_COORD_1", "CONTEXT_BOOL(Eval.Map2TextureCoord1), NO_EXTRA" ], + [ "MAP2_TEXTURE_COORD_2", "CONTEXT_BOOL(Eval.Map2TextureCoord2), NO_EXTRA" ], + [ "MAP2_TEXTURE_COORD_3", "CONTEXT_BOOL(Eval.Map2TextureCoord3), NO_EXTRA" ], + [ "MAP2_TEXTURE_COORD_4", "CONTEXT_BOOL(Eval.Map2TextureCoord4), NO_EXTRA" ], + [ "MAP2_VERTEX_3", "CONTEXT_BOOL(Eval.Map2Vertex3), NO_EXTRA" ], + [ "MAP2_VERTEX_4", "CONTEXT_BOOL(Eval.Map2Vertex4), NO_EXTRA" ], + [ "MAP_COLOR", "CONTEXT_BOOL(Pixel.MapColorFlag), NO_EXTRA" ], + [ "MAP_STENCIL", "CONTEXT_BOOL(Pixel.MapStencilFlag), NO_EXTRA" ], + [ "MAX_ATTRIB_STACK_DEPTH", "CONST(MAX_ATTRIB_STACK_DEPTH), NO_EXTRA" ], + [ "MAX_CLIENT_ATTRIB_STACK_DEPTH", "CONST(MAX_CLIENT_ATTRIB_STACK_DEPTH), NO_EXTRA" ], + [ "MAX_EVAL_ORDER", "CONST(MAX_EVAL_ORDER), NO_EXTRA" ], + [ "MAX_LIST_NESTING", "CONST(MAX_LIST_NESTING), NO_EXTRA" ], + [ "MAX_NAME_STACK_DEPTH", "CONST(MAX_NAME_STACK_DEPTH), NO_EXTRA" ], + [ "MAX_PIXEL_MAP_TABLE", "CONST(MAX_PIXEL_MAP_TABLE), NO_EXTRA" ], + [ "NAME_STACK_DEPTH", "CONTEXT_INT(Select.NameStackDepth), NO_EXTRA" ], + [ "PACK_LSB_FIRST", "CONTEXT_BOOL(Pack.LsbFirst), NO_EXTRA" ], + [ "PACK_SWAP_BYTES", "CONTEXT_BOOL(Pack.SwapBytes), NO_EXTRA" ], + [ "PACK_INVERT_MESA", "CONTEXT_BOOL(Pack.Invert), NO_EXTRA" ], + [ "PIXEL_MAP_A_TO_A_SIZE", "CONTEXT_INT(PixelMaps.AtoA.Size), NO_EXTRA" ], + [ "PIXEL_MAP_B_TO_B_SIZE", "CONTEXT_INT(PixelMaps.BtoB.Size), NO_EXTRA" ], + [ "PIXEL_MAP_G_TO_G_SIZE", "CONTEXT_INT(PixelMaps.GtoG.Size), NO_EXTRA" ], + [ "PIXEL_MAP_I_TO_A_SIZE", "CONTEXT_INT(PixelMaps.ItoA.Size), NO_EXTRA" ], + [ "PIXEL_MAP_I_TO_B_SIZE", "CONTEXT_INT(PixelMaps.ItoB.Size), NO_EXTRA" ], + [ "PIXEL_MAP_I_TO_G_SIZE", "CONTEXT_INT(PixelMaps.ItoG.Size), NO_EXTRA" ], + [ "PIXEL_MAP_I_TO_I_SIZE", "CONTEXT_INT(PixelMaps.ItoI.Size), NO_EXTRA" ], + [ "PIXEL_MAP_I_TO_R_SIZE", "CONTEXT_INT(PixelMaps.ItoR.Size), NO_EXTRA" ], + [ "PIXEL_MAP_R_TO_R_SIZE", "CONTEXT_INT(PixelMaps.RtoR.Size), NO_EXTRA" ], + [ "PIXEL_MAP_S_TO_S_SIZE", "CONTEXT_INT(PixelMaps.StoS.Size), NO_EXTRA" ], + [ "POINT_SIZE_GRANULARITY", "CONTEXT_FLOAT(Const.PointSizeGranularity), NO_EXTRA" ], + [ "POLYGON_MODE", "CONTEXT_ENUM2(Polygon.FrontMode), NO_EXTRA" ], + [ "POLYGON_OFFSET_BIAS_EXT", "CONTEXT_FLOAT(Polygon.OffsetUnits), NO_EXTRA" ], + [ "POLYGON_OFFSET_POINT", "CONTEXT_BOOL(Polygon.OffsetPoint), NO_EXTRA" ], + [ "POLYGON_OFFSET_LINE", "CONTEXT_BOOL(Polygon.OffsetLine), NO_EXTRA" ], + [ "POLYGON_SMOOTH", "CONTEXT_BOOL(Polygon.SmoothFlag), NO_EXTRA" ], + [ "POLYGON_SMOOTH_HINT", "CONTEXT_ENUM(Hint.PolygonSmooth), NO_EXTRA" ], + [ "POLYGON_STIPPLE", "CONTEXT_BOOL(Polygon.StippleFlag), NO_EXTRA" ], + [ "RED_BIAS", "CONTEXT_FLOAT(Pixel.RedBias), NO_EXTRA" ], + [ "RED_SCALE", "CONTEXT_FLOAT(Pixel.RedScale), NO_EXTRA" ], + [ "RENDER_MODE", "CONTEXT_ENUM(RenderMode), NO_EXTRA" ], + [ "RGBA_MODE", "CONST(1), NO_EXTRA" ], + [ "SELECTION_BUFFER_SIZE", "CONTEXT_INT(Select.BufferSize), NO_EXTRA" ], + [ "STEREO", "BUFFER_INT(Visual.stereoMode), NO_EXTRA" ], + [ "TEXTURE_1D", "LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA" ], + [ "TEXTURE_3D", "LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA" ], + [ "TEXTURE_1D_ARRAY_EXT", "LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA" ], + [ "TEXTURE_2D_ARRAY_EXT", "LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA" ], + [ "TEXTURE_BINDING_1D", "LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX, NO_EXTRA" ], + [ "TEXTURE_BINDING_1D_ARRAY", "LOC_CUSTOM, TYPE_INT, TEXTURE_1D_ARRAY_INDEX, extra_MESA_texture_array" ], + [ "TEXTURE_BINDING_2D_ARRAY", "LOC_CUSTOM, TYPE_INT, TEXTURE_1D_ARRAY_INDEX, extra_MESA_texture_array" ], + [ "MAX_ARRAY_TEXTURE_LAYERS_EXT", "CONTEXT_INT(Const.MaxArrayTextureLayers), extra_MESA_texture_array" ], + [ "TEXTURE_GEN_S", "LOC_TEXUNIT, TYPE_BIT_0, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ], + [ "TEXTURE_GEN_T", "LOC_TEXUNIT, TYPE_BIT_1, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ], + [ "TEXTURE_GEN_R", "LOC_TEXUNIT, TYPE_BIT_2, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ], + [ "TEXTURE_GEN_Q", "LOC_TEXUNIT, TYPE_BIT_3, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ], + [ "UNPACK_LSB_FIRST", "CONTEXT_BOOL(Unpack.LsbFirst), NO_EXTRA" ], + [ "UNPACK_SWAP_BYTES", "CONTEXT_BOOL(Unpack.SwapBytes), NO_EXTRA" ], + [ "ZOOM_X", "CONTEXT_FLOAT(Pixel.ZoomX), NO_EXTRA" ], + [ "ZOOM_Y", "CONTEXT_FLOAT(Pixel.ZoomY), NO_EXTRA" ], + +# Vertex arrays + [ "VERTEX_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ], + [ "NORMAL_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ], + [ "COLOR_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ], + [ "INDEX_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled), NO_EXTRA" ], + [ "INDEX_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Type), NO_EXTRA" ], + [ "INDEX_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Stride), NO_EXTRA" ], + [ "INDEX_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ], + [ "EDGE_FLAG_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled), NO_EXTRA" ], + [ "EDGE_FLAG_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Stride), NO_EXTRA" ], + [ "EDGE_FLAG_ARRAY_COUNT_EXT", "CONST(0), NO_EXTRA" ], + +# GL_ARB_texture_compression + [ "TEXTURE_COMPRESSION_HINT_ARB", "CONTEXT_INT(Hint.TextureCompression), NO_EXTRA" ], + +# GL_EXT_compiled_vertex_array + [ "ARRAY_ELEMENT_LOCK_FIRST_EXT", "CONTEXT_INT(Array.LockFirst), extra_EXT_compiled_vertex_array" ], + [ "ARRAY_ELEMENT_LOCK_COUNT_EXT", "CONTEXT_INT(Array.LockCount), extra_EXT_compiled_vertex_array" ], + +# GL_ARB_transpose_matrix + [ "TRANSPOSE_MODELVIEW_MATRIX_ARB", "CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA" ], + [ "TRANSPOSE_PROJECTION_MATRIX_ARB", "CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA" ], + [ "TRANSPOSE_TEXTURE_MATRIX_ARB", "CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA" ], + +# GL_EXT_secondary_color + [ "COLOR_SUM", "CONTEXT_BOOL(Fog.ColorSumEnabled), extra_EXT_secondary_color_ARB_vertex_program" ], + [ "CURRENT_SECONDARY_COLOR", "CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR1][0], TYPE_FLOATN_4), extra_EXT_secondary_color_flush_current" ], + [ "SECONDARY_COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled), extra_EXT_secondary_color" ], + [ "SECONDARY_COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR1].Type), extra_EXT_secondary_color" ], + [ "SECONDARY_COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride), extra_EXT_secondary_color" ], + [ "SECONDARY_COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Size), extra_EXT_secondary_color" ], + +# GL_EXT_fog_coord + [ "CURRENT_FOG_COORDINATE", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_EXT_fog_coord_flush_current" ], + [ "FOG_COORDINATE_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_FOG].Enabled), extra_EXT_fog_coord" ], + [ "FOG_COORDINATE_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_FOG].Type), extra_EXT_fog_coord" ], + [ "FOG_COORDINATE_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_FOG].Stride), extra_EXT_fog_coord" ], + [ "FOG_COORDINATE_SOURCE", "CONTEXT_ENUM(Fog.FogCoordinateSource), extra_EXT_fog_coord" ], + +# GL_NV_fog_distance + [ "FOG_DISTANCE_MODE_NV", "CONTEXT_ENUM(Fog.FogDistanceMode), extra_NV_fog_distance" ], + +# GL_IBM_rasterpos_clip + [ "RASTER_POSITION_UNCLIPPED_IBM", "CONTEXT_BOOL(Transform.RasterPositionUnclipped), extra_IBM_rasterpos_clip" ], + +# GL_NV_point_sprite + [ "POINT_SPRITE_R_MODE_NV", "CONTEXT_ENUM(Point.SpriteRMode), extra_NV_point_sprite" ], + [ "POINT_SPRITE_COORD_ORIGIN", "CONTEXT_ENUM(Point.SpriteOrigin), extra_NV_point_sprite_ARB_point_sprite" ], + +# GL_NV_vertex_program + [ "VERTEX_PROGRAM_BINDING_NV", "LOC_CUSTOM, TYPE_INT, 0, extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY0_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(0)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY1_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(1)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY2_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(2)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY3_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(3)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY4_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(4)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY5_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(5)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY6_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(6)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY7_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(7)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY8_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(8)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY9_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(9)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY10_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(10)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY11_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(11)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY12_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(12)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY13_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(13)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY14_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(14)].Enabled), extra_NV_vertex_program" ], + [ "VERTEX_ATTRIB_ARRAY15_NV", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(15)].Enabled), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB0_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[0]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB1_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[1]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB2_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[2]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB3_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[3]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB4_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[4]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB5_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[5]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB6_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[6]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB7_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[7]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB8_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[8]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB9_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[9]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB10_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[10]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB11_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[11]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB12_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[12]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB13_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[13]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB14_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[14]), extra_NV_vertex_program" ], + [ "MAP1_VERTEX_ATTRIB15_4_NV", "CONTEXT_BOOL(Eval.Map1Attrib[15]), extra_NV_vertex_program" ], + +# GL_NV_fragment_program + [ "FRAGMENT_PROGRAM_NV", "CONTEXT_BOOL(FragmentProgram.Enabled), extra_NV_fragment_program" ], + [ "FRAGMENT_PROGRAM_BINDING_NV", "LOC_CUSTOM, TYPE_INT, 0, extra_NV_fragment_program" ], + [ "MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", "CONST(MAX_NV_FRAGMENT_PROGRAM_PARAMS), extra_NV_fragment_program" ], + +# GL_NV_texture_rectangle + [ "TEXTURE_RECTANGLE_NV", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_NV_texture_rectangle" ], + [ "TEXTURE_BINDING_RECTANGLE_NV", "LOC_CUSTOM, TYPE_INT, TEXTURE_RECT_INDEX, extra_NV_texture_rectangle" ], + [ "MAX_RECTANGLE_TEXTURE_SIZE_NV", "CONTEXT_INT(Const.MaxTextureRectSize), extra_NV_texture_rectangle" ], + +# GL_EXT_stencil_two_side + [ "STENCIL_TEST_TWO_SIDE_EXT", "CONTEXT_BOOL(Stencil.TestTwoSide), extra_EXT_stencil_two_side" ], + [ "ACTIVE_STENCIL_FACE_EXT", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], + +# GL_NV_light_max_exponent + [ "MAX_SHININESS_NV", "CONTEXT_FLOAT(Const.MaxShininess), extra_NV_light_max_exponent" ], + [ "MAX_SPOT_EXPONENT_NV", "CONTEXT_FLOAT(Const.MaxSpotExponent), extra_NV_light_max_exponent" ], + +# GL_NV_primitive_restart + [ "PRIMITIVE_RESTART_NV", "CONTEXT_BOOL(Array.PrimitiveRestart), extra_NV_primitive_restart" ], + [ "PRIMITIVE_RESTART_INDEX_NV", "CONTEXT_INT(Array.RestartIndex), extra_NV_primitive_restart" ], + +# GL_ARB_vertex_buffer_object + [ "INDEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA" ], + [ "EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA" ], + [ "SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA" ], + [ "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA" ], + +# GL_EXT_pixel_buffer_object + [ "PIXEL_PACK_BUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_pixel_buffer_object" ], + [ "PIXEL_UNPACK_BUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_pixel_buffer_object" ], + +# GL_ARB_vertex_program +# == GL_VERTEX_PROGRAM_NV + [ "VERTEX_PROGRAM_ARB", "CONTEXT_BOOL(VertexProgram.Enabled), extra_ARB_vertex_program_NV_vertex_program" ], +# == GL_VERTEX_PROGRAM_POINT_SIZE_NV + [ "VERTEX_PROGRAM_POINT_SIZE_ARB", "CONTEXT_BOOL(VertexProgram.PointSizeEnabled), extra_ARB_vertex_program_NV_vertex_program" ], +# == GL_VERTEX_PROGRAM_TWO_SIDE_NV + [ "VERTEX_PROGRAM_TWO_SIDE_ARB", "CONTEXT_BOOL(VertexProgram.TwoSideEnabled), extra_ARB_vertex_program_NV_vertex_program" ], +# == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV + [ "MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", "CONTEXT_INT(Const.MaxProgramMatrixStackDepth), extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ], +# == GL_MAX_TRACK_MATRICES_NV + [ "MAX_PROGRAM_MATRICES_ARB", "CONTEXT_INT(Const.MaxProgramMatrices), extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ], +# == GL_CURRENT_MATRIX_STACK_DEPTH_NV + [ "CURRENT_MATRIX_STACK_DEPTH_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ], +# == GL_CURRENT_MATRIX_NV + [ "CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ], +# == GL_CURRENT_MATRIX_NV + [ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ], +# == GL_PROGRAM_ERROR_POSITION_NV + [ "PROGRAM_ERROR_POSITION_ARB", "CONTEXT_INT(Program.ErrorPos), extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program" ], + +# GL_ARB_fragment_program + [ "FRAGMENT_PROGRAM_ARB", "CONTEXT_BOOL(FragmentProgram.Enabled), extra_ARB_fragment_program" ], + +# GL_EXT_depth_bounds_test + [ "DEPTH_BOUNDS_TEST_EXT", "CONTEXT_BOOL(Depth.BoundsTest), extra_EXT_depth_bounds_test" ], + [ "DEPTH_BOUNDS_EXT", "CONTEXT_FLOAT2(Depth.BoundsMin), extra_EXT_depth_bounds_test" ], + +# GL_ARB_depth_clamp + [ "DEPTH_CLAMP", "CONTEXT_BOOL(Transform.DepthClamp), extra_ARB_depth_clamp" ], + +# GL_ATI_fragment_shader + [ "NUM_FRAGMENT_REGISTERS_ATI", "CONST(6), extra_ATI_fragment_shader" ], + [ "NUM_FRAGMENT_CONSTANTS_ATI", "CONST(8), extra_ATI_fragment_shader" ], + [ "NUM_PASSES_ATI", "CONST(2), extra_ATI_fragment_shader" ], + [ "NUM_INSTRUCTIONS_PER_PASS_ATI", "CONST(8), extra_ATI_fragment_shader" ], + [ "NUM_INSTRUCTIONS_TOTAL_ATI", "CONST(16), extra_ATI_fragment_shader" ], + [ "COLOR_ALPHA_PAIRING_ATI", "CONST(GL_TRUE), extra_ATI_fragment_shader" ], + [ "NUM_LOOPBACK_COMPONENTS_ATI", "CONST(3), extra_ATI_fragment_shader" ], + [ "NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", "CONST(3), extra_ATI_fragment_shader" ], + +# GL_EXT_framebuffer_blit +# NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT + [ "READ_FRAMEBUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_framebuffer_blit" ], + +# GL_EXT_provoking_vertex + [ "PROVOKING_VERTEX_EXT", "CONTEXT_ENUM(Light.ProvokingVertex), extra_EXT_provoking_vertex" ], + [ "QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", "CONTEXT_BOOL(Const.QuadsFollowProvokingVertexConvention), extra_EXT_provoking_vertex" ], + +# GL_ARB_framebuffer_object + [ "MAX_SAMPLES", "CONTEXT_INT(Const.MaxSamples), extra_ARB_framebuffer_object_EXT_framebuffer_multisample" ], + +# GL_ARB_seamless_cube_map + [ "TEXTURE_CUBE_MAP_SEAMLESS", "CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map" ], + +# GL_ARB_sync + [ "MAX_SERVER_WAIT_TIMEOUT", "CONTEXT_INT64(Const.MaxServerWaitTimeout), extra_ARB_sync" ], + +# GL_EXT_texture_integer + [ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer" ], + +# GL_EXT_transform_feedback + [ "TRANSFORM_FEEDBACK_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_transform_feedback" ], + [ "RASTERIZER_DISCARD", "CONTEXT_BOOL(RasterDiscard), extra_EXT_transform_feedback" ], + [ "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), extra_EXT_transform_feedback" ], + [ "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_EXT_transform_feedback" ], + [ "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", "CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), extra_EXT_transform_feedback" ], + +# GL_ARB_transform_feedback2 + [ "TRANSFORM_FEEDBACK_BUFFER_PAUSED", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_ARB_transform_feedback2" ], + [ "TRANSFORM_FEEDBACK_BUFFER_ACTIVE", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_ARB_transform_feedback2" ], + [ "TRANSFORM_FEEDBACK_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_transform_feedback2" ], + +# GL_ARB_transform_feedback3 + [ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ], + [ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ], + +# GL_ARB_geometry_shader4 + [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxGeometryTextureImageUnits), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_OUTPUT_VERTICES_ARB", "CONTEXT_INT(Const.MaxGeometryOutputVertices), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryVaryingComponents), extra_ARB_geometry_shader4" ], + [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxVertexVaryingComponents), extra_ARB_geometry_shader4" ], + +# GL_ARB_color_buffer_float + [ "RGBA_FLOAT_MODE_ARB", "BUFFER_FIELD(Visual.floatMode, TYPE_BOOLEAN), 0" ], + +# GL_EXT_gpu_shader4 / GLSL 1.30 + [ "MIN_PROGRAM_TEXEL_OFFSET", "CONTEXT_INT(Const.MinProgramTexelOffset), extra_GLSL_130" ], + [ "MAX_PROGRAM_TEXEL_OFFSET", "CONTEXT_INT(Const.MaxProgramTexelOffset), extra_GLSL_130" ], + +# GL_ARB_texture_buffer_object + [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ], + [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], + [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ], + [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], + [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], + +# GL_ARB_sampler_objects / GL 3.3 + [ "SAMPLER_BINDING", "LOC_CUSTOM, TYPE_INT, GL_SAMPLER_BINDING, NO_EXTRA" ], + +# GL 3.0 + [ "NUM_EXTENSIONS", "LOC_CUSTOM, TYPE_INT, 0, extra_version_30" ], + [ "MAJOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_version_30" ], + [ "MINOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_version_30" ], + [ "CONTEXT_FLAGS", "CONTEXT_INT(Const.ContextFlags), extra_version_30" ], + +# GL3.0 / GL_EXT_framebuffer_sRGB + [ "FRAMEBUFFER_SRGB_EXT", "CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB" ], + [ "FRAMEBUFFER_SRGB_CAPABLE_EXT", "BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB" ], + +# GL 3.1 +# NOTE: different enum values for GL_PRIMITIVE_RESTART_NV +# vs. GL_PRIMITIVE_RESTART! + [ "PRIMITIVE_RESTART", "CONTEXT_BOOL(Array.PrimitiveRestart), extra_version_31" ], + [ "PRIMITIVE_RESTART_INDEX", "CONTEXT_INT(Array.RestartIndex), extra_version_31" ], + +# GL 3.2 + [ "CONTEXT_PROFILE_MASK", "CONTEXT_INT(Const.ProfileMask), extra_version_32" ], + +# GL_ARB_robustness + [ "RESET_NOTIFICATION_STRATEGY_ARB", "CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA" ], + +# GL_ARB_debug_output + [ "DEBUG_LOGGED_MESSAGES_ARB", "CONTEXT_INT(Debug.NumMessages), NO_EXTRA" ], + [ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB", "CONTEXT_INT(Debug.NextMsgLength), NO_EXTRA" ], + [ "MAX_DEBUG_LOGGED_MESSAGES_ARB", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ], + [ "MAX_DEBUG_MESSAGE_LENGTH_ARB", "CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA" ], + [ "MAX_DUAL_SOURCE_DRAW_BUFFERS", "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" ], + +# GL_ARB_uniform_buffer_object + [ "MAX_VERTEX_UNIFORM_BLOCKS", "CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ], + [ "MAX_FRAGMENT_UNIFORM_BLOCKS", "CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ], + [ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.GeometryProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ], + [ "MAX_COMBINED_UNIFORM_BLOCKS", "CONTEXT_INT(Const.MaxCombinedUniformBlocks), extra_ARB_uniform_buffer_object" ], + [ "MAX_UNIFORM_BLOCK_SIZE", "CONTEXT_INT(Const.MaxUniformBlockSize), extra_ARB_uniform_buffer_object" ], + [ "MAX_UNIFORM_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxUniformBufferBindings), extra_ARB_uniform_buffer_object" ], + [ "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ], + [ "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ], + [ "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object_and_geometry_shader" ], + [ "UNIFORM_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.UniformBufferOffsetAlignment), extra_ARB_uniform_buffer_object" ], + [ "UNIFORM_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object" ], + +# GL_ARB_timer_query + [ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ], +]} + +] diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 934a2d05f..ed324b588 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -97,7 +97,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = malloc(bytes + alignment + sizeof(void *)); + ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *)); if (!ptr) return NULL; @@ -146,7 +146,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = calloc(1, bytes + alignment + sizeof(void *)); + ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *)); if (!ptr) return NULL; diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 40a802f52..b154b9527 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -3334,6 +3334,9 @@ struct gl_debug_state /** * Enum for the OpenGL APIs we know about and may support. + * + * NOTE: This must match the api_enum table in + * src/mesa/main/get_hash_generator.py */ typedef enum { |