diff options
author | Paul Berry <[email protected]> | 2014-01-07 10:58:56 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2014-01-08 07:31:45 -0800 |
commit | e3b86f07da4ba9a4db6b8aae4072af6f1638b7cc (patch) | |
tree | 1b3c89c2a65cdefd6c39974e19ac337962df42b9 /src/glsl/link_varyings.cpp | |
parent | 65511e5f22e2ba0a5ebd9210319a55d80ea5334e (diff) |
mesa: Use gl_shader::Stage instead of gl_shader::Type where possible.
This reduces confusion since gl_shader::Type is sometimes
GL_SHADER_PROGRAM_MESA but is more frequently
GL_SHADER_{VERTEX,GEOMETRY,FRAGMENT}. It also has the advantage that
when switching on gl_shader::Stage, the compiler will alert if one of
the possible enum types is unhandled. Finally, many functions in
src/glsl (especially those dealing with linking) already use
gl_shader_stage to represent pipeline stages; using gl_shader::Stage
in those functions avoids the need for a conversion.
Note: in the process I changed _mesa_write_shader_to_file() so that if
it encounters an unexpected shader stage, it will use a file suffix of
"????" rather than "geom".
Reviewed-by: Brian Paul <[email protected]>
v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects."
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/link_varyings.cpp')
-rw-r--r-- | src/glsl/link_varyings.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index ab40d458563..da97e9ff24e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1072,7 +1072,7 @@ assign_varying_locations(struct gl_context *ctx, const unsigned producer_base = VARYING_SLOT_VAR0; const unsigned consumer_base = VARYING_SLOT_VAR0; varying_matches matches(ctx->Const.DisableVaryingPacking, - consumer && consumer->Type == GL_FRAGMENT_SHADER); + consumer && consumer->Stage == MESA_SHADER_FRAGMENT); hash_table *tfeedback_candidates = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); hash_table *consumer_inputs @@ -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_progshader_enum_to_string(consumer->Type), + _mesa_shader_stage_to_string(consumer->Stage), var->name, - _mesa_progshader_enum_to_string(producer->Type)); + _mesa_shader_stage_to_string(producer->Stage)); } /* An 'in' variable is only really a shader input if its @@ -1250,14 +1250,14 @@ check_against_output_limit(struct gl_context *ctx, } unsigned max_output_components; - switch (producer->Type) { - case GL_VERTEX_SHADER: + switch (producer->Stage) { + case MESA_SHADER_VERTEX: max_output_components = ctx->Const.VertexProgram.MaxOutputComponents; break; - case GL_GEOMETRY_SHADER: + case MESA_SHADER_GEOMETRY: max_output_components = ctx->Const.GeometryProgram.MaxOutputComponents; break; - case GL_FRAGMENT_SHADER: + case MESA_SHADER_FRAGMENT: default: assert(!"Should not get here."); return false; @@ -1299,14 +1299,14 @@ check_against_input_limit(struct gl_context *ctx, } unsigned max_input_components; - switch (consumer->Type) { - case GL_GEOMETRY_SHADER: + switch (consumer->Stage) { + case MESA_SHADER_GEOMETRY: max_input_components = ctx->Const.GeometryProgram.MaxInputComponents; break; - case GL_FRAGMENT_SHADER: + case MESA_SHADER_FRAGMENT: max_input_components = ctx->Const.FragmentProgram.MaxInputComponents; break; - case GL_VERTEX_SHADER: + case MESA_SHADER_VERTEX: default: assert(!"Should not get here."); return false; |