radv: do not bind NULL graphics pipeline when restoring the meta state
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 13 Sep 2022 07:21:17 +0000 (09:21 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 14 Sep 2022 19:13:42 +0000 (19:13 +0000)
It's invalid to bind NULL pipelines, but make sure to reset it to
its previous NULL state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18567>

src/amd/vulkan/radv_meta.c

index 13dbeaa..6e57022 100644 (file)
@@ -145,8 +145,12 @@ radv_meta_restore(const struct radv_meta_saved_state *state, struct radv_cmd_buf
                                        : VK_PIPELINE_BIND_POINT_COMPUTE;
 
    if (state->flags & RADV_META_SAVE_GRAPHICS_PIPELINE) {
-      radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_GRAPHICS,
-                           radv_pipeline_to_handle(&state->old_graphics_pipeline->base));
+      if (state->old_graphics_pipeline) {
+         radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_GRAPHICS,
+                              radv_pipeline_to_handle(&state->old_graphics_pipeline->base));
+      } else {
+         cmd_buffer->state.graphics_pipeline = NULL;
+      }
 
       cmd_buffer->state.dirty |= RADV_CMD_DIRTY_PIPELINE;