[MESA]
authorJérôme Gardou <jerome.gardou@reactos.org>
Wed, 2 Oct 2013 15:06:13 +0000 (15:06 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Wed, 2 Oct 2013 15:06:13 +0000 (15:06 +0000)
 - leaner build part 8 of X
 - Get rid of the support for opengl ES and their extensions, the ARB_depth_clamp extension and the program implementation of the fixed function pipeline.
CORE-7499

svn path=/trunk/; revision=60511

101 files changed:
reactos/dll/opengl/mesa/generated/glsl/builtin_function.cpp
reactos/dll/opengl/mesa/generated/glsl/glcpp/glcpp-parse.c
reactos/dll/opengl/mesa/generated/glsl/glsl_lexer.cpp
reactos/dll/opengl/mesa/src/glsl/builtin_types.h
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp-parse.c
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp.c
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp.h
reactos/dll/opengl/mesa/src/glsl/glcpp/pp.c
reactos/dll/opengl/mesa/src/glsl/glsl_lexer.cpp
reactos/dll/opengl/mesa/src/glsl/glsl_parser_extras.cpp
reactos/dll/opengl/mesa/src/glsl/glsl_parser_extras.h
reactos/dll/opengl/mesa/src/glsl/glsl_types.cpp
reactos/dll/opengl/mesa/src/glsl/glsl_types.h
reactos/dll/opengl/mesa/src/glsl/linker.cpp
reactos/dll/opengl/mesa/src/glsl/main.cpp
reactos/dll/opengl/mesa/src/glsl/standalone_scaffolding.cpp
reactos/dll/opengl/mesa/src/glsl/test_optpass.cpp
reactos/dll/opengl/mesa/src/mesa/drivers/common/driverfuncs.c
reactos/dll/opengl/mesa/src/mesa/drivers/common/meta.c
reactos/dll/opengl/mesa/src/mesa/drivers/common/meta.h
reactos/dll/opengl/mesa/src/mesa/main/CMakeLists.txt
reactos/dll/opengl/mesa/src/mesa/main/api_exec.c
reactos/dll/opengl/mesa/src/mesa/main/api_validate.c
reactos/dll/opengl/mesa/src/mesa/main/arbprogram.c
reactos/dll/opengl/mesa/src/mesa/main/attrib.c
reactos/dll/opengl/mesa/src/mesa/main/bufferobj.c
reactos/dll/opengl/mesa/src/mesa/main/buffers.c
reactos/dll/opengl/mesa/src/mesa/main/context.c
reactos/dll/opengl/mesa/src/mesa/main/context.h
reactos/dll/opengl/mesa/src/mesa/main/dd.h
reactos/dll/opengl/mesa/src/mesa/main/debug.c
reactos/dll/opengl/mesa/src/mesa/main/dispatch.h
reactos/dll/opengl/mesa/src/mesa/main/drawtex.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/drawtex.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/enable.c
reactos/dll/opengl/mesa/src/mesa/main/extensions.c
reactos/dll/opengl/mesa/src/mesa/main/fbobject.c
reactos/dll/opengl/mesa/src/mesa/main/ff_fragment_shader.cpp [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/ffvertex_prog.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/ffvertex_prog.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/format_pack.c
reactos/dll/opengl/mesa/src/mesa/main/format_unpack.c
reactos/dll/opengl/mesa/src/mesa/main/formats.c
reactos/dll/opengl/mesa/src/mesa/main/formats.h
reactos/dll/opengl/mesa/src/mesa/main/get.c
reactos/dll/opengl/mesa/src/mesa/main/getstring.c
reactos/dll/opengl/mesa/src/mesa/main/image.c
reactos/dll/opengl/mesa/src/mesa/main/mipmap.c
reactos/dll/opengl/mesa/src/mesa/main/mtypes.h
reactos/dll/opengl/mesa/src/mesa/main/pack.c
reactos/dll/opengl/mesa/src/mesa/main/shared.c
reactos/dll/opengl/mesa/src/mesa/main/state.c
reactos/dll/opengl/mesa/src/mesa/main/state.h
reactos/dll/opengl/mesa/src/mesa/main/texcompress.c
reactos/dll/opengl/mesa/src/mesa/main/texformat.c
reactos/dll/opengl/mesa/src/mesa/main/teximage.c
reactos/dll/opengl/mesa/src/mesa/main/teximage.h
reactos/dll/opengl/mesa/src/mesa/main/texobj.c
reactos/dll/opengl/mesa/src/mesa/main/texparam.c
reactos/dll/opengl/mesa/src/mesa/main/texstate.c
reactos/dll/opengl/mesa/src/mesa/main/texstore.c
reactos/dll/opengl/mesa/src/mesa/main/uniform_query.cpp
reactos/dll/opengl/mesa/src/mesa/main/varray.c
reactos/dll/opengl/mesa/src/mesa/main/varray.h
reactos/dll/opengl/mesa/src/mesa/main/version.c
reactos/dll/opengl/mesa/src/mesa/main/vtxfmt.c
reactos/dll/opengl/mesa/src/mesa/math/m_clip_tmp.h
reactos/dll/opengl/mesa/src/mesa/math/m_debug_clip.c
reactos/dll/opengl/mesa/src/mesa/math/m_xform.h
reactos/dll/opengl/mesa/src/mesa/program/ir_to_mesa.cpp
reactos/dll/opengl/mesa/src/mesa/program/program.c
reactos/dll/opengl/mesa/src/mesa/swrast/CMakeLists.txt
reactos/dll/opengl/mesa/src/mesa/swrast/s_aaline.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_aalinetemp.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_aatriangle.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_context.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_context.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_depth.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_depth.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_fragprog.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/swrast/s_fragprog.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/swrast/s_lines.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_span.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_texfetch.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_texfetch_tmp.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_triangle.c
reactos/dll/opengl/mesa/src/mesa/tnl/CMakeLists.txt
reactos/dll/opengl/mesa/src/mesa/tnl/t_context.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_pipeline.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_pipeline.h
reactos/dll/opengl/mesa/src/mesa/tnl/t_rasterpos.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_program.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_vertex.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vp_build.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/tnl/t_vp_build.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/tnl/tnl.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_context.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_context.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec_array.c
reactos/dll/opengl/mesa/src/mesa/x86/x86_xform.c
reactos/dll/opengl/opengl32/swimpl.c

index ff1ee76..3598caa 100644 (file)
@@ -36,7 +36,6 @@ gl_shader *
 read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
 {
    struct gl_context fakeCtx;
-   fakeCtx.API = API_OPENGL;
    fakeCtx.Const.GLSLVersion = 130;
    fakeCtx.Extensions.ARB_ES2_compatibility = true;
    gl_shader *sh = _mesa_new_shader(NULL, 0, target);
@@ -47,7 +46,6 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
    st->symbols->language_version = 130;
    st->ARB_texture_rectangle_enable = true;
    st->EXT_texture_array_enable = true;
-   st->OES_EGL_image_external_enable = true;
    _mesa_glsl_initialize_types(st);
 
    sh->ir = new(sh) exec_list;
@@ -16066,54 +16064,6 @@ static const char *functions_for_EXT_texture_array_vert [] = {
    builtin_texture2DArray,
    builtin_texture2DArrayLod,
 };
-static const char prototypes_for_OES_EGL_image_external_frag[] =
-   "(\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerExternalOES sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerExternalOES sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerExternalOES sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())))"
-;
-static const char *functions_for_OES_EGL_image_external_frag [] = {
-   builtin_texture2D,
-   builtin_texture2DProj,
-};
-static const char prototypes_for_OES_EGL_image_external_vert[] =
-   "(\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerExternalOES sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerExternalOES sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerExternalOES sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())))"
-;
-static const char *functions_for_OES_EGL_image_external_vert [] = {
-   builtin_texture2D,
-   builtin_texture2DProj,
-};
 static const char prototypes_for_OES_texture_3D_frag[] =
    "(\n"
    "(function texture3D\n"
@@ -16321,20 +16271,6 @@ _mesa_glsl_initialize_functions(struct _mesa_glsl_parse_state *state)
                          Elements(functions_for_EXT_texture_array_vert));
    }
 
-   if (state->target == fragment_shader && state->OES_EGL_image_external_enable) {
-      _mesa_read_profile(state, 14,
-                         prototypes_for_OES_EGL_image_external_frag,
-                         functions_for_OES_EGL_image_external_frag,
-                         Elements(functions_for_OES_EGL_image_external_frag));
-   }
-
-   if (state->target == vertex_shader && state->OES_EGL_image_external_enable) {
-      _mesa_read_profile(state, 15,
-                         prototypes_for_OES_EGL_image_external_vert,
-                         functions_for_OES_EGL_image_external_vert,
-                         Elements(functions_for_OES_EGL_image_external_vert));
-   }
-
    if (state->target == fragment_shader && state->OES_texture_3D_enable) {
       _mesa_read_profile(state, 16,
                          prototypes_for_OES_texture_3D_frag,
index 2df5f0a..431665a 100644 (file)
@@ -3456,7 +3456,7 @@ static void add_builtin_define(glcpp_parser_t *parser,
 }
 
 glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions, int api)
+glcpp_parser_create (const struct gl_extensions *extensions)
 {
        glcpp_parser_t *parser;
        int language_version;
@@ -3486,9 +3486,6 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
        add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
        add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
 
-       if (api == API_OPENGLES2)
-               add_builtin_define(parser, "GL_ES", 1);
-
        if (extensions != NULL) {
           if (extensions->EXT_texture_array) {
              add_builtin_define(parser, "GL_EXT_texture_array", 1);
@@ -3504,9 +3501,6 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
              add_builtin_define(parser, "GL_AMD_conservative_depth", 1);
              add_builtin_define(parser, "GL_ARB_conservative_depth", 1);
           }
-
-          if (extensions->OES_EGL_image_external)
-             add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
        }
 
        language_version = 110;
index 35465d8..a48a61c 100644 (file)
@@ -1986,9 +1986,6 @@ case 94:
 YY_RULE_SETUP
 #line 299 "src/glsl/glsl_lexer.ll"
 {
-                         if (yyextra->OES_EGL_image_external_enable)
-                            return SAMPLEREXTERNALOES;
-                         else
                             return IDENTIFIER;
                        }
        YY_BREAK
index cc99b1b..58b9a81 100644 (file)
@@ -300,13 +300,3 @@ const glsl_type glsl_type::builtin_EXT_texture_buffer_object_types[] = {
             GLSL_SAMPLER_DIM_BUF, 0, 0,  GLSL_TYPE_UINT, "usamplerBuffer"),
 };
 /*@}*/
-
-/** \name Sampler types added by GL_OES_EGL_image_external
- */
-/*@{*/
-
-const glsl_type glsl_type::builtin_OES_EGL_image_external_types[] = {
-   glsl_type(GL_SAMPLER_EXTERNAL_OES,
-            GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT, "samplerExternalOES"),
-};
-/*@}*/
index 28cc409..6709679 100644 (file)
@@ -3406,7 +3406,7 @@ static void add_builtin_define(glcpp_parser_t *parser,
 }
 
 glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions, int api)
+glcpp_parser_create (const struct gl_extensions *extensions)
 {
        glcpp_parser_t *parser;
        int language_version;
@@ -3436,9 +3436,6 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
        add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
        add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
 
-       if (api == API_OPENGLES2)
-               add_builtin_define(parser, "GL_ES", 1);
-
        if (extensions != NULL) {
           if (extensions->EXT_texture_array) {
              add_builtin_define(parser, "GL_EXT_texture_array", 1);
@@ -3454,9 +3451,6 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
              add_builtin_define(parser, "GL_AMD_conservative_depth", 1);
              add_builtin_define(parser, "GL_ARB_conservative_depth", 1);
           }
-
-          if (extensions->OES_EGL_image_external)
-             add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
        }
 
        language_version = 110;
index e461a65..e644508 100644 (file)
@@ -111,7 +111,7 @@ main (int argc, char *argv[])
        if (shader == NULL)
           return 1;
 
-       ret = preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
+       ret = preprocess(ctx, &shader, &info_log, NULL);
 
        printf("%s", shader);
        fprintf(stderr, "%s", info_log);
index dc816e9..1fad8cb 100644 (file)
@@ -180,7 +180,7 @@ struct glcpp_parser {
 struct gl_extensions;
 
 glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions, int api);
+glcpp_parser_create (const struct gl_extensions *extensions);
 
 int
 glcpp_parser_parse (glcpp_parser_t *parser);
@@ -190,7 +190,7 @@ glcpp_parser_destroy (glcpp_parser_t *parser);
 
 int
 preprocess(void *ralloc_ctx, const char **shader, char **info_log,
-          const struct gl_extensions *extensions, int api);
+          const struct gl_extensions *extensions);
 
 /* Functions for writing to the info log */
 
index 3640896..ae62d0a 100644 (file)
@@ -141,10 +141,10 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
 
 int
 preprocess(void *ralloc_ctx, const char **shader, char **info_log,
-          const struct gl_extensions *extensions, int api)
+          const struct gl_extensions *extensions)
 {
        int errors;
-       glcpp_parser_t *parser = glcpp_parser_create (extensions, api);
+       glcpp_parser_t *parser = glcpp_parser_create (extensions);
        *shader = remove_line_continuations(parser, *shader);
 
        glcpp_lex_set_source_string (parser, *shader);
index 8fd8009..5f71a18 100644 (file)
@@ -1979,9 +1979,6 @@ case 94:
 YY_RULE_SETUP
 #line 299 "glsl_lexer.ll"
 {
-                         if (yyextra->OES_EGL_image_external_enable)
-                            return SAMPLEREXTERNALOES;
-                         else
                             return IDENTIFIER;
                        }
        YY_BREAK
index 12e0bec..f13268f 100644 (file)
@@ -59,13 +59,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
    this->es_shader = false;
    this->ARB_texture_rectangle_enable = true;
 
-   /* OpenGL ES 2.0 has different defaults from desktop GL. */
-   if (ctx->API == API_OPENGLES2) {
-      this->language_version = 100;
-      this->es_shader = true;
-      this->ARB_texture_rectangle_enable = false;
-   }
-
    this->extensions = &ctx->Extensions;
 
    this->Const.MaxLights = ctx->Const.MaxLights;
@@ -86,19 +79,13 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
     * Core context is supported, this logic will need change.  Older versions of
     * GLSL are no longer supported outside the compatibility contexts of 3.x.
     */
-   this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2)
-      || ctx->Extensions.ARB_ES2_compatibility;
-   this->Const.GLSL_110 = (ctx->API == API_OPENGL);
-   this->Const.GLSL_120 = (ctx->API == API_OPENGL)
-      && (ctx->Const.GLSLVersion >= 120);
-   this->Const.GLSL_130 = (ctx->API == API_OPENGL)
-      && (ctx->Const.GLSLVersion >= 130);
-
-   const unsigned lowest_version =
-      (ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility
-      ? 100 : 110;
-   const unsigned highest_version =
-      (ctx->API == API_OPENGL) ? ctx->Const.GLSLVersion : 100;
+   this->Const.GLSL_100ES = ctx->Extensions.ARB_ES2_compatibility;
+   this->Const.GLSL_110 = true;
+   this->Const.GLSL_120 = (ctx->Const.GLSLVersion >= 120);
+   this->Const.GLSL_130 = (ctx->Const.GLSLVersion >= 130);
+
+   const unsigned lowest_version = ctx->Extensions.ARB_ES2_compatibility ? 100 : 110;
+   const unsigned highest_version = ctx->Const.GLSLVersion;
    char *supported = ralloc_strdup(this, "");
 
    for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) {
@@ -267,7 +254,6 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(AMD_conservative_depth,         false, false, true,  true,  false,     ARB_conservative_depth),
    EXT(AMD_shader_stencil_export,      false, false, true,  true,  false,     ARB_shader_stencil_export),
    EXT(OES_texture_3D,                 true,  false, true,  false, true,      EXT_texture3D),
-   EXT(OES_EGL_image_external,         true,  false, true,  false, true,      OES_EGL_image_external),
 };
 
 #undef EXT
index 2798264..aec21a4 100644 (file)
@@ -196,8 +196,6 @@ struct _mesa_glsl_parse_state {
    bool AMD_shader_stencil_export_warn;
    bool OES_texture_3D_enable;
    bool OES_texture_3D_warn;
-   bool OES_EGL_image_external_enable;
-   bool OES_EGL_image_external_warn;
    /*@}*/
 
    /** Extensions supported by the OpenGL implementation. */
@@ -290,7 +288,7 @@ extern "C" {
 #endif
 
 extern int preprocess(void *ctx, const char **shader, char **info_log,
-                      const struct gl_extensions *extensions, int api);
+                      const struct gl_extensions *extensions);
 
 extern void _mesa_destroy_shader_compiler(void);
 extern void _mesa_destroy_shader_compiler_caches(void);
index 1489aae..4c68986 100644 (file)
@@ -148,8 +148,6 @@ glsl_type::sampler_index() const
    case GLSL_SAMPLER_DIM_BUF:
       assert(!"FINISHME: Implement ARB_texture_buffer_object");
       return TEXTURE_BUFFER_INDEX;
-   case GLSL_SAMPLER_DIM_EXTERNAL:
-      return TEXTURE_EXTERNAL_INDEX;
    default:
       assert(!"Should not get here.");
       return TEXTURE_BUFFER_INDEX;
@@ -230,16 +228,6 @@ glsl_type::generate_OES_texture_3D_types(glsl_symbol_table *symtab, bool warn)
    add_types_to_symbol_table(symtab, &_sampler3D_type, 1, warn);
 }
 
-
-void
-glsl_type::generate_OES_EGL_image_external_types(glsl_symbol_table *symtab,
-                                                bool warn)
-{
-   add_types_to_symbol_table(symtab, builtin_OES_EGL_image_external_types,
-                            Elements(builtin_OES_EGL_image_external_types),
-                            warn);
-}
-
 void
 _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
 {
@@ -276,15 +264,6 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
       glsl_type::generate_EXT_texture_array_types(state->symbols,
                                       state->EXT_texture_array_warn);
    }
-
-   /* We cannot check for language_version == 100 here because we need the
-    * types to support fixed-function program generation.  But this is fine
-    * since the extension is never enabled for OpenGL contexts.
-    */
-   if (state->OES_EGL_image_external_enable) {
-      glsl_type::generate_OES_EGL_image_external_types(state->symbols,
-                                              state->OES_EGL_image_external_warn);
-   }
 }
 
 
index 2997c93..d94c4f5 100644 (file)
@@ -501,7 +501,6 @@ private:
    static const glsl_type builtin_ARB_texture_rectangle_types[];
    static const glsl_type builtin_EXT_texture_array_types[];
    static const glsl_type builtin_EXT_texture_buffer_object_types[];
-   static const glsl_type builtin_OES_EGL_image_external_types[];
    /*@}*/
 
    /**
@@ -520,7 +519,6 @@ private:
    static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
    static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
    static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);
-   static void generate_OES_EGL_image_external_types(glsl_symbol_table *, bool);
    /*@}*/
 
    /**
index c980712..f89d52e 100644 (file)
@@ -1502,7 +1502,7 @@ assign_varying_locations(struct gl_context *ctx,
       }
    }
 
-   if (ctx->API == API_OPENGLES2 || prog->Version == 100) {
+   if (prog->Version == 100) {
       if (varying_vectors > ctx->Const.MaxVarying) {
          if (ctx->Const.GLSLSkipStrictMaxVaryingLimitCheck) {
             linker_warning(prog, "shader uses too many varying vectors "
@@ -1849,8 +1849,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
     * present in a linked program.  By checking for use of shading language
     * version 1.00, we also catch the GL_ARB_ES2_compatibility case.
     */
-   if (!prog->InternalSeparateShader &&
-       (ctx->API == API_OPENGLES2 || prog->Version == 100)) {
+   if (!prog->InternalSeparateShader && prog->Version == 100) {
       if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
         linker_error(prog, "program lacks a vertex shader\n");
       } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) {
index c548127..8bc8639 100644 (file)
@@ -136,7 +136,7 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader)
 
    const char *source = shader->Source;
    state->error = preprocess(state, &source, &state->info_log,
-                            state->extensions, ctx->API) != 0;
+                            state->extensions) != 0;
 
    if (!state->error) {
       _mesa_glsl_lexer_ctor(state, source);
index 5a39162..01ae0da 100644 (file)
@@ -71,7 +71,6 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
    ctx->Extensions.EXT_texture_array = true;
    ctx->Extensions.NV_texture_rectangle = true;
    ctx->Extensions.EXT_texture3D = true;
-   ctx->Extensions.OES_EGL_image_external = true;
 
    ctx->Const.GLSLVersion = 120;
 
index 6abafb5..0462e4d 100644 (file)
@@ -219,7 +219,7 @@ int test_optpass(int argc, char **argv)
       shader->Source = input.c_str();
       const char *source = shader->Source;
       state->error = preprocess(state, &source, &state->info_log,
-                                state->extensions, ctx->API) != 0;
+                                state->extensions) != 0;
 
       if (!state->error) {
          _mesa_glsl_lexer_ctor(state, source);
index 645d897..26cdff6 100644 (file)
@@ -115,7 +115,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->FreeTextureImageBuffer = _swrast_free_texture_image_buffer;
    driver->MapTextureImage = _swrast_map_teximage;
    driver->UnmapTextureImage = _swrast_unmap_teximage;
-   driver->DrawTex = _mesa_meta_DrawTex;
 
    /* Vertex/fragment programs */
    driver->BindProgram = NULL;
@@ -194,7 +193,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->NeedFlush = 0;
    driver->SaveNeedFlush = 0;
 
-   driver->ProgramStringNotify = _tnl_program_string;
    driver->FlushVertices = NULL;
    driver->SaveFlushVertices = NULL;
    driver->PrepareExecBegin = NULL;
index 1689e62..05dd62a 100644 (file)
@@ -576,8 +576,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
                _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
             if (ctx->Extensions.NV_texture_rectangle)
                _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
-            if (ctx->Extensions.OES_EGL_image_external)
-               _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
             _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
             _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
             _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
@@ -3420,131 +3418,3 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
       _mesa_get_teximage(ctx, format, type, pixels, texImage);
    }
 }
-
-
-/**
- * Meta implementation of ctx->Driver.DrawTex() in terms
- * of polygon rendering.
- */
-void
-_mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
-                   GLfloat width, GLfloat height)
-{
-#if FEATURE_OES_draw_texture
-   struct drawtex_state *drawtex = &ctx->Meta->DrawTex;
-   struct vertex {
-      GLfloat x, y, z, st[MAX_TEXTURE_UNITS][2];
-   };
-   struct vertex verts[4];
-   GLuint i;
-
-   _mesa_meta_begin(ctx, (MESA_META_RASTERIZATION |
-                          MESA_META_SHADER |
-                          MESA_META_TRANSFORM |
-                          MESA_META_VERTEX |
-                          MESA_META_VIEWPORT));
-
-   if (drawtex->ArrayObj == 0) {
-      /* one-time setup */
-      GLint active_texture;
-
-      /* create vertex array object */
-      _mesa_GenVertexArrays(1, &drawtex->ArrayObj);
-      _mesa_BindVertexArray(drawtex->ArrayObj);
-
-      /* create vertex array buffer */
-      _mesa_GenBuffersARB(1, &drawtex->VBO);
-      _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
-      _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
-                          NULL, GL_DYNAMIC_DRAW_ARB);
-
-      /* client active texture is not part of the array object */
-      active_texture = ctx->Array.ActiveTexture;
-
-      /* setup vertex arrays */
-      _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
-      _mesa_EnableClientState(GL_VERTEX_ARRAY);
-      for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-         _mesa_ClientActiveTextureARB(GL_TEXTURE0 + i);
-         _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(st[i]));
-         _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
-      }
-
-      /* restore client active texture */
-      _mesa_ClientActiveTextureARB(GL_TEXTURE0 + active_texture);
-   }
-   else {
-      _mesa_BindVertexArray(drawtex->ArrayObj);
-      _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
-   }
-
-   /* vertex positions, texcoords */
-   {
-      const GLfloat x1 = x + width;
-      const GLfloat y1 = y + height;
-
-      z = CLAMP(z, 0.0, 1.0);
-      z = invert_z(z);
-
-      verts[0].x = x;
-      verts[0].y = y;
-      verts[0].z = z;
-
-      verts[1].x = x1;
-      verts[1].y = y;
-      verts[1].z = z;
-
-      verts[2].x = x1;
-      verts[2].y = y1;
-      verts[2].z = z;
-
-      verts[3].x = x;
-      verts[3].y = y1;
-      verts[3].z = z;
-
-      for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-         const struct gl_texture_object *texObj;
-         const struct gl_texture_image *texImage;
-         GLfloat s, t, s1, t1;
-         GLuint tw, th;
-
-         if (!ctx->Texture.Unit[i]._ReallyEnabled) {
-            GLuint j;
-            for (j = 0; j < 4; j++) {
-               verts[j].st[i][0] = 0.0f;
-               verts[j].st[i][1] = 0.0f;
-            }
-            continue;
-         }
-
-         texObj = ctx->Texture.Unit[i]._Current;
-         texImage = texObj->Image[0][texObj->BaseLevel];
-         tw = texImage->Width2;
-         th = texImage->Height2;
-
-         s = (GLfloat) texObj->CropRect[0] / tw;
-         t = (GLfloat) texObj->CropRect[1] / th;
-         s1 = (GLfloat) (texObj->CropRect[0] + texObj->CropRect[2]) / tw;
-         t1 = (GLfloat) (texObj->CropRect[1] + texObj->CropRect[3]) / th;
-
-         verts[0].st[i][0] = s;
-         verts[0].st[i][1] = t;
-
-         verts[1].st[i][0] = s1;
-         verts[1].st[i][1] = t;
-
-         verts[2].st[i][0] = s1;
-         verts[2].st[i][1] = t1;
-
-         verts[3].st[i][0] = s;
-         verts[3].st[i][1] = t1;
-      }
-
-      _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
-   }
-
-   _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
-   _mesa_meta_end(ctx);
-#endif /* FEATURE_OES_draw_texture */
-}
index 05286e2..de01e7c 100644 (file)
@@ -137,8 +137,4 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
                        GLenum format, GLenum type, GLvoid *pixels,
                        struct gl_texture_image *texImage);
 
-extern void
-_mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
-                   GLfloat width, GLfloat height);
-
 #endif /* META_H */
index 5f3fd24..74cdec3 100644 (file)
@@ -22,7 +22,6 @@ list(APPEND SOURCE
     dlist.c
     dlopen.c
     drawpix.c
-    drawtex.c
     enable.c
     enums.c
     eval.c
@@ -30,8 +29,6 @@ list(APPEND SOURCE
     extensions.c
     fbobject.c
     feedback.c
-    ff_fragment_shader.cpp
-    ffvertex_prog.c
     fog.c
     formats.c
     format_pack.c
index 81836f3..15dc7e2 100644 (file)
@@ -644,11 +644,6 @@ _mesa_create_exec_table(void)
    SET_BindVertexArray(exec, _mesa_BindVertexArray);
    SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
 
-#if FEATURE_OES_EGL_image
-   SET_EGLImageTargetTexture2DOES(exec, _mesa_EGLImageTargetTexture2DOES);
-   SET_EGLImageTargetRenderbufferStorageOES(exec, _mesa_EGLImageTargetRenderbufferStorageOES);
-#endif
-
 #if FEATURE_APPLE_object_purgeable
    SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
    SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
index 172bfa5..80db51e 100644 (file)
@@ -106,53 +106,25 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
       return GL_FALSE;
    }
 
-   switch (ctx->API) {
-#if FEATURE_es2_glsl
-   case API_OPENGLES2:
-      /* For ES2, we can draw if any vertex array is enabled (and we
-       * should always have a vertex program/shader). */
-      if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current)
-        return GL_FALSE;
-      break;
-#endif
-
-#if FEATURE_ES1
-   case API_OPENGLES:
-      /* For OpenGL ES, only draw if we have vertex positions
-       */
-      if (!ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled)
-        return GL_FALSE;
-      break;
-#endif
-
-#if FEATURE_GL
-   case API_OPENGL:
-      {
-         const struct gl_shader_program *vsProg =
-            ctx->Shader.CurrentVertexProgram;
-         GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus);
-         GLboolean haveVertexProgram = ctx->VertexProgram._Enabled;
-         if (haveVertexShader || haveVertexProgram) {
-            /* Draw regardless of whether or not we have any vertex arrays.
-             * (Ex: could draw a point using a constant vertex pos)
-             */
-            return GL_TRUE;
-         }
-         else {
-            /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
-             * array [0]).
-             */
-            return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
-                    ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
-         }
+   {
+      const struct gl_shader_program *vsProg =
+         ctx->Shader.CurrentVertexProgram;
+      GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus);
+      GLboolean haveVertexProgram = ctx->VertexProgram._Enabled;
+      if (haveVertexShader || haveVertexProgram) {
+         /* Draw regardless of whether or not we have any vertex arrays.
+          * (Ex: could draw a point using a constant vertex pos)
+          */
+         return GL_TRUE;
+      }
+      else {
+         /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
+          * array [0]).
+          */
+         return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
+                 ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
       }
-      break;
-#endif
-
-   default:
-      ASSERT_NO_FEATURE();
    }
-
    return GL_TRUE;
 }
 
index 957d25f..739961d 100644 (file)
@@ -400,14 +400,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
       _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
       return;
    }
-
-   if (ctx->Program.ErrorPos == -1) {
-      /* finally, give the program to the driver for translation/checking */
-      if (!ctx->Driver.ProgramStringNotify(ctx, target, base)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glProgramStringARB(rejected by driver");
-      }
-   }
 }
 
 
index bd099d3..6ac08d2 100644 (file)
@@ -74,7 +74,6 @@ struct gl_enable_attrib
    GLbitfield ClipPlanes;
    GLboolean ColorMaterial;
    GLboolean CullFace;
-   GLboolean DepthClamp;
    GLboolean DepthTest;
    GLboolean Dither;
    GLboolean Fog;
@@ -134,7 +133,6 @@ struct gl_enable_attrib
 
    /* GL_ARB_point_sprite / GL_NV_point_sprite */
    GLboolean PointSprite;
-   GLboolean FragmentShaderATI;
 };
 
 
@@ -264,7 +262,6 @@ _mesa_PushAttrib(GLbitfield mask)
       attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
       attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
       attr->CullFace = ctx->Polygon.CullFlag;
-      attr->DepthClamp = ctx->Transform.DepthClamp;
       attr->DepthTest = ctx->Depth.Test;
       attr->Dither = ctx->Color.DitherFlag;
       attr->Fog = ctx->Fog.Enabled;
@@ -505,8 +502,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
    TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
                    GL_COLOR_MATERIAL);
    TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
-   TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp,
-                  GL_DEPTH_CLAMP);
    TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
    TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
    TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
@@ -761,8 +756,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
          }
          else if (obj->Target == GL_TEXTURE_BUFFER)
             continue;
-         else if (obj->Target == GL_TEXTURE_EXTERNAL_OES)
-            continue;
 
          target = obj->Target;
 
@@ -1210,9 +1203,6 @@ _mesa_PopAttrib(void)
                if (xform->RescaleNormals != ctx->Transform.RescaleNormals)
                   _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT,
                                    ctx->Transform.RescaleNormals);
-               if (xform->DepthClamp != ctx->Transform.DepthClamp)
-                  _mesa_set_enable(ctx, GL_DEPTH_CLAMP,
-                                   ctx->Transform.DepthClamp);
             }
             break;
          case GL_TEXTURE_BIT:
index 235d504..db27784 100644 (file)
@@ -120,24 +120,8 @@ get_buffer(struct gl_context *ctx, const char *func, GLenum target)
 static inline GLenum
 default_access_mode(const struct gl_context *ctx)
 {
-   /* Table 2.6 on page 31 (page 44 of the PDF) of the OpenGL 1.5 spec says:
-    *
-    * Name           Type  Initial Value  Legal Values
-    * ...            ...   ...            ...
-    * BUFFER_ACCESS  enum  READ_WRITE     READ_ONLY, WRITE_ONLY
-    *                                     READ_WRITE
-    *
-    * However, table 6.8 in the GL_OES_mapbuffer extension says:
-    *
-    * Get Value         Type Get Command          Value          Description
-    * ---------         ---- -----------          -----          -----------
-    * BUFFER_ACCESS_OES Z1   GetBufferParameteriv WRITE_ONLY_OES buffer map flag
-    *
-    * The difference is because GL_OES_mapbuffer only supports mapping buffers
-    * write-only.
-    */
-   return (ctx->API == API_OPENGLES)
-      ? GL_MAP_WRITE_BIT : (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT);
+   (void)ctx;
+   return GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
 }
 
 
index adea0f5..56b5019 100644 (file)
@@ -349,8 +349,7 @@ updated_drawbuffers(struct gl_context *ctx)
 {
    FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 
-#if FEATURE_GL
-   if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
+   if (!ctx->Extensions.ARB_ES2_compatibility) {
       struct gl_framebuffer *fb = ctx->DrawBuffer;
 
       /* Flag the FBO as requiring validation. */
@@ -358,7 +357,6 @@ updated_drawbuffers(struct gl_context *ctx)
         fb->_Status = 0;
       }
    }
-#endif
 }
 
 /**
index 522e792..40da0ce 100644 (file)
@@ -378,12 +378,12 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock);
 static void
 one_time_init( struct gl_context *ctx )
 {
-   static GLbitfield api_init_mask = 0x0;
+   static GLboolean api_init = GL_FALSE;
 
    _glthread_LOCK_MUTEX(OneTimeLock);
 
    /* truly one-time init */
-   if (!api_init_mask) {
+   if (!api_init) {
       GLuint i;
 
       /* do some implementation tests */
@@ -416,8 +416,8 @@ one_time_init( struct gl_context *ctx )
       _mesa_test_formats();
 #endif
    }
-
-   api_init_mask |= 1 << ctx->API;
+   
+   api_init = GL_TRUE;
 
    _glthread_UNLOCK_MUTEX(OneTimeLock);
 
@@ -588,17 +588,8 @@ _mesa_init_constants(struct gl_context *ctx)
    ctx->Const.MaxVarying = MAX_VARYING;
 #endif
 
-   /* Shading language version */
-   if (ctx->API == API_OPENGL) {
-      ctx->Const.GLSLVersion = 120;
-      _mesa_override_glsl_version(ctx);
-   }
-   else if (ctx->API == API_OPENGLES2) {
-      ctx->Const.GLSLVersion = 100;
-   }
-   else if (ctx->API == API_OPENGLES) {
-      ctx->Const.GLSLVersion = 0; /* GLSL not supported */
-   }
+   ctx->Const.GLSLVersion = 120;
+   _mesa_override_glsl_version(ctx);
 
    /* GL_ARB_framebuffer_object */
    ctx->Const.MaxSamples = 0;
@@ -847,20 +838,17 @@ _mesa_alloc_dispatch_table(int size)
  */
 GLboolean
 _mesa_initialize_context(struct gl_context *ctx,
-                         gl_api api,
                          const struct gl_config *visual,
                          struct gl_context *share_list,
                          const struct dd_function_table *driverFunctions,
                          void *driverContext)
 {
    struct gl_shared_state *shared;
-   int i;
 
    /*ASSERT(driverContext);*/
    assert(driverFunctions->NewTextureObject);
    assert(driverFunctions->FreeTextureImageBuffer);
 
-   ctx->API = api;
    ctx->Visual = *visual;
    ctx->DrawBuffer = NULL;
    ctx->ReadBuffer = NULL;
@@ -896,46 +884,14 @@ _mesa_initialize_context(struct gl_context *ctx,
       return GL_FALSE;
    }
 
-#if FEATURE_dispatch
-   /* setup the API dispatch tables */
-   switch (ctx->API) {
-#if FEATURE_GL
-   case API_OPENGL:
-      ctx->Exec = _mesa_create_exec_table();
-      break;
-#endif
-#if FEATURE_ES1
-   case API_OPENGLES:
-      ctx->Exec = _mesa_create_exec_table_es1();
-      break;
-#endif
-#if FEATURE_ES2
-   case API_OPENGLES2:
-      ctx->Exec = _mesa_create_exec_table_es2();
-      break;
-#endif
-   default:
-      _mesa_problem(ctx, "unknown or unsupported API");
-      break;
-   }
+   ctx->Exec = _mesa_create_exec_table();
 
    if (!ctx->Exec) {
       _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
       return GL_FALSE;
    }
-#endif
    ctx->CurrentDispatch = ctx->Exec;
 
-   ctx->FragmentProgram._MaintainTexEnvProgram
-      = (_mesa_getenv("MESA_TEX_PROG") != NULL);
-
-   ctx->VertexProgram._MaintainTnlProgram
-      = (_mesa_getenv("MESA_TNL_PROG") != NULL);
-   if (ctx->VertexProgram._MaintainTnlProgram) {
-      /* this is required... */
-      ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
-   }
-
    /* Mesa core handles all the formats that mesa core knows about.
     * Drivers will want to override this list with just the formats
     * they can handle, and confirm that appropriate fallbacks exist in
@@ -944,41 +900,15 @@ _mesa_initialize_context(struct gl_context *ctx,
    memset(&ctx->TextureFormatSupported, GL_TRUE,
          sizeof(ctx->TextureFormatSupported));
 
-   switch (ctx->API) {
-   case API_OPENGL:
-#if FEATURE_dlist
-      ctx->Save = _mesa_create_save_table();
-      if (!ctx->Save) {
-         _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
-        free(ctx->Exec);
-        return GL_FALSE;
-      }
-
-      _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
-#endif
-      break;
-   case API_OPENGLES:
-      /**
-       * GL_OES_texture_cube_map says
-       * "Initially all texture generation modes are set to REFLECTION_MAP_OES"
-       */
-      for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
-        struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
-        texUnit->GenS.Mode = GL_REFLECTION_MAP_NV;
-        texUnit->GenT.Mode = GL_REFLECTION_MAP_NV;
-        texUnit->GenR.Mode = GL_REFLECTION_MAP_NV;
-        texUnit->GenS._ModeBit = TEXGEN_REFLECTION_MAP_NV;
-        texUnit->GenT._ModeBit = TEXGEN_REFLECTION_MAP_NV;
-        texUnit->GenR._ModeBit = TEXGEN_REFLECTION_MAP_NV;
-      }
-      break;
-   case API_OPENGLES2:
-      ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
-      ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
-      ctx->Point.PointSprite = GL_TRUE;  /* always on for ES 2.x */
-      break;
+   ctx->Save = _mesa_create_save_table();
+   if (!ctx->Save) {
+      _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
+      free(ctx->Exec);
+      return GL_FALSE;
    }
 
+   _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
+
    ctx->FirstTimeCurrent = GL_TRUE;
 
    return GL_TRUE;
@@ -1001,8 +931,7 @@ _mesa_initialize_context(struct gl_context *ctx,
  * \return pointer to a new __struct gl_contextRec or NULL if error.
  */
 struct gl_context *
-_mesa_create_context(gl_api api,
-                     const struct gl_config *visual,
+_mesa_create_context(const struct gl_config *visual,
                      struct gl_context *share_list,
                      const struct dd_function_table *driverFunctions,
                      void *driverContext)
@@ -1016,7 +945,7 @@ _mesa_create_context(gl_api api,
    if (!ctx)
       return NULL;
 
-   if (_mesa_initialize_context(ctx, api, visual, share_list,
+   if (_mesa_initialize_context(ctx, visual, share_list,
                                 driverFunctions, driverContext)) {
       return ctx;
    }
@@ -1052,11 +981,9 @@ _mesa_free_context_data( struct gl_context *ctx )
 
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
-   _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL);
 
    _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
    _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
-   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
 
    _mesa_free_attrib_data(ctx);
    _mesa_free_buffer_objects(ctx);
index a66dd50..9680774 100644 (file)
@@ -106,15 +106,13 @@ _mesa_destroy_visual( struct gl_config *vis );
 
 extern GLboolean
 _mesa_initialize_context( struct gl_context *ctx,
-                          gl_api api,
                           const struct gl_config *visual,
                           struct gl_context *share_list,
                           const struct dd_function_table *driverFunctions,
                           void *driverContext );
 
 extern struct gl_context *
-_mesa_create_context(gl_api api,
-                     const struct gl_config *visual,
+_mesa_create_context(const struct gl_config *visual,
                      struct gl_context *share_list,
                      const struct dd_function_table *driverFunctions,
                      void *driverContext);
index ccc3efb..f91a6ef 100644 (file)
@@ -505,13 +505,6 @@ struct dd_function_table {
    struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id);
    /** Delete a program */
    void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);   
-   /**
-    * Notify driver that a program string (and GPU code) has been specified
-    * or modified.  Return GL_TRUE or GL_FALSE to indicate if the program is
-    * supported by the driver.
-    */
-   GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target, 
-                                    struct gl_program *prog);
 
    /** Query if program can be loaded onto hardware */
    GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target, 
@@ -871,25 +864,6 @@ struct dd_function_table {
 
    /**@}*/
 
-   /**
-    * \name GL_OES_draw_texture interface
-    */
-   /*@{*/
-   void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
-                   GLfloat width, GLfloat height);
-   /*@}*/
-
-   /**
-    * \name GL_OES_EGL_image interface
-    */
-   void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target,
-                                  struct gl_texture_object *texObj,
-                                  struct gl_texture_image *texImage,
-                                  GLeglImageOES image_handle);
-   void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx,
-                                            struct gl_renderbuffer *rb,
-                                            void *image_handle);
-
    /**
     * \name GL_NV_texture_barrier interface
     */
index 72aa8cb..6e695d1 100644 (file)
@@ -50,8 +50,7 @@ tex_target_name(GLenum tgt)
       { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" },
       { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" },
       { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" },
-      { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" },
-      { GL_TEXTURE_EXTERNAL_OES, "GL_TEXTURE_EXTERNAL_OES" }
+      { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" }
    };
    GLuint i;
    for (i = 0; i < Elements(tex_targets); i++) {
index bbff15d..31134bb 100644 (file)
 #define _gloffset_StencilFuncSeparateATI 966
 #define _gloffset_ProgramEnvParameters4fvEXT 967
 #define _gloffset_ProgramLocalParameters4fvEXT 968
-#define _gloffset_EGLImageTargetRenderbufferStorageOES 971
-#define _gloffset_EGLImageTargetTexture2DOES 972
 
 #else /* !FEATURE_remap_table */
 
@@ -1378,8 +1376,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define StencilFuncSeparateATI_remap_index 558
 #define ProgramEnvParameters4fvEXT_remap_index 559
 #define ProgramLocalParameters4fvEXT_remap_index 560
-#define EGLImageTargetRenderbufferStorageOES_remap_index 563
-#define EGLImageTargetTexture2DOES_remap_index 564
 
 #define _gloffset_AttachShader driDispatchRemapTable[AttachShader_remap_index]
 #define _gloffset_CreateProgram driDispatchRemapTable[CreateProgram_remap_index]
@@ -1828,8 +1824,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index]
 #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]
 #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index]
-#define _gloffset_EGLImageTargetRenderbufferStorageOES driDispatchRemapTable[EGLImageTargetRenderbufferStorageOES_remap_index]
-#define _gloffset_EGLImageTargetTexture2DOES driDispatchRemapTable[EGLImageTargetTexture2DOES_remap_index]
 
 #endif /* !FEATURE_remap_table */
 
@@ -11227,27 +11221,5 @@ static inline void SET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp, v
    SET_by_offset(disp, _gloffset_ProgramLocalParameters4fvEXT, fn);
 }
 
-typedef void (GLAPIENTRYP _glptr_EGLImageTargetRenderbufferStorageOES)(GLenum, GLvoid *);
-#define CALL_EGLImageTargetRenderbufferStorageOES(disp, parameters) \
-    (* GET_EGLImageTargetRenderbufferStorageOES(disp)) parameters
-static inline _glptr_EGLImageTargetRenderbufferStorageOES GET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp) {
-   return (_glptr_EGLImageTargetRenderbufferStorageOES) (GET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES));
-}
-
-static inline void SET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid *)) {
-   SET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EGLImageTargetTexture2DOES)(GLenum, GLvoid *);
-#define CALL_EGLImageTargetTexture2DOES(disp, parameters) \
-    (* GET_EGLImageTargetTexture2DOES(disp)) parameters
-static inline _glptr_EGLImageTargetTexture2DOES GET_EGLImageTargetTexture2DOES(struct _glapi_table *disp) {
-   return (_glptr_EGLImageTargetTexture2DOES) (GET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES));
-}
-
-static inline void SET_EGLImageTargetTexture2DOES(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLvoid *)) {
-   SET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES, fn);
-}
-
 
 #endif /* !defined( _DISPATCH_H_ ) */
diff --git a/reactos/dll/opengl/mesa/src/mesa/main/drawtex.c b/reactos/dll/opengl/mesa/src/mesa/main/drawtex.c
deleted file mode 100644 (file)
index 83485a9..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (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 NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- */
-
-#include "main/drawtex.h"
-#include "main/state.h"
-#include "main/imports.h"
-#include "main/mfeatures.h"
-#include "main/mtypes.h"
-
-
-#if FEATURE_OES_draw_texture
-
-
-static void
-draw_texture(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
-             GLfloat width, GLfloat height)
-{
-   if (!ctx->Extensions.OES_draw_texture) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glDrawTex(unsupported)");
-      return;
-   }
-   if (width <= 0.0f || height <= 0.0f) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTex(width or height <= 0)");
-      return;
-   }
-
-   _mesa_set_vp_override(ctx, GL_TRUE);
-
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
-   ASSERT(ctx->Driver.DrawTex);
-   ctx->Driver.DrawTex(ctx, x, y, z, width, height);
-
-   _mesa_set_vp_override(ctx, GL_FALSE);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx, x, y, z, width, height);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexfv(const GLfloat *coords)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx, coords[0], coords[1], coords[2], coords[3], coords[4]);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z,
-                (GLfloat) width, (GLfloat) height);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexiv(const GLint *coords)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1],
-                (GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z,
-                (GLfloat) width, (GLfloat) height);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexsv(const GLshort *coords)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1],
-                (GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx,
-                (GLfloat) x / 65536.0f,
-                (GLfloat) y / 65536.0f,
-                (GLfloat) z / 65536.0f,
-                (GLfloat) width / 65536.0f,
-                (GLfloat) height / 65536.0f);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawTexxv(const GLfixed *coords)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   draw_texture(ctx,
-                (GLfloat) coords[0] / 65536.0f,
-                (GLfloat) coords[1] / 65536.0f,
-                (GLfloat) coords[2] / 65536.0f,
-                (GLfloat) coords[3] / 65536.0f,
-                (GLfloat) coords[4] / 65536.0f);
-}
-
-#endif /* FEATURE_OES_draw_texture */
diff --git a/reactos/dll/opengl/mesa/src/mesa/main/drawtex.h b/reactos/dll/opengl/mesa/src/mesa/main/drawtex.h
deleted file mode 100644 (file)
index 13ff6f9..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (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 NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- */
-
-#ifndef DRAWTEX_H
-#define DRAWTEX_H
-
-
-#include "glheader.h"
-#include "mfeatures.h"
-
-
-#if FEATURE_OES_draw_texture
-
-extern void GLAPIENTRY
-_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-
-extern void GLAPIENTRY
-_mesa_DrawTexfv(const GLfloat *coords);
-
-extern void GLAPIENTRY
-_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height);
-
-extern void GLAPIENTRY
-_mesa_DrawTexiv(const GLint *coords);
-
-extern void GLAPIENTRY
-_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-
-extern void GLAPIENTRY
-_mesa_DrawTexsv(const GLshort *coords);
-
-extern void GLAPIENTRY
-_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-
-extern void GLAPIENTRY
-_mesa_DrawTexxv(const GLfixed *coords);
-
-#endif /* FEATURE_OES_draw_texture */
-
-
-#endif /* DRAWTEX_H */
index 0b36a9e..385022a 100644 (file)
@@ -845,14 +845,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          ctx->Depth.BoundsTest = state;
          break;
 
-      case GL_DEPTH_CLAMP:
-         if (ctx->Transform.DepthClamp == state)
-            return;
-        CHECK_EXTENSION(ARB_depth_clamp, cap);
-         FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
-        ctx->Transform.DepthClamp = state;
-        break;
-
       /* GL_MESA_texture_array */
       case GL_TEXTURE_1D_ARRAY_EXT:
          CHECK_EXTENSION(MESA_texture_array, cap);
@@ -888,14 +880,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          ctx->Color.sRGBEnabled = state;
          break;
 
-      /* GL_OES_EGL_image_external */
-      case GL_TEXTURE_EXTERNAL_OES:
-         CHECK_EXTENSION(OES_EGL_image_external, cap);
-         if (!enable_texture(ctx, state, TEXTURE_EXTERNAL_BIT)) {
-            return;
-         }
-         break;
-
       default:
          goto invalid_enum_error;
    }
@@ -1277,11 +1261,6 @@ _mesa_IsEnabled( GLenum cap )
          CHECK_EXTENSION(EXT_depth_bounds_test);
          return ctx->Depth.BoundsTest;
 
-      /* GL_ARB_depth_clamp */
-      case GL_DEPTH_CLAMP:
-         CHECK_EXTENSION(ARB_depth_clamp);
-         return ctx->Transform.DepthClamp;
-
       /* GL_NV_primitive_restart */
       case GL_PRIMITIVE_RESTART_NV:
         if (!ctx->Extensions.NV_primitive_restart) {
@@ -1301,11 +1280,6 @@ _mesa_IsEnabled( GLenum cap )
         CHECK_EXTENSION(EXT_framebuffer_sRGB);
         return ctx->Color.sRGBEnabled;
 
-      /* GL_OES_EGL_image_external */
-      case GL_TEXTURE_EXTERNAL_OES:
-        CHECK_EXTENSION(OES_EGL_image_external);
-         return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT);
-
       default:
          goto invalid_enum_error;
    }
index 61bbbaf..0fd4b48 100644 (file)
 
 #define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 1))
 
-enum {
-   DISABLE = 0,
-   GL  = 1 << API_OPENGL,
-   ES1 = 1 << API_OPENGLES,
-   ES2 = 1 << API_OPENGLES2,
-};
-
 /**
  * \brief An element of the \c extension_table.
  */
@@ -56,9 +49,6 @@ struct extension {
    /** Offset (in bytes) of the corresponding member in struct gl_extensions. */
    size_t offset;
 
-   /** Set of API's in which the extension exists, as a bitset. */
-   uint8_t api_set;
-
    /** Year the extension was proposed or approved.  Used to sort the 
     * extension string chronologically. */
    uint16_t year;
@@ -77,204 +67,158 @@ struct extension {
  */
 static const struct extension extension_table[] = {
    /* ARB Extensions */
-   { "GL_ARB_ES2_compatibility",                   o(ARB_ES2_compatibility),                   GL,             2009 },
-   { "GL_ARB_color_buffer_float",                  o(ARB_color_buffer_float),                  GL,             2004 },
-   { "GL_ARB_copy_buffer",                         o(ARB_copy_buffer),                         GL,             2008 },
-   { "GL_ARB_conservative_depth",                  o(ARB_conservative_depth),                  GL,             2011 },
-   { "GL_ARB_depth_buffer_float",                  o(ARB_depth_buffer_float),                  GL,             2008 },
-   { "GL_ARB_depth_clamp",                         o(ARB_depth_clamp),                         GL,             2003 },
-   { "GL_ARB_draw_buffers",                        o(dummy_true),                              GL,             2002 },
-   { "GL_ARB_draw_buffers_blend",                  o(ARB_draw_buffers_blend),                  GL,             2009 },
-   { "GL_ARB_fragment_program",                    o(ARB_fragment_program),                    GL,             2002 },
-   { "GL_ARB_fragment_program_shadow",             o(ARB_fragment_program_shadow),             GL,             2003 },
-   { "GL_ARB_fragment_shader",                     o(ARB_fragment_shader),                     GL,             2002 },
-   { "GL_ARB_framebuffer_object",                  o(ARB_framebuffer_object),                  GL,             2005 },
-   { "GL_ARB_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    GL,             1998 },
-   { "GL_ARB_half_float_pixel",                    o(ARB_half_float_pixel),                    GL,             2003 },
-   { "GL_ARB_half_float_vertex",                   o(ARB_half_float_vertex),                   GL,             2008 },
-   { "GL_ARB_map_buffer_range",                    o(ARB_map_buffer_range),                    GL,             2008 },
-   { "GL_ARB_multisample",                         o(dummy_true),                              GL,             1994 },
-   { "GL_ARB_multitexture",                        o(dummy_true),                              GL,             1998 },
-   { "GL_ARB_pixel_buffer_object",                 o(EXT_pixel_buffer_object),                 GL,             2004 },
-   { "GL_ARB_point_parameters",                    o(EXT_point_parameters),                    GL,             1997 },
-   { "GL_ARB_point_sprite",                        o(ARB_point_sprite),                        GL,             2003 },
-   { "GL_ARB_robustness",                          o(dummy_true),                              GL,             2010 },
-   { "GL_ARB_shader_objects",                      o(ARB_shader_objects),                      GL,             2002 },
-   { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
-   { "GL_ARB_shader_texture_lod",                  o(ARB_shader_texture_lod),                  GL,             2009 },
-   { "GL_ARB_shading_language_100",                o(ARB_shading_language_100),                GL,             2003 },
-   { "GL_ARB_texture_border_clamp",                o(ARB_texture_border_clamp),                GL,             2000 },
-   { "GL_ARB_texture_buffer_object",               o(ARB_texture_buffer_object),               GL,             2008 },
-   { "GL_ARB_texture_compression",                 o(dummy_true),                              GL,             2000 },
-   { "GL_ARB_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL,             2004 },
-   { "GL_ARB_texture_cube_map",                    o(ARB_texture_cube_map),                    GL,             1999 },
-   { "GL_ARB_texture_env_add",                     o(dummy_true),                              GL,             1999 },
-   { "GL_ARB_texture_env_combine",                 o(ARB_texture_env_combine),                 GL,             2001 },
-   { "GL_ARB_texture_env_crossbar",                o(ARB_texture_env_crossbar),                GL,             2001 },
-   { "GL_ARB_texture_env_dot3",                    o(ARB_texture_env_dot3),                    GL,             2001 },
-   { "GL_ARB_texture_float",                       o(ARB_texture_float),                       GL,             2004 },
-   { "GL_ARB_texture_mirrored_repeat",             o(dummy_true),                              GL,             2001 },
-   { "GL_ARB_texture_non_power_of_two",            o(ARB_texture_non_power_of_two),            GL,             2003 },
-   { "GL_ARB_texture_rectangle",                   o(NV_texture_rectangle),                    GL,             2004 },
-   { "GL_ARB_texture_rg",                          o(ARB_texture_rg),                          GL,             2008 },
-   { "GL_ARB_texture_storage",                     o(ARB_texture_storage),                     GL,             2011 },
-   { "GL_ARB_transpose_matrix",                    o(ARB_transpose_matrix),                    GL,             1999 },
-   { "GL_ARB_uniform_buffer_object",               o(ARB_uniform_buffer_object),               GL,             2002 },
-   { "GL_ARB_vertex_array_object",                 o(ARB_vertex_array_object),                 GL,             2006 },
-   { "GL_ARB_vertex_buffer_object",                o(dummy_true),                              GL,             2003 },
-   { "GL_ARB_vertex_program",                      o(ARB_vertex_program),                      GL,             2002 },
-   { "GL_ARB_vertex_shader",                       o(ARB_vertex_shader),                       GL,             2002 },
-   { "GL_ARB_window_pos",                          o(ARB_window_pos),                          GL,             2001 },
+   { "GL_ARB_ES2_compatibility",                   o(ARB_ES2_compatibility),                   2009 },
+   { "GL_ARB_color_buffer_float",                  o(ARB_color_buffer_float),                  2004 },
+   { "GL_ARB_copy_buffer",                         o(ARB_copy_buffer),                         2008 },
+   { "GL_ARB_conservative_depth",                  o(ARB_conservative_depth),                  2011 },
+   { "GL_ARB_depth_buffer_float",                  o(ARB_depth_buffer_float),                  2008 },
+   { "GL_ARB_draw_buffers",                        o(dummy_true),                              2002 },
+   { "GL_ARB_draw_buffers_blend",                  o(ARB_draw_buffers_blend),                  2009 },
+   { "GL_ARB_fragment_program",                    o(ARB_fragment_program),                    2002 },
+   { "GL_ARB_fragment_program_shadow",             o(ARB_fragment_program_shadow),             2003 },
+   { "GL_ARB_fragment_shader",                     o(ARB_fragment_shader),                     2002 },
+   { "GL_ARB_framebuffer_object",                  o(ARB_framebuffer_object),                  2005 },
+   { "GL_ARB_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    1998 },
+   { "GL_ARB_half_float_pixel",                    o(ARB_half_float_pixel),                    2003 },
+   { "GL_ARB_half_float_vertex",                   o(ARB_half_float_vertex),                   2008 },
+   { "GL_ARB_map_buffer_range",                    o(ARB_map_buffer_range),                    2008 },
+   { "GL_ARB_multisample",                         o(dummy_true),                              1994 },
+   { "GL_ARB_multitexture",                        o(dummy_true),                              1998 },
+   { "GL_ARB_pixel_buffer_object",                 o(EXT_pixel_buffer_object),                 2004 },
+   { "GL_ARB_point_parameters",                    o(EXT_point_parameters),                    1997 },
+   { "GL_ARB_point_sprite",                        o(ARB_point_sprite),                        2003 },
+   { "GL_ARB_robustness",                          o(dummy_true),                              2010 },
+   { "GL_ARB_shader_objects",                      o(ARB_shader_objects),                      2002 },
+   { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               2009 },
+   { "GL_ARB_shader_texture_lod",                  o(ARB_shader_texture_lod),                  2009 },
+   { "GL_ARB_shading_language_100",                o(ARB_shading_language_100),                2003 },
+   { "GL_ARB_texture_border_clamp",                o(ARB_texture_border_clamp),                2000 },
+   { "GL_ARB_texture_buffer_object",               o(ARB_texture_buffer_object),               2008 },
+   { "GL_ARB_texture_compression",                 o(dummy_true),                              2000 },
+   { "GL_ARB_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            2004 },
+   { "GL_ARB_texture_cube_map",                    o(ARB_texture_cube_map),                    1999 },
+   { "GL_ARB_texture_env_add",                     o(dummy_true),                              1999 },
+   { "GL_ARB_texture_env_combine",                 o(ARB_texture_env_combine),                 2001 },
+   { "GL_ARB_texture_env_crossbar",                o(ARB_texture_env_crossbar),                2001 },
+   { "GL_ARB_texture_env_dot3",                    o(ARB_texture_env_dot3),                    2001 },
+   { "GL_ARB_texture_float",                       o(ARB_texture_float),                       2004 },
+   { "GL_ARB_texture_mirrored_repeat",             o(dummy_true),                              2001 },
+   { "GL_ARB_texture_non_power_of_two",            o(ARB_texture_non_power_of_two),            2003 },
+   { "GL_ARB_texture_rectangle",                   o(NV_texture_rectangle),                    2004 },
+   { "GL_ARB_texture_rg",                          o(ARB_texture_rg),                          2008 },
+   { "GL_ARB_texture_storage",                     o(ARB_texture_storage),                     2011 },
+   { "GL_ARB_transpose_matrix",                    o(ARB_transpose_matrix),                    1999 },
+   { "GL_ARB_uniform_buffer_object",               o(ARB_uniform_buffer_object),               2002 },
+   { "GL_ARB_vertex_array_object",                 o(ARB_vertex_array_object),                 2006 },
+   { "GL_ARB_vertex_buffer_object",                o(dummy_true),                              2003 },
+   { "GL_ARB_vertex_program",                      o(ARB_vertex_program),                      2002 },
+   { "GL_ARB_vertex_shader",                       o(ARB_vertex_shader),                       2002 },
+   { "GL_ARB_window_pos",                          o(ARB_window_pos),                          2001 },
    /* EXT extensions */
-   { "GL_EXT_abgr",                                o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_bgra",                                o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_blend_color",                         o(EXT_blend_color),                         GL,             1995 },
-   { "GL_EXT_blend_equation_separate",             o(EXT_blend_equation_separate),             GL,             2003 },
-   { "GL_EXT_blend_func_separate",                 o(EXT_blend_func_separate),                 GL,             1999 },
-   { "GL_EXT_blend_minmax",                        o(EXT_blend_minmax),                        GL | ES1 | ES2, 1995 },
-   { "GL_EXT_blend_subtract",                      o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_clip_volume_hint",                    o(EXT_clip_volume_hint),                    GL,             1996 },
-   { "GL_EXT_compiled_vertex_array",               o(EXT_compiled_vertex_array),               GL,             1996 },
-   { "GL_EXT_copy_texture",                        o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_depth_bounds_test",                   o(EXT_depth_bounds_test),                   GL,             2002 },
-   { "GL_EXT_draw_instanced",                      o(ARB_draw_instanced),                      GL,             2006 },
-   { "GL_EXT_draw_range_elements",                 o(EXT_draw_range_elements),                 GL,             1997 },
-   { "GL_EXT_fog_coord",                           o(EXT_fog_coord),                           GL,             1999 },
-   { "GL_EXT_framebuffer_blit",                    o(EXT_framebuffer_blit),                    GL,             2005 },
-   { "GL_EXT_framebuffer_multisample",             o(EXT_framebuffer_multisample),             GL,             2005 },
-   { "GL_EXT_framebuffer_object",                  o(EXT_framebuffer_object),                  GL,             2000 },
-   { "GL_EXT_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    GL,             1998 },
-   { "GL_EXT_gpu_program_parameters",              o(EXT_gpu_program_parameters),              GL,             2006 },
-   { "GL_EXT_gpu_shader4",                         o(EXT_gpu_shader4),                         GL,             2006 },
-   { "GL_EXT_multi_draw_arrays",                   o(dummy_true),                              GL | ES1 | ES2, 1999 },
-   { "GL_EXT_packed_depth_stencil",                o(EXT_packed_depth_stencil),                GL,             2005 },
-   { "GL_EXT_packed_pixels",                       o(EXT_packed_pixels),                       GL,             1997 },
-   { "GL_EXT_pixel_buffer_object",                 o(EXT_pixel_buffer_object),                 GL,             2004 },
-   { "GL_EXT_point_parameters",                    o(EXT_point_parameters),                    GL,             1997 },
-   { "GL_EXT_polygon_offset",                      o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_rescale_normal",                      o(EXT_rescale_normal),                      GL,             1997 },
-   { "GL_EXT_secondary_color",                     o(EXT_secondary_color),                     GL,             1999 },
-   { "GL_EXT_separate_shader_objects",             o(EXT_separate_shader_objects),             GL,             2008 },
-   { "GL_EXT_separate_specular_color",             o(EXT_separate_specular_color),             GL,             1997 },
-   { "GL_EXT_shadow_funcs",                        o(EXT_shadow_funcs),                        GL,             2002 },
-   { "GL_EXT_stencil_two_side",                    o(EXT_stencil_two_side),                    GL,             2001 },
-   { "GL_EXT_stencil_wrap",                        o(dummy_true),                              GL,             2002 },
-   { "GL_EXT_subtexture",                          o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_texture3D",                           o(EXT_texture3D),                           GL,             1996 },
-   { "GL_EXT_texture_array",                       o(EXT_texture_array),                       GL,             2006 },
-   { "GL_EXT_texture_compression_dxt1",            o(EXT_texture_compression_s3tc),            GL | ES1 | ES2, 2004 },
-   { "GL_EXT_texture_compression_latc",            o(EXT_texture_compression_latc),            GL,             2006 },
-   { "GL_EXT_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL,             2004 },
-   { "GL_EXT_texture_compression_s3tc",            o(EXT_texture_compression_s3tc),            GL,             2000 },
-   { "GL_EXT_texture_cube_map",                    o(ARB_texture_cube_map),                    GL,             2001 },
-   { "GL_EXT_texture_edge_clamp",                  o(dummy_true),                              GL,             1997 },
-   { "GL_EXT_texture_env_add",                     o(dummy_true),                              GL,             1999 },
-   { "GL_EXT_texture_env_combine",                 o(dummy_true),                              GL,             2000 },
-   { "GL_EXT_texture_env_dot3",                    o(EXT_texture_env_dot3),                    GL,             2000 },
-   { "GL_EXT_texture_filter_anisotropic",          o(EXT_texture_filter_anisotropic),          GL | ES1 | ES2, 1999 },
-   { "GL_EXT_texture_format_BGRA8888",             o(dummy_true),                                   ES1 | ES2, 2005 },
-   { "GL_EXT_texture_integer",                     o(EXT_texture_integer),                     GL,             2006 },
-   { "GL_EXT_texture_lod_bias",                    o(dummy_true),                              GL | ES1,       1999 },
-   { "GL_EXT_texture_mirror_clamp",                o(EXT_texture_mirror_clamp),                GL,             2004 },
-   { "GL_EXT_texture_object",                      o(dummy_true),                              GL,             1995 },
-   { "GL_EXT_texture",                             o(dummy_true),                              GL,             1996 },
-   { "GL_EXT_texture_rectangle",                   o(NV_texture_rectangle),                    GL,             2004 },
-   { "GL_EXT_texture_snorm",                       o(EXT_texture_snorm),                       GL,             2009 },
-   { "GL_EXT_texture_sRGB",                        o(EXT_texture_sRGB),                        GL,             2004 },
-   { "GL_EXT_texture_type_2_10_10_10_REV",         o(dummy_true),                                         ES2, 2008 },
-   { "GL_EXT_vertex_array",                        o(dummy_true),                              GL,             1995 },
-
-   /* OES extensions */
-   { "GL_OES_blend_equation_separate",             o(EXT_blend_equation_separate),                  ES1,       2009 },
-   { "GL_OES_blend_func_separate",                 o(EXT_blend_func_separate),                      ES1,       2009 },
-   { "GL_OES_blend_subtract",                      o(dummy_true),                                   ES1,       2009 },
-   { "GL_OES_byte_coordinates",                    o(dummy_true),                                   ES1,       2002 },
-   { "GL_OES_compressed_paletted_texture",         o(dummy_true),                                   ES1,       2003 },
-   { "GL_OES_depth24",                             o(EXT_framebuffer_object),                       ES1 | ES2, 2005 },
-   { "GL_OES_depth32",                             o(dummy_false),                     DISABLE,                2005 },
-#if FEATURE_OES_draw_texture
-   { "GL_OES_draw_texture",                        o(OES_draw_texture),                             ES1 | ES2, 2004 },
-#endif
-#if FEATURE_OES_EGL_image
-   /*  FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */
-   { "GL_OES_EGL_image",                           o(OES_EGL_image),                           GL | ES1 | ES2, 2006 },
-   { "GL_OES_EGL_image_external",                  o(OES_EGL_image_external),                       ES1 | ES2, 2010 },
-#endif
-   { "GL_OES_element_index_uint",                  o(dummy_true),                                   ES1 | ES2, 2005 },
-   { "GL_OES_fbo_render_mipmap",                   o(EXT_framebuffer_object),                       ES1 | ES2, 2005 },
-   { "GL_OES_fixed_point",                         o(dummy_true),                                   ES1,       2002 },
-   { "GL_OES_framebuffer_object",                  o(EXT_framebuffer_object),                       ES1,       2005 },
-   { "GL_OES_mapbuffer",                           o(dummy_true),                                   ES1 | ES2, 2005 },
-   { "GL_OES_matrix_get",                          o(dummy_true),                                   ES1,       2004 },
-   { "GL_OES_packed_depth_stencil",                o(EXT_packed_depth_stencil),                     ES1 | ES2, 2007 },
-   { "GL_OES_point_size_array",                    o(dummy_true),                                   ES1,       2004 },
-   { "GL_OES_point_sprite",                        o(ARB_point_sprite),                             ES1,       2004 },
-   { "GL_OES_query_matrix",                        o(dummy_true),                                   ES1,       2003 },
-   { "GL_OES_read_format",                         o(dummy_true),                              GL | ES1,       2003 },
-   { "GL_OES_rgb8_rgba8",                          o(EXT_framebuffer_object),                       ES1 | ES2, 2005 },
-   { "GL_OES_single_precision",                    o(dummy_true),                                   ES1,       2003 },
-   { "GL_OES_standard_derivatives",                o(OES_standard_derivatives),                           ES2, 2005 },
-   { "GL_OES_stencil1",                            o(dummy_false),                     DISABLE,                2005 },
-   { "GL_OES_stencil4",                            o(dummy_false),                     DISABLE,                2005 },
-   { "GL_OES_stencil8",                            o(EXT_framebuffer_object),                       ES1 | ES2, 2005 },
-   { "GL_OES_stencil_wrap",                        o(dummy_true),                                   ES1,       2002 },
-   { "GL_OES_texture_3D",                          o(EXT_texture3D),                                      ES2, 2005 },
-   { "GL_OES_texture_cube_map",                    o(ARB_texture_cube_map),                         ES1,       2007 },
-   { "GL_OES_texture_env_crossbar",                o(ARB_texture_env_crossbar),                     ES1,       2005 },
-   { "GL_OES_texture_mirrored_repeat",             o(dummy_true),                                   ES1,       2005 },
-   { "GL_OES_texture_npot",                        o(ARB_texture_non_power_of_two),                       ES2, 2005 },
+   { "GL_EXT_abgr",                                o(dummy_true),                              1995 },
+   { "GL_EXT_bgra",                                o(dummy_true),                              1995 },
+   { "GL_EXT_blend_color",                         o(EXT_blend_color),                         1995 },
+   { "GL_EXT_blend_equation_separate",             o(EXT_blend_equation_separate),             2003 },
+   { "GL_EXT_blend_func_separate",                 o(EXT_blend_func_separate),                 1999 },
+   { "GL_EXT_blend_minmax",                        o(EXT_blend_minmax),                        1995 },
+   { "GL_EXT_blend_subtract",                      o(dummy_true),                              1995 },
+   { "GL_EXT_clip_volume_hint",                    o(EXT_clip_volume_hint),                    1996 },
+   { "GL_EXT_compiled_vertex_array",               o(EXT_compiled_vertex_array),               1996 },
+   { "GL_EXT_copy_texture",                        o(dummy_true),                              1995 },
+   { "GL_EXT_depth_bounds_test",                   o(EXT_depth_bounds_test),                   2002 },
+   { "GL_EXT_draw_instanced",                      o(ARB_draw_instanced),                      2006 },
+   { "GL_EXT_draw_range_elements",                 o(EXT_draw_range_elements),                 1997 },
+   { "GL_EXT_fog_coord",                           o(EXT_fog_coord),                           1999 },
+   { "GL_EXT_framebuffer_blit",                    o(EXT_framebuffer_blit),                    2005 },
+   { "GL_EXT_framebuffer_multisample",             o(EXT_framebuffer_multisample),             2005 },
+   { "GL_EXT_framebuffer_object",                  o(EXT_framebuffer_object),                  2000 },
+   { "GL_EXT_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    1998 },
+   { "GL_EXT_gpu_program_parameters",              o(EXT_gpu_program_parameters),              2006 },
+   { "GL_EXT_gpu_shader4",                         o(EXT_gpu_shader4),                         2006 },
+   { "GL_EXT_multi_draw_arrays",                   o(dummy_true),                              1999 },
+   { "GL_EXT_packed_depth_stencil",                o(EXT_packed_depth_stencil),                2005 },
+   { "GL_EXT_packed_pixels",                       o(EXT_packed_pixels),                       1997 },
+   { "GL_EXT_pixel_buffer_object",                 o(EXT_pixel_buffer_object),                 2004 },
+   { "GL_EXT_point_parameters",                    o(EXT_point_parameters),                    1997 },
+   { "GL_EXT_polygon_offset",                      o(dummy_true),                              1995 },
+   { "GL_EXT_rescale_normal",                      o(EXT_rescale_normal),                      1997 },
+   { "GL_EXT_secondary_color",                     o(EXT_secondary_color),                     1999 },
+   { "GL_EXT_separate_shader_objects",             o(EXT_separate_shader_objects),             2008 },
+   { "GL_EXT_separate_specular_color",             o(EXT_separate_specular_color),             1997 },
+   { "GL_EXT_shadow_funcs",                        o(EXT_shadow_funcs),                        2002 },
+   { "GL_EXT_stencil_two_side",                    o(EXT_stencil_two_side),                    2001 },
+   { "GL_EXT_stencil_wrap",                        o(dummy_true),                              2002 },
+   { "GL_EXT_subtexture",                          o(dummy_true),                              1995 },
+   { "GL_EXT_texture3D",                           o(EXT_texture3D),                           1996 },
+   { "GL_EXT_texture_array",                       o(EXT_texture_array),                       2006 },
+   { "GL_EXT_texture_compression_dxt1",            o(EXT_texture_compression_s3tc),            2004 },
+   { "GL_EXT_texture_compression_latc",            o(EXT_texture_compression_latc),            2006 },
+   { "GL_EXT_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            2004 },
+   { "GL_EXT_texture_compression_s3tc",            o(EXT_texture_compression_s3tc),            2000 },
+   { "GL_EXT_texture_cube_map",                    o(ARB_texture_cube_map),                    2001 },
+   { "GL_EXT_texture_edge_clamp",                  o(dummy_true),                              1997 },
+   { "GL_EXT_texture_env_add",                     o(dummy_true),                              1999 },
+   { "GL_EXT_texture_env_combine",                 o(dummy_true),                              2000 },
+   { "GL_EXT_texture_env_dot3",                    o(EXT_texture_env_dot3),                    2000 },
+   { "GL_EXT_texture_filter_anisotropic",          o(EXT_texture_filter_anisotropic),          1999 },
+   { "GL_EXT_texture_integer",                     o(EXT_texture_integer),                     2006 },
+   { "GL_EXT_texture_lod_bias",                    o(dummy_true),                              1999 },
+   { "GL_EXT_texture_mirror_clamp",                o(EXT_texture_mirror_clamp),                2004 },
+   { "GL_EXT_texture_object",                      o(dummy_true),                              1995 },
+   { "GL_EXT_texture",                             o(dummy_true),                              1996 },
+   { "GL_EXT_texture_rectangle",                   o(NV_texture_rectangle),                    2004 },
+   { "GL_EXT_texture_snorm",                       o(EXT_texture_snorm),                       2009 },
+   { "GL_EXT_texture_sRGB",                        o(EXT_texture_sRGB),                        2004 },
+   { "GL_EXT_vertex_array",                        o(dummy_true),                              1995 },
 
    /* Vendor extensions */
-   { "GL_3DFX_texture_compression_FXT1",           o(TDFX_texture_compression_FXT1),           GL,             1999 },
-   { "GL_AMD_conservative_depth",                  o(ARB_conservative_depth),                  GL,             2009 },
-   { "GL_AMD_draw_buffers_blend",                  o(ARB_draw_buffers_blend),                  GL,             2009 },
-   { "GL_AMD_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
-   { "GL_APPLE_object_purgeable",                  o(APPLE_object_purgeable),                  GL,             2006 },
-   { "GL_APPLE_packed_pixels",                     o(APPLE_packed_pixels),                     GL,             2002 },
-   { "GL_APPLE_vertex_array_object",               o(APPLE_vertex_array_object),               GL,             2002 },
-   { "GL_ATI_blend_equation_separate",             o(EXT_blend_equation_separate),             GL,             2003 },
-   { "GL_ATI_draw_buffers",                        o(dummy_true),                              GL,             2002 },
-   { "GL_ATI_envmap_bumpmap",                      o(ATI_envmap_bumpmap),                      GL,             2001 },
-   { "GL_ATI_separate_stencil",                    o(ATI_separate_stencil),                    GL,             2006 },
-   { "GL_ATI_texture_compression_3dc",             o(ATI_texture_compression_3dc),             GL,             2004 },
-   { "GL_ATI_texture_env_combine3",                o(ATI_texture_env_combine3),                GL,             2002 },
-   { "GL_ATI_texture_float",                       o(ARB_texture_float),                       GL,             2002 },
-   { "GL_ATI_texture_mirror_once",                 o(ATI_texture_mirror_once),                 GL,             2006 },
-   { "GL_IBM_multimode_draw_arrays",               o(IBM_multimode_draw_arrays),               GL,             1998 },
-   { "GL_IBM_rasterpos_clip",                      o(IBM_rasterpos_clip),                      GL,             1996 },
-   { "GL_IBM_texture_mirrored_repeat",             o(dummy_true),                              GL,             1998 },
-   { "GL_INGR_blend_func_separate",                o(EXT_blend_func_separate),                 GL,             1999 },
-   { "GL_MESA_pack_invert",                        o(MESA_pack_invert),                        GL,             2002 },
-   { "GL_MESA_resize_buffers",                     o(MESA_resize_buffers),                     GL,             1999 },
-   { "GL_MESA_texture_array",                      o(MESA_texture_array),                      GL,             2007 },
-   { "GL_MESA_texture_signed_rgba",                o(EXT_texture_snorm),                       GL,             2009 },
-   { "GL_MESA_window_pos",                         o(ARB_window_pos),                          GL,             2000 },
-   { "GL_MESA_ycbcr_texture",                      o(MESA_ycbcr_texture),                      GL,             2002 },
-   { "GL_NV_blend_square",                         o(NV_blend_square),                         GL,             1999 },
-   { "GL_NV_depth_clamp",                          o(ARB_depth_clamp),                         GL,             2001 },
-   { "GL_NV_draw_buffers",                         o(dummy_true),                                         ES2, 2011 },
-   { "GL_NV_fbo_color_attachments",                o(EXT_framebuffer_object),                             ES2, 2010 },
-   { "GL_NV_fog_distance",                         o(NV_fog_distance),                         GL,             2001 },
-   { "GL_NV_fragment_program",                     o(NV_fragment_program),                     GL,             2001 },
-   { "GL_NV_fragment_program_option",              o(NV_fragment_program_option),              GL,             2005 },
-   { "GL_NV_light_max_exponent",                   o(NV_light_max_exponent),                   GL,             1999 },
-   { "GL_NV_packed_depth_stencil",                 o(EXT_packed_depth_stencil),                GL,             2000 },
-   { "GL_NV_point_sprite",                         o(NV_point_sprite),                         GL,             2001 },
-   { "GL_NV_primitive_restart",                    o(NV_primitive_restart),                    GL,             2002 },
-   { "GL_NV_texgen_reflection",                    o(NV_texgen_reflection),                    GL,             1999 },
-   { "GL_NV_texture_barrier",                      o(NV_texture_barrier),                      GL,             2009 },
-   { "GL_NV_texture_env_combine4",                 o(NV_texture_env_combine4),                 GL,             1999 },
-   { "GL_NV_texture_rectangle",                    o(NV_texture_rectangle),                    GL,             2000 },
-   { "GL_NV_vertex_program1_1",                    o(NV_vertex_program1_1),                    GL,             2001 },
-   { "GL_NV_vertex_program",                       o(NV_vertex_program),                       GL,             2000 },
-   { "GL_S3_s3tc",                                 o(S3_s3tc),                                 GL,             1999 },
-   { "GL_SGIS_generate_mipmap",                    o(dummy_true),                              GL,             1997 },
-   { "GL_SGIS_texture_border_clamp",               o(ARB_texture_border_clamp),                GL,             1997 },
-   { "GL_SGIS_texture_edge_clamp",                 o(dummy_true),                              GL,             1997 },
-   { "GL_SGIS_texture_lod",                        o(SGIS_texture_lod),                        GL,             1997 },
-   { "GL_SUN_multi_draw_arrays",                   o(dummy_true),                              GL,             1999 },
-
-   { 0, 0, 0, 0 },
+   { "GL_3DFX_texture_compression_FXT1",           o(TDFX_texture_compression_FXT1),           1999 },
+   { "GL_AMD_conservative_depth",                  o(ARB_conservative_depth),                  2009 },
+   { "GL_AMD_draw_buffers_blend",                  o(ARB_draw_buffers_blend),                  2009 },
+   { "GL_AMD_shader_stencil_export",               o(ARB_shader_stencil_export),               2009 },
+   { "GL_APPLE_object_purgeable",                  o(APPLE_object_purgeable),                  2006 },
+   { "GL_APPLE_packed_pixels",                     o(APPLE_packed_pixels),                     2002 },
+   { "GL_APPLE_vertex_array_object",               o(APPLE_vertex_array_object),               2002 },
+   { "GL_ATI_blend_equation_separate",             o(EXT_blend_equation_separate),             2003 },
+   { "GL_ATI_draw_buffers",                        o(dummy_true),                              2002 },
+   { "GL_ATI_envmap_bumpmap",                      o(ATI_envmap_bumpmap),                      2001 },
+   { "GL_ATI_separate_stencil",                    o(ATI_separate_stencil),                    2006 },
+   { "GL_ATI_texture_compression_3dc",             o(ATI_texture_compression_3dc),             2004 },
+   { "GL_ATI_texture_env_combine3",                o(ATI_texture_env_combine3),                2002 },
+   { "GL_ATI_texture_float",                       o(ARB_texture_float),                       2002 },
+   { "GL_ATI_texture_mirror_once",                 o(ATI_texture_mirror_once),                 2006 },
+   { "GL_IBM_multimode_draw_arrays",               o(IBM_multimode_draw_arrays),               1998 },
+   { "GL_IBM_rasterpos_clip",                      o(IBM_rasterpos_clip),                      1996 },
+   { "GL_IBM_texture_mirrored_repeat",             o(dummy_true),                              1998 },
+   { "GL_INGR_blend_func_separate",                o(EXT_blend_func_separate),                 1999 },
+   { "GL_MESA_pack_invert",                        o(MESA_pack_invert),                        2002 },
+   { "GL_MESA_resize_buffers",                     o(MESA_resize_buffers),                     1999 },
+   { "GL_MESA_texture_array",                      o(MESA_texture_array),                      2007 },
+   { "GL_MESA_texture_signed_rgba",                o(EXT_texture_snorm),                       2009 },
+   { "GL_MESA_window_pos",                         o(ARB_window_pos),                          2000 },
+   { "GL_MESA_ycbcr_texture",                      o(MESA_ycbcr_texture),                      2002 },
+   { "GL_NV_blend_square",                         o(NV_blend_square),                         1999 },
+   { "GL_NV_fog_distance",                         o(NV_fog_distance),                         2001 },
+   { "GL_NV_fragment_program",                     o(NV_fragment_program),                     2001 },
+   { "GL_NV_fragment_program_option",              o(NV_fragment_program_option),              2005 },
+   { "GL_NV_light_max_exponent",                   o(NV_light_max_exponent),                   1999 },
+   { "GL_NV_packed_depth_stencil",                 o(EXT_packed_depth_stencil),                2000 },
+   { "GL_NV_point_sprite",                         o(NV_point_sprite),                         2001 },
+   { "GL_NV_primitive_restart",                    o(NV_primitive_restart),                    2002 },
+   { "GL_NV_texgen_reflection",                    o(NV_texgen_reflection),                    1999 },
+   { "GL_NV_texture_barrier",                      o(NV_texture_barrier),                      2009 },
+   { "GL_NV_texture_env_combine4",                 o(NV_texture_env_combine4),                 1999 },
+   { "GL_NV_texture_rectangle",                    o(NV_texture_rectangle),                    2000 },
+   { "GL_NV_vertex_program1_1",                    o(NV_vertex_program1_1),                    2001 },
+   { "GL_NV_vertex_program",                       o(NV_vertex_program),                       2000 },
+   { "GL_S3_s3tc",                                 o(S3_s3tc),                                 1999 },
+   { "GL_SGIS_generate_mipmap",                    o(dummy_true),                              1997 },
+   { "GL_SGIS_texture_border_clamp",               o(ARB_texture_border_clamp),                1997 },
+   { "GL_SGIS_texture_edge_clamp",                 o(dummy_true),                              1997 },
+   { "GL_SGIS_texture_lod",                        o(SGIS_texture_lod),                        1997 },
+   { "GL_SUN_multi_draw_arrays",                   o(dummy_true),                              1999 },
+
+   { 0, 0, 0},
 };
 
 
@@ -322,8 +266,6 @@ static const size_t default_extensions[] = {
    o(EXT_separate_specular_color),
    o(EXT_texture3D),
 
-   o(OES_standard_derivatives),
-
    /* Vendor Extensions */
    o(APPLE_packed_pixels),
    o(IBM_multimode_draw_arrays),
@@ -344,7 +286,6 @@ void
 _mesa_enable_sw_extensions(struct gl_context *ctx)
 {
    /*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/
-   ctx->Extensions.ARB_depth_clamp = GL_TRUE;
    ctx->Extensions.ARB_draw_instanced = GL_TRUE;
 #if FEATURE_ARB_fragment_program
    ctx->Extensions.ARB_fragment_program = GL_TRUE;
@@ -779,8 +720,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
    count = 0;
    for (i = extension_table; i->name != 0; ++i) {
       if (base[i->offset] &&
-          i->year <= maxYear &&
-          (i->api_set & (1 << ctx->API))) {
+          i->year <= maxYear) {
         length += strlen(i->name) + 1; /* +1 for space */
         ++count;
       }
@@ -809,8 +749,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
    j = 0;
    for (i = extension_table; i->name != 0; ++i) {
       if (base[i->offset] &&
-          i->year <= maxYear &&
-          (i->api_set & (1 << ctx->API))) {
+          i->year <= maxYear) {
          extension_indices[j++] = i - extension_table;
       }
    }
@@ -820,7 +759,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
    /* Build the extension string.*/
    for (j = 0; j < count; ++j) {
       i = &extension_table[extension_indices[j]];
-      assert(base[i->offset] && (i->api_set & (1 << ctx->API)));
+      assert(base[i->offset]);
       strcat(exts, i->name);
       strcat(exts, " ");
    }
index 64c6695..1dafa7c 100644 (file)
@@ -187,10 +187,10 @@ get_framebuffer_target(struct gl_context *ctx, GLenum target)
 {
    switch (target) {
    case GL_DRAW_FRAMEBUFFER:
-      return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL
+      return ctx->Extensions.EXT_framebuffer_blit
         ? ctx->DrawBuffer : NULL;
    case GL_READ_FRAMEBUFFER:
-      return ctx->Extensions.EXT_framebuffer_blit && ctx->API == API_OPENGL
+      return ctx->Extensions.EXT_framebuffer_blit
         ? ctx->ReadBuffer : NULL;
    case GL_FRAMEBUFFER_EXT:
       return ctx->DrawBuffer;
@@ -238,15 +238,11 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
        * hardware is used.
        */
       i = attachment - GL_COLOR_ATTACHMENT0_EXT;
-      if (i >= ctx->Const.MaxColorAttachments
-         || (i > 0 && ctx->API == API_OPENGLES)) {
+      if (i >= ctx->Const.MaxColorAttachments) {
         return NULL;
       }
       return &fb->Attachment[BUFFER_COLOR0 + i];
    case GL_DEPTH_STENCIL_ATTACHMENT:
-      if (ctx->API != API_OPENGL)
-        return NULL;
-      /* fall-through */
    case GL_DEPTH_ATTACHMENT_EXT:
       return &fb->Attachment[BUFFER_DEPTH];
    case GL_STENCIL_ATTACHMENT_EXT:
@@ -817,8 +813,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
       }
    }
 
-#if FEATURE_GL
-   if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
+   if (!ctx->Extensions.ARB_ES2_compatibility) {
       /* Check that all DrawBuffers are present */
       for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
         if (fb->ColorDrawBuffer[j] != GL_NONE) {
@@ -845,9 +840,6 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
         }
       }
    }
-#else
-   (void) j;
-#endif
 
    if (numImages == 0) {
       fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
@@ -1412,41 +1404,6 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
    }
 }
 
-
-#if FEATURE_OES_EGL_image
-void GLAPIENTRY
-_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
-   struct gl_renderbuffer *rb;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   if (!ctx->Extensions.OES_EGL_image) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glEGLImageTargetRenderbufferStorageOES(unsupported)");
-      return;
-   }
-
-   if (target != GL_RENDERBUFFER) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
-                  "EGLImageTargetRenderbufferStorageOES");
-      return;
-   }
-
-   rb = ctx->CurrentRenderbuffer;
-   if (!rb) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "EGLImageTargetRenderbufferStorageOES");
-      return;
-   }
-
-   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
-
-   ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image);
-}
-#endif
-
-
 /**
  * Helper function for _mesa_GetRenderbufferParameterivEXT() and
  * _mesa_GetFramebufferAttachmentParameterivEXT()
@@ -2242,14 +2199,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
 {
    const struct gl_renderbuffer_attachment *att;
    struct gl_framebuffer *buffer;
-   GLenum err;
    GET_CURRENT_CONTEXT(ctx);
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   /* The error differs in GL andd GLES. */
-   err = ctx->API == API_OPENGL ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
-
    buffer = get_framebuffer_target(ctx, target);
    if (!buffer) {
       _mesa_error(ctx, GL_INVALID_ENUM,
@@ -2268,7 +2221,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
        * OES_framebuffer_object spec refers to the EXT_framebuffer_object
        * spec.
        */
-      if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object) {
+      if (!ctx->Extensions.ARB_framebuffer_object) {
         _mesa_error(ctx, GL_INVALID_OPERATION,
                     "glGetFramebufferAttachmentParameteriv(bound FBO = 0)");
         return;
@@ -2315,12 +2268,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
       }
       else {
          assert(att->Type == GL_NONE);
-         if (ctx->API == API_OPENGL) {
-            *params = 0;
-         } else {
-            _mesa_error(ctx, GL_INVALID_ENUM,
-                        "glGetFramebufferAttachmentParameterivEXT(pname)");
-         }
+         *params = 0;
       }
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:
@@ -2328,7 +2276,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
         *params = att->TextureLevel;
       }
       else if (att->Type == GL_NONE) {
-         _mesa_error(ctx, err,
+         _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else {
@@ -2346,7 +2294,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
          }
       }
       else if (att->Type == GL_NONE) {
-         _mesa_error(ctx, err,
+         _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else {
@@ -2364,7 +2312,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
          }
       }
       else if (att->Type == GL_NONE) {
-         _mesa_error(ctx, err,
+         _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else {
@@ -2378,7 +2326,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else if (att->Type == GL_NONE) {
-         _mesa_error(ctx, err,
+         _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else {
@@ -2399,7 +2347,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
          return;
       }
       else if (att->Type == GL_NONE) {
-         _mesa_error(ctx, err,
+         _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else {
@@ -2433,7 +2381,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else if (att->Type == GL_NONE) {
-         _mesa_error(ctx, err,
+         _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else if (att->Texture) {
diff --git a/reactos/dll/opengl/mesa/src/mesa/main/ff_fragment_shader.cpp b/reactos/dll/opengl/mesa/src/mesa/main/ff_fragment_shader.cpp
deleted file mode 100644 (file)
index 556c315..0000000
+++ /dev/null
@@ -1,1549 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * Copyright 2009 VMware, Inc.  All Rights Reserved.
- * Copyright © 2010-2011 Intel Corporation
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, 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 TUNGSTEN GRAPHICS 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.
- * 
- **************************************************************************/
-
-extern "C" {
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "main/uniforms.h"
-#include "main/macros.h"
-#include "program/program.h"
-#include "program/prog_parameter.h"
-#include "program/prog_cache.h"
-#include "program/prog_instruction.h"
-#include "program/prog_print.h"
-#include "program/prog_statevars.h"
-#include "program/programopt.h"
-#include "texenvprogram.h"
-}
-#include "main/uniforms.h"
-#include "../glsl/glsl_types.h"
-#include "../glsl/ir.h"
-#include "../glsl/glsl_symbol_table.h"
-#include "../glsl/glsl_parser_extras.h"
-#include "../glsl/ir_optimization.h"
-#include "../glsl/ir_print_visitor.h"
-#include "../program/ir_to_mesa.h"
-
-/*
- * Note on texture units:
- *
- * The number of texture units supported by fixed-function fragment
- * processing is MAX_TEXTURE_COORD_UNITS, not MAX_TEXTURE_IMAGE_UNITS.
- * That's because there's a one-to-one correspondence between texture
- * coordinates and samplers in fixed-function processing.
- *
- * Since fixed-function vertex processing is limited to MAX_TEXTURE_COORD_UNITS
- * sets of texcoords, so is fixed-function fragment processing.
- *
- * We can safely use ctx->Const.MaxTextureUnits for loop bounds.
- */
-
-
-struct texenvprog_cache_item
-{
-   GLuint hash;
-   void *key;
-   struct gl_shader_program *data;
-   struct texenvprog_cache_item *next;
-};
-
-static GLboolean
-texenv_doing_secondary_color(struct gl_context *ctx)
-{
-   if (ctx->Light.Enabled &&
-       (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR))
-      return GL_TRUE;
-
-   if (ctx->Fog.ColorSumEnabled)
-      return GL_TRUE;
-
-   return GL_FALSE;
-}
-
-struct mode_opt {
-#ifdef __GNUC__
-   __extension__ GLubyte Source:4;  /**< SRC_x */
-   __extension__ GLubyte Operand:3; /**< OPR_x */
-#else
-   GLubyte Source;  /**< SRC_x */
-   GLubyte Operand; /**< OPR_x */
-#endif
-};
-
-struct state_key {
-   GLuint nr_enabled_units:8;
-   GLuint enabled_units:8;
-   GLuint separate_specular:1;
-   GLuint fog_enabled:1;
-   GLuint fog_mode:2;          /**< FOG_x */
-   GLuint inputs_available:12;
-   GLuint num_draw_buffers:4;
-
-   /* NOTE: This array of structs must be last! (see "keySize" below) */
-   struct {
-      GLuint enabled:1;
-      GLuint source_index:4;   /**< TEXTURE_x_INDEX */
-      GLuint ScaleShiftRGB:2;
-      GLuint ScaleShiftA:2;
-
-      GLuint NumArgsRGB:3;  /**< up to MAX_COMBINER_TERMS */
-      GLuint ModeRGB:5;     /**< MODE_x */
-
-      GLuint NumArgsA:3;  /**< up to MAX_COMBINER_TERMS */
-      GLuint ModeA:5;     /**< MODE_x */
-
-      struct mode_opt OptRGB[MAX_COMBINER_TERMS];
-      struct mode_opt OptA[MAX_COMBINER_TERMS];
-   } unit[MAX_TEXTURE_UNITS];
-};
-
-#define FOG_LINEAR  0
-#define FOG_EXP     1
-#define FOG_EXP2    2
-#define FOG_UNKNOWN 3
-
-static GLuint translate_fog_mode( GLenum mode )
-{
-   switch (mode) {
-   case GL_LINEAR: return FOG_LINEAR;
-   case GL_EXP: return FOG_EXP;
-   case GL_EXP2: return FOG_EXP2;
-   default: return FOG_UNKNOWN;
-   }
-}
-
-#define OPR_SRC_COLOR           0
-#define OPR_ONE_MINUS_SRC_COLOR 1
-#define OPR_SRC_ALPHA           2
-#define OPR_ONE_MINUS_SRC_ALPHA        3
-#define OPR_ZERO                4
-#define OPR_ONE                 5
-#define OPR_UNKNOWN             7
-
-static GLuint translate_operand( GLenum operand )
-{
-   switch (operand) {
-   case GL_SRC_COLOR: return OPR_SRC_COLOR;
-   case GL_ONE_MINUS_SRC_COLOR: return OPR_ONE_MINUS_SRC_COLOR;
-   case GL_SRC_ALPHA: return OPR_SRC_ALPHA;
-   case GL_ONE_MINUS_SRC_ALPHA: return OPR_ONE_MINUS_SRC_ALPHA;
-   case GL_ZERO: return OPR_ZERO;
-   case GL_ONE: return OPR_ONE;
-   default:
-      assert(0);
-      return OPR_UNKNOWN;
-   }
-}
-
-#define SRC_TEXTURE  0
-#define SRC_TEXTURE0 1
-#define SRC_TEXTURE1 2
-#define SRC_TEXTURE2 3
-#define SRC_TEXTURE3 4
-#define SRC_TEXTURE4 5
-#define SRC_TEXTURE5 6
-#define SRC_TEXTURE6 7
-#define SRC_TEXTURE7 8
-#define SRC_CONSTANT 9
-#define SRC_PRIMARY_COLOR 10
-#define SRC_PREVIOUS 11
-#define SRC_ZERO     12
-#define SRC_UNKNOWN  15
-
-static GLuint translate_source( GLenum src )
-{
-   switch (src) {
-   case GL_TEXTURE: return SRC_TEXTURE;
-   case GL_TEXTURE0:
-   case GL_TEXTURE1:
-   case GL_TEXTURE2:
-   case GL_TEXTURE3:
-   case GL_TEXTURE4:
-   case GL_TEXTURE5:
-   case GL_TEXTURE6:
-   case GL_TEXTURE7: return SRC_TEXTURE0 + (src - GL_TEXTURE0);
-   case GL_CONSTANT: return SRC_CONSTANT;
-   case GL_PRIMARY_COLOR: return SRC_PRIMARY_COLOR;
-   case GL_PREVIOUS: return SRC_PREVIOUS;
-   case GL_ZERO:
-      return SRC_ZERO;
-   default:
-      assert(0);
-      return SRC_UNKNOWN;
-   }
-}
-
-#define MODE_REPLACE                     0  /* r = a0 */
-#define MODE_MODULATE                    1  /* r = a0 * a1 */
-#define MODE_ADD                         2  /* r = a0 + a1 */
-#define MODE_ADD_SIGNED                  3  /* r = a0 + a1 - 0.5 */
-#define MODE_INTERPOLATE                 4  /* r = a0 * a2 + a1 * (1 - a2) */
-#define MODE_SUBTRACT                    5  /* r = a0 - a1 */
-#define MODE_DOT3_RGB                    6  /* r = a0 . a1 */
-#define MODE_DOT3_RGB_EXT                7  /* r = a0 . a1 */
-#define MODE_DOT3_RGBA                   8  /* r = a0 . a1 */
-#define MODE_DOT3_RGBA_EXT               9  /* r = a0 . a1 */
-#define MODE_MODULATE_ADD_ATI           10  /* r = a0 * a2 + a1 */
-#define MODE_MODULATE_SIGNED_ADD_ATI    11  /* r = a0 * a2 + a1 - 0.5 */
-#define MODE_MODULATE_SUBTRACT_ATI      12  /* r = a0 * a2 - a1 */
-#define MODE_ADD_PRODUCTS               13  /* r = a0 * a1 + a2 * a3 */
-#define MODE_ADD_PRODUCTS_SIGNED        14  /* r = a0 * a1 + a2 * a3 - 0.5 */
-#define MODE_BUMP_ENVMAP_ATI            15  /* special */
-#define MODE_UNKNOWN                    16
-
-/**
- * Translate GL combiner state into a MODE_x value
- */
-static GLuint translate_mode( GLenum envMode, GLenum mode )
-{
-   switch (mode) {
-   case GL_REPLACE: return MODE_REPLACE;
-   case GL_MODULATE: return MODE_MODULATE;
-   case GL_ADD:
-      if (envMode == GL_COMBINE4_NV)
-         return MODE_ADD_PRODUCTS;
-      else
-         return MODE_ADD;
-   case GL_ADD_SIGNED:
-      if (envMode == GL_COMBINE4_NV)
-         return MODE_ADD_PRODUCTS_SIGNED;
-      else
-         return MODE_ADD_SIGNED;
-   case GL_INTERPOLATE: return MODE_INTERPOLATE;
-   case GL_SUBTRACT: return MODE_SUBTRACT;
-   case GL_DOT3_RGB: return MODE_DOT3_RGB;
-   case GL_DOT3_RGB_EXT: return MODE_DOT3_RGB_EXT;
-   case GL_DOT3_RGBA: return MODE_DOT3_RGBA;
-   case GL_DOT3_RGBA_EXT: return MODE_DOT3_RGBA_EXT;
-   case GL_MODULATE_ADD_ATI: return MODE_MODULATE_ADD_ATI;
-   case GL_MODULATE_SIGNED_ADD_ATI: return MODE_MODULATE_SIGNED_ADD_ATI;
-   case GL_MODULATE_SUBTRACT_ATI: return MODE_MODULATE_SUBTRACT_ATI;
-   case GL_BUMP_ENVMAP_ATI: return MODE_BUMP_ENVMAP_ATI;
-   default:
-      assert(0);
-      return MODE_UNKNOWN;
-   }
-}
-
-
-/**
- * Do we need to clamp the results of the given texture env/combine mode?
- * If the inputs to the mode are in [0,1] we don't always have to clamp
- * the results.
- */
-static GLboolean
-need_saturate( GLuint mode )
-{
-   switch (mode) {
-   case MODE_REPLACE:
-   case MODE_MODULATE:
-   case MODE_INTERPOLATE:
-      return GL_FALSE;
-   case MODE_ADD:
-   case MODE_ADD_SIGNED:
-   case MODE_SUBTRACT:
-   case MODE_DOT3_RGB:
-   case MODE_DOT3_RGB_EXT:
-   case MODE_DOT3_RGBA:
-   case MODE_DOT3_RGBA_EXT:
-   case MODE_MODULATE_ADD_ATI:
-   case MODE_MODULATE_SIGNED_ADD_ATI:
-   case MODE_MODULATE_SUBTRACT_ATI:
-   case MODE_ADD_PRODUCTS:
-   case MODE_ADD_PRODUCTS_SIGNED:
-   case MODE_BUMP_ENVMAP_ATI:
-      return GL_TRUE;
-   default:
-      assert(0);
-      return GL_FALSE;
-   }
-}
-
-
-
-/**
- * Translate TEXTURE_x_BIT to TEXTURE_x_INDEX.
- */
-static GLuint translate_tex_src_bit( GLbitfield bit )
-{
-   ASSERT(bit);
-   return _mesa_ffs(bit) - 1;
-}
-
-
-#define VERT_BIT_TEX_ANY    (0xff << VERT_ATTRIB_TEX0)
-#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0)
-
-/**
- * Identify all possible varying inputs.  The fragment program will
- * never reference non-varying inputs, but will track them via state
- * constants instead.
- *
- * This function figures out all the inputs that the fragment program
- * has access to.  The bitmask is later reduced to just those which
- * are actually referenced.
- */
-static GLbitfield get_fp_input_mask( struct gl_context *ctx )
-{
-   /* _NEW_PROGRAM */
-   const GLboolean vertexShader =
-      (ctx->Shader.CurrentVertexProgram &&
-       ctx->Shader.CurrentVertexProgram->LinkStatus &&
-       ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]);
-   const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
-   GLbitfield fp_inputs = 0x0;
-
-   if (ctx->VertexProgram._Overriden) {
-      /* Somebody's messing with the vertex program and we don't have
-       * a clue what's happening.  Assume that it could be producing
-       * all possible outputs.
-       */
-      fp_inputs = ~0;
-   }
-   else if (ctx->RenderMode == GL_FEEDBACK) {
-      /* _NEW_RENDERMODE */
-      fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
-   }
-   else if (!(vertexProgram || vertexShader)) {
-      /* Fixed function vertex logic */
-      /* _NEW_ARRAY */
-      GLbitfield64 varying_inputs = ctx->varying_vp_inputs;
-
-      /* These get generated in the setup routine regardless of the
-       * vertex program:
-       */
-      /* _NEW_POINT */
-      if (ctx->Point.PointSprite)
-         varying_inputs |= FRAG_BITS_TEX_ANY;
-
-      /* First look at what values may be computed by the generated
-       * vertex program:
-       */
-      /* _NEW_LIGHT */
-      if (ctx->Light.Enabled) {
-         fp_inputs |= FRAG_BIT_COL0;
-
-         if (texenv_doing_secondary_color(ctx))
-            fp_inputs |= FRAG_BIT_COL1;
-      }
-
-      /* _NEW_TEXTURE */
-      fp_inputs |= (ctx->Texture._TexGenEnabled |
-                    ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0;
-
-      /* Then look at what might be varying as a result of enabled
-       * arrays, etc:
-       */
-      if (varying_inputs & VERT_BIT_COLOR0)
-         fp_inputs |= FRAG_BIT_COL0;
-      if (varying_inputs & VERT_BIT_COLOR1)
-         fp_inputs |= FRAG_BIT_COL1;
-
-      fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0) 
-                    << FRAG_ATTRIB_TEX0);
-
-   }
-   else {
-      /* calculate from vp->outputs */
-      struct gl_program *vprog;
-      GLbitfield64 vp_outputs;
-
-      /* Choose GLSL vertex shader over ARB vertex program.  Need this
-       * since vertex shader state validation comes after fragment state
-       * validation (see additional comments in state.c).
-       */
-      if (vertexShader)
-         vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
-      else
-         vprog = &ctx->VertexProgram.Current->Base;
-
-      vp_outputs = vprog->OutputsWritten;
-
-      /* These get generated in the setup routine regardless of the
-       * vertex program:
-       */
-      /* _NEW_POINT */
-      if (ctx->Point.PointSprite)
-         vp_outputs |= FRAG_BITS_TEX_ANY;
-
-      if (vp_outputs & (1 << VERT_RESULT_COL0))
-         fp_inputs |= FRAG_BIT_COL0;
-      if (vp_outputs & (1 << VERT_RESULT_COL1))
-         fp_inputs |= FRAG_BIT_COL1;
-
-      fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0) 
-                    << FRAG_ATTRIB_TEX0);
-   }
-   
-   return fp_inputs;
-}
-
-
-/**
- * Examine current texture environment state and generate a unique
- * key to identify it.
- */
-static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
-{
-   GLuint i, j;
-   GLbitfield inputs_referenced = FRAG_BIT_COL0;
-   const GLbitfield inputs_available = get_fp_input_mask( ctx );
-   GLuint keySize;
-
-   memset(key, 0, sizeof(*key));
-
-   /* _NEW_TEXTURE */
-   for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-      const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
-      const struct gl_texture_object *texObj = texUnit->_Current;
-      const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine;
-      GLenum format;
-
-      if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
-         continue;
-
-      format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
-
-      key->unit[i].enabled = 1;
-      key->enabled_units |= (1<<i);
-      key->nr_enabled_units = i + 1;
-      inputs_referenced |= FRAG_BIT_TEX(i);
-
-      key->unit[i].source_index =
-         translate_tex_src_bit(texUnit->_ReallyEnabled);
-
-      key->unit[i].NumArgsRGB = comb->_NumArgsRGB;
-      key->unit[i].NumArgsA = comb->_NumArgsA;
-
-      key->unit[i].ModeRGB =
-        translate_mode(texUnit->EnvMode, comb->ModeRGB);
-      key->unit[i].ModeA =
-        translate_mode(texUnit->EnvMode, comb->ModeA);
-
-      key->unit[i].ScaleShiftRGB = comb->ScaleShiftRGB;
-      key->unit[i].ScaleShiftA = comb->ScaleShiftA;
-
-      for (j = 0; j < MAX_COMBINER_TERMS; j++) {
-         key->unit[i].OptRGB[j].Operand = translate_operand(comb->OperandRGB[j]);
-         key->unit[i].OptA[j].Operand = translate_operand(comb->OperandA[j]);
-         key->unit[i].OptRGB[j].Source = translate_source(comb->SourceRGB[j]);
-         key->unit[i].OptA[j].Source = translate_source(comb->SourceA[j]);
-      }
-
-      if (key->unit[i].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
-         /* requires some special translation */
-         key->unit[i].NumArgsRGB = 2;
-         key->unit[i].ScaleShiftRGB = 0;
-         key->unit[i].OptRGB[0].Operand = OPR_SRC_COLOR;
-         key->unit[i].OptRGB[0].Source = SRC_TEXTURE;
-         key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR;
-         key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0;
-       }
-   }
-
-   /* _NEW_LIGHT | _NEW_FOG */
-   if (texenv_doing_secondary_color(ctx)) {
-      key->separate_specular = 1;
-      inputs_referenced |= FRAG_BIT_COL1;
-   }
-
-   /* _NEW_FOG */
-   if (ctx->Fog.Enabled) {
-      key->fog_enabled = 1;
-      key->fog_mode = translate_fog_mode(ctx->Fog.Mode);
-      inputs_referenced |= FRAG_BIT_FOGC; /* maybe */
-   }
-
-   /* _NEW_BUFFERS */
-   key->num_draw_buffers = ctx->DrawBuffer->_NumColorDrawBuffers;
-
-   /* _NEW_COLOR */
-   if (ctx->Color.AlphaEnabled && key->num_draw_buffers == 0) {
-      /* if alpha test is enabled we need to emit at least one color */
-      key->num_draw_buffers = 1;
-   }
-
-   key->inputs_available = (inputs_available & inputs_referenced);
-
-   /* compute size of state key, ignoring unused texture units */
-   keySize = sizeof(*key) - sizeof(key->unit)
-      + key->nr_enabled_units * sizeof(key->unit[0]);
-
-   return keySize;
-}
-
-
-/** State used to build the fragment program:
- */
-struct texenv_fragment_program {
-   struct gl_shader_program *shader_program;
-   struct gl_shader *shader;
-   struct gl_fragment_program *program;
-   exec_list *instructions;
-   exec_list *top_instructions;
-   void *mem_ctx;
-   struct state_key *state;
-
-   GLbitfield alu_temps;       /**< Track texture indirections, see spec. */
-   GLbitfield temps_output;    /**< Track texture indirections, see spec. */
-   GLbitfield temp_in_use;     /**< Tracks temporary regs which are in use. */
-   GLboolean error;
-
-   ir_variable *src_texture[MAX_TEXTURE_COORD_UNITS];
-   /* Reg containing each texture unit's sampled texture color,
-    * else undef.
-    */
-
-   /* Texcoord override from bumpmapping. */
-   ir_variable *texcoord_tex[MAX_TEXTURE_COORD_UNITS];
-
-   /* Reg containing texcoord for a texture unit,
-    * needed for bump mapping, else undef.
-    */
-
-   ir_rvalue *src_previous;    /**< Reg containing color from previous
-                                * stage.  May need to be decl'd.
-                                */
-
-   GLuint last_tex_stage;      /**< Number of last enabled texture unit */
-};
-
-static ir_rvalue *
-get_current_attrib(struct texenv_fragment_program *p, GLuint attrib)
-{
-   ir_variable *current;
-   ir_rvalue *val;
-
-   current = p->shader->symbols->get_variable("gl_CurrentAttribFragMESA");
-   current->max_array_access = MAX2(current->max_array_access, attrib);
-   val = new(p->mem_ctx) ir_dereference_variable(current);
-   ir_rvalue *index = new(p->mem_ctx) ir_constant(attrib);
-   return new(p->mem_ctx) ir_dereference_array(val, index);
-}
-
-static ir_rvalue *
-get_gl_Color(struct texenv_fragment_program *p)
-{
-   if (p->state->inputs_available & FRAG_BIT_COL0) {
-      ir_variable *var = p->shader->symbols->get_variable("gl_Color");
-      assert(var);
-      return new(p->mem_ctx) ir_dereference_variable(var);
-   } else {
-      return get_current_attrib(p, VERT_ATTRIB_COLOR0);
-   }
-}
-
-static ir_rvalue *
-get_source(struct texenv_fragment_program *p,
-          GLuint src, GLuint unit)
-{
-   ir_variable *var;
-   ir_dereference *deref;
-
-   switch (src) {
-   case SRC_TEXTURE: 
-      return new(p->mem_ctx) ir_dereference_variable(p->src_texture[unit]);
-
-   case SRC_TEXTURE0:
-   case SRC_TEXTURE1:
-   case SRC_TEXTURE2:
-   case SRC_TEXTURE3:
-   case SRC_TEXTURE4:
-   case SRC_TEXTURE5:
-   case SRC_TEXTURE6:
-   case SRC_TEXTURE7: 
-      return new(p->mem_ctx)
-        ir_dereference_variable(p->src_texture[src - SRC_TEXTURE0]);
-
-   case SRC_CONSTANT:
-      var = p->shader->symbols->get_variable("gl_TextureEnvColor");
-      assert(var);
-      deref = new(p->mem_ctx) ir_dereference_variable(var);
-      var->max_array_access = MAX2(var->max_array_access, unit);
-      return new(p->mem_ctx) ir_dereference_array(deref,
-                                                 new(p->mem_ctx) ir_constant(unit));
-
-   case SRC_PRIMARY_COLOR:
-      var = p->shader->symbols->get_variable("gl_Color");
-      assert(var);
-      return new(p->mem_ctx) ir_dereference_variable(var);
-
-   case SRC_ZERO:
-      return new(p->mem_ctx) ir_constant(0.0f);
-
-   case SRC_PREVIOUS:
-      if (!p->src_previous) {
-        return get_gl_Color(p);
-      } else {
-        return p->src_previous->clone(p->mem_ctx, NULL);
-      }
-
-   default:
-      assert(0);
-      return NULL;
-   }
-}
-
-static ir_rvalue *
-emit_combine_source(struct texenv_fragment_program *p,
-                   GLuint unit,
-                   GLuint source,
-                   GLuint operand)
-{
-   ir_rvalue *src;
-
-   src = get_source(p, source, unit);
-
-   switch (operand) {
-   case OPR_ONE_MINUS_SRC_COLOR: 
-      return new(p->mem_ctx) ir_expression(ir_binop_sub,
-                                          new(p->mem_ctx) ir_constant(1.0f),
-                                          src);
-
-   case OPR_SRC_ALPHA:
-      return src->type->is_scalar()
-        ? src : (ir_rvalue *) new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1);
-
-   case OPR_ONE_MINUS_SRC_ALPHA: {
-      ir_rvalue *const scalar = (src->type->is_scalar())
-        ? src : (ir_rvalue *) new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1);
-
-      return new(p->mem_ctx) ir_expression(ir_binop_sub,
-                                          new(p->mem_ctx) ir_constant(1.0f),
-                                          scalar);
-   }
-
-   case OPR_ZERO:
-      return new(p->mem_ctx) ir_constant(0.0f);
-   case OPR_ONE:
-      return new(p->mem_ctx) ir_constant(1.0f);
-   case OPR_SRC_COLOR: 
-      return src;
-   default:
-      assert(0);
-      return src;
-   }
-}
-
-/**
- * Check if the RGB and Alpha sources and operands match for the given
- * texture unit's combinder state.  When the RGB and A sources and
- * operands match, we can emit fewer instructions.
- */
-static GLboolean args_match( const struct state_key *key, GLuint unit )
-{
-   GLuint i, numArgs = key->unit[unit].NumArgsRGB;
-
-   for (i = 0; i < numArgs; i++) {
-      if (key->unit[unit].OptA[i].Source != key->unit[unit].OptRGB[i].Source) 
-        return GL_FALSE;
-
-      switch (key->unit[unit].OptA[i].Operand) {
-      case OPR_SRC_ALPHA: 
-        switch (key->unit[unit].OptRGB[i].Operand) {
-        case OPR_SRC_COLOR: 
-        case OPR_SRC_ALPHA: 
-           break;
-        default:
-           return GL_FALSE;
-        }
-        break;
-      case OPR_ONE_MINUS_SRC_ALPHA: 
-        switch (key->unit[unit].OptRGB[i].Operand) {
-        case OPR_ONE_MINUS_SRC_COLOR: 
-        case OPR_ONE_MINUS_SRC_ALPHA: 
-           break;
-        default:
-           return GL_FALSE;
-        }
-        break;
-      default: 
-        return GL_FALSE;       /* impossible */
-      }
-   }
-
-   return GL_TRUE;
-}
-
-static ir_rvalue *
-smear(struct texenv_fragment_program *p, ir_rvalue *val)
-{
-   if (!val->type->is_scalar())
-      return val;
-
-   return new(p->mem_ctx) ir_swizzle(val, 0, 0, 0, 0, 4);
-}
-
-static ir_rvalue *
-emit_combine(struct texenv_fragment_program *p,
-            GLuint unit,
-            GLuint nr,
-            GLuint mode,
-            const struct mode_opt *opt)
-{
-   ir_rvalue *src[MAX_COMBINER_TERMS];
-   ir_rvalue *tmp0, *tmp1;
-   GLuint i;
-
-   assert(nr <= MAX_COMBINER_TERMS);
-
-   for (i = 0; i < nr; i++)
-      src[i] = emit_combine_source( p, unit, opt[i].Source, opt[i].Operand );
-
-   switch (mode) {
-   case MODE_REPLACE: 
-      return src[0];
-
-   case MODE_MODULATE: 
-      return new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[1]);
-
-   case MODE_ADD: 
-      return new(p->mem_ctx) ir_expression(ir_binop_add, src[0], src[1]);
-
-   case MODE_ADD_SIGNED:
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_add, src[0], src[1]);
-      return new(p->mem_ctx) ir_expression(ir_binop_add, tmp0,
-                                          new(p->mem_ctx) ir_constant(-0.5f));
-
-   case MODE_INTERPOLATE: 
-      /* Arg0 * (Arg2) + Arg1 * (1-Arg2) */
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[2]);
-
-      tmp1 = new(p->mem_ctx) ir_expression(ir_binop_sub,
-                                          new(p->mem_ctx) ir_constant(1.0f),
-                                          src[2]->clone(p->mem_ctx, NULL));
-      tmp1 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[1], tmp1);
-
-      return new(p->mem_ctx) ir_expression(ir_binop_add, tmp0, tmp1);
-
-   case MODE_SUBTRACT: 
-      return new(p->mem_ctx) ir_expression(ir_binop_sub, src[0], src[1]);
-
-   case MODE_DOT3_RGBA:
-   case MODE_DOT3_RGBA_EXT: 
-   case MODE_DOT3_RGB_EXT:
-   case MODE_DOT3_RGB: {
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0],
-                                          new(p->mem_ctx) ir_constant(2.0f));
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_add, tmp0,
-                                          new(p->mem_ctx) ir_constant(-1.0f));
-      tmp0 = new(p->mem_ctx) ir_swizzle(smear(p, tmp0), 0, 1, 2, 3, 3);
-
-      tmp1 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[1],
-                                          new(p->mem_ctx) ir_constant(2.0f));
-      tmp1 = new(p->mem_ctx) ir_expression(ir_binop_add, tmp1,
-                                          new(p->mem_ctx) ir_constant(-1.0f));
-      tmp1 = new(p->mem_ctx) ir_swizzle(smear(p, tmp1), 0, 1, 2, 3, 3);
-
-      return new(p->mem_ctx) ir_expression(ir_binop_dot, tmp0, tmp1);
-   }
-   case MODE_MODULATE_ADD_ATI:
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[2]);
-      return new(p->mem_ctx) ir_expression(ir_binop_add, tmp0, src[1]);
-
-   case MODE_MODULATE_SIGNED_ADD_ATI:
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[2]);
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_add, tmp0, src[1]);
-      return new(p->mem_ctx) ir_expression(ir_binop_add, tmp0,
-                                          new(p->mem_ctx) ir_constant(-0.5f));
-
-   case MODE_MODULATE_SUBTRACT_ATI:
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[2]);
-      return new(p->mem_ctx) ir_expression(ir_binop_sub, tmp0, src[1]);
-
-   case MODE_ADD_PRODUCTS:
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[1]);
-      tmp1 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[2], src[3]);
-      return new(p->mem_ctx) ir_expression(ir_binop_add, tmp0, tmp1);
-
-   case MODE_ADD_PRODUCTS_SIGNED:
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[0], src[1]);
-      tmp1 = new(p->mem_ctx) ir_expression(ir_binop_mul, src[2], src[3]);
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_add, tmp0, tmp1);
-      return new(p->mem_ctx) ir_expression(ir_binop_add, tmp0,
-                                          new(p->mem_ctx) ir_constant(-0.5f));
-
-   case MODE_BUMP_ENVMAP_ATI:
-      /* special - not handled here */
-      assert(0);
-      return src[0];
-   default: 
-      assert(0);
-      return src[0];
-   }
-}
-
-static ir_rvalue *
-saturate(struct texenv_fragment_program *p, ir_rvalue *val)
-{
-   val = new(p->mem_ctx) ir_expression(ir_binop_min, val,
-                                      new(p->mem_ctx) ir_constant(1.0f));
-   return new(p->mem_ctx) ir_expression(ir_binop_max, val,
-                                       new(p->mem_ctx) ir_constant(0.0f));
-}
-
-/**
- * Generate instructions for one texture unit's env/combiner mode.
- */
-static ir_rvalue *
-emit_texenv(struct texenv_fragment_program *p, GLuint unit)
-{
-   const struct state_key *key = p->state;
-   GLboolean rgb_saturate, alpha_saturate;
-   GLuint rgb_shift, alpha_shift;
-
-   if (!key->unit[unit].enabled) {
-      return get_source(p, SRC_PREVIOUS, 0);
-   }
-   if (key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
-      /* this isn't really a env stage delivering a color and handled elsewhere */
-      return get_source(p, SRC_PREVIOUS, 0);
-   }
-   
-   switch (key->unit[unit].ModeRGB) {
-   case MODE_DOT3_RGB_EXT:
-      alpha_shift = key->unit[unit].ScaleShiftA;
-      rgb_shift = 0;
-      break;
-   case MODE_DOT3_RGBA_EXT:
-      alpha_shift = 0;
-      rgb_shift = 0;
-      break;
-   default:
-      rgb_shift = key->unit[unit].ScaleShiftRGB;
-      alpha_shift = key->unit[unit].ScaleShiftA;
-      break;
-   }
-   
-   /* If we'll do rgb/alpha shifting don't saturate in emit_combine().
-    * We don't want to clamp twice.
-    */
-   if (rgb_shift)
-      rgb_saturate = GL_FALSE;  /* saturate after rgb shift */
-   else if (need_saturate(key->unit[unit].ModeRGB))
-      rgb_saturate = GL_TRUE;
-   else
-      rgb_saturate = GL_FALSE;
-
-   if (alpha_shift)
-      alpha_saturate = GL_FALSE;  /* saturate after alpha shift */
-   else if (need_saturate(key->unit[unit].ModeA))
-      alpha_saturate = GL_TRUE;
-   else
-      alpha_saturate = GL_FALSE;
-
-   ir_variable *temp_var = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
-                                                      "texenv_combine",
-                                                      ir_var_temporary);
-   p->instructions->push_tail(temp_var);
-
-   ir_dereference *deref;
-   ir_assignment *assign;
-   ir_rvalue *val;
-
-   /* Emit the RGB and A combine ops
-    */
-   if (key->unit[unit].ModeRGB == key->unit[unit].ModeA &&
-       args_match(key, unit)) {
-      val = emit_combine(p, unit,
-                        key->unit[unit].NumArgsRGB,
-                        key->unit[unit].ModeRGB,
-                        key->unit[unit].OptRGB);
-      val = smear(p, val);
-      if (rgb_saturate)
-        val = saturate(p, val);
-
-      deref = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      assign = new(p->mem_ctx) ir_assignment(deref, val);
-      p->instructions->push_tail(assign);
-   }
-   else if (key->unit[unit].ModeRGB == MODE_DOT3_RGBA_EXT ||
-           key->unit[unit].ModeRGB == MODE_DOT3_RGBA) {
-      ir_rvalue *val = emit_combine(p, unit,
-                                   key->unit[unit].NumArgsRGB,
-                                   key->unit[unit].ModeRGB,
-                                   key->unit[unit].OptRGB);
-      val = smear(p, val);
-      if (rgb_saturate)
-        val = saturate(p, val);
-      deref = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      assign = new(p->mem_ctx) ir_assignment(deref, val);
-      p->instructions->push_tail(assign);
-   }
-   else {
-      /* Need to do something to stop from re-emitting identical
-       * argument calculations here:
-       */
-      val = emit_combine(p, unit,
-                        key->unit[unit].NumArgsRGB,
-                        key->unit[unit].ModeRGB,
-                        key->unit[unit].OptRGB);
-      val = smear(p, val);
-      val = new(p->mem_ctx) ir_swizzle(val, 0, 1, 2, 3, 3);
-      if (rgb_saturate)
-        val = saturate(p, val);
-      deref = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      assign = new(p->mem_ctx) ir_assignment(deref, val, NULL, WRITEMASK_XYZ);
-      p->instructions->push_tail(assign);
-
-      val = emit_combine(p, unit,
-                        key->unit[unit].NumArgsA,
-                        key->unit[unit].ModeA,
-                        key->unit[unit].OptA);
-      val = smear(p, val);
-      val = new(p->mem_ctx) ir_swizzle(val, 3, 3, 3, 3, 1);
-      if (alpha_saturate)
-        val = saturate(p, val);
-      deref = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      assign = new(p->mem_ctx) ir_assignment(deref, val, NULL, WRITEMASK_W);
-      p->instructions->push_tail(assign);
-   }
-
-   deref = new(p->mem_ctx) ir_dereference_variable(temp_var);
-
-   /* Deal with the final shift:
-    */
-   if (alpha_shift || rgb_shift) {
-      ir_constant *shift;
-
-      if (rgb_shift == alpha_shift) {
-        shift = new(p->mem_ctx) ir_constant((float)(1 << rgb_shift));
-      }
-      else {
-        float const_data[4] = {
-           1 << rgb_shift,
-           1 << rgb_shift,
-           1 << rgb_shift,
-           1 << alpha_shift
-        };
-        shift = new(p->mem_ctx) ir_constant(glsl_type::vec4_type,
-                                            (ir_constant_data *)const_data);
-      }
-
-      return saturate(p, new(p->mem_ctx) ir_expression(ir_binop_mul,
-                                                      deref, shift));
-   }
-   else
-      return deref;
-}
-
-
-/**
- * Generate instruction for getting a texture source term.
- */
-static void load_texture( struct texenv_fragment_program *p, GLuint unit )
-{
-   ir_dereference *deref;
-   ir_assignment *assign;
-
-   if (p->src_texture[unit])
-      return;
-
-   const GLuint texTarget = p->state->unit[unit].source_index;
-   ir_rvalue *texcoord;
-
-   if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) {
-      texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit);
-   } else if (p->texcoord_tex[unit]) {
-      texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]);
-   } else {
-      ir_variable *tc_array = p->shader->symbols->get_variable("gl_TexCoord");
-      assert(tc_array);
-      texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
-      ir_rvalue *index = new(p->mem_ctx) ir_constant(unit);
-      texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
-      tc_array->max_array_access = MAX2(tc_array->max_array_access, unit);
-   }
-
-   if (!p->state->unit[unit].enabled) {
-      p->src_texture[unit] = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
-                                                        "dummy_tex",
-                                                        ir_var_temporary);
-      p->instructions->push_tail(p->src_texture[unit]);
-
-      deref = new(p->mem_ctx) ir_dereference_variable(p->src_texture[unit]);
-      assign = new(p->mem_ctx) ir_assignment(deref,
-                                            new(p->mem_ctx) ir_constant(0.0f));
-      p->instructions->push_tail(assign);
-      return ;
-   }
-
-   const glsl_type *sampler_type = NULL;
-   int coords = 0;
-
-   switch (texTarget) {
-   case TEXTURE_1D_INDEX:
-        sampler_type = p->shader->symbols->get_type("sampler1D");
-      coords = 1;
-      break;
-   case TEXTURE_1D_ARRAY_INDEX:
-        sampler_type = p->shader->symbols->get_type("sampler1DArray");
-      coords = 2;
-      break;
-   case TEXTURE_2D_INDEX:
-        sampler_type = p->shader->symbols->get_type("sampler2D");
-      coords = 2;
-      break;
-   case TEXTURE_2D_ARRAY_INDEX:
-        sampler_type = p->shader->symbols->get_type("sampler2DArray");
-      coords = 3;
-      break;
-   case TEXTURE_RECT_INDEX:
-        sampler_type = p->shader->symbols->get_type("sampler2DRect");
-      coords = 2;
-      break;
-   case TEXTURE_3D_INDEX:
-      sampler_type = p->shader->symbols->get_type("sampler3D");
-      coords = 3;
-      break;
-   case TEXTURE_CUBE_INDEX:
-        sampler_type = p->shader->symbols->get_type("samplerCube");
-      coords = 3;
-      break;
-   case TEXTURE_EXTERNAL_INDEX:
-      sampler_type = p->shader->symbols->get_type("samplerExternalOES");
-      coords = 2;
-      break;
-   }
-
-   p->src_texture[unit] = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
-                                                     "tex",
-                                                     ir_var_temporary);
-   p->instructions->push_tail(p->src_texture[unit]);
-
-   ir_texture *tex = new(p->mem_ctx) ir_texture(ir_tex);
-
-
-   char *sampler_name = ralloc_asprintf(p->mem_ctx, "sampler_%d", unit);
-   ir_variable *sampler = new(p->mem_ctx) ir_variable(sampler_type,
-                                                     sampler_name,
-                                                     ir_var_uniform);
-   p->top_instructions->push_head(sampler);
-   deref = new(p->mem_ctx) ir_dereference_variable(sampler);
-   tex->set_sampler(deref, glsl_type::vec4_type);
-
-   tex->coordinate = new(p->mem_ctx) ir_swizzle(texcoord, 0, 1, 2, 3, coords);
-
-   texcoord = texcoord->clone(p->mem_ctx, NULL);
-   tex->projector = new(p->mem_ctx) ir_swizzle(texcoord, 3, 0, 0, 0, 1);
-
-   deref = new(p->mem_ctx) ir_dereference_variable(p->src_texture[unit]);
-   assign = new(p->mem_ctx) ir_assignment(deref, tex);
-   p->instructions->push_tail(assign);
-}
-
-static void
-load_texenv_source(struct texenv_fragment_program *p,
-                  GLuint src, GLuint unit)
-{
-   switch (src) {
-   case SRC_TEXTURE:
-      load_texture(p, unit);
-      break;
-
-   case SRC_TEXTURE0:
-   case SRC_TEXTURE1:
-   case SRC_TEXTURE2:
-   case SRC_TEXTURE3:
-   case SRC_TEXTURE4:
-   case SRC_TEXTURE5:
-   case SRC_TEXTURE6:
-   case SRC_TEXTURE7:       
-      load_texture(p, src - SRC_TEXTURE0);
-      break;
-      
-   default:
-      /* not a texture src - do nothing */
-      break;
-   }
-}
-
-
-/**
- * Generate instructions for loading all texture source terms.
- */
-static GLboolean
-load_texunit_sources( struct texenv_fragment_program *p, GLuint unit )
-{
-   const struct state_key *key = p->state;
-   GLuint i;
-
-   for (i = 0; i < key->unit[unit].NumArgsRGB; i++) {
-      load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit );
-   }
-
-   for (i = 0; i < key->unit[unit].NumArgsA; i++) {
-      load_texenv_source( p, key->unit[unit].OptA[i].Source, unit );
-   }
-
-   return GL_TRUE;
-}
-
-/**
- * Generate instructions for loading bump map textures.
- */
-static void
-load_texunit_bumpmap( struct texenv_fragment_program *p, GLuint unit )
-{
-   const struct state_key *key = p->state;
-   GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0;
-   ir_rvalue *bump;
-   ir_rvalue *texcoord;
-   ir_variable *rot_mat_0_var, *rot_mat_1_var;
-   ir_dereference_variable *rot_mat_0, *rot_mat_1;
-
-   rot_mat_0_var = p->shader->symbols->get_variable("gl_BumpRotMatrix0MESA");
-   rot_mat_1_var = p->shader->symbols->get_variable("gl_BumpRotMatrix1MESA");
-   rot_mat_0 = new(p->mem_ctx) ir_dereference_variable(rot_mat_0_var);
-   rot_mat_1 = new(p->mem_ctx) ir_dereference_variable(rot_mat_1_var);
-
-   ir_variable *tc_array = p->shader->symbols->get_variable("gl_TexCoord");
-   assert(tc_array);
-   texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
-   ir_rvalue *index = new(p->mem_ctx) ir_constant(bumpedUnitNr);
-   texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
-   tc_array->max_array_access = MAX2(tc_array->max_array_access, unit);
-
-   load_texenv_source( p, unit + SRC_TEXTURE0, unit );
-
-   /* Apply rot matrix and add coords to be available in next phase.
-    * dest = Arg1 + (Arg0.xx * rotMat0) + (Arg0.yy * rotMat1)
-    * note only 2 coords are affected the rest are left unchanged (mul by 0)
-    */
-   ir_dereference *deref;
-   ir_assignment *assign;
-   ir_rvalue *bump_x, *bump_y;
-
-   texcoord = smear(p, texcoord);
-
-   /* bump_texcoord = texcoord */
-   ir_variable *bumped = new(p->mem_ctx) ir_variable(texcoord->type,
-                                                    "bump_texcoord",
-                                                    ir_var_temporary);
-   p->instructions->push_tail(bumped);
-
-   deref = new(p->mem_ctx) ir_dereference_variable(bumped);
-   assign = new(p->mem_ctx) ir_assignment(deref, texcoord);
-   p->instructions->push_tail(assign);
-
-   /* bump_texcoord.xy += arg0.x * rotmat0 + arg0.y * rotmat1 */
-   bump = get_source(p, key->unit[unit].OptRGB[0].Source, unit);
-   bump_x = new(p->mem_ctx) ir_swizzle(bump, 0, 0, 0, 0, 1);
-   bump = bump->clone(p->mem_ctx, NULL);
-   bump_y = new(p->mem_ctx) ir_swizzle(bump, 1, 0, 0, 0, 1);
-
-   bump_x = new(p->mem_ctx) ir_expression(ir_binop_mul, bump_x, rot_mat_0);
-   bump_y = new(p->mem_ctx) ir_expression(ir_binop_mul, bump_y, rot_mat_1);
-
-   ir_expression *expr;
-   expr = new(p->mem_ctx) ir_expression(ir_binop_add, bump_x, bump_y);
-
-   deref = new(p->mem_ctx) ir_dereference_variable(bumped);
-   expr = new(p->mem_ctx) ir_expression(ir_binop_add,
-                                       new(p->mem_ctx) ir_swizzle(deref,
-                                                                  0, 1, 1, 1,
-                                                                  2),
-                                       expr);
-
-   deref = new(p->mem_ctx) ir_dereference_variable(bumped);
-   assign = new(p->mem_ctx) ir_assignment(deref, expr, NULL, WRITEMASK_XY);
-   p->instructions->push_tail(assign);
-
-   p->texcoord_tex[bumpedUnitNr] = bumped;
-}
-
-/**
- * Applies the fog calculations.
- *
- * This is basically like the ARB_fragment_prorgam fog options.  Note
- * that ffvertex_prog.c produces fogcoord for us when
- * GL_FOG_COORDINATE_EXT is set to GL_FRAGMENT_DEPTH_EXT.
- */
-static ir_rvalue *
-emit_fog_instructions(struct texenv_fragment_program *p,
-                     ir_rvalue *fragcolor)
-{
-   struct state_key *key = p->state;
-   ir_rvalue *f, *temp;
-   ir_variable *params, *oparams;
-   ir_variable *fogcoord;
-   ir_assignment *assign;
-
-   /* Temporary storage for the whole fog result.  Fog calculations
-    * only affect rgb so we're hanging on to the .a value of fragcolor
-    * this way.
-    */
-   ir_variable *fog_result = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
-                                                        "fog_result",
-                                                        ir_var_auto);
-   p->instructions->push_tail(fog_result);
-   temp = new(p->mem_ctx) ir_dereference_variable(fog_result);
-   assign = new(p->mem_ctx) ir_assignment(temp, fragcolor);
-   p->instructions->push_tail(assign);
-
-   temp = new(p->mem_ctx) ir_dereference_variable(fog_result);
-   fragcolor = new(p->mem_ctx) ir_swizzle(temp, 0, 1, 2, 3, 3);
-
-   oparams = p->shader->symbols->get_variable("gl_FogParamsOptimizedMESA");
-   fogcoord = p->shader->symbols->get_variable("gl_FogFragCoord");
-   params = p->shader->symbols->get_variable("gl_Fog");
-   f = new(p->mem_ctx) ir_dereference_variable(fogcoord);
-
-   ir_variable *f_var = new(p->mem_ctx) ir_variable(glsl_type::float_type,
-                                                   "fog_factor", ir_var_auto);
-   p->instructions->push_tail(f_var);
-
-   switch (key->fog_mode) {
-   case FOG_LINEAR:
-      /* f = (end - z) / (end - start)
-       *
-       * gl_MesaFogParamsOptimized gives us (-1 / (end - start)) and
-       * (end / (end - start)) so we can generate a single MAD.
-       */
-      temp = new(p->mem_ctx) ir_dereference_variable(oparams);
-      temp = new(p->mem_ctx) ir_swizzle(temp, 0, 0, 0, 0, 1);
-      f = new(p->mem_ctx) ir_expression(ir_binop_mul, f, temp);
-
-      temp = new(p->mem_ctx) ir_dereference_variable(oparams);
-      temp = new(p->mem_ctx) ir_swizzle(temp, 1, 0, 0, 0, 1);
-      f = new(p->mem_ctx) ir_expression(ir_binop_add, f, temp);
-      break;
-   case FOG_EXP:
-      /* f = e^(-(density * fogcoord))
-       *
-       * gl_MesaFogParamsOptimized gives us density/ln(2) so we can
-       * use EXP2 which is generally the native instruction without
-       * having to do any further math on the fog density uniform.
-       */
-      temp = new(p->mem_ctx) ir_dereference_variable(oparams);
-      temp = new(p->mem_ctx) ir_swizzle(temp, 2, 0, 0, 0, 1);
-      f = new(p->mem_ctx) ir_expression(ir_binop_mul, f, temp);
-      f = new(p->mem_ctx) ir_expression(ir_unop_neg, f);
-      f = new(p->mem_ctx) ir_expression(ir_unop_exp2, f);
-      break;
-   case FOG_EXP2:
-      /* f = e^(-(density * fogcoord)^2)
-       *
-       * gl_MesaFogParamsOptimized gives us density/sqrt(ln(2)) so we
-       * can do this like FOG_EXP but with a squaring after the
-       * multiply by density.
-       */
-      ir_variable *temp_var = new(p->mem_ctx) ir_variable(glsl_type::float_type,
-                                                         "fog_temp",
-                                                         ir_var_auto);
-      p->instructions->push_tail(temp_var);
-
-      temp = new(p->mem_ctx) ir_dereference_variable(oparams);
-      temp = new(p->mem_ctx) ir_swizzle(temp, 3, 0, 0, 0, 1);
-      f = new(p->mem_ctx) ir_expression(ir_binop_mul,
-                                       f, temp);
-
-      temp = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      ir_assignment *assign = new(p->mem_ctx) ir_assignment(temp, f);
-      p->instructions->push_tail(assign);
-
-      f = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      temp = new(p->mem_ctx) ir_dereference_variable(temp_var);
-      f = new(p->mem_ctx) ir_expression(ir_binop_mul, f, temp);
-      f = new(p->mem_ctx) ir_expression(ir_unop_neg, f);
-      f = new(p->mem_ctx) ir_expression(ir_unop_exp2, f);
-      break;
-   }
-
-   f = saturate(p, f);
-
-   temp = new(p->mem_ctx) ir_dereference_variable(f_var);
-   assign = new(p->mem_ctx) ir_assignment(temp, f);
-   p->instructions->push_tail(assign);
-
-   f = new(p->mem_ctx) ir_dereference_variable(f_var);
-   f = new(p->mem_ctx) ir_expression(ir_binop_sub,
-                                    new(p->mem_ctx) ir_constant(1.0f),
-                                    f);
-   temp = new(p->mem_ctx) ir_dereference_variable(params);
-   temp = new(p->mem_ctx) ir_dereference_record(temp, "color");
-   temp = new(p->mem_ctx) ir_swizzle(temp, 0, 1, 2, 3, 3);
-   temp = new(p->mem_ctx) ir_expression(ir_binop_mul, temp, f);
-
-   f = new(p->mem_ctx) ir_dereference_variable(f_var);
-   f = new(p->mem_ctx) ir_expression(ir_binop_mul, fragcolor, f);
-   f = new(p->mem_ctx) ir_expression(ir_binop_add, temp, f);
-
-   ir_dereference *deref = new(p->mem_ctx) ir_dereference_variable(fog_result);
-   assign = new(p->mem_ctx) ir_assignment(deref, f, NULL, WRITEMASK_XYZ);
-   p->instructions->push_tail(assign);
-
-   return new(p->mem_ctx) ir_dereference_variable(fog_result);
-}
-
-static void
-emit_instructions(struct texenv_fragment_program *p)
-{
-   struct state_key *key = p->state;
-   GLuint unit;
-
-   if (key->enabled_units) {
-      /* Zeroth pass - bump map textures first */
-      for (unit = 0; unit < key->nr_enabled_units; unit++) {
-        if (key->unit[unit].enabled &&
-             key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
-           load_texunit_bumpmap(p, unit);
-        }
-      }
-
-      /* First pass - to support texture_env_crossbar, first identify
-       * all referenced texture sources and emit texld instructions
-       * for each:
-       */
-      for (unit = 0; unit < key->nr_enabled_units; unit++)
-        if (key->unit[unit].enabled) {
-           load_texunit_sources(p, unit);
-           p->last_tex_stage = unit;
-        }
-
-      /* Second pass - emit combine instructions to build final color:
-       */
-      for (unit = 0; unit < key->nr_enabled_units; unit++) {
-        if (key->unit[unit].enabled) {
-           p->src_previous = emit_texenv(p, unit);
-        }
-      }
-   }
-
-   ir_rvalue *cf = get_source(p, SRC_PREVIOUS, 0);
-   ir_dereference_variable *deref;
-   ir_assignment *assign;
-
-   if (key->separate_specular) {
-      ir_rvalue *tmp0;
-      ir_variable *spec_result = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
-                                                           "specular_add",
-                                                           ir_var_temporary);
-
-      p->instructions->push_tail(spec_result);
-
-      deref = new(p->mem_ctx) ir_dereference_variable(spec_result);
-      assign = new(p->mem_ctx) ir_assignment(deref, cf);
-      p->instructions->push_tail(assign);
-
-      deref = new(p->mem_ctx) ir_dereference_variable(spec_result);
-      tmp0 = new(p->mem_ctx) ir_swizzle(deref, 0, 1, 2, 3, 3);
-
-      ir_rvalue *secondary;
-      if (p->state->inputs_available & FRAG_BIT_COL1) {
-        ir_variable *var =
-           p->shader->symbols->get_variable("gl_SecondaryColor");
-        assert(var);
-        secondary = new(p->mem_ctx) ir_dereference_variable(var);
-      } else {
-        secondary = get_current_attrib(p, VERT_ATTRIB_COLOR1);
-      }
-      secondary = new(p->mem_ctx) ir_swizzle(secondary, 0, 1, 2, 3, 3);
-
-      tmp0 = new(p->mem_ctx) ir_expression(ir_binop_add, tmp0, secondary);
-
-      deref = new(p->mem_ctx) ir_dereference_variable(spec_result);
-      assign = new(p->mem_ctx) ir_assignment(deref, tmp0, NULL, WRITEMASK_XYZ);
-      p->instructions->push_tail(assign);
-
-      cf = new(p->mem_ctx) ir_dereference_variable(spec_result);
-   }
-
-   if (key->fog_enabled) {
-      cf = emit_fog_instructions(p, cf);
-   }
-
-   ir_variable *frag_color = p->shader->symbols->get_variable("gl_FragColor");
-   assert(frag_color);
-   deref = new(p->mem_ctx) ir_dereference_variable(frag_color);
-   assign = new(p->mem_ctx) ir_assignment(deref, cf);
-   p->instructions->push_tail(assign);
-}
-
-/**
- * Generate a new fragment program which implements the context's
- * current texture env/combine mode.
- */
-static struct gl_shader_program *
-create_new_program(struct gl_context *ctx, struct state_key *key)
-{
-   struct texenv_fragment_program p;
-   unsigned int unit;
-   _mesa_glsl_parse_state *state;
-
-   memset(&p, 0, sizeof(p));
-   p.mem_ctx = ralloc_context(NULL);
-   p.shader = ctx->Driver.NewShader(ctx, 0, GL_FRAGMENT_SHADER);
-   p.shader->ir = new(p.shader) exec_list;
-   state = new(p.shader) _mesa_glsl_parse_state(ctx, GL_FRAGMENT_SHADER,
-                                               p.shader);
-   p.shader->symbols = state->symbols;
-   p.top_instructions = p.shader->ir;
-   p.instructions = p.shader->ir;
-   p.state = key;
-   p.shader_program = ctx->Driver.NewShaderProgram(ctx, 0);
-
-   /* Tell the linker to ignore the fact that we're building a
-    * separate shader, in case we're in a GLES2 context that would
-    * normally reject that.  The real problem is that we're building a
-    * fixed function program in a GLES2 context at all, but that's a
-    * big mess to clean up.
-    */
-   p.shader_program->InternalSeparateShader = GL_TRUE;
-
-   state->language_version = 130;
-   if (ctx->Extensions.OES_EGL_image_external)
-      state->OES_EGL_image_external_enable = true;
-   _mesa_glsl_initialize_types(state);
-   _mesa_glsl_initialize_variables(p.instructions, state);
-
-   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
-      p.src_texture[unit] = NULL;
-      p.texcoord_tex[unit] = NULL;
-   }
-
-   p.src_previous = NULL;
-
-   p.last_tex_stage = 0;
-
-   ir_function *main_f = new(p.mem_ctx) ir_function("main");
-   p.instructions->push_tail(main_f);
-   state->symbols->add_function(main_f);
-
-   ir_function_signature *main_sig =
-      new(p.mem_ctx) ir_function_signature(p.shader->symbols->get_type("void"));
-   main_sig->is_defined = true;
-   main_f->add_signature(main_sig);
-
-   p.instructions = &main_sig->body;
-   if (key->num_draw_buffers)
-      emit_instructions(&p);
-
-   validate_ir_tree(p.shader->ir);
-
-   while (do_common_optimization(p.shader->ir, false, false, 32))
-      ;
-   reparent_ir(p.shader->ir, p.shader->ir);
-
-   p.shader->CompileStatus = true;
-   p.shader->Version = state->language_version;
-   p.shader->num_builtins_to_link = state->num_builtins_to_link;
-   p.shader_program->Shaders =
-      (gl_shader **)malloc(sizeof(*p.shader_program->Shaders));
-   p.shader_program->Shaders[0] = p.shader;
-   p.shader_program->NumShaders = 1;
-
-   _mesa_glsl_link_shader(ctx, p.shader_program);
-
-   /* Set the sampler uniforms, and relink to get them into the linked
-    * program.
-    */
-   struct gl_shader *const fs =
-      p.shader_program->_LinkedShaders[MESA_SHADER_FRAGMENT];
-   struct gl_program *const fp = fs->Program;
-
-   _mesa_generate_parameters_list_for_uniforms(p.shader_program, fs,
-                                              fp->Parameters);
-
-   _mesa_associate_uniform_storage(ctx, p.shader_program, fp->Parameters);
-
-   for (unsigned int i = 0; i < MAX_TEXTURE_UNITS; i++) {
-      /* Enough space for 'sampler_999\0'.
-       */
-      char name[12];
-
-      snprintf(name, sizeof(name), "sampler_%d", i);
-
-      int loc = _mesa_get_uniform_location(ctx, p.shader_program, name);
-      if (loc != -1) {
-        unsigned base;
-        unsigned idx;
-
-        /* Avoid using _mesa_uniform() because it flags state
-         * updates, so if we're generating this shader_program in a
-         * state update, we end up recursing.  Instead, just set the
-         * value, which is picked up at re-link.
-         */
-        _mesa_uniform_split_location_offset(loc, &base, &idx);
-        assert(idx == 0);
-
-        struct gl_uniform_storage *const storage =
-           &p.shader_program->UniformStorage[base];
-
-        /* Update the storage, the SamplerUnits in the shader program, and
-         * the SamplerUnits in the assembly shader.
-         */
-        storage->storage[idx].i = i;
-        fp->SamplerUnits[storage->sampler] = i;
-        p.shader_program->SamplerUnits[storage->sampler] = i;
-        _mesa_propagate_uniforms_to_driver_storage(storage, 0, 1);
-      }
-   }
-   _mesa_update_shader_textures_used(p.shader_program, fp);
-   (void) ctx->Driver.ProgramStringNotify(ctx, fp->Target, fp);
-
-   if (!p.shader_program->LinkStatus)
-      _mesa_problem(ctx, "Failed to link fixed function fragment shader: %s\n",
-                   p.shader_program->InfoLog);
-
-   ralloc_free(p.mem_ctx);
-   return p.shader_program;
-}
-
-extern "C" {
-
-/**
- * Return a fragment program which implements the current
- * fixed-function texture, fog and color-sum operations.
- */
-struct gl_shader_program *
-_mesa_get_fixed_func_fragment_program(struct gl_context *ctx)
-{
-   struct gl_shader_program *shader_program;
-   struct state_key key;
-   GLuint keySize;
-
-   keySize = make_state_key(ctx, &key);
-
-   shader_program = (struct gl_shader_program *)
-      _mesa_search_program_cache(ctx->FragmentProgram.Cache,
-                                 &key, keySize);
-
-   if (!shader_program) {
-      shader_program = create_new_program(ctx, &key);
-
-      _mesa_shader_cache_insert(ctx, ctx->FragmentProgram.Cache,
-                               &key, keySize, shader_program);
-   }
-
-   return shader_program;
-}
-
-}
diff --git a/reactos/dll/opengl/mesa/src/mesa/main/ffvertex_prog.c b/reactos/dll/opengl/mesa/src/mesa/main/ffvertex_prog.c
deleted file mode 100644 (file)
index 19d319a..0000000
+++ /dev/null
@@ -1,1702 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, 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 TUNGSTEN GRAPHICS 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.
- *
- **************************************************************************/
-
-/**
- * \file ffvertex_prog.c
- *
- * Create a vertex program to execute the current fixed function T&L pipeline.
- * \author Keith Whitwell
- */
-
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "main/mfeatures.h"
-#include "main/enums.h"
-#include "main/ffvertex_prog.h"
-#include "program/program.h"
-#include "program/prog_cache.h"
-#include "program/prog_instruction.h"
-#include "program/prog_parameter.h"
-#include "program/prog_print.h"
-#include "program/prog_statevars.h"
-
-
-/** Max of number of lights and texture coord units */
-#define NUM_UNITS MAX2(MAX_TEXTURE_COORD_UNITS, MAX_LIGHTS)
-
-struct state_key {
-   unsigned light_color_material_mask:12;
-   unsigned light_global_enabled:1;
-   unsigned light_local_viewer:1;
-   unsigned light_twoside:1;
-   unsigned material_shininess_is_zero:1;
-   unsigned need_eye_coords:1;
-   unsigned normalize:1;
-   unsigned rescale_normals:1;
-
-   unsigned fog_source_is_depth:1;
-   unsigned fog_distance_mode:2;
-   unsigned separate_specular:1;
-   unsigned point_attenuated:1;
-   unsigned point_array:1;
-   unsigned texture_enabled_global:1;
-   unsigned fragprog_inputs_read:12;
-
-   GLbitfield64 varying_vp_inputs;
-
-   struct {
-      unsigned light_enabled:1;
-      unsigned light_eyepos3_is_zero:1;
-      unsigned light_spotcutoff_is_180:1;
-      unsigned light_attenuated:1;
-      unsigned texunit_really_enabled:1;
-      unsigned texmat_enabled:1;
-      unsigned coord_replace:1;
-      unsigned texgen_enabled:4;
-      unsigned texgen_mode0:4;
-      unsigned texgen_mode1:4;
-      unsigned texgen_mode2:4;
-      unsigned texgen_mode3:4;
-   } unit[NUM_UNITS];
-};
-
-
-#define TXG_NONE           0
-#define TXG_OBJ_LINEAR     1
-#define TXG_EYE_LINEAR     2
-#define TXG_SPHERE_MAP     3
-#define TXG_REFLECTION_MAP 4
-#define TXG_NORMAL_MAP     5
-
-static GLuint translate_texgen( GLboolean enabled, GLenum mode )
-{
-   if (!enabled)
-      return TXG_NONE;
-
-   switch (mode) {
-   case GL_OBJECT_LINEAR: return TXG_OBJ_LINEAR;
-   case GL_EYE_LINEAR: return TXG_EYE_LINEAR;
-   case GL_SPHERE_MAP: return TXG_SPHERE_MAP;
-   case GL_REFLECTION_MAP_NV: return TXG_REFLECTION_MAP;
-   case GL_NORMAL_MAP_NV: return TXG_NORMAL_MAP;
-   default: return TXG_NONE;
-   }
-}
-
-#define FDM_EYE_RADIAL    0
-#define FDM_EYE_PLANE     1
-#define FDM_EYE_PLANE_ABS 2
-
-static GLuint translate_fog_distance_mode( GLenum mode )
-{
-   switch (mode) {
-   case GL_EYE_RADIAL_NV:
-      return FDM_EYE_RADIAL;
-   case GL_EYE_PLANE:
-      return FDM_EYE_PLANE;
-   default: /* shouldn't happen; fall through to a sensible default */
-   case GL_EYE_PLANE_ABSOLUTE_NV:
-      return FDM_EYE_PLANE_ABS;
-   }
-}
-
-static GLboolean check_active_shininess( struct gl_context *ctx,
-                                         const struct state_key *key,
-                                         GLuint side )
-{
-   GLuint attr = MAT_ATTRIB_FRONT_SHININESS + side;
-
-   if ((key->varying_vp_inputs & VERT_BIT_COLOR0) &&
-       (key->light_color_material_mask & (1 << attr)))
-      return GL_TRUE;
-
-   if (key->varying_vp_inputs & VERT_ATTRIB_GENERIC(attr))
-      return GL_TRUE;
-
-   if (ctx->Light.Material.Attrib[attr][0] != 0.0F)
-      return GL_TRUE;
-
-   return GL_FALSE;
-}
-
-
-static void make_state_key( struct gl_context *ctx, struct state_key *key )
-{
-   const struct gl_fragment_program *fp;
-   GLuint i;
-
-   memset(key, 0, sizeof(struct state_key));
-   fp = ctx->FragmentProgram._Current;
-
-   /* This now relies on texenvprogram.c being active:
-    */
-   assert(fp);
-
-   key->need_eye_coords = ctx->_NeedEyeCoords;
-
-   key->fragprog_inputs_read = fp->Base.InputsRead;
-   key->varying_vp_inputs = ctx->varying_vp_inputs;
-
-   if (ctx->RenderMode == GL_FEEDBACK) {
-      /* make sure the vertprog emits color and tex0 */
-      key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
-   }
-
-   key->separate_specular = (ctx->Light.Model.ColorControl ==
-                            GL_SEPARATE_SPECULAR_COLOR);
-
-   if (ctx->Light.Enabled) {
-      key->light_global_enabled = 1;
-
-      if (ctx->Light.Model.LocalViewer)
-        key->light_local_viewer = 1;
-
-      if (ctx->Light.Model.TwoSide)
-        key->light_twoside = 1;
-
-      if (ctx->Light.ColorMaterialEnabled) {
-        key->light_color_material_mask = ctx->Light.ColorMaterialBitmask;
-      }
-
-      for (i = 0; i < MAX_LIGHTS; i++) {
-        struct gl_light *light = &ctx->Light.Light[i];
-
-        if (light->Enabled) {
-           key->unit[i].light_enabled = 1;
-
-           if (light->EyePosition[3] == 0.0)
-              key->unit[i].light_eyepos3_is_zero = 1;
-
-           if (light->SpotCutoff == 180.0)
-              key->unit[i].light_spotcutoff_is_180 = 1;
-
-           if (light->ConstantAttenuation != 1.0 ||
-               light->LinearAttenuation != 0.0 ||
-               light->QuadraticAttenuation != 0.0)
-              key->unit[i].light_attenuated = 1;
-        }
-      }
-
-      if (check_active_shininess(ctx, key, 0)) {
-         key->material_shininess_is_zero = 0;
-      }
-      else if (key->light_twoside &&
-               check_active_shininess(ctx, key, 1)) {
-         key->material_shininess_is_zero = 0;
-      }
-      else {
-         key->material_shininess_is_zero = 1;
-      }
-   }
-
-   if (ctx->Transform.Normalize)
-      key->normalize = 1;
-
-   if (ctx->Transform.RescaleNormals)
-      key->rescale_normals = 1;
-
-   if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) {
-      key->fog_source_is_depth = 1;
-      key->fog_distance_mode = translate_fog_distance_mode(ctx->Fog.FogDistanceMode);
-   }
-
-   if (ctx->Point._Attenuated)
-      key->point_attenuated = 1;
-
-#if FEATURE_point_size_array
-   if (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled)
-      key->point_array = 1;
-#endif
-
-   if (ctx->Texture._TexGenEnabled ||
-       ctx->Texture._TexMatEnabled ||
-       ctx->Texture._EnabledUnits)
-      key->texture_enabled_global = 1;
-
-   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
-      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
-
-      if (texUnit->_ReallyEnabled)
-        key->unit[i].texunit_really_enabled = 1;
-
-      if (ctx->Point.PointSprite)
-        if (ctx->Point.CoordReplace[i])
-           key->unit[i].coord_replace = 1;
-
-      if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
-        key->unit[i].texmat_enabled = 1;
-
-      if (texUnit->TexGenEnabled) {
-        key->unit[i].texgen_enabled = 1;
-
-        key->unit[i].texgen_mode0 =
-           translate_texgen( texUnit->TexGenEnabled & (1<<0),
-                             texUnit->GenS.Mode );
-        key->unit[i].texgen_mode1 =
-           translate_texgen( texUnit->TexGenEnabled & (1<<1),
-                             texUnit->GenT.Mode );
-        key->unit[i].texgen_mode2 =
-           translate_texgen( texUnit->TexGenEnabled & (1<<2),
-                             texUnit->GenR.Mode );
-        key->unit[i].texgen_mode3 =
-           translate_texgen( texUnit->TexGenEnabled & (1<<3),
-                             texUnit->GenQ.Mode );
-      }
-   }
-}
-
-
-
-/* Very useful debugging tool - produces annotated listing of
- * generated program with line/function references for each
- * instruction back into this file:
- */
-#define DISASSEM 0
-
-
-/* Use uregs to represent registers internally, translate to Mesa's
- * expected formats on emit.
- *
- * NOTE: These are passed by value extensively in this file rather
- * than as usual by pointer reference.  If this disturbs you, try
- * remembering they are just 32bits in size.
- *
- * GCC is smart enough to deal with these dword-sized structures in
- * much the same way as if I had defined them as dwords and was using
- * macros to access and set the fields.  This is much nicer and easier
- * to evolve.
- */
-struct ureg {
-   GLuint file:4;
-   GLint idx:9;      /* relative addressing may be negative */
-                     /* sizeof(idx) should == sizeof(prog_src_reg::Index) */
-   GLuint negate:1;
-   GLuint swz:12;
-   GLuint pad:6;
-};
-
-
-struct tnl_program {
-   const struct state_key *state;
-   struct gl_vertex_program *program;
-   GLint max_inst;  /** number of instructions allocated for program */
-   GLboolean mvp_with_dp4;
-
-   GLuint temp_in_use;
-   GLuint temp_reserved;
-
-   struct ureg eye_position;
-   struct ureg eye_position_z;
-   struct ureg eye_position_normalized;
-   struct ureg transformed_normal;
-   struct ureg identity;
-
-   GLuint materials;
-   GLuint color_materials;
-};
-
-
-static const struct ureg undef = {
-   PROGRAM_UNDEFINED,
-   0,
-   0,
-   0,
-   0
-};
-
-/* Local shorthand:
- */
-#define X    SWIZZLE_X
-#define Y    SWIZZLE_Y
-#define Z    SWIZZLE_Z
-#define W    SWIZZLE_W
-
-
-/* Construct a ureg:
- */
-static struct ureg make_ureg(GLuint file, GLint idx)
-{
-   struct ureg reg;
-   reg.file = file;
-   reg.idx = idx;
-   reg.negate = 0;
-   reg.swz = SWIZZLE_NOOP;
-   reg.pad = 0;
-   return reg;
-}
-
-
-
-static struct ureg negate( struct ureg reg )
-{
-   reg.negate ^= 1;
-   return reg;
-}
-
-
-static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w )
-{
-   reg.swz = MAKE_SWIZZLE4(GET_SWZ(reg.swz, x),
-                          GET_SWZ(reg.swz, y),
-                          GET_SWZ(reg.swz, z),
-                          GET_SWZ(reg.swz, w));
-   return reg;
-}
-
-
-static struct ureg swizzle1( struct ureg reg, int x )
-{
-   return swizzle(reg, x, x, x, x);
-}
-
-
-static struct ureg get_temp( struct tnl_program *p )
-{
-   int bit = _mesa_ffs( ~p->temp_in_use );
-   if (!bit) {
-      _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
-      exit(1);
-   }
-
-   if ((GLuint) bit > p->program->Base.NumTemporaries)
-      p->program->Base.NumTemporaries = bit;
-
-   p->temp_in_use |= 1<<(bit-1);
-   return make_ureg(PROGRAM_TEMPORARY, bit-1);
-}
-
-
-static struct ureg reserve_temp( struct tnl_program *p )
-{
-   struct ureg temp = get_temp( p );
-   p->temp_reserved |= 1<<temp.idx;
-   return temp;
-}
-
-
-static void release_temp( struct tnl_program *p, struct ureg reg )
-{
-   if (reg.file == PROGRAM_TEMPORARY) {
-      p->temp_in_use &= ~(1<<reg.idx);
-      p->temp_in_use |= p->temp_reserved; /* can't release reserved temps */
-   }
-}
-
-static void release_temps( struct tnl_program *p )
-{
-   p->temp_in_use = p->temp_reserved;
-}
-
-
-static struct ureg register_param5(struct tnl_program *p,
-                                  GLint s0,
-                                  GLint s1,
-                                  GLint s2,
-                                  GLint s3,
-                                   GLint s4)
-{
-   gl_state_index tokens[STATE_LENGTH];
-   GLint idx;
-   tokens[0] = s0;
-   tokens[1] = s1;
-   tokens[2] = s2;
-   tokens[3] = s3;
-   tokens[4] = s4;
-   idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
-   return make_ureg(PROGRAM_STATE_VAR, idx);
-}
-
-
-#define register_param1(p,s0)          register_param5(p,s0,0,0,0,0)
-#define register_param2(p,s0,s1)       register_param5(p,s0,s1,0,0,0)
-#define register_param3(p,s0,s1,s2)    register_param5(p,s0,s1,s2,0,0)
-#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0)
-
-
-
-/**
- * \param input  one of VERT_ATTRIB_x tokens.
- */
-static struct ureg register_input( struct tnl_program *p, GLuint input )
-{
-   assert(input < VERT_ATTRIB_MAX);
-
-   if (p->state->varying_vp_inputs & VERT_BIT(input)) {
-      p->program->Base.InputsRead |= VERT_BIT(input);
-      return make_ureg(PROGRAM_INPUT, input);
-   }
-   else {
-      return register_param3( p, STATE_INTERNAL, STATE_CURRENT_ATTRIB, input );
-   }
-}
-
-
-/**
- * \param input  one of VERT_RESULT_x tokens.
- */
-static struct ureg register_output( struct tnl_program *p, GLuint output )
-{
-   p->program->Base.OutputsWritten |= BITFIELD64_BIT(output);
-   return make_ureg(PROGRAM_OUTPUT, output);
-}
-
-
-static struct ureg register_const4f( struct tnl_program *p,
-                             GLfloat s0,
-                             GLfloat s1,
-                             GLfloat s2,
-                             GLfloat s3)
-{
-   gl_constant_value values[4];
-   GLint idx;
-   GLuint swizzle;
-   values[0].f = s0;
-   values[1].f = s1;
-   values[2].f = s2;
-   values[3].f = s3;
-   idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4,
-                                     &swizzle );
-   ASSERT(swizzle == SWIZZLE_NOOP);
-   return make_ureg(PROGRAM_CONSTANT, idx);
-}
-
-#define register_const1f(p, s0)         register_const4f(p, s0, 0, 0, 1)
-#define register_scalar_const(p, s0)    register_const4f(p, s0, s0, s0, s0)
-#define register_const2f(p, s0, s1)     register_const4f(p, s0, s1, 0, 1)
-#define register_const3f(p, s0, s1, s2) register_const4f(p, s0, s1, s2, 1)
-
-static GLboolean is_undef( struct ureg reg )
-{
-   return reg.file == PROGRAM_UNDEFINED;
-}
-
-
-static struct ureg get_identity_param( struct tnl_program *p )
-{
-   if (is_undef(p->identity))
-      p->identity = register_const4f(p, 0,0,0,1);
-
-   return p->identity;
-}
-
-static void register_matrix_param5( struct tnl_program *p,
-                                   GLint s0, /* modelview, projection, etc */
-                                   GLint s1, /* texture matrix number */
-                                   GLint s2, /* first row */
-                                   GLint s3, /* last row */
-                                   GLint s4, /* inverse, transpose, etc */
-                                   struct ureg *matrix )
-{
-   GLint i;
-
-   /* This is a bit sad as the support is there to pull the whole
-    * matrix out in one go:
-    */
-   for (i = 0; i <= s3 - s2; i++)
-      matrix[i] = register_param5( p, s0, s1, i, i, s4 );
-}
-
-
-static void emit_arg( struct prog_src_register *src,
-                     struct ureg reg )
-{
-   src->File = reg.file;
-   src->Index = reg.idx;
-   src->Swizzle = reg.swz;
-   src->Negate = reg.negate ? NEGATE_XYZW : NEGATE_NONE;
-   src->Abs = 0;
-   src->RelAddr = 0;
-   /* Check that bitfield sizes aren't exceeded */
-   ASSERT(src->Index == reg.idx);
-}
-
-
-static void emit_dst( struct prog_dst_register *dst,
-                     struct ureg reg, GLuint mask )
-{
-   dst->File = reg.file;
-   dst->Index = reg.idx;
-   /* allow zero as a shorthand for xyzw */
-   dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
-   dst->CondMask = COND_TR;  /* always pass cond test */
-   dst->CondSwizzle = SWIZZLE_NOOP;
-   dst->CondSrc = 0;
-   /* Check that bitfield sizes aren't exceeded */
-   ASSERT(dst->Index == reg.idx);
-}
-
-
-static void debug_insn( struct prog_instruction *inst, const char *fn,
-                       GLuint line )
-{
-   if (DISASSEM) {
-      static const char *last_fn;
-
-      if (fn != last_fn) {
-        last_fn = fn;
-        printf("%s:\n", fn);
-      }
-
-      printf("%d:\t", line);
-      _mesa_print_instruction(inst);
-   }
-}
-
-
-static void emit_op3fn(struct tnl_program *p,
-                       enum prog_opcode op,
-                      struct ureg dest,
-                      GLuint mask,
-                      struct ureg src0,
-                      struct ureg src1,
-                      struct ureg src2,
-                      const char *fn,
-                      GLuint line)
-{
-   GLuint nr;
-   struct prog_instruction *inst;
-
-   assert((GLint) p->program->Base.NumInstructions <= p->max_inst);
-
-   if (p->program->Base.NumInstructions == p->max_inst) {
-      /* need to extend the program's instruction array */
-      struct prog_instruction *newInst;
-
-      /* double the size */
-      p->max_inst *= 2;
-
-      newInst = _mesa_alloc_instructions(p->max_inst);
-      if (!newInst) {
-         _mesa_error(NULL, GL_OUT_OF_MEMORY, "vertex program build");
-         return;
-      }
-
-      _mesa_copy_instructions(newInst,
-                              p->program->Base.Instructions,
-                              p->program->Base.NumInstructions);
-
-      _mesa_free_instructions(p->program->Base.Instructions,
-                              p->program->Base.NumInstructions);
-
-      p->program->Base.Instructions = newInst;
-   }
-
-   nr = p->program->Base.NumInstructions++;
-
-   inst = &p->program->Base.Instructions[nr];
-   inst->Opcode = (enum prog_opcode) op;
-   inst->Data = 0;
-
-   emit_arg( &inst->SrcReg[0], src0 );
-   emit_arg( &inst->SrcReg[1], src1 );
-   emit_arg( &inst->SrcReg[2], src2 );
-
-   emit_dst( &inst->DstReg, dest, mask );
-
-   debug_insn(inst, fn, line);
-}
-
-
-#define emit_op3(p, op, dst, mask, src0, src1, src2) \
-   emit_op3fn(p, op, dst, mask, src0, src1, src2, __FUNCTION__, __LINE__)
-
-#define emit_op2(p, op, dst, mask, src0, src1) \
-    emit_op3fn(p, op, dst, mask, src0, src1, undef, __FUNCTION__, __LINE__)
-
-#define emit_op1(p, op, dst, mask, src0) \
-    emit_op3fn(p, op, dst, mask, src0, undef, undef, __FUNCTION__, __LINE__)
-
-
-static struct ureg make_temp( struct tnl_program *p, struct ureg reg )
-{
-   if (reg.file == PROGRAM_TEMPORARY &&
-       !(p->temp_reserved & (1<<reg.idx)))
-      return reg;
-   else {
-      struct ureg temp = get_temp(p);
-      emit_op1(p, OPCODE_MOV, temp, 0, reg);
-      return temp;
-   }
-}
-
-
-/* Currently no tracking performed of input/output/register size or
- * active elements.  Could be used to reduce these operations, as
- * could the matrix type.
- */
-static void emit_matrix_transform_vec4( struct tnl_program *p,
-                                       struct ureg dest,
-                                       const struct ureg *mat,
-                                       struct ureg src)
-{
-   emit_op2(p, OPCODE_DP4, dest, WRITEMASK_X, src, mat[0]);
-   emit_op2(p, OPCODE_DP4, dest, WRITEMASK_Y, src, mat[1]);
-   emit_op2(p, OPCODE_DP4, dest, WRITEMASK_Z, src, mat[2]);
-   emit_op2(p, OPCODE_DP4, dest, WRITEMASK_W, src, mat[3]);
-}
-
-
-/* This version is much easier to implement if writemasks are not
- * supported natively on the target or (like SSE), the target doesn't
- * have a clean/obvious dotproduct implementation.
- */
-static void emit_transpose_matrix_transform_vec4( struct tnl_program *p,
-                                                 struct ureg dest,
-                                                 const struct ureg *mat,
-                                                 struct ureg src)
-{
-   struct ureg tmp;
-
-   if (dest.file != PROGRAM_TEMPORARY)
-      tmp = get_temp(p);
-   else
-      tmp = dest;
-
-   emit_op2(p, OPCODE_MUL, tmp, 0, swizzle1(src,X), mat[0]);
-   emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Y), mat[1], tmp);
-   emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Z), mat[2], tmp);
-   emit_op3(p, OPCODE_MAD, dest, 0, swizzle1(src,W), mat[3], tmp);
-
-   if (dest.file != PROGRAM_TEMPORARY)
-      release_temp(p, tmp);
-}
-
-
-static void emit_matrix_transform_vec3( struct tnl_program *p,
-                                       struct ureg dest,
-                                       const struct ureg *mat,
-                                       struct ureg src)
-{
-   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_X, src, mat[0]);
-   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_Y, src, mat[1]);
-   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_Z, src, mat[2]);
-}
-
-
-static void emit_normalize_vec3( struct tnl_program *p,
-                                struct ureg dest,
-                                struct ureg src )
-{
-#if 0
-   /* XXX use this when drivers are ready for NRM3 */
-   emit_op1(p, OPCODE_NRM3, dest, WRITEMASK_XYZ, src);
-#else
-   struct ureg tmp = get_temp(p);
-   emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src);
-   emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
-   emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X));
-   release_temp(p, tmp);
-#endif
-}
-
-
-static void emit_passthrough( struct tnl_program *p,
-                             GLuint input,
-                             GLuint output )
-{
-   struct ureg out = register_output(p, output);
-   emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input));
-}
-
-
-static struct ureg get_eye_position( struct tnl_program *p )
-{
-   if (is_undef(p->eye_position)) {
-      struct ureg pos = register_input( p, VERT_ATTRIB_POS );
-      struct ureg modelview[4];
-
-      p->eye_position = reserve_temp(p);
-
-      if (p->mvp_with_dp4) {
-        register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
-                                 0, modelview );
-
-        emit_matrix_transform_vec4(p, p->eye_position, modelview, pos);
-      }
-      else {
-        register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
-                                STATE_MATRIX_TRANSPOSE, modelview );
-
-        emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos);
-      }
-   }
-
-   return p->eye_position;
-}
-
-
-static struct ureg get_eye_position_z( struct tnl_program *p )
-{
-   if (!is_undef(p->eye_position))
-      return swizzle1(p->eye_position, Z);
-
-   if (is_undef(p->eye_position_z)) {
-      struct ureg pos = register_input( p, VERT_ATTRIB_POS );
-      struct ureg modelview[4];
-
-      p->eye_position_z = reserve_temp(p);
-
-      register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
-                              0, modelview );
-
-      emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]);
-   }
-
-   return p->eye_position_z;
-}
-
-
-static struct ureg get_eye_position_normalized( struct tnl_program *p )
-{
-   if (is_undef(p->eye_position_normalized)) {
-      struct ureg eye = get_eye_position(p);
-      p->eye_position_normalized = reserve_temp(p);
-      emit_normalize_vec3(p, p->eye_position_normalized, eye);
-   }
-
-   return p->eye_position_normalized;
-}
-
-
-static struct ureg get_transformed_normal( struct tnl_program *p )
-{
-   if (is_undef(p->transformed_normal) &&
-       !p->state->need_eye_coords &&
-       !p->state->normalize &&
-       !(p->state->need_eye_coords == p->state->rescale_normals))
-   {
-      p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL );
-   }
-   else if (is_undef(p->transformed_normal))
-   {
-      struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
-      struct ureg mvinv[3];
-      struct ureg transformed_normal = reserve_temp(p);
-
-      if (p->state->need_eye_coords) {
-         register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2,
-                                 STATE_MATRIX_INVTRANS, mvinv );
-
-         /* Transform to eye space:
-          */
-         emit_matrix_transform_vec3( p, transformed_normal, mvinv, normal );
-         normal = transformed_normal;
-      }
-
-      /* Normalize/Rescale:
-       */
-      if (p->state->normalize) {
-        emit_normalize_vec3( p, transformed_normal, normal );
-         normal = transformed_normal;
-      }
-      else if (p->state->need_eye_coords == p->state->rescale_normals) {
-         /* This is already adjusted for eye/non-eye rendering:
-          */
-        struct ureg rescale = register_param2(p, STATE_INTERNAL,
-                                               STATE_NORMAL_SCALE);
-
-        emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
-         normal = transformed_normal;
-      }
-
-      assert(normal.file == PROGRAM_TEMPORARY);
-      p->transformed_normal = normal;
-   }
-
-   return p->transformed_normal;
-}
-
-
-static void build_hpos( struct tnl_program *p )
-{
-   struct ureg pos = register_input( p, VERT_ATTRIB_POS );
-   struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
-   struct ureg mvp[4];
-
-   if (p->mvp_with_dp4) {
-      register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
-                             0, mvp );
-      emit_matrix_transform_vec4( p, hpos, mvp, pos );
-   }
-   else {
-      register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
-                             STATE_MATRIX_TRANSPOSE, mvp );
-      emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos );
-   }
-}
-
-
-static GLuint material_attrib( GLuint side, GLuint property )
-{
-   return (property - STATE_AMBIENT) * 2 + side;
-}
-
-
-/**
- * Get a bitmask of which material values vary on a per-vertex basis.
- */
-static void set_material_flags( struct tnl_program *p )
-{
-   p->color_materials = 0;
-   p->materials = 0;
-
-   if (p->state->varying_vp_inputs & VERT_BIT_COLOR0) {
-      p->materials =
-        p->color_materials = p->state->light_color_material_mask;
-   }
-
-   p->materials |= (p->state->varying_vp_inputs >> VERT_ATTRIB_GENERIC0);
-}
-
-
-static struct ureg get_material( struct tnl_program *p, GLuint side,
-                                GLuint property )
-{
-   GLuint attrib = material_attrib(side, property);
-
-   if (p->color_materials & (1<<attrib))
-      return register_input(p, VERT_ATTRIB_COLOR0);
-   else if (p->materials & (1<<attrib)) {
-      /* Put material values in the GENERIC slots -- they are not used
-       * for anything in fixed function mode.
-       */
-      return register_input( p, attrib + VERT_ATTRIB_GENERIC0 );
-   }
-   else
-      return register_param3( p, STATE_MATERIAL, side, property );
-}
-
-#define SCENE_COLOR_BITS(side) (( MAT_BIT_FRONT_EMISSION | \
-                                  MAT_BIT_FRONT_AMBIENT | \
-                                  MAT_BIT_FRONT_DIFFUSE) << (side))
-
-
-/**
- * Either return a precalculated constant value or emit code to
- * calculate these values dynamically in the case where material calls
- * are present between begin/end pairs.
- *
- * Probably want to shift this to the program compilation phase - if
- * we always emitted the calculation here, a smart compiler could
- * detect that it was constant (given a certain set of inputs), and
- * lift it out of the main loop.  That way the programs created here
- * would be independent of the vertex_buffer details.
- */
-static struct ureg get_scenecolor( struct tnl_program *p, GLuint side )
-{
-   if (p->materials & SCENE_COLOR_BITS(side)) {
-      struct ureg lm_ambient = register_param1(p, STATE_LIGHTMODEL_AMBIENT);
-      struct ureg material_emission = get_material(p, side, STATE_EMISSION);
-      struct ureg material_ambient = get_material(p, side, STATE_AMBIENT);
-      struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE);
-      struct ureg tmp = make_temp(p, material_diffuse);
-      emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient,
-              material_ambient, material_emission);
-      return tmp;
-   }
-   else
-      return register_param2( p, STATE_LIGHTMODEL_SCENECOLOR, side );
-}
-
-
-static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
-                                 GLuint side, GLuint property )
-{
-   GLuint attrib = material_attrib(side, property);
-   if (p->materials & (1<<attrib)) {
-      struct ureg light_value =
-        register_param3(p, STATE_LIGHT, light, property);
-      struct ureg material_value = get_material(p, side, property);
-      struct ureg tmp = get_temp(p);
-      emit_op2(p, OPCODE_MUL, tmp, 0, light_value, material_value);
-      return tmp;
-   }
-   else
-      return register_param4(p, STATE_LIGHTPROD, light, side, property);
-}
-
-
-static struct ureg calculate_light_attenuation( struct tnl_program *p,
-                                               GLuint i,
-                                               struct ureg VPpli,
-                                               struct ureg dist )
-{
-   struct ureg attenuation = register_param3(p, STATE_LIGHT, i,
-                                            STATE_ATTENUATION);
-   struct ureg att = undef;
-
-   /* Calculate spot attenuation:
-    */
-   if (!p->state->unit[i].light_spotcutoff_is_180) {
-      struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL,
-                                                 STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
-      struct ureg spot = get_temp(p);
-      struct ureg slt = get_temp(p);
-
-      att = get_temp(p);
-
-      emit_op2(p, OPCODE_DP3, spot, 0, negate(VPpli), spot_dir_norm);
-      emit_op2(p, OPCODE_SLT, slt, 0, swizzle1(spot_dir_norm,W), spot);
-      emit_op2(p, OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W));
-      emit_op2(p, OPCODE_MUL, att, 0, slt, spot);
-
-      release_temp(p, spot);
-      release_temp(p, slt);
-   }
-
-   /* Calculate distance attenuation(See formula (2.4) at glspec 2.1 page 62):
-    *
-    * Skip the calucation when _dist_ is undefined(light_eyepos3_is_zero)
-    */
-   if (p->state->unit[i].light_attenuated && !is_undef(dist)) {
-      if (is_undef(att))
-         att = get_temp(p);
-      /* 1/d,d,d,1/d */
-      emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist);
-      /* 1,d,d*d,1/d */
-      emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y));
-      /* 1/dist-atten */
-      emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist);
-
-      if (!p->state->unit[i].light_spotcutoff_is_180) {
-        /* dist-atten */
-        emit_op1(p, OPCODE_RCP, dist, 0, dist);
-        /* spot-atten * dist-atten */
-        emit_op2(p, OPCODE_MUL, att, 0, dist, att);
-      }
-      else {
-        /* dist-atten */
-        emit_op1(p, OPCODE_RCP, att, 0, dist);
-      }
-   }
-
-   return att;
-}
-
-
-/**
- * Compute:
- *   lit.y = MAX(0, dots.x)
- *   lit.z = SLT(0, dots.x)
- */
-static void emit_degenerate_lit( struct tnl_program *p,
-                                 struct ureg lit,
-                                 struct ureg dots )
-{
-   struct ureg id = get_identity_param(p);  /* id = {0,0,0,1} */
-
-   /* Note that lit.x & lit.w will not be examined.  Note also that
-    * dots.xyzw == dots.xxxx.
-    */
-
-   /* MAX lit, id, dots;
-    */
-   emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots);
-
-   /* result[2] = (in > 0 ? 1 : 0)
-    * SLT lit.z, id.z, dots;   # lit.z = (0 < dots.z) ? 1 : 0
-    */
-   emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, swizzle1(id,Z), dots);
-}
-
-
-/* Need to add some addtional parameters to allow lighting in object
- * space - STATE_SPOT_DIRECTION and STATE_HALF_VECTOR implicitly assume eye
- * space lighting.
- */
-static void build_lighting( struct tnl_program *p )
-{
-   const GLboolean twoside = p->state->light_twoside;
-   const GLboolean separate = p->state->separate_specular;
-   GLuint nr_lights = 0, count = 0;
-   struct ureg normal = get_transformed_normal(p);
-   struct ureg lit = get_temp(p);
-   struct ureg dots = get_temp(p);
-   struct ureg _col0 = undef, _col1 = undef;
-   struct ureg _bfc0 = undef, _bfc1 = undef;
-   GLuint i;
-
-   /*
-    * NOTE:
-    * dots.x = dot(normal, VPpli)
-    * dots.y = dot(normal, halfAngle)
-    * dots.z = back.shininess
-    * dots.w = front.shininess
-    */
-
-   for (i = 0; i < MAX_LIGHTS; i++)
-      if (p->state->unit[i].light_enabled)
-        nr_lights++;
-
-   set_material_flags(p);
-
-   {
-      if (!p->state->material_shininess_is_zero) {
-         struct ureg shininess = get_material(p, 0, STATE_SHININESS);
-         emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X));
-         release_temp(p, shininess);
-      }
-
-      _col0 = make_temp(p, get_scenecolor(p, 0));
-      if (separate)
-        _col1 = make_temp(p, get_identity_param(p));
-      else
-        _col1 = _col0;
-   }
-
-   if (twoside) {
-      if (!p->state->material_shininess_is_zero) {
-         /* Note that we negate the back-face specular exponent here.
-          * The negation will be un-done later in the back-face code below.
-          */
-         struct ureg shininess = get_material(p, 1, STATE_SHININESS);
-         emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
-                  negate(swizzle1(shininess,X)));
-         release_temp(p, shininess);
-      }
-
-      _bfc0 = make_temp(p, get_scenecolor(p, 1));
-      if (separate)
-        _bfc1 = make_temp(p, get_identity_param(p));
-      else
-        _bfc1 = _bfc0;
-   }
-
-   /* If no lights, still need to emit the scenecolor.
-    */
-   {
-      struct ureg res0 = register_output( p, VERT_RESULT_COL0 );
-      emit_op1(p, OPCODE_MOV, res0, 0, _col0);
-   }
-
-   if (separate) {
-      struct ureg res1 = register_output( p, VERT_RESULT_COL1 );
-      emit_op1(p, OPCODE_MOV, res1, 0, _col1);
-   }
-
-   if (twoside) {
-      struct ureg res0 = register_output( p, VERT_RESULT_BFC0 );
-      emit_op1(p, OPCODE_MOV, res0, 0, _bfc0);
-   }
-
-   if (twoside && separate) {
-      struct ureg res1 = register_output( p, VERT_RESULT_BFC1 );
-      emit_op1(p, OPCODE_MOV, res1, 0, _bfc1);
-   }
-
-   if (nr_lights == 0) {
-      release_temps(p);
-      return;
-   }
-
-   for (i = 0; i < MAX_LIGHTS; i++) {
-      if (p->state->unit[i].light_enabled) {
-        struct ureg half = undef;
-        struct ureg att = undef, VPpli = undef;
-        struct ureg dist = undef;
-
-        count++;
-         if (p->state->unit[i].light_eyepos3_is_zero) {
-             VPpli = register_param3(p, STATE_INTERNAL,
-                                     STATE_LIGHT_POSITION_NORMALIZED, i);
-         } else {
-            struct ureg Ppli = register_param3(p, STATE_INTERNAL,
-                                               STATE_LIGHT_POSITION, i);
-            struct ureg V = get_eye_position(p);
-
-            VPpli = get_temp(p);
-            dist = get_temp(p);
-
-            /* Calculate VPpli vector
-             */
-            emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V);
-
-            /* Normalize VPpli.  The dist value also used in
-             * attenuation below.
-             */
-            emit_op2(p, OPCODE_DP3, dist, 0, VPpli, VPpli);
-            emit_op1(p, OPCODE_RSQ, dist, 0, dist);
-            emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist);
-         }
-
-         /* Calculate attenuation:
-          */
-         att = calculate_light_attenuation(p, i, VPpli, dist);
-         release_temp(p, dist);
-
-        /* Calculate viewer direction, or use infinite viewer:
-         */
-         if (!p->state->material_shininess_is_zero) {
-            if (p->state->light_local_viewer) {
-               struct ureg eye_hat = get_eye_position_normalized(p);
-               half = get_temp(p);
-               emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
-               emit_normalize_vec3(p, half, half);
-            } else if (p->state->unit[i].light_eyepos3_is_zero) {
-               half = register_param3(p, STATE_INTERNAL,
-                                      STATE_LIGHT_HALF_VECTOR, i);
-            } else {
-               struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
-               half = get_temp(p);
-               emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
-               emit_normalize_vec3(p, half, half);
-            }
-        }
-
-        /* Calculate dot products:
-         */
-         if (p->state->material_shininess_is_zero) {
-            emit_op2(p, OPCODE_DP3, dots, 0, normal, VPpli);
-         }
-         else {
-            emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli);
-            emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half);
-         }
-
-        /* Front face lighting:
-         */
-        {
-           struct ureg ambient = get_lightprod(p, i, 0, STATE_AMBIENT);
-           struct ureg diffuse = get_lightprod(p, i, 0, STATE_DIFFUSE);
-           struct ureg specular = get_lightprod(p, i, 0, STATE_SPECULAR);
-           struct ureg res0, res1;
-           GLuint mask0, mask1;
-
-           if (count == nr_lights) {
-              if (separate) {
-                 mask0 = WRITEMASK_XYZ;
-                 mask1 = WRITEMASK_XYZ;
-                 res0 = register_output( p, VERT_RESULT_COL0 );
-                 res1 = register_output( p, VERT_RESULT_COL1 );
-              }
-              else {
-                 mask0 = 0;
-                 mask1 = WRITEMASK_XYZ;
-                 res0 = _col0;
-                 res1 = register_output( p, VERT_RESULT_COL0 );
-              }
-           }
-            else {
-              mask0 = 0;
-              mask1 = 0;
-              res0 = _col0;
-              res1 = _col1;
-           }
-
-           if (!is_undef(att)) {
-               /* light is attenuated by distance */
-               emit_op1(p, OPCODE_LIT, lit, 0, dots);
-               emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
-               emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0);
-            }
-            else if (!p->state->material_shininess_is_zero) {
-               /* there's a non-zero specular term */
-               emit_op1(p, OPCODE_LIT, lit, 0, dots);
-               emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
-            }
-            else {
-               /* no attenutation, no specular */
-               emit_degenerate_lit(p, lit, dots);
-               emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
-            }
-
-           emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0);
-           emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1);
-
-           release_temp(p, ambient);
-           release_temp(p, diffuse);
-           release_temp(p, specular);
-        }
-
-        /* Back face lighting:
-         */
-        if (twoside) {
-           struct ureg ambient = get_lightprod(p, i, 1, STATE_AMBIENT);
-           struct ureg diffuse = get_lightprod(p, i, 1, STATE_DIFFUSE);
-           struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR);
-           struct ureg res0, res1;
-           GLuint mask0, mask1;
-
-           if (count == nr_lights) {
-              if (separate) {
-                 mask0 = WRITEMASK_XYZ;
-                 mask1 = WRITEMASK_XYZ;
-                 res0 = register_output( p, VERT_RESULT_BFC0 );
-                 res1 = register_output( p, VERT_RESULT_BFC1 );
-              }
-              else {
-                 mask0 = 0;
-                 mask1 = WRITEMASK_XYZ;
-                 res0 = _bfc0;
-                 res1 = register_output( p, VERT_RESULT_BFC0 );
-              }
-           }
-            else {
-              res0 = _bfc0;
-              res1 = _bfc1;
-              mask0 = 0;
-              mask1 = 0;
-           }
-
-            /* For the back face we need to negate the X and Y component
-             * dot products.  dots.Z has the negated back-face specular
-             * exponent.  We swizzle that into the W position.  This
-             * negation makes the back-face specular term positive again.
-             */
-            dots = negate(swizzle(dots,X,Y,W,Z));
-
-           if (!is_undef(att)) {
-               emit_op1(p, OPCODE_LIT, lit, 0, dots);
-              emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
-               emit_op3(p, OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0);
-            }
-            else if (!p->state->material_shininess_is_zero) {
-               emit_op1(p, OPCODE_LIT, lit, 0, dots);
-               emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); /**/
-            }
-            else {
-               emit_degenerate_lit(p, lit, dots);
-               emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0);
-            }
-
-           emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
-           emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
-            /* restore dots to its original state for subsequent lights
-             * by negating and swizzling again.
-             */
-            dots = negate(swizzle(dots,X,Y,W,Z));
-
-           release_temp(p, ambient);
-           release_temp(p, diffuse);
-           release_temp(p, specular);
-        }
-
-        release_temp(p, half);
-        release_temp(p, VPpli);
-        release_temp(p, att);
-      }
-   }
-
-   release_temps( p );
-}
-
-
-static void build_fog( struct tnl_program *p )
-{
-   struct ureg fog = register_output(p, VERT_RESULT_FOGC);
-   struct ureg input;
-
-   if (p->state->fog_source_is_depth) {
-
-      switch (p->state->fog_distance_mode) {
-      case FDM_EYE_RADIAL: /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */
-       input = get_eye_position(p);
-       emit_op2(p, OPCODE_DP3, fog, WRITEMASK_X, input, input);
-       emit_op1(p, OPCODE_RSQ, fog, WRITEMASK_X, fog);
-       emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, fog);
-       break;
-      case FDM_EYE_PLANE: /* Z = Ze */
-       input = get_eye_position_z(p);
-       emit_op1(p, OPCODE_MOV, fog, WRITEMASK_X, input);
-       break;
-      case FDM_EYE_PLANE_ABS: /* Z = abs(Ze) */
-       input = get_eye_position_z(p);
-       emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
-       break;
-      default: assert(0); break; /* can't happen */
-      }
-
-   }
-   else {
-      input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
-      emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
-   }
-
-   emit_op1(p, OPCODE_MOV, fog, WRITEMASK_YZW, get_identity_param(p));
-}
-
-
-static void build_reflect_texgen( struct tnl_program *p,
-                                 struct ureg dest,
-                                 GLuint writemask )
-{
-   struct ureg normal = get_transformed_normal(p);
-   struct ureg eye_hat = get_eye_position_normalized(p);
-   struct ureg tmp = get_temp(p);
-
-   /* n.u */
-   emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
-   /* 2n.u */
-   emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
-   /* (-2n.u)n + u */
-   emit_op3(p, OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat);
-
-   release_temp(p, tmp);
-}
-
-
-static void build_sphere_texgen( struct tnl_program *p,
-                                struct ureg dest,
-                                GLuint writemask )
-{
-   struct ureg normal = get_transformed_normal(p);
-   struct ureg eye_hat = get_eye_position_normalized(p);
-   struct ureg tmp = get_temp(p);
-   struct ureg half = register_scalar_const(p, .5);
-   struct ureg r = get_temp(p);
-   struct ureg inv_m = get_temp(p);
-   struct ureg id = get_identity_param(p);
-
-   /* Could share the above calculations, but it would be
-    * a fairly odd state for someone to set (both sphere and
-    * reflection active for different texture coordinate
-    * components.  Of course - if two texture units enable
-    * reflect and/or sphere, things start to tilt in favour
-    * of seperating this out:
-    */
-
-   /* n.u */
-   emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
-   /* 2n.u */
-   emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
-   /* (-2n.u)n + u */
-   emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat);
-   /* r + 0,0,1 */
-   emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z));
-   /* rx^2 + ry^2 + (rz+1)^2 */
-   emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp);
-   /* 2/m */
-   emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
-   /* 1/m */
-   emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half);
-   /* r/m + 1/2 */
-   emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half);
-
-   release_temp(p, tmp);
-   release_temp(p, r);
-   release_temp(p, inv_m);
-}
-
-
-static void build_texture_transform( struct tnl_program *p )
-{
-   GLuint i, j;
-
-   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
-
-      if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
-        continue;
-
-      if (p->state->unit[i].coord_replace)
-        continue;
-
-      if (p->state->unit[i].texgen_enabled ||
-         p->state->unit[i].texmat_enabled) {
-
-        GLuint texmat_enabled = p->state->unit[i].texmat_enabled;
-        struct ureg out = register_output(p, VERT_RESULT_TEX0 + i);
-        struct ureg out_texgen = undef;
-
-        if (p->state->unit[i].texgen_enabled) {
-           GLuint copy_mask = 0;
-           GLuint sphere_mask = 0;
-           GLuint reflect_mask = 0;
-           GLuint normal_mask = 0;
-           GLuint modes[4];
-
-           if (texmat_enabled)
-              out_texgen = get_temp(p);
-           else
-              out_texgen = out;
-
-           modes[0] = p->state->unit[i].texgen_mode0;
-           modes[1] = p->state->unit[i].texgen_mode1;
-           modes[2] = p->state->unit[i].texgen_mode2;
-           modes[3] = p->state->unit[i].texgen_mode3;
-
-           for (j = 0; j < 4; j++) {
-              switch (modes[j]) {
-              case TXG_OBJ_LINEAR: {
-                 struct ureg obj = register_input(p, VERT_ATTRIB_POS);
-                 struct ureg plane =
-                    register_param3(p, STATE_TEXGEN, i,
-                                    STATE_TEXGEN_OBJECT_S + j);
-
-                 emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
-                          obj, plane );
-                 break;
-              }
-              case TXG_EYE_LINEAR: {
-                 struct ureg eye = get_eye_position(p);
-                 struct ureg plane =
-                    register_param3(p, STATE_TEXGEN, i,
-                                    STATE_TEXGEN_EYE_S + j);
-
-                 emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
-                          eye, plane );
-                 break;
-              }
-              case TXG_SPHERE_MAP:
-                 sphere_mask |= WRITEMASK_X << j;
-                 break;
-              case TXG_REFLECTION_MAP:
-                 reflect_mask |= WRITEMASK_X << j;
-                 break;
-              case TXG_NORMAL_MAP:
-                 normal_mask |= WRITEMASK_X << j;
-                 break;
-              case TXG_NONE:
-                 copy_mask |= WRITEMASK_X << j;
-              }
-           }
-
-           if (sphere_mask) {
-              build_sphere_texgen(p, out_texgen, sphere_mask);
-           }
-
-           if (reflect_mask) {
-              build_reflect_texgen(p, out_texgen, reflect_mask);
-           }
-
-           if (normal_mask) {
-              struct ureg normal = get_transformed_normal(p);
-              emit_op1(p, OPCODE_MOV, out_texgen, normal_mask, normal );
-           }
-
-           if (copy_mask) {
-              struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i);
-              emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in );
-           }
-        }
-
-        if (texmat_enabled) {
-           struct ureg texmat[4];
-           struct ureg in = (!is_undef(out_texgen) ?
-                             out_texgen :
-                             register_input(p, VERT_ATTRIB_TEX0+i));
-           if (p->mvp_with_dp4) {
-              register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
-                                      0, texmat );
-              emit_matrix_transform_vec4( p, out, texmat, in );
-           }
-           else {
-              register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
-                                      STATE_MATRIX_TRANSPOSE, texmat );
-              emit_transpose_matrix_transform_vec4( p, out, texmat, in );
-           }
-        }
-
-        release_temps(p);
-      }
-      else {
-        emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
-      }
-   }
-}
-
-
-/**
- * Point size attenuation computation.
- */
-static void build_atten_pointsize( struct tnl_program *p )
-{
-   struct ureg eye = get_eye_position_z(p);
-   struct ureg state_size = register_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED);
-   struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
-   struct ureg out = register_output(p, VERT_RESULT_PSIZ);
-   struct ureg ut = get_temp(p);
-
-   /* dist = |eyez| */
-   emit_op1(p, OPCODE_ABS, ut, WRITEMASK_Y, swizzle1(eye, Z));
-   /* p1 + dist * (p2 + dist * p3); */
-   emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y),
-               swizzle1(state_attenuation, Z), swizzle1(state_attenuation, Y));
-   emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y),
-               ut, swizzle1(state_attenuation, X));
-
-   /* 1 / sqrt(factor) */
-   emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut );
-
-#if 0
-   /* out = pointSize / sqrt(factor) */
-   emit_op2(p, OPCODE_MUL, out, WRITEMASK_X, ut, state_size);
-#else
-   /* this is a good place to clamp the point size since there's likely
-    * no hardware registers to clamp point size at rasterization time.
-    */
-   emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size);
-   emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y));
-   emit_op2(p, OPCODE_MIN, out, WRITEMASK_X, ut, swizzle1(state_size, Z));
-#endif
-
-   release_temp(p, ut);
-}
-
-
-/**
- * Pass-though per-vertex point size, from user's point size array.
- */
-static void build_array_pointsize( struct tnl_program *p )
-{
-   struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE);
-   struct ureg out = register_output(p, VERT_RESULT_PSIZ);
-   emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in);
-}
-
-
-static void build_tnl_program( struct tnl_program *p )
-{
-   /* Emit the program, starting with modelviewproject:
-    */
-   build_hpos(p);
-
-   /* Lighting calculations:
-    */
-   if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) {
-      if (p->state->light_global_enabled)
-        build_lighting(p);
-      else {
-        if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
-           emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
-
-        if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
-           emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
-      }
-   }
-
-   if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC)
-      build_fog(p);
-
-   if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY)
-      build_texture_transform(p);
-
-   if (p->state->point_attenuated)
-      build_atten_pointsize(p);
-   else if (p->state->point_array)
-      build_array_pointsize(p);
-
-   /* Finish up:
-    */
-   emit_op1(p, OPCODE_END, undef, 0, undef);
-
-   /* Disassemble:
-    */
-   if (DISASSEM) {
-      printf ("\n");
-   }
-}
-
-
-static void
-create_new_program( const struct state_key *key,
-                    struct gl_vertex_program *program,
-                    GLboolean mvp_with_dp4,
-                    GLuint max_temps)
-{
-   struct tnl_program p;
-
-   memset(&p, 0, sizeof(p));
-   p.state = key;
-   p.program = program;
-   p.eye_position = undef;
-   p.eye_position_z = undef;
-   p.eye_position_normalized = undef;
-   p.transformed_normal = undef;
-   p.identity = undef;
-   p.temp_in_use = 0;
-   p.mvp_with_dp4 = mvp_with_dp4;
-
-   if (max_temps >= sizeof(int) * 8)
-      p.temp_reserved = 0;
-   else
-      p.temp_reserved = ~((1<<max_temps)-1);
-
-   /* Start by allocating 32 instructions.
-    * If we need more, we'll grow the instruction array as needed.
-    */
-   p.max_inst = 32;
-   p.program->Base.Instructions = _mesa_alloc_instructions(p.max_inst);
-   p.program->Base.String = NULL;
-   p.program->Base.NumInstructions =
-   p.program->Base.NumTemporaries =
-   p.program->Base.NumParameters =
-   p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0;
-   p.program->Base.Parameters = _mesa_new_parameter_list();
-   p.program->Base.InputsRead = 0;
-   p.program->Base.OutputsWritten = 0;
-
-   build_tnl_program( &p );
-}
-
-
-/**
- * Return a vertex program which implements the current fixed-function
- * transform/lighting/texgen operations.
- * XXX move this into core mesa (main/)
- */
-struct gl_vertex_program *
-_mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
-{
-   struct gl_vertex_program *prog;
-   struct state_key key;
-
-   /* Grab all the relevent state and put it in a single structure:
-    */
-   make_state_key(ctx, &key);
-
-   /* Look for an already-prepared program for this state:
-    */
-   prog = (struct gl_vertex_program *)
-      _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key));
-
-   if (!prog) {
-      /* OK, we'll have to build a new one */
-      if (0)
-         printf("Build new TNL program\n");
-
-      prog = (struct gl_vertex_program *)
-         ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
-      if (!prog)
-         return NULL;
-
-      create_new_program( &key, prog,
-                          ctx->mvp_with_dp4,
-                          ctx->Const.VertexProgram.MaxTemps );
-
-#if 0
-      if (ctx->Driver.ProgramStringNotify)
-         ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
-                                          &prog->Base );
-#endif
-      _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
-                                 &key, sizeof(key), &prog->Base);
-   }
-
-   return prog;
-}
diff --git a/reactos/dll/opengl/mesa/src/mesa/main/ffvertex_prog.h b/reactos/dll/opengl/mesa/src/mesa/main/ffvertex_prog.h
deleted file mode 100644 (file)
index 837a15e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, 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 TUNGSTEN GRAPHICS 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.
- * 
- **************************************************************************/
-
-
-#ifndef FFVERTEX_PROG_H
-#define FFVERTEX_PROG_H
-
-
-struct gl_context;
-
-struct gl_vertex_program *
-_mesa_get_fixed_func_vertex_program(struct gl_context *ctx);
-
-
-
-#endif /* FFVERTEX_PROG_H */
index e980425..8762da9 100644 (file)
@@ -969,32 +969,6 @@ pack_float_RG1616_REV(const GLfloat src[4], void *dst)
 }
 
 
-/* MESA_FORMAT_ARGB2101010 */
-
-static void
-pack_ubyte_ARGB2101010(const GLubyte src[4], void *dst)
-{
-   GLuint *d = ((GLuint *) dst);
-   GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
-   GLushort g = UBYTE_TO_USHORT(src[GCOMP]);
-   GLushort b = UBYTE_TO_USHORT(src[BCOMP]);
-   GLushort a = UBYTE_TO_USHORT(src[ACOMP]);
-   *d = PACK_COLOR_2101010_US(a, r, g, b);
-}
-
-static void
-pack_float_ARGB2101010(const GLfloat src[4], void *dst)
-{
-   GLuint *d = ((GLuint *) dst);
-   GLushort r, g, b, a;
-   UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
-   UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
-   UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
-   UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
-   *d = PACK_COLOR_2101010_US(a, r, g, b);
-}
-
-
 /* MESA_FORMAT_SRGB8 */
 
 static void
@@ -1638,7 +1612,6 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format)
       table[MESA_FORMAT_R16] = pack_ubyte_R16;
       table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616;
       table[MESA_FORMAT_RG1616_REV] = pack_ubyte_RG1616_REV;
-      table[MESA_FORMAT_ARGB2101010] = pack_ubyte_ARGB2101010;
 
       /* should never convert RGBA to these formats */
       table[MESA_FORMAT_Z24_S8] = NULL;
@@ -1780,7 +1753,6 @@ _mesa_get_pack_float_rgba_function(gl_format format)
       table[MESA_FORMAT_R16] = pack_float_R16;
       table[MESA_FORMAT_RG1616] = pack_float_RG1616;
       table[MESA_FORMAT_RG1616_REV] = pack_float_RG1616_REV;
-      table[MESA_FORMAT_ARGB2101010] = pack_float_ARGB2101010;
 
       /* should never convert RGBA to these formats */
       table[MESA_FORMAT_Z24_S8] = NULL;
index c16bf59..150ec2b 100644 (file)
@@ -586,19 +586,6 @@ unpack_RG1616_REV(const void *src, GLfloat dst[][4], GLuint n)
    }
 }
 
-static void
-unpack_ARGB2101010(const void *src, GLfloat dst[][4], GLuint n)
-{
-   const GLuint *s = ((const GLuint *) src);
-   GLuint i;
-   for (i = 0; i < n; i++) {
-      dst[i][RCOMP] = ((s[i] >> 20) & 0x3ff) * (1.0F / 1023.0F);
-      dst[i][GCOMP] = ((s[i] >> 10) & 0x3ff) * (1.0F / 1023.0F);
-      dst[i][BCOMP] = ((s[i] >>  0) & 0x3ff) * (1.0F / 1023.0F);
-      dst[i][ACOMP] = ((s[i] >> 30) &  0x03) * (1.0F / 3.0F);
-   }
-}
-
 
 static void
 unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
@@ -1461,7 +1448,6 @@ get_unpack_rgba_function(gl_format format)
       table[MESA_FORMAT_R16] = unpack_R16;
       table[MESA_FORMAT_RG1616] = unpack_RG1616;
       table[MESA_FORMAT_RG1616_REV] = unpack_RG1616_REV;
-      table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010;
       table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8;
       table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24;
       table[MESA_FORMAT_Z16] = unpack_Z16;
index 34366bc..81a37da 100644 (file)
@@ -420,15 +420,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       0, 0, 0, 0, 0,
       1, 1, 4
    },
-   {
-      MESA_FORMAT_ARGB2101010,
-      "MESA_FORMAT_ARGB2101010",
-      GL_RGBA,
-      GL_UNSIGNED_NORMALIZED,
-      10, 10, 10, 2,
-      0, 0, 0, 0, 0,
-      1, 1, 4
-   },
    {
       MESA_FORMAT_Z24_S8,          /* Name */
       "MESA_FORMAT_Z24_S8",        /* StrName */
@@ -2038,11 +2029,6 @@ _mesa_format_to_type_and_comps(gl_format format,
       *comps = 4;
       return;
 
-   case MESA_FORMAT_ARGB2101010:
-      *datatype = GL_UNSIGNED_INT_2_10_10_10_REV;
-      *comps = 4;
-      return;
-
    case MESA_FORMAT_RGBA5551:
       *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
       *comps = 4;
@@ -2586,9 +2572,6 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
    case MESA_FORMAT_RG1616_REV:
       return GL_FALSE;
 
-   case MESA_FORMAT_ARGB2101010:
-      return format == GL_BGRA && type == GL_UNSIGNED_INT_2_10_10_10_REV;
-
    case MESA_FORMAT_Z24_S8:
       return format == GL_DEPTH_STENCIL && type == GL_UNSIGNED_INT_24_8;
    case MESA_FORMAT_Z24_X8:
index 514de58..4c4d530 100644 (file)
@@ -104,7 +104,6 @@ typedef enum
    MESA_FORMAT_R16,            /*                     RRRR RRRR RRRR RRRR */
    MESA_FORMAT_RG1616,         /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
    MESA_FORMAT_RG1616_REV,     /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
-   MESA_FORMAT_ARGB2101010,     /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
    MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
    MESA_FORMAT_S8_Z24,          /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
    MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */
index 4b090be..b29769e 100644 (file)
@@ -86,7 +86,6 @@
 
 enum value_type {
    TYPE_INVALID,
-   TYPE_API_MASK,
    TYPE_INT,
    TYPE_INT_2,
    TYPE_INT_3,
@@ -131,7 +130,6 @@ enum value_extra {
    EXTRA_VERSION_30,
    EXTRA_VERSION_31,
    EXTRA_VERSION_32,
-   EXTRA_VERSION_ES2,
    EXTRA_NEW_BUFFERS, 
    EXTRA_NEW_FRAG_CLAMP,
    EXTRA_VALID_DRAW_BUFFER,
@@ -300,7 +298,6 @@ EXTRA_EXT(NV_texture_rectangle);
 EXTRA_EXT(EXT_stencil_two_side);
 EXTRA_EXT(NV_light_max_exponent);
 EXTRA_EXT(EXT_depth_bounds_test);
-EXTRA_EXT(ARB_depth_clamp);
 EXTRA_EXT(EXT_framebuffer_blit);
 EXTRA_EXT(ARB_shader_objects);
 EXTRA_EXT(ARB_fragment_shader);
@@ -320,7 +317,6 @@ EXTRA_EXT(ARB_color_buffer_float);
 EXTRA_EXT(ARB_copy_buffer);
 EXTRA_EXT(EXT_framebuffer_sRGB);
 EXTRA_EXT(ARB_texture_buffer_object);
-EXTRA_EXT(OES_EGL_image_external);
 
 static const int
 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -349,16 +345,7 @@ static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
 static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
 static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
 
-static const int
-extra_ARB_vertex_program_version_es2[] = {
-   EXT(ARB_vertex_program),
-   EXTRA_VERSION_ES2,
-   EXTRA_END
-};
-
 #define API_OPENGL_BIT (1 << API_OPENGL)
-#define API_OPENGLES_BIT (1 << API_OPENGLES)
-#define API_OPENGLES2_BIT (1 << API_OPENGLES2)
 
 /* This is the big table describing all the enums we accept in
  * glGet*v().  The table is partitioned into six parts: enums
@@ -371,9 +358,6 @@ extra_ARB_vertex_program_version_es2[] = {
  * 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, 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 },
@@ -500,9 +484,6 @@ static const struct value_desc values[] = {
     * GLSL: */
    { GL_MAX_CLIP_PLANES, CONTEXT_INT(Const.MaxClipPlanes), NO_EXTRA },
 
-#if FEATURE_GL || FEATURE_ES1
-   /* Enums in OpenGL and GLES1 */
-   { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_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 },
@@ -654,24 +635,7 @@ static const struct value_desc values[] = {
    { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
      CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy),
      extra_EXT_texture_filter_anisotropic },
-#endif /* FEATURE_GL || FEATURE_ES1 */
 
-#if FEATURE_ES1
-   { 0, 0, TYPE_API_MASK, API_OPENGLES_BIT },
-   /* XXX: OES_matrix_get */
-   { GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES },
-   { GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES },
-   { GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES },
-
-   /* OES_point_size_array */
-   { GL_POINT_SIZE_ARRAY_OES, ARRAY_FIELD(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_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 },
@@ -725,10 +689,6 @@ static const struct value_desc values[] = {
    { 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_version_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,
@@ -737,29 +697,7 @@ static const struct value_desc values[] = {
    /* GL_ARB_fragment_program/OES_standard_derivatives */
    { GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB,
      CONTEXT_ENUM(Hint.FragmentShaderDerivative), extra_ARB_fragment_shader },
-#endif /* FEATURE_GL || FEATURE_ES2 */
-
-#if FEATURE_ES2
-   /* Enums unique to OpenGL ES 2.0 */
-   { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, 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 */
-
-   /* 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 },
-
-#if FEATURE_GL
-   /* Remaining enums are only in OpenGL */
-   { 0, 0, TYPE_API_MASK, API_OPENGL_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 },
@@ -1142,10 +1080,6 @@ static const struct value_desc values[] = {
    { 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_EXT_framebuffer_blit
     * NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT */
    { GL_READ_FRAMEBUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0,
@@ -1212,7 +1146,6 @@ static const struct value_desc values[] = {
 
    /* GL_ARB_robustness */
    { GL_RESET_NOTIFICATION_STRATEGY_ARB, CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA },
-#endif /* FEATURE_GL */
 };
 
 /* All we need now is a way to look up the value struct from the enum.
@@ -1281,18 +1214,10 @@ 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) {
@@ -1341,7 +1266,6 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
    case GL_TEXTURE_2D_ARRAY_EXT:
    case GL_TEXTURE_CUBE_MAP_ARB:
    case GL_TEXTURE_RECTANGLE_NV:
-   case GL_TEXTURE_EXTERNAL_OES:
       v->value_bool = _mesa_IsEnabled(d->pname);
       break;
 
@@ -1692,11 +1616,6 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
          if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
             _mesa_update_state(ctx);
          break;
-      case EXTRA_VERSION_ES2:
-        if (ctx->API == API_OPENGLES2) {
-           total++;
-           enabled++;
-        }
         break;
       case EXTRA_NEW_BUFFERS:
         if (ctx->NewState & _NEW_BUFFERS)
@@ -1788,14 +1707,6 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
    while (1) {
       d = &values[table[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)) {
-        _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
-                     _mesa_lookup_enum_by_nr(pname));
-        return &error_value;
-      }
-
       if (likely(d->pname == pname))
         break;
 
index dbf6c3f..9e1526e 100644 (file)
 static const GLubyte *
 shading_language_version(struct gl_context *ctx)
 {
-   switch (ctx->API) {
-   case API_OPENGL:
-      if (!ctx->Extensions.ARB_shader_objects) {
-         _mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
-         return (const GLubyte *) 0;
-      }
+   if (!ctx->Extensions.ARB_shader_objects) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
+      return (const GLubyte *) 0;
+   }
 
-      switch (ctx->Const.GLSLVersion) {
+   switch (ctx->Const.GLSLVersion) {
       case 110:
          return (const GLubyte *) "1.10";
       case 120:
@@ -57,18 +55,6 @@ shading_language_version(struct gl_context *ctx)
          _mesa_problem(ctx,
                        "Invalid GLSL version in shading_language_version()");
          return (const GLubyte *) 0;
-      }
-      break;
-
-   case API_OPENGLES2:
-      return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
-
-   case API_OPENGLES:
-      /* fall-through */
-
-   default:
-      _mesa_problem(ctx, "Unexpected API value in shading_language_version()");
-      return (const GLubyte *) 0;
    }
 }
 
index 40352f3..f3abdce 100644 (file)
@@ -58,8 +58,6 @@ _mesa_type_is_packed(GLenum type)
    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
    case GL_UNSIGNED_INT_8_8_8_8:
    case GL_UNSIGNED_INT_8_8_8_8_REV:
-   case GL_UNSIGNED_INT_10_10_10_2:
-   case GL_UNSIGNED_INT_2_10_10_10_REV:
    case GL_UNSIGNED_SHORT_8_8_MESA:
    case GL_UNSIGNED_SHORT_8_8_REV_MESA:
    case GL_UNSIGNED_INT_24_8_EXT:
@@ -190,8 +188,6 @@ _mesa_sizeof_packed_type( GLenum type )
          return sizeof(GLushort);
       case GL_UNSIGNED_INT_8_8_8_8:
       case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
       case GL_UNSIGNED_INT_24_8_EXT:
       case GL_UNSIGNED_INT_5_9_9_9_REV:
       case GL_UNSIGNED_INT_10F_11F_11F_REV:
@@ -316,8 +312,6 @@ _mesa_bytes_per_pixel( GLenum format, GLenum type )
             return -1;
       case GL_UNSIGNED_INT_8_8_8_8:
       case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
          if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT ||
              format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT)
             return sizeof(GLuint);
@@ -393,8 +387,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
    case GL_UNSIGNED_INT_8_8_8_8:
    case GL_UNSIGNED_INT_8_8_8_8_REV:
-   case GL_UNSIGNED_INT_10_10_10_2:
-   case GL_UNSIGNED_INT_2_10_10_10_REV:
       if (format == GL_RGBA ||
           format == GL_BGRA ||
           format == GL_ABGR_EXT) {
@@ -548,8 +540,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
             case GL_UNSIGNED_SHORT_1_5_5_5_REV:
             case GL_UNSIGNED_INT_8_8_8_8:
             case GL_UNSIGNED_INT_8_8_8_8_REV:
-            case GL_UNSIGNED_INT_10_10_10_2:
-            case GL_UNSIGNED_INT_2_10_10_10_REV:
                return GL_NO_ERROR;
             case GL_HALF_FLOAT:
                return ctx->Extensions.ARB_half_float_pixel
@@ -1131,19 +1121,6 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
       return ctx->Extensions.EXT_texture_compression_latc;
    case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
       return ctx->Extensions.ATI_texture_compression_3dc;
-#if FEATURE_ES
-   case GL_PALETTE4_RGB8_OES:
-   case GL_PALETTE4_RGBA8_OES:
-   case GL_PALETTE4_R5_G6_B5_OES:
-   case GL_PALETTE4_RGBA4_OES:
-   case GL_PALETTE4_RGB5_A1_OES:
-   case GL_PALETTE8_RGB8_OES:
-   case GL_PALETTE8_RGBA8_OES:
-   case GL_PALETTE8_R5_G6_B5_OES:
-   case GL_PALETTE8_RGBA4_OES:
-   case GL_PALETTE8_RGB5_A1_OES:
-      return ctx->API == API_OPENGLES;
-#endif
    default:
       return GL_FALSE;
    }
index 3849a00..358af8a 100644 (file)
@@ -640,37 +640,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
       }
    }
 
-   else if (datatype == GL_UNSIGNED_INT_2_10_10_10_REV && comps == 4) {
-      GLuint i, j, k;
-      const GLuint *rowA = (const GLuint *) srcRowA;
-      const GLuint *rowB = (const GLuint *) srcRowB;
-      GLuint *dst = (GLuint *) dstRow;
-      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
-           i++, j += colStride, k += colStride) {
-         const GLint rowAr0 = rowA[j] & 0x3ff;
-         const GLint rowAr1 = rowA[k] & 0x3ff;
-         const GLint rowBr0 = rowB[j] & 0x3ff;
-         const GLint rowBr1 = rowB[k] & 0x3ff;
-         const GLint rowAg0 = (rowA[j] >> 10) & 0x3ff;
-         const GLint rowAg1 = (rowA[k] >> 10) & 0x3ff;
-         const GLint rowBg0 = (rowB[j] >> 10) & 0x3ff;
-         const GLint rowBg1 = (rowB[k] >> 10) & 0x3ff;
-         const GLint rowAb0 = (rowA[j] >> 20) & 0x3ff;
-         const GLint rowAb1 = (rowA[k] >> 20) & 0x3ff;
-         const GLint rowBb0 = (rowB[j] >> 20) & 0x3ff;
-         const GLint rowBb1 = (rowB[k] >> 20) & 0x3ff;
-         const GLint rowAa0 = (rowA[j] >> 30) & 0x3;
-         const GLint rowAa1 = (rowA[k] >> 30) & 0x3;
-         const GLint rowBa0 = (rowB[j] >> 30) & 0x3;
-         const GLint rowBa1 = (rowB[k] >> 30) & 0x3;
-         const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
-         const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
-         const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
-         const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
-         dst[i] = (alpha << 30) | (blue << 20) | (green << 10) | red;
-      }
-   }
-
    else if (datatype == GL_FLOAT_32_UNSIGNED_INT_24_8_REV && comps == 1) {
       GLuint i, j, k;
       const GLfloat *rowA = (const GLfloat *) srcRowA;
@@ -1243,55 +1212,6 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
          dst[i] = (g << 4) | r;
       }
    }
-   else if ((datatype == GL_UNSIGNED_INT_2_10_10_10_REV) && (comps == 4)) {
-      DECLARE_ROW_POINTERS0(GLuint);
-
-      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
-           i++, j += colStride, k += colStride) {
-         const GLint rowAr0 = rowA[j] & 0x3ff;
-         const GLint rowAr1 = rowA[k] & 0x3ff;
-         const GLint rowBr0 = rowB[j] & 0x3ff;
-         const GLint rowBr1 = rowB[k] & 0x3ff;
-         const GLint rowCr0 = rowC[j] & 0x3ff;
-         const GLint rowCr1 = rowC[k] & 0x3ff;
-         const GLint rowDr0 = rowD[j] & 0x3ff;
-         const GLint rowDr1 = rowD[k] & 0x3ff;
-         const GLint rowAg0 = (rowA[j] >> 10) & 0x3ff;
-         const GLint rowAg1 = (rowA[k] >> 10) & 0x3ff;
-         const GLint rowBg0 = (rowB[j] >> 10) & 0x3ff;
-         const GLint rowBg1 = (rowB[k] >> 10) & 0x3ff;
-         const GLint rowCg0 = (rowC[j] >> 10) & 0x3ff;
-         const GLint rowCg1 = (rowC[k] >> 10) & 0x3ff;
-         const GLint rowDg0 = (rowD[j] >> 10) & 0x3ff;
-         const GLint rowDg1 = (rowD[k] >> 10) & 0x3ff;
-         const GLint rowAb0 = (rowA[j] >> 20) & 0x3ff;
-         const GLint rowAb1 = (rowA[k] >> 20) & 0x3ff;
-         const GLint rowBb0 = (rowB[j] >> 20) & 0x3ff;
-         const GLint rowBb1 = (rowB[k] >> 20) & 0x3ff;
-         const GLint rowCb0 = (rowC[j] >> 20) & 0x3ff;
-         const GLint rowCb1 = (rowC[k] >> 20) & 0x3ff;
-         const GLint rowDb0 = (rowD[j] >> 20) & 0x3ff;
-         const GLint rowDb1 = (rowD[k] >> 20) & 0x3ff;
-         const GLint rowAa0 = (rowA[j] >> 30) & 0x3;
-         const GLint rowAa1 = (rowA[k] >> 30) & 0x3;
-         const GLint rowBa0 = (rowB[j] >> 30) & 0x3;
-         const GLint rowBa1 = (rowB[k] >> 30) & 0x3;
-         const GLint rowCa0 = (rowC[j] >> 30) & 0x3;
-         const GLint rowCa1 = (rowC[k] >> 30) & 0x3;
-         const GLint rowDa0 = (rowD[j] >> 30) & 0x3;
-         const GLint rowDa1 = (rowD[k] >> 30) & 0x3;
-         const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
-                                       rowCr0, rowCr1, rowDr0, rowDr1);
-         const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
-                                       rowCg0, rowCg1, rowDg0, rowDg1);
-         const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
-                                       rowCb0, rowCb1, rowDb0, rowDb1);
-         const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
-                                       rowCa0, rowCa1, rowDa0, rowDa1);
-
-         dst[i] = (a << 30) | (b << 20) | (g << 10) | r;
-      }
-   }
 
    else if (datatype == GL_FLOAT_32_UNSIGNED_INT_24_8_REV && comps == 1) {
       DECLARE_ROW_POINTERS(GLfloat, 2);
@@ -1656,7 +1576,6 @@ _mesa_generate_mipmap_level(GLenum target,
       }
       break;
    case GL_TEXTURE_RECTANGLE_NV:
-   case GL_TEXTURE_EXTERNAL_OES:
       /* no mipmaps, do nothing */
       break;
    default:
index ab6b9af..4037e39 100644 (file)
@@ -1119,7 +1119,6 @@ typedef enum
    TEXTURE_BUFFER_INDEX,
    TEXTURE_2D_ARRAY_INDEX,
    TEXTURE_1D_ARRAY_INDEX,
-   TEXTURE_EXTERNAL_INDEX,
    TEXTURE_CUBE_INDEX,
    TEXTURE_3D_INDEX,
    TEXTURE_RECT_INDEX,
@@ -1137,7 +1136,6 @@ typedef enum
 #define TEXTURE_BUFFER_BIT   (1 << TEXTURE_BUFFER_INDEX)
 #define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
 #define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
-#define TEXTURE_EXTERNAL_BIT (1 << TEXTURE_EXTERNAL_INDEX)
 #define TEXTURE_CUBE_BIT     (1 << TEXTURE_CUBE_INDEX)
 #define TEXTURE_3D_BIT       (1 << TEXTURE_3D_INDEX)
 #define TEXTURE_RECT_BIT     (1 << TEXTURE_RECT_INDEX)
@@ -1275,7 +1273,6 @@ struct gl_texture_object
    GLint MaxLevel;             /**< max mipmap level, OpenGL 1.2 */
    GLint _MaxLevel;            /**< actual max mipmap level (q in the spec) */
    GLfloat _MaxLambda;         /**< = _MaxLevel - BaseLevel (q - b in spec) */
-   GLint CropRect[4];           /**< GL_OES_draw_texture */
    GLboolean GenerateMipmap;    /**< GL_SGIS_generate_mipmap */
    GLboolean _Complete;                /**< Is texture object complete? */
    GLboolean _RenderToTexture;  /**< Any rendering to this texture? */
@@ -1428,7 +1425,6 @@ struct gl_transform_attrib
    GLboolean Normalize;                                /**< Normalize all normals? */
    GLboolean RescaleNormals;                   /**< GL_EXT_rescale_normal */
    GLboolean RasterPositionUnclipped;           /**< GL_IBM_rasterpos_clip */
-   GLboolean DepthClamp;                       /**< GL_ARB_depth_clamp */
 
    GLfloat CullEyePos[4];
    GLfloat CullObjPos[4];
@@ -1870,12 +1866,6 @@ struct gl_vertex_program_state
    GLenum TrackMatrix[MAX_PROGRAM_ENV_PARAMS / 4];
    GLenum TrackMatrixTransform[MAX_PROGRAM_ENV_PARAMS / 4];
 
-   /** Should fixed-function T&L be implemented with a vertex prog? */
-   GLboolean _MaintainTnlProgram;
-
-   /** Program to emulate fixed-function T&L (see above) */
-   struct gl_vertex_program *_TnlProgram;
-
    /** Cache of fixed-function programs */
    struct gl_program_cache *Cache;
 
@@ -1900,12 +1890,6 @@ struct gl_fragment_program_state
 
    GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
 
-   /** Should fixed-function texturing be implemented with a fragment prog? */
-   GLboolean _MaintainTexEnvProgram;
-
-   /** Program to emulate fixed-function texture env/combine (see above) */
-   struct gl_fragment_program *_TexEnvProgram;
-
    /** Cache of fixed-function programs */
    struct gl_program_cache *Cache;
 };
@@ -2558,7 +2542,6 @@ struct gl_extensions
    GLboolean EXT_texture_mirror_clamp;
    GLboolean EXT_texture_snorm;
    GLboolean EXT_texture_sRGB;
-   GLboolean OES_standard_derivatives;
    /* vendor extensions */
    GLboolean APPLE_packed_pixels;
    GLboolean APPLE_vertex_array_object;
@@ -2590,9 +2573,6 @@ struct gl_extensions
    GLboolean SGIS_texture_lod;
    GLboolean TDFX_texture_compression_FXT1;
    GLboolean S3_s3tc;
-   GLboolean OES_EGL_image;
-   GLboolean OES_draw_texture;
-   GLboolean OES_EGL_image_external;
    GLboolean extension_sentinel;
    /** The extension string */
    const GLubyte *String;
@@ -2796,17 +2776,6 @@ struct gl_dlist_state
 };
 
 
-/**
- * Enum for the OpenGL APIs we know about and may support.
- */
-typedef enum
-{
-   API_OPENGL,
-   API_OPENGLES,
-   API_OPENGLES2
-} gl_api;
-
-
 /**
  * Mesa rendering context.
  *
@@ -2824,7 +2793,6 @@ struct gl_context
 
    /** \name API function pointer tables */
    /*@{*/
-   gl_api API;
    struct _glapi_table *Save;  /**< Display list save functions */
    struct _glapi_table *Exec;  /**< Execute functions */
    struct _glapi_table *CurrentDispatch;  /**< == Save or Exec !! */
index bbac67c..52c0622 100644 (file)
@@ -1934,64 +1934,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
             }
          }
          break;
-      case GL_UNSIGNED_INT_10_10_10_2:
-         if (dstFormat == GL_RGBA) {
-            GLuint *dst = (GLuint *) dstAddr;
-            for (i=0;i<n;i++) {
-               dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F) << 22)
-                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
-                      | (IROUND(rgba[i][BCOMP] * 1023.0F) <<  2)
-                      | (IROUND(rgba[i][ACOMP] *    3.0F)      );
-            }
-         }
-         else if (dstFormat == GL_BGRA) {
-            GLuint *dst = (GLuint *) dstAddr;
-            for (i=0;i<n;i++) {
-               dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F) << 22)
-                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
-                      | (IROUND(rgba[i][RCOMP] * 1023.0F) <<  2)
-                      | (IROUND(rgba[i][ACOMP] *    3.0F)      );
-            }
-         }
-         else if (dstFormat == GL_ABGR_EXT) {
-            GLuint *dst = (GLuint *) dstAddr;
-            for (i=0;i<n;i++) {
-               dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F) << 22)
-                      | (IROUND(rgba[i][BCOMP] * 1023.0F) << 12)
-                      | (IROUND(rgba[i][GCOMP] * 1023.0F) <<  2)
-                      | (IROUND(rgba[i][RCOMP] *    3.0F)      );
-            }
-         }
-         break;
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-         if (dstFormat == GL_RGBA) {
-            GLuint *dst = (GLuint *) dstAddr;
-            for (i=0;i<n;i++) {
-               dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F)      )
-                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
-                      | (IROUND(rgba[i][BCOMP] * 1023.0F) << 20)
-                      | (IROUND(rgba[i][ACOMP] *    3.0F) << 30);
-            }
-         }
-         else if (dstFormat == GL_BGRA) {
-            GLuint *dst = (GLuint *) dstAddr;
-            for (i=0;i<n;i++) {
-               dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F)      )
-                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
-                      | (IROUND(rgba[i][RCOMP] * 1023.0F) << 20)
-                      | (IROUND(rgba[i][ACOMP] *    3.0F) << 30);
-            }
-         }
-         else if (dstFormat == GL_ABGR_EXT) {
-            GLuint *dst = (GLuint *) dstAddr;
-            for (i=0;i<n;i++) {
-               dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F)      )
-                      | (IROUND(rgba[i][BCOMP] * 1023.0F) << 10)
-                      | (IROUND(rgba[i][GCOMP] * 1023.0F) << 20)
-                      | (IROUND(rgba[i][RCOMP] *    3.0F) << 30);
-            }
-         }
-         break;
       default:
          _mesa_problem(ctx, "bad type in _mesa_pack_rgba_span_float");
          free(luminance);
@@ -2451,8 +2393,6 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
           srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
           srcType == GL_UNSIGNED_INT_8_8_8_8 ||
           srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
-          srcType == GL_UNSIGNED_INT_10_10_10_2 ||
-          srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
           srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
           srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
 
@@ -2862,68 +2802,6 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
             }
          }
          break;
-      case GL_UNSIGNED_INT_10_10_10_2:
-         if (!intFormat) {
-            rs = 1.0F / 1023.0F;
-            gs = 1.0F / 1023.0F;
-            bs = 1.0F / 1023.0F;
-            as = 1.0F / 3.0F;
-         }
-         if (swapBytes) {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               SWAP4BYTE(p);
-               rgba[i][rDst] = ((p >> 22)        ) * rs;
-               rgba[i][gDst] = ((p >> 12) & 0x3ff) * gs;
-               rgba[i][bDst] = ((p >>  2) & 0x3ff) * bs;
-               rgba[i][aDst] = ((p      ) & 0x3  ) * as;
-            }
-         }
-         else {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               rgba[i][rDst] = ((p >> 22)        ) * rs;
-               rgba[i][gDst] = ((p >> 12) & 0x3ff) * gs;
-               rgba[i][bDst] = ((p >>  2) & 0x3ff) * bs;
-               rgba[i][aDst] = ((p      ) & 0x3  ) * as;
-            }
-         }
-         break;
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-         if (!intFormat) {
-            rs = 1.0F / 1023.0F;
-            gs = 1.0F / 1023.0F;
-            bs = 1.0F / 1023.0F;
-            as = 1.0F / 3.0F;
-         }
-         if (swapBytes) {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               SWAP4BYTE(p);
-               rgba[i][rDst] = ((p      ) & 0x3ff) * rs;
-               rgba[i][gDst] = ((p >> 10) & 0x3ff) * gs;
-               rgba[i][bDst] = ((p >> 20) & 0x3ff) * bs;
-               rgba[i][aDst] = ((p >> 30)        ) * as;
-            }
-         }
-         else {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               rgba[i][rDst] = ((p      ) & 0x3ff) * rs;
-               rgba[i][gDst] = ((p >> 10) & 0x3ff) * gs;
-               rgba[i][bDst] = ((p >> 20) & 0x3ff) * bs;
-               rgba[i][aDst] = ((p >> 30)        ) * as;
-            }
-         }
-         break;
       default:
          _mesa_problem(NULL, "bad srcType in extract float data");
          break;
@@ -3004,8 +2882,6 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4],
           srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
           srcType == GL_UNSIGNED_INT_8_8_8_8 ||
           srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
-          srcType == GL_UNSIGNED_INT_10_10_10_2 ||
-          srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
           srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
           srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
 
@@ -3319,56 +3195,6 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4],
             }
          }
          break;
-      case GL_UNSIGNED_INT_10_10_10_2:
-         if (swapBytes) {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               SWAP4BYTE(p);
-               rgba[i][rDst] = ((p >> 22)        );
-               rgba[i][gDst] = ((p >> 12) & 0x3ff);
-               rgba[i][bDst] = ((p >>  2) & 0x3ff);
-               rgba[i][aDst] = ((p      ) & 0x3  );
-            }
-         }
-         else {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               rgba[i][rDst] = ((p >> 22)        );
-               rgba[i][gDst] = ((p >> 12) & 0x3ff);
-               rgba[i][bDst] = ((p >>  2) & 0x3ff);
-               rgba[i][aDst] = ((p      ) & 0x3  );
-            }
-         }
-         break;
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-         if (swapBytes) {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               SWAP4BYTE(p);
-               rgba[i][rDst] = ((p      ) & 0x3ff);
-               rgba[i][gDst] = ((p >> 10) & 0x3ff);
-               rgba[i][bDst] = ((p >> 20) & 0x3ff);
-               rgba[i][aDst] = ((p >> 30)        );
-            }
-         }
-         else {
-            const GLuint *uisrc = (const GLuint *) src;
-            GLuint i;
-            for (i = 0; i < n; i ++) {
-               GLuint p = uisrc[i];
-               rgba[i][rDst] = ((p      ) & 0x3ff);
-               rgba[i][gDst] = ((p >> 10) & 0x3ff);
-               rgba[i][bDst] = ((p >> 20) & 0x3ff);
-               rgba[i][aDst] = ((p >> 30)        );
-            }
-         }
-         break;
       default:
          _mesa_problem(NULL, "bad srcType in extract uint data");
          break;
@@ -3447,8 +3273,6 @@ _mesa_unpack_color_span_ubyte(struct gl_context *ctx,
           srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
           srcType == GL_UNSIGNED_INT_8_8_8_8 ||
           srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
-          srcType == GL_UNSIGNED_INT_10_10_10_2 ||
-          srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
           srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
           srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
 
@@ -3700,8 +3524,6 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
           srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
           srcType == GL_UNSIGNED_INT_8_8_8_8 ||
           srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
-          srcType == GL_UNSIGNED_INT_10_10_10_2 ||
-          srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
           srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
           srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
 
@@ -3904,8 +3726,6 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx,
           srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ||
           srcType == GL_UNSIGNED_INT_8_8_8_8 ||
           srcType == GL_UNSIGNED_INT_8_8_8_8_REV ||
-          srcType == GL_UNSIGNED_INT_10_10_10_2 ||
-          srcType == GL_UNSIGNED_INT_2_10_10_10_REV ||
           srcType == GL_UNSIGNED_INT_5_9_9_9_REV ||
           srcType == GL_UNSIGNED_INT_10F_11F_11F_REV);
 
index 8c28091..8d1d843 100644 (file)
@@ -89,7 +89,6 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
          GL_TEXTURE_BUFFER,
          GL_TEXTURE_2D_ARRAY_EXT,
          GL_TEXTURE_1D_ARRAY_EXT,
-         GL_TEXTURE_EXTERNAL_OES,
          GL_TEXTURE_CUBE_MAP,
          GL_TEXTURE_3D,
          GL_TEXTURE_RECTANGLE_NV,
index 46eb8c3..6bb539c 100644 (file)
@@ -36,7 +36,6 @@
 #include "context.h"
 #include "debug.h"
 #include "macros.h"
-#include "ffvertex_prog.h"
 #include "framebuffer.h"
 #include "light.h"
 #include "matrix.h"
@@ -255,8 +254,6 @@ update_program(struct gl_context *ctx)
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
                               (struct gl_fragment_program *)
                               fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
-      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
-                              NULL);
    }
    else if (ctx->FragmentProgram._Enabled) {
       /* Use user-defined fragment program */
@@ -265,28 +262,10 @@ update_program(struct gl_context *ctx)
                                     NULL);
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
                                ctx->FragmentProgram.Current);
-      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
-                              NULL);
-   }
-   else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
-      /* Use fragment program generated from fixed-function state */
-      struct gl_shader_program *f = _mesa_get_fixed_func_fragment_program(ctx);
-
-      _mesa_reference_shader_program(ctx,
-                                    &ctx->Shader._CurrentFragmentProgram,
-                                    f);
-      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
-                              (struct gl_fragment_program *)
-                               f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
-      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
-                              (struct gl_fragment_program *)
-                               f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
    }
    else {
       /* No fragment program */
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
-      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
-                              NULL);
    }
 
    /* Examine vertex program after fragment program as
@@ -305,13 +284,6 @@ update_program(struct gl_context *ctx)
       _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
                                ctx->VertexProgram.Current);
    }
-   else if (ctx->VertexProgram._MaintainTnlProgram) {
-      /* Use vertex program generated from fixed-function state */
-      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
-                               _mesa_get_fixed_func_vertex_program(ctx));
-      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram,
-                               ctx->VertexProgram._Current);
-   }
    else {
       /* no vertex program */
       _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
@@ -574,19 +546,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
    if (MESA_VERBOSE & VERBOSE_STATE)
       _mesa_print_state("_mesa_update_state", new_state);
 
-   /* Determine which state flags effect vertex/fragment program state */
-   if (ctx->FragmentProgram._MaintainTexEnvProgram) {
-      prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
-                    _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE |
-                    _NEW_PROGRAM | _NEW_FRAG_CLAMP | _NEW_COLOR);
-   }
-   if (ctx->VertexProgram._MaintainTnlProgram) {
-      prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
-                     _NEW_TRANSFORM | _NEW_POINT |
-                     _NEW_FOG | _NEW_LIGHT |
-                     _MESA_NEW_NEED_EYE_COORDS);
-   }
-
    /*
     * Now update derived state info
     */
index 29a2540..5ab7d0e 100644 (file)
@@ -60,12 +60,10 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
       return GL_TRUE;
 
    if (ctx->VertexProgram._Current &&
-       (ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
        (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1))
       return GL_TRUE;
 
    if (ctx->FragmentProgram._Current &&
-       (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
        (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1))
       return GL_TRUE;
 
index 8d2b2a2..633d9f1 100644 (file)
@@ -264,26 +264,6 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
       }
    }
 
-#if FEATURE_ES1
-   if (ctx->API == API_OPENGLES) {
-      if (formats) {
-        formats[n++] = GL_PALETTE4_RGB8_OES;
-        formats[n++] = GL_PALETTE4_RGBA8_OES;
-        formats[n++] = GL_PALETTE4_R5_G6_B5_OES;
-        formats[n++] = GL_PALETTE4_RGBA4_OES;
-        formats[n++] = GL_PALETTE4_RGB5_A1_OES;
-        formats[n++] = GL_PALETTE8_RGB8_OES;
-        formats[n++] = GL_PALETTE8_RGBA8_OES;
-        formats[n++] = GL_PALETTE8_R5_G6_B5_OES;
-        formats[n++] = GL_PALETTE8_RGBA4_OES;
-        formats[n++] = GL_PALETTE8_RGB5_A1_OES;
-      }
-      else {
-        n += 10;
-      }
-   }
-#endif
-
    return n;
 }
 
index 4944d60..34707e8 100644 (file)
@@ -97,7 +97,6 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
 
       /* deep RGBA formats */
       case GL_RGB10_A2:
-        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
         RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
         break;
       case GL_RGBA12:
@@ -835,19 +834,6 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       }
    }
 
-   /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
-    */
-   if (ctx->API != API_OPENGL) {
-      switch (internalFormat) {
-      case GL_BGRA:
-        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
-        break;
-
-      default:
-         ; /* fallthrough */
-      }
-   }
-
    if (ctx->Extensions.ARB_texture_compression_rgtc) {
       switch (internalFormat) {
          case GL_COMPRESSED_RED_RGTC1:
index 5e2480c..9dccd93 100644 (file)
@@ -128,17 +128,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
          ; /* fallthrough */
    }
 
-   /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0).
-    */
-   if (ctx->API != API_OPENGL) {
-      switch (internalFormat) {
-         case GL_BGRA:
-            return GL_RGBA;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
    switch (internalFormat) {
    case GL_COMPRESSED_ALPHA:
       return GL_ALPHA;
@@ -469,25 +458,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
       }
    }
 
-   if (ctx->API == API_OPENGLES) {
-      switch (internalFormat) {
-      case GL_PALETTE4_RGB8_OES:
-      case GL_PALETTE4_R5_G6_B5_OES:
-      case GL_PALETTE8_RGB8_OES:
-      case GL_PALETTE8_R5_G6_B5_OES:
-        return GL_RGB;
-      case GL_PALETTE4_RGBA8_OES:
-      case GL_PALETTE8_RGB5_A1_OES:
-      case GL_PALETTE4_RGBA4_OES:
-      case GL_PALETTE4_RGB5_A1_OES:
-      case GL_PALETTE8_RGBA8_OES:
-      case GL_PALETTE8_RGBA4_OES:
-        return GL_RGBA;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
    return -1; /* error */
 }
 
@@ -551,7 +521,7 @@ set_tex_image(struct gl_texture_object *tObj,
 
    ASSERT(tObj);
    ASSERT(texImage);
-   if (target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_EXTERNAL_OES)
+   if (target == GL_TEXTURE_RECTANGLE_NV)
       assert(level == 0);
 
    tObj->Image[face][level] = texImage;
@@ -728,9 +698,6 @@ _mesa_select_tex_object(struct gl_context *ctx,
       case GL_TEXTURE_BUFFER:
          return ctx->Extensions.ARB_texture_buffer_object
             ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
-      case GL_TEXTURE_EXTERNAL_OES:
-         return ctx->Extensions.OES_EGL_image_external
-            ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL;
       default:
          _mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
          return NULL;
@@ -918,7 +885,6 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
               ctx->Extensions.EXT_texture_array)
          ? ctx->Const.MaxTextureLevels : 0;
    case GL_TEXTURE_BUFFER:
-   case GL_TEXTURE_EXTERNAL_OES:
       /* fall-through */
    default:
       return 0; /* bad target */
@@ -950,7 +916,6 @@ _mesa_get_texture_dimensions(GLenum target)
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
    case GL_TEXTURE_1D_ARRAY:
    case GL_PROXY_TEXTURE_1D_ARRAY:
-   case GL_TEXTURE_EXTERNAL_OES:
       return 2;
    case GL_TEXTURE_3D:
    case GL_PROXY_TEXTURE_3D:
@@ -1121,7 +1086,6 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
    case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-   case GL_TEXTURE_EXTERNAL_OES:
    case GL_PROXY_TEXTURE_2D:
    case GL_PROXY_TEXTURE_RECTANGLE:
    case GL_PROXY_TEXTURE_CUBE_MAP:
@@ -2616,50 +2580,6 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
 }
 
 
-#if FEATURE_OES_EGL_image
-void GLAPIENTRY
-_mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if ((target == GL_TEXTURE_2D &&
-        !ctx->Extensions.OES_EGL_image) ||
-       (target == GL_TEXTURE_EXTERNAL_OES &&
-        !ctx->Extensions.OES_EGL_image_external)) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
-                 "glEGLImageTargetTexture2D(target=%d)", target);
-      return;
-   }
-
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_state(ctx);
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-   _mesa_lock_texture(ctx, texObj);
-
-   texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
-   if (!texImage) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEGLImageTargetTexture2D");
-   } else {
-      ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
-
-      ctx->Driver.EGLImageTargetTexture2D(ctx, target,
-                                         texObj, texImage, image);
-
-      /* state update */
-      texObj->_Complete = GL_FALSE;
-      ctx->NewState |= _NEW_TEXTURE;
-   }
-   _mesa_unlock_texture(ctx, texObj);
-
-}
-#endif
-
-
-
 /**
  * Implement all the glTexSubImage1/2/3D() functions.
  */
index e2bdaca..2fca2d2 100644 (file)
@@ -185,9 +185,6 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
                      GLint border, GLenum format, GLenum type,
                      const GLvoid *pixels );
 
-extern void GLAPIENTRY
-_mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
-
 extern void GLAPIENTRY
 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
                      GLsizei width,
index e800070..7558089 100644 (file)
@@ -107,7 +107,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
           target == GL_TEXTURE_RECTANGLE_NV ||
           target == GL_TEXTURE_1D_ARRAY_EXT ||
           target == GL_TEXTURE_2D_ARRAY_EXT ||
-          target == GL_TEXTURE_EXTERNAL_OES ||
           target == GL_TEXTURE_BUFFER);
 
    memset(obj, 0, sizeof(*obj));
@@ -124,8 +123,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
    obj->RequiredTextureImageUnits = 1;
 
    /* sampler state */
-   if (target == GL_TEXTURE_RECTANGLE_NV ||
-       target == GL_TEXTURE_EXTERNAL_OES) {
+   if (target == GL_TEXTURE_RECTANGLE_NV) {
       obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
       obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
       obj->Sampler.WrapR = GL_CLAMP_TO_EDGE;
@@ -155,8 +153,7 @@ finish_texture_init(struct gl_context *ctx, GLenum target,
 {
    assert(obj->Target == 0);
 
-   if (target == GL_TEXTURE_RECTANGLE_NV ||
-       target == GL_TEXTURE_EXTERNAL_OES) {
+   if (target == GL_TEXTURE_RECTANGLE_NV) {
       /* have to init wrap and filter state here - kind of klunky */
       obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
       obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
@@ -295,7 +292,6 @@ valid_texture_object(const struct gl_texture_object *tex)
    case GL_TEXTURE_1D_ARRAY_EXT:
    case GL_TEXTURE_2D_ARRAY_EXT:
    case GL_TEXTURE_BUFFER:
-   case GL_TEXTURE_EXTERNAL_OES:
       return GL_TRUE;
    case 0x99:
       _mesa_problem(NULL, "invalid reference to a deleted texture object");
@@ -456,8 +452,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
                      t->Image[0][baseLevel]->HeightLog2);
       maxLevels = ctx->Const.MaxCubeTextureLevels;
    }
-   else if (t->Target == GL_TEXTURE_RECTANGLE_NV ||
-            t->Target == GL_TEXTURE_EXTERNAL_OES) {
+   else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
       maxLog2 = 0;  /* not applicable */
       maxLevels = 1;  /* no mipmapping */
    }
@@ -1003,8 +998,6 @@ target_enum_to_index(GLenum target)
       return TEXTURE_2D_ARRAY_INDEX;
    case GL_TEXTURE_BUFFER_ARB:
       return TEXTURE_BUFFER_INDEX;
-   case GL_TEXTURE_EXTERNAL_OES:
-      return TEXTURE_EXTERNAL_INDEX;
    default:
       return -1;
    }
index 25a9538..6866154 100644 (file)
@@ -61,10 +61,6 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
           (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp))
          return GL_TRUE;
    }
-   else if (target == GL_TEXTURE_EXTERNAL_OES) {
-      if (wrap == GL_CLAMP_TO_EDGE)
-         return GL_TRUE;
-   }
    else {
       switch (wrap) {
       case GL_CLAMP:
@@ -144,11 +140,6 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
          return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
       }
       break;
-   case GL_TEXTURE_EXTERNAL_OES:
-      if (ctx->Extensions.OES_EGL_image_external) {
-         return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX];
-      }
-      break;
    default:
       ;
    }
@@ -209,8 +200,7 @@ set_tex_parameteri(struct gl_context *ctx,
       case GL_LINEAR_MIPMAP_NEAREST:
       case GL_NEAREST_MIPMAP_LINEAR:
       case GL_LINEAR_MIPMAP_LINEAR:
-         if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
-             texObj->Target != GL_TEXTURE_EXTERNAL_OES) {
+         if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
             incomplete(ctx, texObj);
             texObj->Sampler.MinFilter = params[0];
             return GL_TRUE;
@@ -291,8 +281,6 @@ set_tex_parameteri(struct gl_context *ctx,
       return GL_TRUE;
 
    case GL_GENERATE_MIPMAP_SGIS:
-      if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
-         goto invalid_param;
       if (texObj->GenerateMipmap != params[0]) {
          /* no flush() */
         texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
@@ -300,15 +288,6 @@ set_tex_parameteri(struct gl_context *ctx,
       }
       return GL_FALSE;
 
-#if FEATURE_OES_draw_texture
-   case GL_TEXTURE_CROP_RECT_OES:
-      texObj->CropRect[0] = params[0];
-      texObj->CropRect[1] = params[1];
-      texObj->CropRect[2] = params[2];
-      texObj->CropRect[3] = params[3];
-      return GL_TRUE;
-#endif
-
    default:
       goto invalid_pname;
    }
@@ -502,20 +481,6 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
       }
       break;
 
-#if FEATURE_OES_draw_texture
-   case GL_TEXTURE_CROP_RECT_OES:
-      {
-         /* convert float params to int */
-         GLint iparams[4];
-         iparams[0] = (GLint) params[0];
-         iparams[1] = (GLint) params[1];
-         iparams[2] = (GLint) params[2];
-         iparams[3] = (GLint) params[3];
-         need_update = set_tex_parameteri(ctx, texObj, pname, iparams);
-      }
-      break;
-#endif
-
    case GL_TEXTURE_SWIZZLE_R_EXT:
    case GL_TEXTURE_SWIZZLE_G_EXT:
    case GL_TEXTURE_SWIZZLE_B_EXT:
@@ -950,14 +915,6 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
       case GL_TEXTURE_LOD_BIAS:
          *params = obj->Sampler.LodBias;
          break;
-#if FEATURE_OES_draw_texture
-      case GL_TEXTURE_CROP_RECT_OES:
-         params[0] = obj->CropRect[0];
-         params[1] = obj->CropRect[1];
-         params[2] = obj->CropRect[2];
-         params[3] = obj->CropRect[3];
-         break;
-#endif
 
       case GL_TEXTURE_IMMUTABLE_FORMAT:
          if (!ctx->Extensions.ARB_texture_storage)
@@ -1049,14 +1006,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
       case GL_TEXTURE_LOD_BIAS:
          *params = (GLint) obj->Sampler.LodBias;
          break;
-#if FEATURE_OES_draw_texture
-      case GL_TEXTURE_CROP_RECT_OES:
-         params[0] = obj->CropRect[0];
-         params[1] = obj->CropRect[1];
-         params[2] = obj->CropRect[2];
-         params[3] = obj->CropRect[3];
-         break;
-#endif
 
       case GL_TEXTURE_IMMUTABLE_FORMAT:
          if (!ctx->Extensions.ARB_texture_storage)
@@ -1064,12 +1013,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
          *params = (GLint) obj->Immutable;
          break;
 
-      case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
-         if (!ctx->Extensions.OES_EGL_image_external)
-            goto invalid_pname;
-         *params = obj->RequiredTextureImageUnits;
-         break;
-
       default:
          goto invalid_pname;
    }
index 63451ca..c368838 100644 (file)
@@ -686,7 +686,6 @@ alloc_proxy_textures( struct gl_context *ctx )
       GL_TEXTURE_BUFFER,
       GL_TEXTURE_2D_ARRAY_EXT,
       GL_TEXTURE_1D_ARRAY_EXT,
-      GL_TEXTURE_EXTERNAL_OES,
       GL_TEXTURE_CUBE_MAP_ARB,
       GL_TEXTURE_3D,
       GL_TEXTURE_RECTANGLE_NV,
index 416b32f..5a64d98 100644 (file)
@@ -1942,82 +1942,6 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
-
-static GLboolean
-_mesa_texstore_argb2101010(TEXSTORE_PARAMS)
-{
-   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
-   ASSERT(dstFormat == MESA_FORMAT_ARGB2101010);
-   ASSERT(_mesa_get_format_bytes(dstFormat) == 4);
-
-   if (!ctx->_ImageTransferState &&
-       !srcPacking->SwapBytes &&
-       dstFormat == MESA_FORMAT_ARGB2101010 &&
-       srcFormat == GL_BGRA &&
-       srcType == GL_UNSIGNED_INT_2_10_10_10_REV &&
-       baseInternalFormat == GL_RGBA) {
-      /* simple memcpy path */
-      memcpy_texture(ctx, dims,
-                     dstFormat,
-                     dstRowStride, dstSlices,
-                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
-                     srcAddr, srcPacking);
-   }
-   else {
-      /* general path */
-      const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims,
-                                                 baseInternalFormat,
-                                                 baseFormat,
-                                                 srcWidth, srcHeight, srcDepth,
-                                                 srcFormat, srcType, srcAddr,
-                                                 srcPacking,
-                                                 ctx->_ImageTransferState);
-      const GLfloat *src = tempImage;
-      GLint img, row, col;
-      if (!tempImage)
-         return GL_FALSE;
-      for (img = 0; img < srcDepth; img++) {
-         GLubyte *dstRow = dstSlices[img];
-         if (baseInternalFormat == GL_RGBA) {
-            for (row = 0; row < srcHeight; row++) {
-               GLuint *dstUI = (GLuint *) dstRow;
-               for (col = 0; col < srcWidth; col++) {
-                  GLushort a,r,g,b;
-
-                  UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
-                  UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
-                  UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
-                  UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
-                  dstUI[col] = PACK_COLOR_2101010_US(a, r, g, b);
-                  src += 4;
-               }
-               dstRow += dstRowStride;
-            }
-         } else if (baseInternalFormat == GL_RGB) {
-            for (row = 0; row < srcHeight; row++) {
-               GLuint *dstUI = (GLuint *) dstRow;
-               for (col = 0; col < srcWidth; col++) {
-                  GLushort r,g,b;
-
-                  UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
-                  UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
-                  UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
-                  dstUI[col] = PACK_COLOR_2101010_US(0xffff, r, g, b);
-                  src += 4;
-               }
-               dstRow += dstRowStride;
-            }
-         } else {
-            ASSERT(0);
-         }
-      }
-      free((void *) tempImage);
-   }
-   return GL_TRUE;
-}
-
-
 /**
  * Do texstore for 2-channel, 4-bit/channel, unsigned normalized formats.
  */
@@ -4079,7 +4003,6 @@ _mesa_get_texstore_func(gl_format format)
       table[MESA_FORMAT_R16] = _mesa_texstore_unorm16;
       table[MESA_FORMAT_RG1616] = _mesa_texstore_unorm1616;
       table[MESA_FORMAT_RG1616_REV] = _mesa_texstore_unorm1616;
-      table[MESA_FORMAT_ARGB2101010] = _mesa_texstore_argb2101010;
       table[MESA_FORMAT_Z24_S8] = _mesa_texstore_z24_s8;
       table[MESA_FORMAT_S8_Z24] = _mesa_texstore_s8_z24;
       table[MESA_FORMAT_Z16] = _mesa_texstore_z16;
</