Mesa (master): mesa/st: Dump nir-to-tgsi output when ST_DEBUG=tgsi or nir is set.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 15 00:25:46 UTC 2021


Module: Mesa
Branch: master
Commit: 942ee6a547f337c18be76df545cb5653df0ce7d1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=942ee6a547f337c18be76df545cb5653df0ce7d1

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jan 11 15:55:29 2021 -0800

mesa/st: Dump nir-to-tgsi output when ST_DEBUG=tgsi or nir is set.

Suggested by Gert Wollny, and oh how I've wanted this.

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8488>

---

 src/mesa/state_tracker/st_program.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3cec2d9ab8d..e85d0f58a61 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -505,8 +505,10 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state)
    gl_shader_stage stage = nir->info.stage;
    enum pipe_shader_type sh = pipe_shader_type_from_mesa(stage);
 
-   if (ST_DEBUG & DEBUG_PRINT_IR)
+   if (ST_DEBUG & DEBUG_PRINT_IR) {
+      fprintf(stderr, "NIR before handing off to driver:\n");
       nir_print_shader(nir, stderr);
+   }
 
    if (PIPE_SHADER_IR_NIR !=
        screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_PREFERRED_IR)) {
@@ -518,6 +520,12 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state)
 
       state->type = PIPE_SHADER_IR_TGSI;
       state->tokens = nir_to_tgsi(nir, screen);
+
+      if (ST_DEBUG & DEBUG_PRINT_IR) {
+         fprintf(stderr, "TGSI for driver after nir-to-tgsi:\n");
+         tgsi_dump(state->tokens, 0);
+         fprintf(stderr, "\n");
+      }
    }
 
    struct pipe_shader_state *shader;



More information about the mesa-commit mailing list