summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/ast_to_hir.cpp10
-rw-r--r--src/glsl/glsl_parser_extras.cpp17
-rw-r--r--src/glsl/glsl_parser_extras.h7
-rw-r--r--src/glsl/link_varyings.cpp24
-rw-r--r--src/glsl/linker.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp4
-rw-r--r--src/mesa/main/shaderapi.c6
-rw-r--r--src/mesa/main/uniform_query.cpp2
-rw-r--r--src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
10 files changed, 38 insertions, 38 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 3bc181e8785..91810f985bf 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2110,7 +2110,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
_mesa_glsl_error(loc, state,
"%s cannot be given an explicit location in %s shader",
mode_string(var),
- _mesa_glsl_shader_target_name(state->target));
+ _mesa_shader_type_to_string(state->target));
} else {
var->data.explicit_location = true;
@@ -2188,7 +2188,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
_mesa_glsl_error(loc, state,
"`attribute' variables may not be declared in the "
"%s shader",
- _mesa_glsl_shader_target_name(state->target));
+ _mesa_shader_type_to_string(state->target));
}
/* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
@@ -2599,7 +2599,7 @@ process_initializer(ir_variable *var, ast_declaration *decl,
if ((var->data.mode == ir_var_shader_in) && (state->current_function == NULL)) {
_mesa_glsl_error(& initializer_loc, state,
"cannot initialize %s shader input / %s",
- _mesa_glsl_shader_target_name(state->target),
+ _mesa_shader_type_to_string(state->target),
(state->target == MESA_SHADER_VERTEX)
? "attribute" : "varying");
}
@@ -4890,7 +4890,7 @@ ast_interface_block::hir(exec_list *instructions,
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex input not allowed "
"in the %s shader",
- _mesa_glsl_shader_target_name(state->target));
+ _mesa_shader_type_to_string(state->target));
}
if (this->instance_name == NULL ||
strcmp(this->instance_name, "gl_in") != 0 || !this->is_array) {
@@ -4907,7 +4907,7 @@ ast_interface_block::hir(exec_list *instructions,
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex output not "
"allowed in the %s shader",
- _mesa_glsl_shader_target_name(state->target));
+ _mesa_shader_type_to_string(state->target));
}
if (this->instance_name != NULL) {
_mesa_glsl_error(&loc, state,
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 5f19368d856..fc9a8b20411 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -334,16 +334,15 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
extern "C" {
/**
- * The most common use of _mesa_glsl_shader_target_name(), which is
- * shared with C code in Mesa core to translate a GLenum to a short
- * shader stage name in debug printouts.
+ * Translate a GLenum to a short shader stage name for debug printouts and
+ * error messages.
*
* It recognizes the PROGRAM variants of the names so it can be used
* with a struct gl_program->Target, not just a struct
* gl_shader->Type.
*/
const char *
-_mesa_glsl_shader_target_name(GLenum type)
+_mesa_shader_enum_to_string(GLenum type)
{
switch (type) {
case GL_VERTEX_SHADER:
@@ -363,11 +362,11 @@ _mesa_glsl_shader_target_name(GLenum type)
} /* extern "C" */
/**
- * Overloaded C++ variant usable within the compiler for translating
- * our internal enum into short stage names.
+ * Translate a gl_shader_type to a short shader stage name for debug printouts
+ * and error messages.
*/
const char *
-_mesa_glsl_shader_target_name(gl_shader_type target)
+_mesa_shader_type_to_string(unsigned target)
{
switch (target) {
case MESA_SHADER_VERTEX: return "vertex";
@@ -651,11 +650,11 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
if (behavior == extension_require) {
_mesa_glsl_error(name_locp, state, fmt,
- name, _mesa_glsl_shader_target_name(state->target));
+ name, _mesa_shader_type_to_string(state->target));
return false;
} else {
_mesa_glsl_warning(name_locp, state, fmt,
- name, _mesa_glsl_shader_target_name(state->target));
+ name, _mesa_shader_type_to_string(state->target));
}
}
}
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 622ddbac726..7b013fa6dee 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -422,10 +422,11 @@ extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
_mesa_glsl_parse_state *state);
/**
- * Get the textual name of the specified shader target
+ * Get the textual name of the specified shader target (which is a
+ * gl_shader_type).
*/
extern const char *
-_mesa_glsl_shader_target_name(gl_shader_type target);
+_mesa_shader_type_to_string(unsigned target);
#endif /* __cplusplus */
@@ -439,7 +440,7 @@ extern "C" {
#endif
extern const char *
-_mesa_glsl_shader_target_name(GLenum type);
+_mesa_shader_enum_to_string(GLenum type);
extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, struct gl_context *gl_ctx);
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 229a4cb8584..98f902ca4ef 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -82,10 +82,10 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
linker_error(prog,
"%s shader output `%s' declared as type `%s', "
"but %s shader input declared as type `%s'\n",
- _mesa_glsl_shader_target_name(producer_type),
+ _mesa_shader_enum_to_string(producer_type),
output->name,
output->type->name,
- _mesa_glsl_shader_target_name(consumer_type),
+ _mesa_shader_enum_to_string(consumer_type),
input->type->name);
return;
}
@@ -97,10 +97,10 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
linker_error(prog,
"%s shader output `%s' %s centroid qualifier, "
"but %s shader input %s centroid qualifier\n",
- _mesa_glsl_shader_target_name(producer_type),
+ _mesa_shader_enum_to_string(producer_type),
output->name,
(output->data.centroid) ? "has" : "lacks",
- _mesa_glsl_shader_target_name(consumer_type),
+ _mesa_shader_enum_to_string(consumer_type),
(input->data.centroid) ? "has" : "lacks");
return;
}
@@ -109,10 +109,10 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
linker_error(prog,
"%s shader output `%s' %s sample qualifier, "
"but %s shader input %s sample qualifier\n",
- _mesa_glsl_shader_target_name(producer_type),
+ _mesa_shader_enum_to_string(producer_type),
output->name,
(output->data.sample) ? "has" : "lacks",
- _mesa_glsl_shader_target_name(consumer_type),
+ _mesa_shader_enum_to_string(consumer_type),
(input->data.sample) ? "has" : "lacks");
return;
}
@@ -121,10 +121,10 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
linker_error(prog,
"%s shader output `%s' %s invariant qualifier, "
"but %s shader input %s invariant qualifier\n",
- _mesa_glsl_shader_target_name(producer_type),
+ _mesa_shader_enum_to_string(producer_type),
output->name,
(output->data.invariant) ? "has" : "lacks",
- _mesa_glsl_shader_target_name(consumer_type),
+ _mesa_shader_enum_to_string(consumer_type),
(input->data.invariant) ? "has" : "lacks");
return;
}
@@ -135,10 +135,10 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
"interpolation qualifier, "
"but %s shader input specifies %s "
"interpolation qualifier\n",
- _mesa_glsl_shader_target_name(producer_type),
+ _mesa_shader_enum_to_string(producer_type),
output->name,
interpolation_string(output->data.interpolation),
- _mesa_glsl_shader_target_name(consumer_type),
+ _mesa_shader_enum_to_string(consumer_type),
interpolation_string(input->data.interpolation));
return;
}
@@ -1217,9 +1217,9 @@ assign_varying_locations(struct gl_context *ctx,
linker_error(prog, "%s shader varying %s not written "
"by %s shader\n.",
- _mesa_glsl_shader_target_name(consumer->Type),
+ _mesa_shader_enum_to_string(consumer->Type),
var->name,
- _mesa_glsl_shader_target_name(producer->Type));
+ _mesa_shader_enum_to_string(producer->Type));
}
/* An 'in' variable is only really a shader input if its
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index a6133ea9cb5..f6d7a909550 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1375,7 +1375,7 @@ link_intrastage_shaders(void *mem_ctx,
if (main == NULL) {
linker_error(prog, "%s shader lacks `main'\n",
- _mesa_glsl_shader_target_name(shader_list[0]->Type));
+ _mesa_shader_enum_to_string(shader_list[0]->Type));
return NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 6f0ace8932c..3f59c804ca5 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -261,7 +261,7 @@ 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",
- _mesa_glsl_shader_target_name(shader->base.Type), shProg->Name);
+ _mesa_shader_enum_to_string(shader->base.Type), shProg->Name);
_mesa_print_ir(shader->base.ir, NULL);
printf("\n");
}
@@ -274,7 +274,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",
- _mesa_glsl_shader_target_name(sh->Type),
+ _mesa_shader_enum_to_string(sh->Type),
i,
shProg->Name);
printf("%s", sh->Source);
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 4f3be68a406..57511e83e43 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -791,7 +791,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
} else {
if (ctx->Shader.Flags & GLSL_DUMP) {
printf("GLSL source for %s shader %d:\n",
- _mesa_glsl_shader_target_name(sh->Type), sh->Name);
+ _mesa_shader_enum_to_string(sh->Type), sh->Name);
printf("%s\n", sh->Source);
}
@@ -823,7 +823,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
if (!sh->CompileStatus) {
if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) {
fprintf(stderr, "GLSL source for %s shader %d:\n",
- _mesa_glsl_shader_target_name(sh->Type), sh->Name);
+ _mesa_shader_enum_to_string(sh->Type), sh->Name);
fprintf(stderr, "%s\n", sh->Source);
fprintf(stderr, "Info Log:\n%s\n", sh->InfoLog);
fflush(stderr);
@@ -898,7 +898,7 @@ print_shader_info(const struct gl_shader_program *shProg)
printf("Mesa: glUseProgram(%u)\n", shProg->Name);
for (i = 0; i < shProg->NumShaders; i++) {
printf(" %s shader %u, checksum %u\n",
- _mesa_glsl_shader_target_name(shProg->Shaders[i]->Type),
+ _mesa_shader_enum_to_string(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 88ad476acb9..61bcbcb8afd 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -452,7 +452,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, _mesa_glsl_shader_target_name(prog->Target));
+ shProg->Name, _mesa_shader_enum_to_string(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 23d479c32d6..beb0c093b5e 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2801,7 +2801,7 @@ get_mesa_program(struct gl_context *ctx,
int i;
struct gl_program *prog;
GLenum target;
- const char *target_string = _mesa_glsl_shader_target_name(shader->Type);
+ const char *target_string = _mesa_shader_enum_to_string(shader->Type);
struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 1331c73dc30..eb12426a544 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5143,7 +5143,7 @@ get_mesa_program(struct gl_context *ctx,
if (ctx->Shader.Flags & GLSL_DUMP) {
printf("\n");
printf("GLSL IR for linked %s program %d:\n",
- _mesa_glsl_shader_target_name(shader->Type),
+ _mesa_shader_enum_to_string(shader->Type),
shader_program->Name);
_mesa_print_ir(shader->ir, NULL);
printf("\n");