From: Ian Romanick Date: Wed, 7 Apr 2010 23:44:30 +0000 (-0700) Subject: Add utility function to get the name of a shader target X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5bfe30a02be67f2b0e757921295a89adfd368e3f;p=mesa.git Add utility function to get the name of a shader target --- diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index 877b165ad71..335a058b965 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -37,6 +37,19 @@ #include "ir_constant_folding.h" #include "ir_print_visitor.h" +const char * +_mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) +{ + switch (target) { + case vertex_shader: return "vertex"; + case fragment_shader: return "fragment"; + case geometry_shader: return "geometry"; + } + + assert(!"Should not get here."); +} + + void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...) diff --git a/glsl_parser_extras.h b/glsl_parser_extras.h index 373d295bba4..2f33bea0534 100644 --- a/glsl_parser_extras.h +++ b/glsl_parser_extras.h @@ -85,4 +85,10 @@ extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc, extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *); +/** + * Get the textual name of the specified shader target + */ +extern const char * +_mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target); + #endif /* GLSL_PARSER_EXTRAS_H */