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/glsl_parser_extras.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/glsl_parser_extras.cpp')
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 8a9526c471f..0031e15d722 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -1448,7 +1448,7 @@ static void set_shader_inout_layout(struct gl_shader *shader, struct _mesa_glsl_parse_state *state) { - if (shader->Type != GL_GEOMETRY_SHADER) { + if (shader->Stage != MESA_SHADER_GEOMETRY) { /* Should have been prevented by the parser. */ assert(!state->gs_input_prim_type_specified); assert(!state->out_qualifier->flags.i); @@ -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_enum_to_shader_stage(shader->Type)]; + &ctx->ShaderCompilerOptions[shader->Stage]; /* Do some optimization at compile time to reduce shader IR size * and reduce later work if the same shader is linked multiple times |