Previously, we had an enum called gl_shader_type which represented
pipeline stages in the order they occur in the pipeline
(i.e. MESA_SHADER_VERTEX=0, MESA_SHADER_GEOMETRY=1, etc), and several
inconsistently named functions for converting between it and other
representations:

- _mesa_shader_type_to_string: gl_shader_type -> string
- _mesa_shader_type_to_index: GLenum (GL_*_SHADER) -> gl_shader_type
- _mesa_program_target_to_index: GLenum (GL_*_PROGRAM) -> gl_shader_type
- _mesa_shader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string

This patch tries to clean things up so that we use more consistent
terminology: the enum is now called gl_shader_stage (to emphasize that
it is in the order of pipeline stages), and the conversion functions are:

- _mesa_shader_stage_to_string: gl_shader_stage -> string
- _mesa_shader_enum_to_shader_stage: GLenum (GL_*_SHADER) -> gl_shader_stage
- _mesa_program_enum_to_shader_stage: GLenum (GL_*_PROGRAM) -> gl_shader_type
- _mesa_progshader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string

In addition, MESA_SHADER_TYPES has been renamed to MESA_SHADER_STAGES,
for consistency with the new name for the enum.
---
 src/glsl/ast_to_hir.cpp                          | 12 ++---
 src/glsl/glsl_parser_extras.cpp                  | 14 +++---
 src/glsl/glsl_parser_extras.h                    |  8 +--
 src/glsl/ir_uniform.h                            |  2 +-
 src/glsl/link_atomics.cpp                        | 22 ++++-----
 src/glsl/link_uniform_initializers.cpp           |  8 +--
 src/glsl/link_uniforms.cpp                       | 12 ++---
 src/glsl/link_varyings.cpp                       | 24 ++++-----
 src/glsl/linker.cpp                              | 62 ++++++++++++------------
 src/glsl/main.cpp                                |  2 +-
 src/glsl/standalone_scaffolding.cpp              |  2 +-
 src/glsl/standalone_scaffolding.h                |  6 +--
 src/glsl/test_optpass.cpp                        |  2 +-
 src/glsl/tests/set_uniform_initializer_tests.cpp |  4 +-
 src/mesa/drivers/dri/i965/brw_context.c          |  2 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp         | 10 ++--
 src/mesa/main/context.c                          |  8 +--
 src/mesa/main/mtypes.h                           | 12 ++---
 src/mesa/main/shaderapi.c                        | 14 +++---
 src/mesa/main/shaderapi.h                        |  2 +-
 src/mesa/main/shaderobj.c                        |  4 +-
 src/mesa/main/shaderobj.h                        |  6 +--
 src/mesa/main/uniform_query.cpp                  |  6 +--
 src/mesa/main/uniforms.c                         |  4 +-
 src/mesa/program/ir_to_mesa.cpp                  | 18 +++----
 src/mesa/program/program.c                       |  2 +-
 src/mesa/program/program.h                       |  8 +--
 src/mesa/program/sampler.cpp                     |  2 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp       | 12 ++---
 29 files changed, 145 insertions(+), 145 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 91810f9..9f1e4e6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1882,7 +1882,7 @@ ast_fully_specified_type::glsl_type(const char **name,
  * this function will produce undefined results.
  */
 static bool
-is_varying_var(ir_variable *var, gl_shader_type target)
+is_varying_var(ir_variable *var, gl_shader_stage target)
 {
    switch (target) {
    case MESA_SHADER_VERTEX:
@@ -2110,7 +2110,7 @@ validate_explicit_location(const struct 
ast_type_qualifier *qual,
       _mesa_glsl_error(loc, state,
                        "%s cannot be given an explicit location in %s shader",
                        mode_string(var),
-                      _mesa_shader_type_to_string(state->target));
+                      _mesa_shader_stage_to_string(state->target));
    } else {
       var->data.explicit_location = true;
 
@@ -2188,7 +2188,7 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
       _mesa_glsl_error(loc, state,
                       "`attribute' variables may not be declared in the "
                       "%s shader",
-                      _mesa_shader_type_to_string(state->target));
+                      _mesa_shader_stage_to_string(state->target));
    }
 
    /* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
@@ -2599,7 +2599,7 @@ process_initializer(ir_variable *var, ast_declaration 
*decl,
    if ((var->data.mode == ir_var_shader_in) && (state->current_function == 
NULL)) {
       _mesa_glsl_error(& initializer_loc, state,
                       "cannot initialize %s shader input / %s",
-                      _mesa_shader_type_to_string(state->target),
+                      _mesa_shader_stage_to_string(state->target),
                       (state->target == MESA_SHADER_VERTEX)
                       ? "attribute" : "varying");
    }
@@ -4890,7 +4890,7 @@ ast_interface_block::hir(exec_list *instructions,
             _mesa_glsl_error(&loc, state,
                              "redeclaration of gl_PerVertex input not allowed "
                              "in the %s shader",
-                             _mesa_shader_type_to_string(state->target));
+                             _mesa_shader_stage_to_string(state->target));
          }
          if (this->instance_name == NULL ||
              strcmp(this->instance_name, "gl_in") != 0 || !this->is_array) {
@@ -4907,7 +4907,7 @@ ast_interface_block::hir(exec_list *instructions,
             _mesa_glsl_error(&loc, state,
                              "redeclaration of gl_PerVertex output not "
                              "allowed in the %s shader",
-                             _mesa_shader_type_to_string(state->target));
+                             _mesa_shader_stage_to_string(state->target));
          }
          if (this->instance_name != NULL) {
             _mesa_glsl_error(&loc, state,
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index e839caf..492f2ac 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -342,7 +342,7 @@ extern "C" {
  * gl_shader->Type.
  */
 const char *
-_mesa_shader_enum_to_string(GLenum type)
+_mesa_progshader_enum_to_string(GLenum type)
 {
    switch (type) {
    case GL_VERTEX_SHADER:
@@ -362,11 +362,11 @@ _mesa_shader_enum_to_string(GLenum type)
 } /* extern "C" */
 
 /**
- * Translate a gl_shader_type to a short shader stage name for debug printouts
- * and error messages.
+ * Translate a gl_shader_stage to a short shader stage name for debug
+ * printouts and error messages.
  */
 const char *
-_mesa_shader_type_to_string(unsigned target)
+_mesa_shader_stage_to_string(unsigned target)
 {
    switch (target) {
    case MESA_SHADER_VERTEX:   return "vertex";
@@ -651,11 +651,11 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE 
*name_locp,
 
          if (behavior == extension_require) {
             _mesa_glsl_error(name_locp, state, fmt,
-                             name, _mesa_shader_type_to_string(state->target));
+                             name, 
_mesa_shader_stage_to_string(state->target));
             return false;
          } else {
             _mesa_glsl_warning(name_locp, state, fmt,
-                               name, 
_mesa_shader_type_to_string(state->target));
+                               name, 
_mesa_shader_stage_to_string(state->target));
          }
       }
    }
@@ -1516,7 +1516,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct 
gl_shader *shader,
 
    if (!state->error && !shader->ir->is_empty()) {
       struct gl_shader_compiler_options *options =
-         &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
+         
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader->Type)];
 
       /* Do some optimization at compile time to reduce shader IR size
        * and reduce later work if the same shader is linked multiple times
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 0e281ae..ecf832f 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -165,7 +165,7 @@ struct _mesa_glsl_parse_state {
 
    bool es_shader;
    unsigned language_version;
-   gl_shader_type target;
+   gl_shader_stage target;
 
    /**
     * Number of nested struct_specifier levels
@@ -425,10 +425,10 @@ extern bool _mesa_glsl_process_extension(const char 
*name, YYLTYPE *name_locp,
 
 /**
  * Get the textual name of the specified shader target (which is a
- * gl_shader_type).
+ * gl_shader_stage).
  */
 extern const char *
-_mesa_shader_type_to_string(unsigned target);
+_mesa_shader_stage_to_string(unsigned target);
 
 
 #endif /* __cplusplus */
@@ -442,7 +442,7 @@ extern "C" {
 #endif
 
 extern const char *
-_mesa_shader_enum_to_string(GLenum type);
+_mesa_progshader_enum_to_string(GLenum type);
 
 extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
                       const struct gl_extensions *extensions, struct 
gl_context *gl_ctx);
diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
index 13faab7..f678c2c 100644
--- a/src/glsl/ir_uniform.h
+++ b/src/glsl/ir_uniform.h
@@ -116,7 +116,7 @@ struct gl_uniform_storage {
        * Whether this sampler is used in this shader stage.
        */
       bool active;
-   } sampler[MESA_SHADER_TYPES];
+   } sampler[MESA_SHADER_STAGES];
 
    /**
     * Storage used by the driver for the uniform
diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index 603329c..bfa09a3 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -64,7 +64,7 @@ namespace {
 
       active_atomic_counter *counters;
       unsigned num_counters;
-      unsigned stage_references[MESA_SHADER_TYPES];
+      unsigned stage_references[MESA_SHADER_STAGES];
       unsigned size;
    };
 
@@ -96,7 +96,7 @@ namespace {
 
       *num_buffers = 0;
 
-      for (unsigned i = 0; i < MESA_SHADER_TYPES; ++i) {
+      for (unsigned i = 0; i < MESA_SHADER_STAGES; ++i) {
          struct gl_shader *sh = prog->_LinkedShaders[i];
          if (sh == NULL)
             continue;
@@ -199,7 +199,7 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
       }
 
       /* Assign stage-specific fields. */
-      for (unsigned j = 0; j < MESA_SHADER_TYPES; ++j)
+      for (unsigned j = 0; j < MESA_SHADER_STAGES; ++j)
          mab.StageReferences[j] =
             (ab.stage_references[j] ? GL_TRUE : GL_FALSE);
 
@@ -219,18 +219,18 @@ link_check_atomic_counter_resources(struct gl_context 
*ctx,
       ctx->Const.GeometryProgram.MaxAtomicCounters,
       ctx->Const.FragmentProgram.MaxAtomicCounters
    };
-   STATIC_ASSERT(Elements(max_atomic_counters) == MESA_SHADER_TYPES);
+   STATIC_ASSERT(Elements(max_atomic_counters) == MESA_SHADER_STAGES);
    const unsigned max_atomic_buffers[] = {
       ctx->Const.VertexProgram.MaxAtomicBuffers,
       ctx->Const.GeometryProgram.MaxAtomicBuffers,
       ctx->Const.FragmentProgram.MaxAtomicBuffers
    };
-   STATIC_ASSERT(Elements(max_atomic_buffers) == MESA_SHADER_TYPES);
+   STATIC_ASSERT(Elements(max_atomic_buffers) == MESA_SHADER_STAGES);
    unsigned num_buffers;
    active_atomic_buffer *const abs =
       find_active_atomic_counters(ctx, prog, &num_buffers);
-   unsigned atomic_counters[MESA_SHADER_TYPES] = {};
-   unsigned atomic_buffers[MESA_SHADER_TYPES] = {};
+   unsigned atomic_counters[MESA_SHADER_STAGES] = {};
+   unsigned atomic_buffers[MESA_SHADER_STAGES] = {};
    unsigned total_atomic_counters = 0;
    unsigned total_atomic_buffers = 0;
 
@@ -243,7 +243,7 @@ link_check_atomic_counter_resources(struct gl_context *ctx,
       if (abs[i].size == 0)
          continue;
 
-      for (unsigned j = 0; j < MESA_SHADER_TYPES; ++j) {
+      for (unsigned j = 0; j < MESA_SHADER_STAGES; ++j) {
          const unsigned n = abs[i].stage_references[j];
 
          if (n) {
@@ -256,14 +256,14 @@ link_check_atomic_counter_resources(struct gl_context 
*ctx,
    }
 
    /* Check that they are within the supported limits. */
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (atomic_counters[i] > max_atomic_counters[i])
          linker_error(prog, "Too many %s shader atomic counters",
-                      _mesa_shader_type_to_string(i));
+                      _mesa_shader_stage_to_string(i));
 
       if (atomic_buffers[i] > max_atomic_buffers[i])
          linker_error(prog, "Too many %s shader atomic counter buffers",
-                      _mesa_shader_type_to_string(i));
+                      _mesa_shader_stage_to_string(i));
    }
 
    if (total_atomic_counters > ctx->Const.MaxCombinedAtomicCounters)
diff --git a/src/glsl/link_uniform_initializers.cpp 
b/src/glsl/link_uniform_initializers.cpp
index 04daa17..7d5c147 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -106,7 +106,7 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
          storage->storage[i].i = binding + i;
       }
 
-      for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
+      for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
          gl_shader *shader = prog->_LinkedShaders[sh];
 
          if (shader && storage->sampler[sh].active) {
@@ -119,7 +119,7 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
       }
    } else if (storage->block_index != -1) {
       /* This is a field of a UBO.  val is the binding index. */
-      for (int i = 0; i < MESA_SHADER_TYPES; i++) {
+      for (int i = 0; i < MESA_SHADER_STAGES; i++) {
          int stage_index = 
prog->UniformBlockStageIndex[i][storage->block_index];
 
          if (stage_index != -1) {
@@ -194,7 +194,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program 
*prog,
                               val->type->components());
 
       if (storage->type->is_sampler()) {
-         for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
+         for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
             gl_shader *shader = prog->_LinkedShaders[sh];
 
             if (shader && storage->sampler[sh].active) {
@@ -215,7 +215,7 @@ link_set_uniform_initializers(struct gl_shader_program 
*prog)
 {
    void *mem_ctx = NULL;
 
-   for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_shader *shader = prog->_LinkedShaders[i];
 
       if (shader == NULL)
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index bda6e4f..1c97e19 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -356,9 +356,9 @@ public:
    {
    }
 
-   void start_shader(gl_shader_type shader_type)
+   void start_shader(gl_shader_stage shader_type)
    {
-      assert(shader_type < MESA_SHADER_TYPES);
+      assert(shader_type < MESA_SHADER_STAGES);
       this->shader_type = shader_type;
 
       this->shader_samplers_used = 0;
@@ -429,7 +429,7 @@ public:
    int ubo_block_index;
    int ubo_byte_offset;
    bool ubo_row_major;
-   gl_shader_type shader_type;
+   gl_shader_stage shader_type;
 
 private:
    void handle_samplers(const glsl_type *base_type,
@@ -741,7 +741,7 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog)
     * glGetUniformLocation.
     */
    count_uniform_size uniform_size(prog->UniformHash);
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_shader *sh = prog->_LinkedShaders[i];
 
       if (sh == NULL)
@@ -809,11 +809,11 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog)
 
    parcel_out_uniform_storage parcel(prog->UniformHash, uniforms, data);
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
         continue;
 
-      parcel.start_shader((gl_shader_type)i);
+      parcel.start_shader((gl_shader_stage)i);
 
       foreach_list(node, prog->_LinkedShaders[i]->ir) {
         ir_variable *const var = ((ir_instruction *) node)->as_variable();
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 98f902c..ab40d45 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -82,10 +82,10 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
          linker_error(prog,
                       "%s shader output `%s' declared as type `%s', "
                       "but %s shader input declared as type `%s'\n",
-                      _mesa_shader_enum_to_string(producer_type),
+                      _mesa_progshader_enum_to_string(producer_type),
                       output->name,
                       output->type->name,
-                      _mesa_shader_enum_to_string(consumer_type),
+                      _mesa_progshader_enum_to_string(consumer_type),
                       input->type->name);
          return;
       }
@@ -97,10 +97,10 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
       linker_error(prog,
                    "%s shader output `%s' %s centroid qualifier, "
                    "but %s shader input %s centroid qualifier\n",
-                   _mesa_shader_enum_to_string(producer_type),
+                   _mesa_progshader_enum_to_string(producer_type),
                    output->name,
                    (output->data.centroid) ? "has" : "lacks",
-                   _mesa_shader_enum_to_string(consumer_type),
+                   _mesa_progshader_enum_to_string(consumer_type),
                    (input->data.centroid) ? "has" : "lacks");
       return;
    }
@@ -109,10 +109,10 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
       linker_error(prog,
                    "%s shader output `%s' %s sample qualifier, "
                    "but %s shader input %s sample qualifier\n",
-                   _mesa_shader_enum_to_string(producer_type),
+                   _mesa_progshader_enum_to_string(producer_type),
                    output->name,
                    (output->data.sample) ? "has" : "lacks",
-                   _mesa_shader_enum_to_string(consumer_type),
+                   _mesa_progshader_enum_to_string(consumer_type),
                    (input->data.sample) ? "has" : "lacks");
       return;
    }
@@ -121,10 +121,10 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
       linker_error(prog,
                    "%s shader output `%s' %s invariant qualifier, "
                    "but %s shader input %s invariant qualifier\n",
-                   _mesa_shader_enum_to_string(producer_type),
+                   _mesa_progshader_enum_to_string(producer_type),
                    output->name,
                    (output->data.invariant) ? "has" : "lacks",
-                   _mesa_shader_enum_to_string(consumer_type),
+                   _mesa_progshader_enum_to_string(consumer_type),
                    (input->data.invariant) ? "has" : "lacks");
       return;
    }
@@ -135,10 +135,10 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
                    "interpolation qualifier, "
                    "but %s shader input specifies %s "
                    "interpolation qualifier\n",
-                   _mesa_shader_enum_to_string(producer_type),
+                   _mesa_progshader_enum_to_string(producer_type),
                    output->name,
                    interpolation_string(output->data.interpolation),
-                   _mesa_shader_enum_to_string(consumer_type),
+                   _mesa_progshader_enum_to_string(consumer_type),
                    interpolation_string(input->data.interpolation));
       return;
    }
@@ -1217,9 +1217,9 @@ assign_varying_locations(struct gl_context *ctx,
 
                linker_error(prog, "%s shader varying %s not written "
                             "by %s shader\n.",
-                            _mesa_shader_enum_to_string(consumer->Type),
+                            _mesa_progshader_enum_to_string(consumer->Type),
                            var->name,
-                            _mesa_shader_enum_to_string(producer->Type));
+                            _mesa_progshader_enum_to_string(producer->Type));
             }
 
             /* An 'in' variable is only really a shader input if its
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index a81e107..428a044 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -438,7 +438,7 @@ analyze_clip_usage(struct gl_shader_program *prog,
       if (clip_vertex.variable_found() && clip_distance.variable_found()) {
          linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
                       "and `gl_ClipDistance'\n",
-                      _mesa_shader_enum_to_string(shader->Type));
+                      _mesa_progshader_enum_to_string(shader->Type));
          return;
       }
       *UsesClipDistance = clip_distance.variable_found();
@@ -786,7 +786,7 @@ void
 cross_validate_uniforms(struct gl_shader_program *prog)
 {
    cross_validate_globals(prog, prog->_LinkedShaders,
-                          MESA_SHADER_TYPES, true);
+                          MESA_SHADER_STAGES, true);
 }
 
 /**
@@ -797,12 +797,12 @@ static bool
 interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog)
 {
    unsigned max_num_uniform_blocks = 0;
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i])
         max_num_uniform_blocks += prog->_LinkedShaders[i]->NumUniformBlocks;
    }
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_shader *sh = prog->_LinkedShaders[i];
 
       prog->UniformBlockStageIndex[i] = ralloc_array(prog, int,
@@ -1376,7 +1376,7 @@ link_intrastage_shaders(void *mem_ctx,
 
    if (main == NULL) {
       linker_error(prog, "%s shader lacks `main'\n",
-                  _mesa_shader_enum_to_string(shader_list[0]->Type));
+                  _mesa_progshader_enum_to_string(shader_list[0]->Type));
       return NULL;
    }
 
@@ -1488,7 +1488,7 @@ link_intrastage_shaders(void *mem_ctx,
 static void
 update_array_sizes(struct gl_shader_program *prog)
 {
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
         if (prog->_LinkedShaders[i] == NULL)
            continue;
 
@@ -1511,7 +1511,7 @@ update_array_sizes(struct gl_shader_program *prog)
            continue;
 
         unsigned int size = var->data.max_array_access;
-        for (unsigned j = 0; j < MESA_SHADER_TYPES; j++) {
+        for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
               if (prog->_LinkedShaders[j] == NULL)
                  continue;
 
@@ -1899,7 +1899,7 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
       ctx->Const.GeometryProgram.MaxTextureImageUnits,
       ctx->Const.FragmentProgram.MaxTextureImageUnits
    };
-   STATIC_ASSERT(Elements(max_samplers) == MESA_SHADER_TYPES);
+   STATIC_ASSERT(Elements(max_samplers) == MESA_SHADER_STAGES);
 
    const unsigned max_default_uniform_components[] = {
       ctx->Const.VertexProgram.MaxUniformComponents,
@@ -1907,7 +1907,7 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
       ctx->Const.FragmentProgram.MaxUniformComponents
    };
    STATIC_ASSERT(Elements(max_default_uniform_components) ==
-                 MESA_SHADER_TYPES);
+                 MESA_SHADER_STAGES);
 
    const unsigned max_combined_uniform_components[] = {
       ctx->Const.VertexProgram.MaxCombinedUniformComponents,
@@ -1915,16 +1915,16 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
       ctx->Const.FragmentProgram.MaxCombinedUniformComponents
    };
    STATIC_ASSERT(Elements(max_combined_uniform_components) ==
-                 MESA_SHADER_TYPES);
+                 MESA_SHADER_STAGES);
 
    const unsigned max_uniform_blocks[] = {
       ctx->Const.VertexProgram.MaxUniformBlocks,
       ctx->Const.GeometryProgram.MaxUniformBlocks,
       ctx->Const.FragmentProgram.MaxUniformBlocks
    };
-   STATIC_ASSERT(Elements(max_uniform_blocks) == MESA_SHADER_TYPES);
+   STATIC_ASSERT(Elements(max_uniform_blocks) == MESA_SHADER_STAGES);
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_shader *sh = prog->_LinkedShaders[i];
 
       if (sh == NULL)
@@ -1932,7 +1932,7 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
 
       if (sh->num_samplers > max_samplers[i]) {
         linker_error(prog, "Too many %s shader texture samplers",
-                     _mesa_shader_type_to_string(i));
+                     _mesa_shader_stage_to_string(i));
       }
 
       if (sh->num_uniform_components > max_default_uniform_components[i]) {
@@ -1941,11 +1941,11 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
                            "components, but the driver will try to optimize "
                            "them out; this is non-portable out-of-spec "
                           "behavior\n",
-                           _mesa_shader_type_to_string(i));
+                           _mesa_shader_stage_to_string(i));
          } else {
             linker_error(prog, "Too many %s shader default uniform block "
                         "components",
-                         _mesa_shader_type_to_string(i));
+                         _mesa_shader_stage_to_string(i));
          }
       }
 
@@ -1955,19 +1955,19 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
             linker_warning(prog, "Too many %s shader uniform components, "
                            "but the driver will try to optimize them out; "
                            "this is non-portable out-of-spec behavior\n",
-                           _mesa_shader_type_to_string(i));
+                           _mesa_shader_stage_to_string(i));
          } else {
             linker_error(prog, "Too many %s shader uniform components",
-                         _mesa_shader_type_to_string(i));
+                         _mesa_shader_stage_to_string(i));
          }
       }
    }
 
-   unsigned blocks[MESA_SHADER_TYPES] = {0};
+   unsigned blocks[MESA_SHADER_STAGES] = {0};
    unsigned total_uniform_blocks = 0;
 
    for (unsigned i = 0; i < prog->NumUniformBlocks; i++) {
-      for (unsigned j = 0; j < MESA_SHADER_TYPES; j++) {
+      for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
         if (prog->UniformBlockStageIndex[j][i] != -1) {
            blocks[j]++;
            total_uniform_blocks++;
@@ -1979,10 +1979,10 @@ check_resources(struct gl_context *ctx, struct 
gl_shader_program *prog)
                      prog->NumUniformBlocks,
                      ctx->Const.MaxCombinedUniformBlocks);
       } else {
-        for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+        for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
            if (blocks[i] > max_uniform_blocks[i]) {
               linker_error(prog, "Too many %s uniform blocks (%d/%d)",
-                           _mesa_shader_type_to_string(i),
+                           _mesa_shader_stage_to_string(i),
                            blocks[i],
                            max_uniform_blocks[i]);
               break;
@@ -2010,7 +2010,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
    ralloc_free(prog->UniformBlocks);
    prog->UniformBlocks = NULL;
    prog->NumUniformBlocks = 0;
-   for (int i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (int i = 0; i < MESA_SHADER_STAGES; i++) {
       ralloc_free(prog->UniformBlockStageIndex[i]);
       prog->UniformBlockStageIndex[i] = NULL;
    }
@@ -2085,7 +2085,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
       goto done;
    }
 
-   for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] != NULL)
         ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);
 
@@ -2154,7 +2154,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
 
    unsigned prev;
 
-   for (prev = 0; prev < MESA_SHADER_TYPES; prev++) {
+   for (prev = 0; prev < MESA_SHADER_STAGES; prev++) {
       if (prog->_LinkedShaders[prev] != NULL)
          break;
    }
@@ -2162,7 +2162,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
    /* Validate the inputs of each stage with the output of the preceding
     * stage.
     */
-   for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = prev + 1; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
          continue;
 
@@ -2182,11 +2182,11 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
 
    /* Cross-validate uniform blocks between shader stages */
    validate_interstage_uniform_blocks(prog, prog->_LinkedShaders,
-                                      MESA_SHADER_TYPES);
+                                      MESA_SHADER_STAGES);
    if (!prog->LinkStatus)
       goto done;
 
-   for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] != NULL)
          lower_named_interface_blocks(mem_ctx, prog->_LinkedShaders[i]);
    }
@@ -2211,7 +2211,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
     * uniforms, and varyings.  Later optimization could possibly make
     * some of that unused.
     */
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
         continue;
 
@@ -2257,7 +2257,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
    }
 
    unsigned first;
-   for (first = 0; first < MESA_SHADER_TYPES; first++) {
+   for (first = 0; first < MESA_SHADER_STAGES; first++) {
       if (prog->_LinkedShaders[first] != NULL)
         break;
    }
@@ -2289,7 +2289,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
     * eliminated if they are (transitively) not used in a later stage.
     */
    int last, next;
-   for (last = MESA_SHADER_TYPES-1; last >= 0; last--) {
+   for (last = MESA_SHADER_STAGES-1; last >= 0; last--) {
       if (prog->_LinkedShaders[last] != NULL)
          break;
    }
@@ -2404,7 +2404,7 @@ done:
    free(frag_shader_list);
    free(geom_shader_list);
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
         continue;
 
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index aa188b1..2f59848 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -388,7 +388,7 @@ main(int argc, char **argv)
         printf("Info log for linking:\n%s\n", whole_program->InfoLog);
    }
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++)
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++)
       ralloc_free(whole_program->_LinkedShaders[i]);
 
    ralloc_free(whole_program);
diff --git a/src/glsl/standalone_scaffolding.cpp 
b/src/glsl/standalone_scaffolding.cpp
index cbff6d1..73dfe5c 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -148,6 +148,6 @@ void initialize_context_to_defaults(struct gl_context *ctx, 
gl_api api)
    /* Default pragma settings */
    options.DefaultPragmas.Optimize = true;
 
-   for (int sh = 0; sh < MESA_SHADER_TYPES; ++sh)
+   for (int sh = 0; sh < MESA_SHADER_STAGES; ++sh)
       memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options));
 }
diff --git a/src/glsl/standalone_scaffolding.h 
b/src/glsl/standalone_scaffolding.h
index 9f4818a..327fef2 100644
--- a/src/glsl/standalone_scaffolding.h
+++ b/src/glsl/standalone_scaffolding.h
@@ -48,8 +48,8 @@ extern "C" void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
                    const char *msg, int len);
 
-static inline gl_shader_type
-_mesa_shader_type_to_index(GLenum v)
+static inline gl_shader_stage
+_mesa_shader_enum_to_shader_stage(GLenum v)
 {
    switch (v) {
    case GL_VERTEX_SHADER:
@@ -59,7 +59,7 @@ _mesa_shader_type_to_index(GLenum v)
    case GL_GEOMETRY_SHADER:
       return MESA_SHADER_GEOMETRY;
    default:
-      assert(!"bad value in _mesa_shader_type_to_index()");
+      assert(!"bad value in _mesa_shader_enum_to_shader_stage()");
       return MESA_SHADER_VERTEX;
    }
 }
diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp
index 67e2ab2..01f6f95 100644
--- a/src/glsl/test_optpass.cpp
+++ b/src/glsl/test_optpass.cpp
@@ -242,7 +242,7 @@ int test_optpass(int argc, char **argv)
    if (!state->error) {
       GLboolean progress;
       const struct gl_shader_compiler_options *options =
-         &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader_type)];
+         
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader_type)];
       do {
          progress = do_optimization_passes(shader->ir, &argv[optind],
                                            argc - optind, quiet != 0, options);
diff --git a/src/glsl/tests/set_uniform_initializer_tests.cpp 
b/src/glsl/tests/set_uniform_initializer_tests.cpp
index 5c6d4a5..be202b3 100644
--- a/src/glsl/tests/set_uniform_initializer_tests.cpp
+++ b/src/glsl/tests/set_uniform_initializer_tests.cpp
@@ -116,7 +116,7 @@ establish_uniform_storage(struct gl_shader_program *prog, 
unsigned num_storage,
    prog->UniformStorage[index_to_set].type = type;
    prog->UniformStorage[index_to_set].array_elements = array_size;
    prog->UniformStorage[index_to_set].initialized = false;
-   for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
+   for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
       prog->UniformStorage[index_to_set].sampler[sh].index = ~0;
       prog->UniformStorage[index_to_set].sampler[sh].active = false;
    }
@@ -137,7 +137,7 @@ establish_uniform_storage(struct gl_shader_program *prog, 
unsigned num_storage,
       prog->UniformStorage[i].type = glsl_type::void_type;
       prog->UniformStorage[i].array_elements = 0;
       prog->UniformStorage[i].initialized = false;
-      for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
+      for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
          prog->UniformStorage[i].sampler[sh].index = ~0;
          prog->UniformStorage[i].sampler[sh].active = false;
       }
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 78c06fc..8d202a2 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -463,7 +463,7 @@ brw_initialize_context_constants(struct brw_context *brw)
    }
 
    /* We want the GLSL compiler to emit code that uses condition codes */
-   for (int i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (int i = 0; i < MESA_SHADER_STAGES; i++) {
       ctx->ShaderCompilerOptions[i].MaxIfDepth = brw->gen < 6 ? 16 : UINT_MAX;
       ctx->ShaderCompilerOptions[i].EmitCondCodes = true;
       ctx->ShaderCompilerOptions[i].EmitNoNoise = true;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 3f59c80..a40df6d 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -82,7 +82,7 @@ brw_shader_precompile(struct gl_context *ctx, struct 
gl_shader_program *prog)
 
 static void
 brw_lower_packing_builtins(struct brw_context *brw,
-                           gl_shader_type shader_type,
+                           gl_shader_stage shader_type,
                            exec_list *ir)
 {
    int ops = LOWER_PACK_SNORM_2x16
@@ -132,7 +132,7 @@ brw_link_shader(struct gl_context *ctx, struct 
gl_shader_program *shProg)
        return false;
       prog->Parameters = _mesa_new_parameter_list();
 
-      _mesa_copy_linked_program_data((gl_shader_type) stage, shProg, prog);
+      _mesa_copy_linked_program_data((gl_shader_stage) stage, shProg, prog);
 
       void *mem_ctx = ralloc_context(NULL);
       bool progress;
@@ -145,7 +145,7 @@ brw_link_shader(struct gl_context *ctx, struct 
gl_shader_program *shProg)
       /* lower_packing_builtins() inserts arithmetic instructions, so it
        * must precede lower_instructions().
        */
-      brw_lower_packing_builtins(brw, (gl_shader_type) stage, shader->ir);
+      brw_lower_packing_builtins(brw, (gl_shader_stage) stage, shader->ir);
       do_mat_op_to_vec(shader->ir);
       const int bitfield_insert = brw->gen >= 7
                                   ? BITFIELD_INSERT_TO_BFM_BFI
@@ -261,7 +261,7 @@ brw_link_shader(struct gl_context *ctx, struct 
gl_shader_program *shProg)
       if (ctx->Shader.Flags & GLSL_DUMP) {
          printf("\n");
          printf("GLSL IR for linked %s program %d:\n",
-                _mesa_shader_enum_to_string(shader->base.Type), shProg->Name);
+                _mesa_progshader_enum_to_string(shader->base.Type), 
shProg->Name);
          _mesa_print_ir(shader->base.ir, NULL);
          printf("\n");
       }
@@ -274,7 +274,7 @@ brw_link_shader(struct gl_context *ctx, struct 
gl_shader_program *shProg)
             continue;
 
          printf("GLSL %s shader %d source for linked program %d:\n",
-                _mesa_shader_enum_to_string(sh->Type),
+                _mesa_progshader_enum_to_string(sh->Type),
                 i,
                 shProg->Name);
          printf("%s", sh->Source);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 658499f..76e2ecc 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1851,14 +1851,14 @@ _mesa_valid_to_render(struct gl_context *ctx, const 
char *where)
 
 #ifdef DEBUG
    if (ctx->Shader.Flags & GLSL_LOG) {
-      struct gl_shader_program *shProg[MESA_SHADER_TYPES];
-      gl_shader_type i;
+      struct gl_shader_program *shProg[MESA_SHADER_STAGES];
+      gl_shader_stage i;
 
       shProg[MESA_SHADER_VERTEX] = ctx->Shader.CurrentVertexProgram;
       shProg[MESA_SHADER_GEOMETRY] = ctx->Shader.CurrentGeometryProgram;
       shProg[MESA_SHADER_FRAGMENT] = ctx->Shader.CurrentFragmentProgram;
 
-      for (i = 0; i < MESA_SHADER_TYPES; i++) {
+      for (i = 0; i < MESA_SHADER_STAGES; i++) {
         if (shProg[i] == NULL || shProg[i]->_Used
             || shProg[i]->_LinkedShaders[i] == NULL)
            continue;
@@ -1875,7 +1875,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char 
*where)
         _mesa_append_uniforms_to_file(shProg[i]->_LinkedShaders[i]);
       }
 
-      for (i = 0; i < MESA_SHADER_TYPES; i++) {
+      for (i = 0; i < MESA_SHADER_STAGES; i++) {
         if (shProg[i] != NULL)
            shProg[i]->_Used = GL_TRUE;
       }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a5294b0..9e2083c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2399,9 +2399,9 @@ typedef enum
    MESA_SHADER_VERTEX = 0,
    MESA_SHADER_GEOMETRY = 1,
    MESA_SHADER_FRAGMENT = 2,
-} gl_shader_type;
+} gl_shader_stage;
 
-#define MESA_SHADER_TYPES (MESA_SHADER_FRAGMENT + 1)
+#define MESA_SHADER_STAGES (MESA_SHADER_FRAGMENT + 1)
 
 
 struct gl_uniform_buffer_variable
@@ -2482,7 +2482,7 @@ struct gl_active_atomic_buffer
    GLuint MinimumSize;
 
    /** Shader stages making use of it. */
-   GLboolean StageReferences[MESA_SHADER_TYPES];
+   GLboolean StageReferences[MESA_SHADER_STAGES];
 };
 
 /**
@@ -2620,7 +2620,7 @@ struct gl_shader_program
     * This is used to maintain the Binding values of the stage's 
UniformBlocks[]
     * and to answer the GL_UNIFORM_BLOCK_REFERENCED_BY_*_SHADER queries.
     */
-   int *UniformBlockStageIndex[MESA_SHADER_TYPES];
+   int *UniformBlockStageIndex[MESA_SHADER_STAGES];
 
    /**
     * Map of active uniform names to locations
@@ -2650,7 +2650,7 @@ struct gl_shader_program
     * \c MESA_SHADER_* defines.  Entries for non-existent stages will be
     * \c NULL.
     */
-   struct gl_shader *_LinkedShaders[MESA_SHADER_TYPES];
+   struct gl_shader *_LinkedShaders[MESA_SHADER_STAGES];
 };   
 
 
@@ -3907,7 +3907,7 @@ struct gl_context
    struct gl_ati_fragment_shader_state ATIFragmentShader;
 
    struct gl_shader_state Shader; /**< GLSL shader object state */
-   struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_TYPES];
+   struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES];
 
    struct gl_query_state Query;  /**< occlusion, timer queries */
 
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 57511e8..fc76f23 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -108,7 +108,7 @@ _mesa_init_shader_state(struct gl_context *ctx)
     * are generated by the GLSL compiler.
     */
    struct gl_shader_compiler_options options;
-   gl_shader_type sh;
+   gl_shader_stage sh;
 
    memset(&options, 0, sizeof(options));
    options.MaxUnrollIterations = 32;
@@ -117,7 +117,7 @@ _mesa_init_shader_state(struct gl_context *ctx)
    /* Default pragma settings */
    options.DefaultPragmas.Optimize = GL_TRUE;
 
-   for (sh = 0; sh < MESA_SHADER_TYPES; ++sh)
+   for (sh = 0; sh < MESA_SHADER_STAGES; ++sh)
       memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options));
 
    ctx->Shader.Flags = get_shader_flags();
@@ -778,7 +778,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
    if (!sh)
       return;
 
-   options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(sh->Type)];
+   options = 
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(sh->Type)];
 
    /* set default pragma state for shader */
    sh->Pragmas = options->DefaultPragmas;
@@ -791,7 +791,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
    } else {
       if (ctx->Shader.Flags & GLSL_DUMP) {
          printf("GLSL source for %s shader %d:\n",
-                _mesa_shader_enum_to_string(sh->Type), sh->Name);
+                _mesa_progshader_enum_to_string(sh->Type), sh->Name);
          printf("%s\n", sh->Source);
       }
 
@@ -823,7 +823,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
    if (!sh->CompileStatus) {
       if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) {
          fprintf(stderr, "GLSL source for %s shader %d:\n",
-                 _mesa_shader_enum_to_string(sh->Type), sh->Name);
+                 _mesa_progshader_enum_to_string(sh->Type), sh->Name);
          fprintf(stderr, "%s\n", sh->Source);
          fprintf(stderr, "Info Log:\n%s\n", sh->InfoLog);
          fflush(stderr);
@@ -898,7 +898,7 @@ print_shader_info(const struct gl_shader_program *shProg)
    printf("Mesa: glUseProgram(%u)\n", shProg->Name);
    for (i = 0; i < shProg->NumShaders; i++) {
       printf("  %s shader %u, checksum %u\n",
-             _mesa_shader_enum_to_string(shProg->Shaders[i]->Type),
+             _mesa_progshader_enum_to_string(shProg->Shaders[i]->Type),
             shProg->Shaders[i]->Name,
             shProg->Shaders[i]->SourceChecksum);
    }
@@ -1836,7 +1836,7 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar 
*string)
  * object to a specific gl_program object.
  */
 void
-_mesa_copy_linked_program_data(gl_shader_type type,
+_mesa_copy_linked_program_data(gl_shader_stage type,
                                const struct gl_shader_program *src,
                                struct gl_program *dst)
 {
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index fe58e7d..4822e32 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -211,7 +211,7 @@ extern GLuint GLAPIENTRY
 _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string);
 
 extern void
-_mesa_copy_linked_program_data(gl_shader_type type,
+_mesa_copy_linked_program_data(gl_shader_stage type,
                                const struct gl_shader_program *src,
                                struct gl_program *dst);
 
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 0d794ad..3076fb4 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -307,7 +307,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
                                struct gl_shader_program *shProg)
 {
    GLuint i;
-   gl_shader_type sh;
+   gl_shader_stage sh;
 
    assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
 
@@ -346,7 +346,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
    shProg->TransformFeedback.NumVarying = 0;
 
 
-   for (sh = 0; sh < MESA_SHADER_TYPES; sh++) {
+   for (sh = 0; sh < MESA_SHADER_STAGES; sh++) {
       if (shProg->_LinkedShaders[sh] != NULL) {
         ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[sh]);
         shProg->_LinkedShaders[sh] = NULL;
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index 155058d..5175570 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -101,8 +101,8 @@ extern void
 _mesa_free_shader_state(struct gl_context *ctx);
 
 
-static inline gl_shader_type
-_mesa_shader_type_to_index(GLenum v)
+static inline gl_shader_stage
+_mesa_shader_enum_to_shader_stage(GLenum v)
 {
    switch (v) {
    case GL_VERTEX_SHADER:
@@ -112,7 +112,7 @@ _mesa_shader_type_to_index(GLenum v)
    case GL_GEOMETRY_SHADER:
       return MESA_SHADER_GEOMETRY;
    default:
-      ASSERT(0 && "bad value in _mesa_shader_type_to_index()");
+      ASSERT(0 && "bad value in _mesa_shader_enum_to_shader_stage()");
       return MESA_SHADER_VERTEX;
    }
 }
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 61bcbcb..d90193e 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -445,14 +445,14 @@ log_uniform(const void *values, enum glsl_base_type 
basicType,
 static void
 log_program_parameters(const struct gl_shader_program *shProg)
 {
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (shProg->_LinkedShaders[i] == NULL)
         continue;
 
       const struct gl_program *const prog = shProg->_LinkedShaders[i]->Program;
 
       printf("Program %d %s shader parameters:\n",
-             shProg->Name, _mesa_shader_enum_to_string(prog->Target));
+             shProg->Name, _mesa_progshader_enum_to_string(prog->Target));
       for (unsigned j = 0; j < prog->Parameters->NumParameters; j++) {
         printf("%s: %p %f %f %f %f\n",
                prog->Parameters->Parameters[j].Name,
@@ -784,7 +784,7 @@ _mesa_uniform(struct gl_context *ctx, struct 
gl_shader_program *shProg,
       int i;
 
       bool flushed = false;
-      for (i = 0; i < MESA_SHADER_TYPES; i++) {
+      for (i = 0; i < MESA_SHADER_STAGES; i++) {
         struct gl_shader *const sh = shProg->_LinkedShaders[i];
          int j;
 
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 17e24f6..071d668 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -68,7 +68,7 @@ _mesa_update_shader_textures_used(struct gl_shader_program 
*shProg,
 {
    GLuint s;
    struct gl_shader *shader =
-      shProg->_LinkedShaders[_mesa_program_target_to_index(prog->Target)];
+      shProg->_LinkedShaders[_mesa_program_enum_to_shader_stage(prog->Target)];
 
    assert(shader);
 
@@ -642,7 +642,7 @@ _mesa_UniformBlockBinding(GLuint program,
 
       shProg->UniformBlocks[uniformBlockIndex].Binding = uniformBlockBinding;
 
-      for (i = 0; i < MESA_SHADER_TYPES; i++) {
+      for (i = 0; i < MESA_SHADER_STAGES; i++) {
         int stage_index = shProg->UniformBlockStageIndex[i][uniformBlockIndex];
 
         if (stage_index != -1) {
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index beb0c09..ae4a6e2 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2392,7 +2392,7 @@ class add_uniform_to_shader : public 
program_resource_visitor {
 public:
    add_uniform_to_shader(struct gl_shader_program *shader_program,
                         struct gl_program_parameter_list *params,
-                         gl_shader_type shader_type)
+                         gl_shader_stage shader_type)
       : shader_program(shader_program), params(params), idx(-1),
         shader_type(shader_type)
    {
@@ -2414,7 +2414,7 @@ private:
    struct gl_shader_program *shader_program;
    struct gl_program_parameter_list *params;
    int idx;
-   gl_shader_type shader_type;
+   gl_shader_stage shader_type;
 };
 
 } /* anonymous namespace */
@@ -2494,7 +2494,7 @@ _mesa_generate_parameters_list_for_uniforms(struct 
gl_shader_program
                                            *params)
 {
    add_uniform_to_shader add(shader_program, params,
-                             _mesa_shader_type_to_index(sh->Type));
+                             _mesa_shader_enum_to_shader_stage(sh->Type));
 
    foreach_list(node, sh->ir) {
       ir_variable *var = ((ir_instruction *) node)->as_variable();
@@ -2801,9 +2801,9 @@ get_mesa_program(struct gl_context *ctx,
    int i;
    struct gl_program *prog;
    GLenum target;
-   const char *target_string = _mesa_shader_enum_to_string(shader->Type);
+   const char *target_string = _mesa_progshader_enum_to_string(shader->Type);
    struct gl_shader_compiler_options *options =
-         &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
+         
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader->Type)];
 
    switch (shader->Type) {
    case GL_VERTEX_SHADER:
@@ -3000,14 +3000,14 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
 {
    assert(prog->LinkStatus);
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
         continue;
 
       bool progress;
       exec_list *ir = prog->_LinkedShaders[i]->ir;
       const struct gl_shader_compiler_options *options =
-            
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)];
+            
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type)];
 
       do {
         progress = false;
@@ -3055,7 +3055,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
       validate_ir_tree(ir);
    }
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_program *linked_prog;
 
       if (prog->_LinkedShaders[i] == NULL)
@@ -3064,7 +3064,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
       linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
 
       if (linked_prog) {
-         _mesa_copy_linked_program_data((gl_shader_type) i, prog, linked_prog);
+         _mesa_copy_linked_program_data((gl_shader_stage) i, prog, 
linked_prog);
 
         _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
                                 linked_prog);
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index cdf1c03..45748fd 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -891,7 +891,7 @@ _mesa_find_free_register(const GLboolean used[],
  */
 GLboolean
 _mesa_valid_register_index(const struct gl_context *ctx,
-                           gl_shader_type shaderType,
+                           gl_shader_stage shaderType,
                            gl_register_file file, GLint index)
 {
    const struct gl_program_constants *c;
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index baff473..4015b4c 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -181,7 +181,7 @@ _mesa_find_free_register(const GLboolean used[],
 
 extern GLboolean
 _mesa_valid_register_index(const struct gl_context *ctx,
-                           gl_shader_type shaderType,
+                           gl_shader_stage shaderType,
                            gl_register_file file, GLint index);
 
 extern void
@@ -192,7 +192,7 @@ _mesa_get_min_invocations_per_fragment(struct gl_context 
*ctx,
                                        const struct gl_fragment_program *prog);
 
 static inline GLuint
-_mesa_program_target_to_index(GLenum v)
+_mesa_program_enum_to_shader_stage(GLenum v)
 {
    switch (v) {
    case GL_VERTEX_PROGRAM_ARB:
@@ -215,8 +215,8 @@ _mesa_program_index_to_target(GLuint i)
       GL_GEOMETRY_PROGRAM_NV,
       GL_FRAGMENT_PROGRAM_ARB
    };
-   STATIC_ASSERT(Elements(enums) == MESA_SHADER_TYPES);
-   if(i >= MESA_SHADER_TYPES) {
+   STATIC_ASSERT(Elements(enums) == MESA_SHADER_STAGES);
+   if(i >= MESA_SHADER_STAGES) {
       assert(!"Unexpected program index");
       return 0;
    } else
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index 9b94127..e6532be 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -111,7 +111,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference 
*sampler,
 {
    get_sampler_name getname(sampler, shader_program);
 
-   GLuint shader = _mesa_program_target_to_index(prog->Target);
+   GLuint shader = _mesa_program_enum_to_shader_stage(prog->Target);
 
    sampler->accept(&getname);
 
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index eb12426..b2131ed 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4996,7 +4996,7 @@ st_translate_program(
        * prog->ParameterValues to get reallocated (e.g., anything that adds a
        * program constant) has to happen before creating this linkage.
        */
-      for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+      for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
          if (program->shader_program->_LinkedShaders[i] == NULL)
             continue;
 
@@ -5037,7 +5037,7 @@ get_mesa_program(struct gl_context *ctx,
    GLenum target;
    bool progress;
    struct gl_shader_compiler_options *options =
-         &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
+         
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader->Type)];
    struct pipe_screen *pscreen = ctx->st->pipe->screen;
    unsigned ptarget;
 
@@ -5143,7 +5143,7 @@ get_mesa_program(struct gl_context *ctx,
    if (ctx->Shader.Flags & GLSL_DUMP) {
       printf("\n");
       printf("GLSL IR for linked %s program %d:\n",
-             _mesa_shader_enum_to_string(shader->Type),
+             _mesa_progshader_enum_to_string(shader->Type),
              shader_program->Name);
       _mesa_print_ir(shader->ir, NULL);
       printf("\n");
@@ -5236,14 +5236,14 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
 {
    assert(prog->LinkStatus);
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
          continue;
 
       bool progress;
       exec_list *ir = prog->_LinkedShaders[i]->ir;
       const struct gl_shader_compiler_options *options =
-            
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)];
+            
&ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type)];
 
       /* If there are forms of indirect addressing that the driver
        * cannot handle, perform the lowering pass.
@@ -5306,7 +5306,7 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
       validate_ir_tree(ir);
    }
 
-   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       struct gl_program *linked_prog;
 
       if (prog->_LinkedShaders[i] == NULL)
-- 
1.8.5.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to