mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
gallium/ttn: Add a debug flag for dumping the shaders.
Just like for ntt, it's nice to be able to dump the shader that assertion failed on you. Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11915>
This commit is contained in:
parent
8c36022e0d
commit
11f9ad9238
1 changed files with 12 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue