From faf3dbad0d30ed36ae6010a90ca2513edb591148 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 12 Jun 2013 16:57:11 -0700 Subject: 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 Reviewed-by: Paul Berry --- src/mesa/drivers/dri/i965/brw_shader.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 65df9316506..12986cc403d 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -28,6 +28,7 @@ extern "C" { } #include "brw_fs.h" #include "glsl/ir_optimization.h" +#include "glsl/glsl_parser_extras.h" struct gl_shader * brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) @@ -112,8 +113,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) struct brw_context *brw = brw_context(ctx); struct intel_context *intel = &brw->intel; unsigned int stage; - static const char *target_strings[] - = { "vertex", "fragment", "geometry" }; for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) { struct brw_shader *shader = @@ -262,8 +261,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) if (ctx->Shader.Flags & GLSL_DUMP) { printf("\n"); - printf("GLSL IR for linked %s program %d:\n", target_strings[stage], - shProg->Name); + printf("GLSL IR for linked %s program %d:\n", + _mesa_glsl_shader_target_name(shader->base.Type), shProg->Name); _mesa_print_ir(shader->base.ir, NULL); printf("\n"); } @@ -276,7 +275,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) continue; printf("GLSL %s shader %d source for linked program %d:\n", - target_strings[_mesa_shader_type_to_index(sh->Type)], + _mesa_glsl_shader_target_name(sh->Type), i, shProg->Name); printf("%s", sh->Source); -- cgit v1.2.3