summaryrefslogtreecommitdiff
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2014-01-07 10:58:56 -0800
committerPaul Berry <stereotype441@gmail.com>2014-01-08 07:31:45 -0800
commite3b86f07da4ba9a4db6b8aae4072af6f1638b7cc (patch)
tree1b3c89c2a65cdefd6c39974e19ac337962df42b9 /src/glsl/linker.cpp
parent65511e5f22e2ba0a5ebd9210319a55d80ea5334e (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 <brianp@vmware.com> v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects." Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 428a044e9b8..91a7220fc8e 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_progshader_enum_to_string(shader->Type));
+ _mesa_shader_stage_to_string(shader->Stage));
return;
}
*UsesClipDistance = clip_distance.variable_found();
@@ -1209,7 +1209,7 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
/* No in/out qualifiers defined for anything but GLSL 1.50+
* geometry shaders so far.
*/
- if (linked_shader->Type != GL_GEOMETRY_SHADER || prog->Version < 150)
+ if (linked_shader->Stage != MESA_SHADER_GEOMETRY || prog->Version < 150)
return;
/* From the GLSL 1.50 spec, page 46:
@@ -1376,7 +1376,7 @@ link_intrastage_shaders(void *mem_ctx,
if (main == NULL) {
linker_error(prog, "%s shader lacks `main'\n",
- _mesa_progshader_enum_to_string(shader_list[0]->Type));
+ _mesa_shader_stage_to_string(shader_list[0]->Stage));
return NULL;
}
@@ -1450,7 +1450,7 @@ link_intrastage_shaders(void *mem_ctx,
validate_ir_tree(linked->ir);
/* Set the size of geometry shader input arrays */
- if (linked->Type == GL_GEOMETRY_SHADER) {
+ if (linked->Stage == MESA_SHADER_GEOMETRY) {
unsigned num_vertices = vertices_per_prim(prog->Geom.InputType);
geom_array_resize_visitor input_resize_visitor(num_vertices, prog);
foreach_iter(exec_list_iterator, iter, *linked->ir) {
@@ -2049,16 +2049,16 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
}
- switch (prog->Shaders[i]->Type) {
- case GL_VERTEX_SHADER:
+ switch (prog->Shaders[i]->Stage) {
+ case MESA_SHADER_VERTEX:
vert_shader_list[num_vert_shaders] = prog->Shaders[i];
num_vert_shaders++;
break;
- case GL_FRAGMENT_SHADER:
+ case MESA_SHADER_FRAGMENT:
frag_shader_list[num_frag_shaders] = prog->Shaders[i];
num_frag_shaders++;
break;
- case GL_GEOMETRY_SHADER:
+ case MESA_SHADER_GEOMETRY:
geom_shader_list[num_geom_shaders] = prog->Shaders[i];
num_geom_shaders++;
break;