radv: fix assertion on gpu hang detection
authorMikhail Korolev <stilriv@gmail.com>
Mon, 12 Dec 2022 08:02:43 +0000 (09:02 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Dec 2022 12:55:07 +0000 (12:55 +0000)
fixes assert in RADV_DECL_PIPELINE_DOWNCAST when bound pipline is a compute
pipeline

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20276>

src/amd/vulkan/radv_debug.c

index 5dd6d8e..a8a0a1c 100644 (file)
@@ -533,20 +533,26 @@ radv_dump_queue_state(struct radv_queue *queue, const char *dump_dir, FILE *f)
 
    pipeline = radv_get_saved_pipeline(queue->device, ring);
    if (pipeline) {
-      struct radv_graphics_pipeline *graphics_pipeline = radv_pipeline_to_graphics(pipeline);
       VkShaderStageFlags active_stages;
 
       if (pipeline->type == RADV_PIPELINE_GRAPHICS) {
+         struct radv_graphics_pipeline *graphics_pipeline =
+            radv_pipeline_to_graphics(pipeline);
          active_stages = graphics_pipeline->active_stages;
+         radv_dump_vs_prolog(pipeline, f);
       } else {
          active_stages = VK_SHADER_STAGE_COMPUTE_BIT;
       }
 
-      radv_dump_vs_prolog(pipeline, f);
       radv_dump_shaders(pipeline, active_stages, dump_dir, f);
       if (!(queue->device->instance->debug_flags & RADV_DEBUG_NO_UMR))
          radv_dump_annotated_shaders(pipeline, active_stages, f);
-      radv_dump_vertex_descriptors(graphics_pipeline, f);
+
+      if (pipeline->type == RADV_PIPELINE_GRAPHICS) {
+         struct radv_graphics_pipeline *graphics_pipeline =
+            radv_pipeline_to_graphics(pipeline);
+         radv_dump_vertex_descriptors(graphics_pipeline, f);
+      }
       radv_dump_descriptors(queue->device, f);
    }
 }