Add utility function to get the name of a shader target
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 7 Apr 2010 23:44:30 +0000 (16:44 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 7 Apr 2010 23:49:25 +0000 (16:49 -0700)
glsl_parser_extras.cpp
glsl_parser_extras.h

index 877b165ad718f4cb171d0355d4303893171110cb..335a058b965cbcfbbc1354162ddbcc1f9463f1b5 100644 (file)
 #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, ...)
index 373d295bba4bc4328afaa4beba17f92aa7458a39..2f33bea0534e60cd8306c347aee8348222f55dde 100644 (file)
@@ -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 */