radv: rework how shaders are dumped when generating a hang report
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 24 May 2018 11:09:12 +0000 (13:09 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 25 May 2018 09:58:03 +0000 (11:58 +0200)
Use a flag for the active stages instead.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_debug.c

index 72c7c39fcb896a96e958195f139ee743642a63e0..5cdbf5bea9a5a3bf096b54563aaeea9ff30478f8 100644 (file)
@@ -442,28 +442,22 @@ radv_dump_annotated_shader(struct radv_shader_variant *shader,
 
 static void
 radv_dump_annotated_shaders(struct radv_pipeline *pipeline,
-                           struct radv_shader_variant *compute_shader,
-                           FILE *f)
+                           VkShaderStageFlagBits active_stages, FILE *f)
 {
        struct ac_wave_info waves[AC_MAX_WAVES_PER_CHIP];
        unsigned num_waves = ac_get_wave_info(waves);
-       unsigned mask;
 
        fprintf(f, COLOR_CYAN "The number of active waves = %u" COLOR_RESET
                "\n\n", num_waves);
 
        /* Dump annotated active graphics shaders. */
-       mask = pipeline->active_stages;
-       while (mask) {
-               int stage = u_bit_scan(&mask);
+       while (active_stages) {
+               int stage = u_bit_scan(&active_stages);
 
                radv_dump_annotated_shader(pipeline->shaders[stage],
                                           stage, waves, num_waves, f);
        }
 
-       radv_dump_annotated_shader(compute_shader, MESA_SHADER_COMPUTE, waves,
-                                  num_waves, f);
-
        /* Print waves executing shaders that are not currently bound. */
        unsigned i;
        bool found = false;
@@ -521,47 +515,42 @@ radv_dump_shader(struct radv_pipeline *pipeline,
 
 static void
 radv_dump_shaders(struct radv_pipeline *pipeline,
-                 struct radv_shader_variant *compute_shader, FILE *f)
+                 VkShaderStageFlagBits active_stages, FILE *f)
 {
-       unsigned mask;
-
        /* Dump active graphics shaders. */
-       mask = pipeline->active_stages;
-       while (mask) {
-               int stage = u_bit_scan(&mask);
+       while (active_stages) {
+               int stage = u_bit_scan(&active_stages);
 
                radv_dump_shader(pipeline, pipeline->shaders[stage], stage, f);
        }
-
-       radv_dump_shader(pipeline, compute_shader, MESA_SHADER_COMPUTE, f);
 }
 
 static void
 radv_dump_graphics_state(struct radv_pipeline *graphics_pipeline,
                         struct radv_pipeline *compute_pipeline, FILE *f)
 {
-       struct radv_shader_variant *compute_shader =
-               compute_pipeline ? compute_pipeline->shaders[MESA_SHADER_COMPUTE] : NULL;
+       VkShaderStageFlagBits active_stages;
 
        if (!graphics_pipeline)
                return;
 
-       radv_dump_shaders(graphics_pipeline, compute_shader, f);
-       radv_dump_annotated_shaders(graphics_pipeline, compute_shader, f);
+       active_stages = graphics_pipeline->active_stages;
+
+       radv_dump_shaders(graphics_pipeline, active_stages, f);
+       radv_dump_annotated_shaders(graphics_pipeline, active_stages, f);
        radv_dump_descriptors(graphics_pipeline, f);
 }
 
 static void
 radv_dump_compute_state(struct radv_pipeline *compute_pipeline, FILE *f)
 {
+       VkShaderStageFlagBits active_stages = VK_SHADER_STAGE_COMPUTE_BIT;
+
        if (!compute_pipeline)
                return;
 
-       radv_dump_shaders(compute_pipeline,
-                         compute_pipeline->shaders[MESA_SHADER_COMPUTE], f);
-       radv_dump_annotated_shaders(compute_pipeline,
-                                   compute_pipeline->shaders[MESA_SHADER_COMPUTE],
-                                   f);
+       radv_dump_shaders(compute_pipeline, active_stages, f);
+       radv_dump_annotated_shaders(compute_pipeline, active_stages, f);
        radv_dump_descriptors(compute_pipeline, f);
 }