From 17d988bfaab755cd4076224b199e9ca56eb68614 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 24 Oct 2017 09:08:55 +1100 Subject: [PATCH] radv: move nir print after linking is done We now have linking optimisations so we want to delay dumping the nir until after these are complete. Fixes: 06f05040eb73 (radv: Link shaders) Reviewed-by: Bas Nieuwenhuizen (cherry picked from commit f0a2bbd1a4a0caf85d91469e61d01a126cfc2a36) Squashed with commit: radv: print NIR before LLVM IR and disassembly It's still printed after linking, but it makes more sense to have SPIRV->NIR->LLVM IR->ASM. Fixes: f0a2bbd1a4 (radv: move nir print after linking is done) Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen (cherry picked from commit 9711979df007859de86fc08c20c826a71d10a660) --- src/amd/vulkan/radv_pipeline.c | 8 ++++++++ src/amd/vulkan/radv_shader.c | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 30a90ac9608..7ad09cec831 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -1786,6 +1786,14 @@ void radv_create_shaders(struct radv_pipeline *pipeline, radv_link_shaders(pipeline, nir); + for (int i = 0; i < MESA_SHADER_STAGES; ++i) { + if (!(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS)) + continue; + + if (modules[i]) + nir_print_shader(nir[i], stderr); + } + if (nir[MESA_SHADER_FRAGMENT]) { if (!pipeline->shaders[MESA_SHADER_FRAGMENT]) { pipeline->shaders[MESA_SHADER_FRAGMENT] = diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 6176a2e590d..59039170687 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -291,9 +291,6 @@ radv_shader_compile_to_nir(struct radv_device *device, nir_remove_dead_variables(nir, nir_var_local); radv_optimize_nir(nir); - if (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS) - nir_print_shader(nir, stderr); - return nir; }