From 63c2e8137d4dca0f5232a3c3a98e182e7ba7f943 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 26 Mar 2020 15:35:11 +0100 Subject: [PATCH] tu: Dump out shader assembly when requested We don't use the ir3 variant machinery, so we have to do this ourselves. Part-of: --- src/freedreno/vulkan/tu_shader.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c index 4a396ced9e7..a8a5303d6ca 100644 --- a/src/freedreno/vulkan/tu_shader.c +++ b/src/freedreno/vulkan/tu_shader.c @@ -644,6 +644,14 @@ tu_shader_compile(struct tu_device *dev, if (!shader->binary) return VK_ERROR_OUT_OF_HOST_MEMORY; + if (shader_debug_enabled(shader->ir3_shader.type)) { + fprintf(stdout, "Native code for unnamed %s shader %s:\n", + ir3_shader_stage(&shader->variants[0]), shader->ir3_shader.nir->info.name); + if (shader->ir3_shader.type == MESA_SHADER_FRAGMENT) + fprintf(stdout, "SIMD0\n"); + ir3_shader_disasm(&shader->variants[0], shader->binary, stdout); + } + /* compile another variant for the binning pass */ if (options->include_binning_pass && shader->ir3_shader.type == MESA_SHADER_VERTEX) { @@ -654,6 +662,12 @@ tu_shader_compile(struct tu_device *dev, return VK_ERROR_OUT_OF_HOST_MEMORY; shader->has_binning_pass = true; + + if (shader_debug_enabled(MESA_SHADER_VERTEX)) { + fprintf(stdout, "Native code for unnamed binning shader %s:\n", + shader->ir3_shader.nir->info.name); + ir3_shader_disasm(&shader->variants[1], shader->binary, stdout); + } } if (unlikely(dev->physical_device->instance->debug_flags & TU_DEBUG_IR3)) { -- 2.30.2