diff options
author | Kenneth Graunke <[email protected]> | 2015-02-18 17:35:41 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-02-19 15:15:45 -0800 |
commit | 7555d1bafb089bc5130f86602a23725e184c490e (patch) | |
tree | eca26dec6220c9589760d896d099aa644c9c2d5d /src/glsl/glsl_parser_extras.cpp | |
parent | 231267bf011e1fa6edb52ffad27fcbca8e0e28e1 (diff) |
glsl: Create a _mesa_shader_stage_to_abbrev() function.
This is similar to _mesa_shader_stage_to_string(), but returns "VS"
instead of "vertex".
v2: Use unreachable() and add MESA_SHADER_COMPUTE (requested by Ian).
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.cpp')
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 29e6dd2ff7d..2e44dc1567a 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"; + case MESA_SHADER_COMPUTE: return "CS"; + } + + unreachable("Unknown shader stage."); +} + /* 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 |