mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 10:14:13 +08:00
mesa: add GLSL_SOURCE
many times I just want to dump glsl and not a trillion lines of IR Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18280>
This commit is contained in:
parent
9701b9098f
commit
8b15025a2b
@ -13,7 +13,8 @@ The **MESA_GLSL** environment variable can be set to a comma-separated
|
||||
list of keywords to control some aspects of the GLSL compiler and shader
|
||||
execution. These are generally used for debugging.
|
||||
|
||||
- **dump** - print GLSL shader code to stdout at link time
|
||||
- **dump** - print GLSL shader code, IR, and NIR to stdout at link time
|
||||
- **source** - print GLSL shader code to stdout at link time
|
||||
- **log** - log all GLSL shaders to files. The filenames will be
|
||||
"shader_X.vert" or "shader_X.frag" where X the shader ID.
|
||||
- **cache_info** - print debug information about shader cache
|
||||
|
@ -2296,6 +2296,7 @@ struct gl_ati_fragment_shader_state
|
||||
#define GLSL_DUMP_ON_ERROR 0x80 /**< Dump shaders to stderr on compile error */
|
||||
#define GLSL_CACHE_INFO 0x100 /**< Print debug information about shader cache */
|
||||
#define GLSL_CACHE_FALLBACK 0x200 /**< Force shader cache fallback paths */
|
||||
#define GLSL_SOURCE 0x400 /**< Only dump GLSL */
|
||||
|
||||
|
||||
/**
|
||||
|
@ -135,6 +135,8 @@ _mesa_get_shader_flags(void)
|
||||
flags |= GLSL_DUMP;
|
||||
if (strstr(env, "log"))
|
||||
flags |= GLSL_LOG;
|
||||
if (strstr(env, "source"))
|
||||
flags |= GLSL_SOURCE;
|
||||
#endif
|
||||
if (strstr(env, "cache_fb"))
|
||||
flags |= GLSL_CACHE_FALLBACK;
|
||||
@ -1216,7 +1218,7 @@ _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh)
|
||||
*/
|
||||
sh->CompileStatus = COMPILE_FAILURE;
|
||||
} else {
|
||||
if (ctx->_Shader->Flags & GLSL_DUMP) {
|
||||
if (ctx->_Shader->Flags & (GLSL_DUMP | GLSL_SOURCE)) {
|
||||
_mesa_log("GLSL source for %s shader %d:\n",
|
||||
_mesa_shader_stage_to_string(sh->Stage), sh->Name);
|
||||
_mesa_log_direct(sh->Source);
|
||||
|
Loading…
Reference in New Issue
Block a user