radv: fix crashes when fast-clearing in a secondary command buffer
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 11 Jan 2021 08:20:48 +0000 (09:20 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 11 Jan 2021 11:07:09 +0000 (11:07 +0000)
iview can be NULL inside a secondary command buffer.

Fixes: 00064713a30 ("radv: determine at creation if an image view can be fast cleared")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8408>

src/amd/vulkan/radv_meta_clear.c

index 2c3dfb5..4461ba4 100644 (file)
@@ -1001,7 +1001,7 @@ radv_can_fast_clear_depth(struct radv_cmd_buffer *cmd_buffer,
                          const VkClearDepthStencilValue clear_value,
                          uint32_t view_mask)
 {
-       if (!iview->support_fast_clear)
+       if (!iview || !iview->support_fast_clear)
                return false;
 
        if (!radv_layout_is_htile_compressed(cmd_buffer->device, iview->image, image_layout, in_render_loop,
@@ -1571,7 +1571,7 @@ radv_can_fast_clear_color(struct radv_cmd_buffer *cmd_buffer,
 {
        uint32_t clear_color[2];
 
-       if (!iview->support_fast_clear)
+       if (!iview || !iview->support_fast_clear)
                return false;
 
        if (!radv_layout_can_fast_clear(cmd_buffer->device, iview->image, image_layout, in_render_loop,