mesa: Use shared code for converting shader targets to short strings.

We were duplicating this code all over the place, and they all would need
updating for the next set of shader targets.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
Eric Anholt
2013-06-12 16:57:11 -07:00
parent 426ca34b7a
commit faf3dbad0d
9 changed files with 61 additions and 43 deletions

View File

@@ -2810,22 +2810,19 @@ get_mesa_program(struct gl_context *ctx,
int i;
struct gl_program *prog;
GLenum target;
const char *target_string;
const char *target_string = _mesa_glsl_shader_target_name(shader->Type);
struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
switch (shader->Type) {
case GL_VERTEX_SHADER:
target = GL_VERTEX_PROGRAM_ARB;
target_string = "vertex";
break;
case GL_FRAGMENT_SHADER:
target = GL_FRAGMENT_PROGRAM_ARB;
target_string = "fragment";
break;
case GL_GEOMETRY_SHADER:
target = GL_GEOMETRY_PROGRAM_NV;
target_string = "geometry";
break;
default:
assert(!"should not be reached");