summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2014-01-07 10:11:39 -0800
committerPaul Berry <[email protected]>2014-01-08 07:30:30 -0800
commit665b8d7b6d8eae03c9dc0ef1a744fe59d9cc6cb6 (patch)
tree54e3ca4a5dded5d90e29a5a541c9ed190352f3e9 /src/glsl
parenteda21d2a3010d9fc5a68b55a843c5e44b2abf8dd (diff)
mesa: Clean up nomenclature for pipeline stages.
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_stage - _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. Reviewed-by: Kenneth Graunke <[email protected]> v2: Also rename the "target" field of _mesa_glsl_parse_state and the "target" parameter of _mesa_shader_stage_to_string to "stage". Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ast_to_hir.cpp76
-rw-r--r--src/glsl/builtin_functions.cpp22
-rw-r--r--src/glsl/builtin_variables.cpp12
-rw-r--r--src/glsl/glsl_parser.yy8
-rw-r--r--src/glsl/glsl_parser_extras.cpp22
-rw-r--r--src/glsl/glsl_parser_extras.h10
-rw-r--r--src/glsl/ir_uniform.h2
-rw-r--r--src/glsl/link_atomics.cpp22
-rw-r--r--src/glsl/link_uniform_initializers.cpp8
-rw-r--r--src/glsl/link_uniforms.cpp12
-rw-r--r--src/glsl/link_varyings.cpp24
-rw-r--r--src/glsl/linker.cpp62
-rw-r--r--src/glsl/main.cpp2
-rw-r--r--src/glsl/standalone_scaffolding.cpp2
-rw-r--r--src/glsl/standalone_scaffolding.h6
-rw-r--r--src/glsl/test_optpass.cpp2
-rw-r--r--src/glsl/tests/set_uniform_initializer_tests.cpp4
17 files changed, 148 insertions, 148 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 91810f985bf..3e79f1a8ed5 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1860,7 +1860,7 @@ ast_fully_specified_type::glsl_type(const char **name,
if (type->base_type == GLSL_TYPE_FLOAT
&& state->es_shader
- && state->target == MESA_SHADER_FRAGMENT
+ && state->stage == MESA_SHADER_FRAGMENT
&& this->qualifier.precision == ast_precision_none
&& state->symbols->get_variable("#default precision") == NULL) {
YYLTYPE loc = this->get_location();
@@ -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:
@@ -1984,7 +1984,7 @@ validate_binding_qualifier(struct _mesa_glsl_parse_state *state,
* through binding + N - 1 must be within this range."
*/
unsigned limit = 0;
- switch (state->target) {
+ switch (state->stage) {
case MESA_SHADER_VERTEX:
limit = ctx->Const.VertexProgram.MaxTextureImageUnits;
break;
@@ -2049,8 +2049,8 @@ interpret_interpolation_qualifier(const struct ast_type_qualifier *qual,
}
- if ((state->target == MESA_SHADER_VERTEX && mode == ir_var_shader_in) ||
- (state->target == MESA_SHADER_FRAGMENT && mode == ir_var_shader_out)) {
+ if ((state->stage == MESA_SHADER_VERTEX && mode == ir_var_shader_in) ||
+ (state->stage == MESA_SHADER_FRAGMENT && mode == ir_var_shader_out)) {
_mesa_glsl_error(loc, state,
"interpolation qualifier `%s' cannot be applied to "
"vertex shader inputs or fragment shader outputs",
@@ -2076,7 +2076,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
* In the fragment shader only shader outputs can be given explicit
* locations.
*/
- switch (state->target) {
+ switch (state->stage) {
case MESA_SHADER_VERTEX:
if (var->data.mode == ir_var_shader_in) {
if (!state->check_explicit_attrib_location_allowed(loc, var))
@@ -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->stage));
} else {
var->data.explicit_location = true;
@@ -2122,7 +2122,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
* ensures that negative values stay negative.
*/
if (qual->location >= 0) {
- var->data.location = (state->target == MESA_SHADER_VERTEX)
+ var->data.location = (state->stage == MESA_SHADER_VERTEX)
? (qual->location + VERT_ATTRIB_GENERIC0)
: (qual->location + FRAG_RESULT_DATA0);
} else {
@@ -2174,7 +2174,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
if (qual->flags.q.constant || qual->flags.q.attribute
|| qual->flags.q.uniform
- || (qual->flags.q.varying && (state->target == MESA_SHADER_FRAGMENT)))
+ || (qual->flags.q.varying && (state->stage == MESA_SHADER_FRAGMENT)))
var->data.read_only = 1;
if (qual->flags.q.centroid)
@@ -2183,12 +2183,12 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
if (qual->flags.q.sample)
var->data.sample = 1;
- if (qual->flags.q.attribute && state->target != MESA_SHADER_VERTEX) {
+ if (qual->flags.q.attribute && state->stage != MESA_SHADER_VERTEX) {
var->type = glsl_type::error_type;
_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->stage));
}
/* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
@@ -2214,16 +2214,16 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
else if (qual->flags.q.in)
var->data.mode = is_parameter ? ir_var_function_in : ir_var_shader_in;
else if (qual->flags.q.attribute
- || (qual->flags.q.varying && (state->target == MESA_SHADER_FRAGMENT)))
+ || (qual->flags.q.varying && (state->stage == MESA_SHADER_FRAGMENT)))
var->data.mode = ir_var_shader_in;
else if (qual->flags.q.out)
var->data.mode = is_parameter ? ir_var_function_out : ir_var_shader_out;
- else if (qual->flags.q.varying && (state->target == MESA_SHADER_VERTEX))
+ else if (qual->flags.q.varying && (state->stage == MESA_SHADER_VERTEX))
var->data.mode = ir_var_shader_out;
else if (qual->flags.q.uniform)
var->data.mode = ir_var_uniform;
- if (!is_parameter && is_varying_var(var, state->target)) {
+ if (!is_parameter && is_varying_var(var, state->stage)) {
/* This variable is being used to link data between shader stages (in
* pre-glsl-1.30 parlance, it's a "varying"). Check that it has a type
* that is allowed for such purposes.
@@ -2272,7 +2272,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
}
if (state->all_invariant && (state->current_function == NULL)) {
- switch (state->target) {
+ switch (state->stage) {
case MESA_SHADER_VERTEX:
if (var->data.mode == ir_var_shader_out)
var->data.invariant = true;
@@ -2599,8 +2599,8 @@ 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),
- (state->target == MESA_SHADER_VERTEX)
+ _mesa_shader_stage_to_string(state->stage),
+ (state->stage == MESA_SHADER_VERTEX)
? "attribute" : "varying");
}
@@ -2844,12 +2844,12 @@ ast_declarator_list::hir(exec_list *instructions,
_mesa_glsl_error(& loc, state,
"undeclared variable `%s' cannot be marked "
"invariant", decl->identifier);
- } else if ((state->target == MESA_SHADER_VERTEX)
+ } else if ((state->stage == MESA_SHADER_VERTEX)
&& (earlier->data.mode != ir_var_shader_out)) {
_mesa_glsl_error(& loc, state,
"`%s' cannot be marked invariant, vertex shader "
"outputs only", decl->identifier);
- } else if ((state->target == MESA_SHADER_FRAGMENT)
+ } else if ((state->stage == MESA_SHADER_FRAGMENT)
&& (earlier->data.mode != ir_var_shader_in)) {
_mesa_glsl_error(& loc, state,
"`%s' cannot be marked invariant, fragment shader "
@@ -3034,12 +3034,12 @@ ast_declarator_list::hir(exec_list *instructions,
& loc, false);
if (this->type->qualifier.flags.q.invariant) {
- if ((state->target == MESA_SHADER_VERTEX) &&
+ if ((state->stage == MESA_SHADER_VERTEX) &&
var->data.mode != ir_var_shader_out) {
_mesa_glsl_error(& loc, state,
"`%s' cannot be marked invariant, vertex shader "
"outputs only", var->name);
- } else if ((state->target == MESA_SHADER_FRAGMENT) &&
+ } else if ((state->stage == MESA_SHADER_FRAGMENT) &&
var->data.mode != ir_var_shader_in) {
/* FINISHME: Note that this doesn't work for invariant on
* a function signature inval
@@ -3080,7 +3080,7 @@ ast_declarator_list::hir(exec_list *instructions,
} else if (var->data.mode == ir_var_shader_in) {
var->data.read_only = true;
- if (state->target == MESA_SHADER_VERTEX) {
+ if (state->stage == MESA_SHADER_VERTEX) {
bool error_emitted = false;
/* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec:
@@ -3135,7 +3135,7 @@ ast_declarator_list::hir(exec_list *instructions,
"cannot have array type")) {
error_emitted = true;
}
- } else if (state->target == MESA_SHADER_GEOMETRY) {
+ } else if (state->stage == MESA_SHADER_GEOMETRY) {
/* From section 4.3.4 (Inputs) of the GLSL 1.50 spec:
*
* Geometry shader input variables get the per-vertex values
@@ -3185,10 +3185,10 @@ ast_declarator_list::hir(exec_list *instructions,
if (state->is_version(130, 300) &&
var->type->contains_integer() &&
var->data.interpolation != INTERP_QUALIFIER_FLAT &&
- ((state->target == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_in)
- || (state->target == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_out
+ ((state->stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_in)
+ || (state->stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_out
&& state->es_shader))) {
- const char *var_type = (state->target == MESA_SHADER_VERTEX) ?
+ const char *var_type = (state->stage == MESA_SHADER_VERTEX) ?
"vertex output" : "fragment input";
_mesa_glsl_error(&loc, state, "if a %s is (or contains) "
"an integer, then it must be qualified with 'flat'",
@@ -3244,7 +3244,7 @@ ast_declarator_list::hir(exec_list *instructions,
const char *i = this->type->qualifier.interpolation_string();
assert(i != NULL);
- switch (state->target) {
+ switch (state->stage) {
case MESA_SHADER_VERTEX:
if (this->type->qualifier.flags.q.in) {
_mesa_glsl_error(&loc, state,
@@ -3275,13 +3275,13 @@ ast_declarator_list::hir(exec_list *instructions,
if (state->is_version(130, 300)
&& this->type->qualifier.flags.q.centroid
&& this->type->qualifier.flags.q.in
- && state->target == MESA_SHADER_VERTEX) {
+ && state->stage == MESA_SHADER_VERTEX) {
_mesa_glsl_error(&loc, state,
"'centroid in' cannot be used in a vertex shader");
}
- if (state->target == MESA_SHADER_VERTEX
+ if (state->stage == MESA_SHADER_VERTEX
&& this->type->qualifier.flags.q.sample
&& this->type->qualifier.flags.q.in) {
@@ -3296,7 +3296,7 @@ ast_declarator_list::hir(exec_list *instructions,
* "It is an error to use auxiliary storage qualifiers or interpolation
* qualifiers on an output in a fragment shader."
*/
- if (state->target == MESA_SHADER_FRAGMENT &&
+ if (state->stage == MESA_SHADER_FRAGMENT &&
this->type->qualifier.flags.q.out &&
this->type->qualifier.has_auxiliary_storage()) {
_mesa_glsl_error(&loc, state,
@@ -3954,7 +3954,7 @@ ast_jump_statement::hir(exec_list *instructions,
}
case ast_discard:
- if (state->target != MESA_SHADER_FRAGMENT) {
+ if (state->stage != MESA_SHADER_FRAGMENT) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
@@ -4492,7 +4492,7 @@ ast_type_specifier::hir(exec_list *instructions,
if (type->base_type == GLSL_TYPE_FLOAT
&& state->es_shader
- && state->target == MESA_SHADER_FRAGMENT) {
+ && state->stage == MESA_SHADER_FRAGMENT) {
/* Section 4.5.3 (Default Precision Qualifiers) of the GLSL ES 1.00
* spec says:
*
@@ -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->stage));
}
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->stage));
}
if (this->instance_name != NULL) {
_mesa_glsl_error(&loc, state,
@@ -4995,7 +4995,7 @@ ast_interface_block::hir(exec_list *instructions,
* variable (or input block, see interface blocks below) needs to be
* declared as an array.
*/
- if (state->target == MESA_SHADER_GEOMETRY && !this->is_array &&
+ if (state->stage == MESA_SHADER_GEOMETRY && !this->is_array &&
var_mode == ir_var_shader_in) {
_mesa_glsl_error(&loc, state, "geometry shader inputs must be arrays");
}
@@ -5050,7 +5050,7 @@ ast_interface_block::hir(exec_list *instructions,
* geometry shader input.
*/
if (this->array_size == NULL &&
- (state->target != MESA_SHADER_GEOMETRY || !this->layout.flags.q.in)) {
+ (state->stage != MESA_SHADER_GEOMETRY || !this->layout.flags.q.in)) {
_mesa_glsl_error(&loc, state,
"only geometry shader inputs may be unsized "
"instance block arrays");
@@ -5069,7 +5069,7 @@ ast_interface_block::hir(exec_list *instructions,
var_mode);
}
- if (state->target == MESA_SHADER_GEOMETRY && var_mode == ir_var_shader_in)
+ if (state->stage == MESA_SHADER_GEOMETRY && var_mode == ir_var_shader_in)
handle_geometry_shader_input_decl(state, loc, var);
if (ir_variable *earlier =
@@ -5265,7 +5265,7 @@ detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
else if (strcmp(var->name, "gl_FragData") == 0)
gl_FragData_assigned = true;
else if (strncmp(var->name, "gl_", 3) != 0) {
- if (state->target == MESA_SHADER_FRAGMENT &&
+ if (state->stage == MESA_SHADER_FRAGMENT &&
var->data.mode == ir_var_shader_out) {
user_defined_fs_output_assigned = true;
user_defined_fs_output = var;
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 10127f38ee8..2207fe14f12 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -77,7 +77,7 @@ always_available(const _mesa_glsl_parse_state *state)
static bool
compatibility_vs_only(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_VERTEX &&
+ return state->stage == MESA_SHADER_VERTEX &&
state->language_version <= 130 &&
!state->es_shader;
}
@@ -85,13 +85,13 @@ compatibility_vs_only(const _mesa_glsl_parse_state *state)
static bool
fs_only(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_FRAGMENT;
+ return state->stage == MESA_SHADER_FRAGMENT;
}
static bool
gs_only(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_GEOMETRY;
+ return state->stage == MESA_SHADER_GEOMETRY;
}
static bool
@@ -103,7 +103,7 @@ v110(const _mesa_glsl_parse_state *state)
static bool
v110_fs_only(const _mesa_glsl_parse_state *state)
{
- return !state->es_shader && state->target == MESA_SHADER_FRAGMENT;
+ return !state->es_shader && state->stage == MESA_SHADER_FRAGMENT;
}
static bool
@@ -122,7 +122,7 @@ static bool
v130_fs_only(const _mesa_glsl_parse_state *state)
{
return state->is_version(130, 300) &&
- state->target == MESA_SHADER_FRAGMENT;
+ state->stage == MESA_SHADER_FRAGMENT;
}
static bool
@@ -155,7 +155,7 @@ lod_exists_in_stage(const _mesa_glsl_parse_state *state)
* Since ARB_shader_texture_lod can only be enabled on desktop GLSL, we
* don't need to explicitly check state->es_shader.
*/
- return state->target == MESA_SHADER_VERTEX ||
+ return state->stage == MESA_SHADER_VERTEX ||
state->is_version(130, 300) ||
state->ARB_shader_texture_lod_enable;
}
@@ -223,7 +223,7 @@ texture_array_lod(const _mesa_glsl_parse_state *state)
static bool
fs_texture_array(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_FRAGMENT &&
+ return state->stage == MESA_SHADER_FRAGMENT &&
state->EXT_texture_array_enable;
}
@@ -243,7 +243,7 @@ texture_multisample(const _mesa_glsl_parse_state *state)
static bool
fs_texture_cube_map_array(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_FRAGMENT &&
+ return state->stage == MESA_SHADER_FRAGMENT &&
(state->is_version(400, 0) ||
state->ARB_texture_cube_map_array_enable);
}
@@ -265,7 +265,7 @@ texture_query_levels(const _mesa_glsl_parse_state *state)
static bool
texture_query_lod(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_FRAGMENT &&
+ return state->stage == MESA_SHADER_FRAGMENT &&
state->ARB_texture_query_lod_enable;
}
@@ -292,7 +292,7 @@ texture_gather_only(const _mesa_glsl_parse_state *state)
static bool
fs_oes_derivatives(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_FRAGMENT &&
+ return state->stage == MESA_SHADER_FRAGMENT &&
(state->is_version(110, 300) ||
state->OES_standard_derivatives_enable);
}
@@ -318,7 +318,7 @@ tex3d(const _mesa_glsl_parse_state *state)
static bool
fs_tex3d(const _mesa_glsl_parse_state *state)
{
- return state->target == MESA_SHADER_FRAGMENT &&
+ return state->stage == MESA_SHADER_FRAGMENT &&
(!state->es_shader || state->OES_texture_3D_enable);
}
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index ff9acb8d0d0..1a9489e53da 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -876,7 +876,7 @@ builtin_variable_generator::add_varying(int slot, const glsl_type *type,
const char *name,
const char *name_as_gs_input)
{
- switch (state->target) {
+ switch (state->stage) {
case MESA_SHADER_GEOMETRY:
this->per_vertex_in.add_field(slot, type, name);
/* FALLTHROUGH */
@@ -901,7 +901,7 @@ builtin_variable_generator::generate_varyings()
add_varying(loc, type, name, name "In")
/* gl_Position and gl_PointSize are not visible from fragment shaders. */
- if (state->target != MESA_SHADER_FRAGMENT) {
+ if (state->stage != MESA_SHADER_FRAGMENT) {
ADD_VARYING(VARYING_SLOT_POS, vec4_t, "gl_Position");
ADD_VARYING(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
}
@@ -914,7 +914,7 @@ builtin_variable_generator::generate_varyings()
if (compatibility) {
ADD_VARYING(VARYING_SLOT_TEX0, array(vec4_t, 0), "gl_TexCoord");
ADD_VARYING(VARYING_SLOT_FOGC, float_t, "gl_FogFragCoord");
- if (state->target == MESA_SHADER_FRAGMENT) {
+ if (state->stage == MESA_SHADER_FRAGMENT) {
ADD_VARYING(VARYING_SLOT_COL0, vec4_t, "gl_Color");
ADD_VARYING(VARYING_SLOT_COL1, vec4_t, "gl_SecondaryColor");
} else {
@@ -926,13 +926,13 @@ builtin_variable_generator::generate_varyings()
}
}
- if (state->target == MESA_SHADER_GEOMETRY) {
+ if (state->stage == MESA_SHADER_GEOMETRY) {
const glsl_type *per_vertex_in_type =
this->per_vertex_in.construct_interface_instance();
add_variable("gl_in", array(per_vertex_in_type, 0),
ir_var_shader_in, -1);
}
- if (state->target == MESA_SHADER_VERTEX || state->target == MESA_SHADER_GEOMETRY) {
+ if (state->stage == MESA_SHADER_VERTEX || state->stage == MESA_SHADER_GEOMETRY) {
const glsl_type *per_vertex_out_type =
this->per_vertex_out.construct_interface_instance();
const glsl_struct_field *fields = per_vertex_out_type->fields.structure;
@@ -963,7 +963,7 @@ _mesa_glsl_initialize_variables(exec_list *instructions,
gen.generate_varyings();
- switch (state->target) {
+ switch (state->stage) {
case MESA_SHADER_VERTEX:
gen.generate_vs_special_vars();
break;
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 39767609d20..1c56d6f145a 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -2219,11 +2219,11 @@ basic_interface_block:
* "It is illegal to have an input block in a vertex shader
* or an output block in a fragment shader"
*/
- if ((state->target == MESA_SHADER_VERTEX) && $1.flags.q.in) {
+ if ((state->stage == MESA_SHADER_VERTEX) && $1.flags.q.in) {
_mesa_glsl_error(& @1, state,
"`in' interface block is not allowed for "
"a vertex shader");
- } else if ((state->target == MESA_SHADER_FRAGMENT) && $1.flags.q.out) {
+ } else if ((state->stage == MESA_SHADER_FRAGMENT) && $1.flags.q.out) {
_mesa_glsl_error(& @1, state,
"`out' interface block is not allowed for "
"a fragment shader");
@@ -2377,7 +2377,7 @@ layout_defaults:
{
void *ctx = state;
$$ = NULL;
- if (state->target != MESA_SHADER_GEOMETRY) {
+ if (state->stage != MESA_SHADER_GEOMETRY) {
_mesa_glsl_error(& @1, state,
"input layout qualifiers only valid in "
"geometry shaders");
@@ -2405,7 +2405,7 @@ layout_defaults:
| layout_qualifier OUT_TOK ';'
{
- if (state->target != MESA_SHADER_GEOMETRY) {
+ if (state->stage != MESA_SHADER_GEOMETRY) {
_mesa_glsl_error(& @1, state,
"out layout qualifiers only valid in "
"geometry shaders");
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index e839caf9ad2..8a9526c471f 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -58,9 +58,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
: ctx(_ctx), switch_state()
{
switch (target) {
- case GL_VERTEX_SHADER: this->target = MESA_SHADER_VERTEX; break;
- case GL_FRAGMENT_SHADER: this->target = MESA_SHADER_FRAGMENT; break;
- case GL_GEOMETRY_SHADER: this->target = MESA_SHADER_GEOMETRY; break;
+ case GL_VERTEX_SHADER: this->stage = MESA_SHADER_VERTEX; break;
+ case GL_FRAGMENT_SHADER: this->stage = MESA_SHADER_FRAGMENT; break;
+ case GL_GEOMETRY_SHADER: this->stage = MESA_SHADER_GEOMETRY; break;
}
this->scanner = NULL;
@@ -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,13 +362,13 @@ _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 stage)
{
- switch (target) {
+ switch (stage) {
case MESA_SHADER_VERTEX: return "vertex";
case MESA_SHADER_FRAGMENT: return "fragment";
case MESA_SHADER_GEOMETRY: return "geometry";
@@ -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->stage));
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->stage));
}
}
}
@@ -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 0e281ae203e..8e0ae3bd7e0 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 stage;
/**
* Number of nested struct_specifier levels
@@ -424,11 +424,11 @@ extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
_mesa_glsl_parse_state *state);
/**
- * Get the textual name of the specified shader target (which is a
- * gl_shader_type).
+ * Get the textual name of the specified shader stage (which is a
+ * gl_shader_stage).
*/
extern const char *
-_mesa_shader_type_to_string(unsigned target);
+_mesa_shader_stage_to_string(unsigned stage);
#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 13faab7c0a1..f678c2c5c4d 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 603329c503b..bfa09a3bca6 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 04daa1760a0..7d5c1472dae 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 bda6e4ffb3b..1c97e195781 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 98f902ca4ef..ab40d458563 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 a81e107372b..428a044e9b8 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 aa188b1f158..2f59848adbf 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 cbff6d18228..73dfe5c38be 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 9f4818a8a33..327fef2df15 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 67e2ab2b15c..01f6f9585f0 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 5c6d4a51491..be202b3d57e 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;
}