mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 21:30:09 +01:00
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 <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
parent
231267bf01
commit
7555d1bafb
2 changed files with 20 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -583,6 +583,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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue