diff options
author | Paul Berry <[email protected]> | 2014-01-07 10:11:39 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2014-01-08 07:30:30 -0800 |
commit | 665b8d7b6d8eae03c9dc0ef1a744fe59d9cc6cb6 (patch) | |
tree | 54e3ca4a5dded5d90e29a5a541c9ed190352f3e9 /src/mesa/program | |
parent | eda21d2a3010d9fc5a68b55a843c5e44b2abf8dd (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/mesa/program')
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 18 | ||||
-rw-r--r-- | src/mesa/program/program.c | 2 | ||||
-rw-r--r-- | src/mesa/program/program.h | 8 | ||||
-rw-r--r-- | src/mesa/program/sampler.cpp | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index beb0c093b5e..ae4a6e2dec6 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 cdf1c03fa91..45748fdc93c 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 baff473764d..4015b4c202b 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 9b941273092..e6532be84d3 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); |