freedreno/a6xx: emit shader names in debug builds
authorRob Clark <robdclark@chromium.org>
Wed, 13 May 2020 16:54:57 +0000 (09:54 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 16 Jun 2020 20:56:15 +0000 (20:56 +0000)
To simplify mapping a shader in a cmdstream trace back to glsl.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5280>

src/gallium/drivers/freedreno/a6xx/fd6_program.c

index 9faa11bd3840dff5c52e08a8364ac63d1f84332c..9f1510942c64d2686b70e3c568ad760c330a78d3 100644 (file)
@@ -78,6 +78,13 @@ fd6_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
                unreachable("");
        }
 
+#ifdef DEBUG
+       /* Name should generally match what you get with MESA_SHADER_CAPTURE_PATH: */
+       const char *name = so->shader->nir->info.name;
+       if (name)
+               fd_emit_string5(ring, name, strlen(name));
+#endif
+
        OUT_PKT4(ring, instrlen, 1);
        OUT_RING(ring, so->instrlen);