diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index e60b92e867d..4dfb15619e0 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -23,6 +23,7 @@ */ #include "util/blob.h" +#include "util/debug.h" #include "util/disk_cache.h" #include "util/u_memory.h" #include "util/ralloc.h" @@ -2560,6 +2561,7 @@ tgsi_to_nir(const void *tgsi_tokens, struct nir_shader *s = NULL; uint8_t key[CACHE_KEY_SIZE]; unsigned processor; + bool debug = env_var_as_boolean("TGSI_TO_NIR_DEBUG", false); if (allow_disk_cache) cache = screen->get_disk_shader_cache(screen); @@ -2577,6 +2579,11 @@ tgsi_to_nir(const void *tgsi_tokens, if (s) return s; + if (debug) { + fprintf(stderr, "TGSI before translation to NIR:\n"); + tgsi_dump(tgsi_tokens, 0); + } + /* Not in the cache */ c = ttn_compile_init(tgsi_tokens, NULL, screen); @@ -2584,6 +2591,11 @@ tgsi_to_nir(const void *tgsi_tokens, ttn_finalize_nir(c, screen); ralloc_free(c); + if (debug) { + mesa_logi("NIR after translation from TGSI:\n"); + nir_log_shaderi(s); + } + if (cache) save_nir_to_disk_cache(cache, key, s);