radv: print NIR before LLVM IR and disassembly
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 24 Oct 2017 15:23:43 +0000 (17:23 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 25 Oct 2017 09:46:53 +0000 (11:46 +0200)
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 <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_pipeline.c

index 926e3788cc260a4b1154098cc1217d94b90f7b7f..aaaafbefa93352e7b8846238daedc2f864c7f990 100644 (file)
@@ -1810,6 +1810,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] =
@@ -1894,13 +1902,8 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
 
        for (int i = 0; i < MESA_SHADER_STAGES; ++i) {
                free(codes[i]);
-               if (modules[i]) {
-                       if (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS)
-                               nir_print_shader(nir[i], stderr);
-
-                       if (!pipeline->device->trace_bo)
-                               ralloc_free(nir[i]);
-               }
+               if (modules[i] && !pipeline->device->trace_bo)
+                       ralloc_free(nir[i]);
        }
 
        if (fs_m.nir)