summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp9
-rw-r--r--src/mesa/main/shaderapi.c17
-rw-r--r--src/mesa/main/uniform_query.cpp9
-rw-r--r--src/mesa/program/ir_to_mesa.cpp5
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
5 files changed, 11 insertions, 36 deletions
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);
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 8cb02760b20..88518caa53b 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -816,21 +816,8 @@ print_shader_info(const struct gl_shader_program *shProg)
printf("Mesa: glUseProgram(%u)\n", shProg->Name);
for (i = 0; i < shProg->NumShaders; i++) {
- const char *s;
- switch (shProg->Shaders[i]->Type) {
- case GL_VERTEX_SHADER:
- s = "vertex";
- break;
- case GL_FRAGMENT_SHADER:
- s = "fragment";
- break;
- case GL_GEOMETRY_SHADER:
- s = "geometry";
- break;
- default:
- s = "";
- }
- printf(" %s shader %u, checksum %u\n", s,
+ printf(" %s shader %u, checksum %u\n",
+ _mesa_glsl_shader_target_name(shProg->Shaders[i]->Type),
shProg->Shaders[i]->Name,
shProg->Shaders[i]->SourceChecksum);
}
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 296f80f17bf..3c460042eee 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -33,6 +33,7 @@
#include "program/hash_table.h"
#include "../glsl/program.h"
#include "../glsl/ir_uniform.h"
+#include "../glsl/glsl_parser_extras.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
#include "uniforms.h"
@@ -434,12 +435,6 @@ log_uniform(const void *values, enum glsl_base_type basicType,
static void
log_program_parameters(const struct gl_shader_program *shProg)
{
- static const char *stages[] = {
- "vertex", "fragment", "geometry"
- };
-
- assert(Elements(stages) == MESA_SHADER_TYPES);
-
for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
if (shProg->_LinkedShaders[i] == NULL)
continue;
@@ -447,7 +442,7 @@ log_program_parameters(const struct gl_shader_program *shProg)
const struct gl_program *const prog = shProg->_LinkedShaders[i]->Program;
printf("Program %d %s shader parameters:\n",
- shProg->Name, stages[i]);
+ shProg->Name, _mesa_glsl_shader_target_name(prog->Target));
for (unsigned j = 0; j < prog->Parameters->NumParameters; j++) {
printf("%s: %p %f %f %f %f\n",
prog->Parameters->Parameters[j].Name,
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 191e2911912..2739df72577 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -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");
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4a68882603f..32bc2b37b10 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4994,7 +4994,6 @@ get_mesa_program(struct gl_context *ctx,
glsl_to_tgsi_visitor* v;
struct gl_program *prog;
GLenum target;
- const char *target_string;
bool progress;
struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
@@ -5005,17 +5004,14 @@ get_mesa_program(struct gl_context *ctx,
case GL_VERTEX_SHADER:
target = GL_VERTEX_PROGRAM_ARB;
ptarget = PIPE_SHADER_VERTEX;
- target_string = "vertex";
break;
case GL_FRAGMENT_SHADER:
target = GL_FRAGMENT_PROGRAM_ARB;
ptarget = PIPE_SHADER_FRAGMENT;
- target_string = "fragment";
break;
case GL_GEOMETRY_SHADER:
target = GL_GEOMETRY_PROGRAM_NV;
ptarget = PIPE_SHADER_GEOMETRY;
- target_string = "geometry";
break;
default:
assert(!"should not be reached");
@@ -5105,7 +5101,8 @@ get_mesa_program(struct gl_context *ctx,
if (ctx->Shader.Flags & GLSL_DUMP) {
printf("\n");
- printf("GLSL IR for linked %s program %d:\n", target_string,
+ printf("GLSL IR for linked %s program %d:\n",
+ _mesa_glsl_shader_target_name(shader->Type),
shader_program->Name);
_mesa_print_ir(shader->ir, NULL);
printf("\n");