This is similar to _mesa_shader_stage_to_string(), but returns "VS" instead of "vertex".
Signed-off-by: Kenneth Graunke <[email protected]> --- src/glsl/glsl_parser_extras.cpp | 17 +++++++++++++++++ src/glsl/glsl_parser_extras.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index ccdf031..0334e4a 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -376,6 +376,23 @@ _mesa_shader_stage_to_string(unsigned stage) return "unknown"; } +/** + * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS) + * for debug printouts and error messages. + */ +const char * +_mesa_shader_stage_to_abbrev(unsigned stage) +{ + switch (stage) { + case MESA_SHADER_VERTEX: return "VS"; + case MESA_SHADER_FRAGMENT: return "FS"; + case MESA_SHADER_GEOMETRY: return "GS"; + } + + assert(!"Should not get here."); + return "unknown"; +} + /* This helper function will append the given message to the shader's info log and report it via GL_ARB_debug_output. Per that extension, 'type' is one of the enum values classifying the message, and diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 843fdae..6861fac 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -576,6 +576,9 @@ extern "C" { extern const char * _mesa_shader_stage_to_string(unsigned stage); +extern const char * +_mesa_shader_stage_to_abbrev(unsigned stage); + extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log, const struct gl_extensions *extensions, struct gl_context *gl_ctx); -- 2.2.2 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
