radv: fix crash in vkCmdClearAttachments with unused attachment
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 22 Jul 2019 08:12:48 +0000 (10:12 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 22 Jul 2019 12:25:54 +0000 (14:25 +0200)
depth_stencil_attachment and/or ds_resolve attachment can be NULL.

This fixes crashes with
dEQP-VK.renderpass.suballocation.unused_clear_attachments.*

Cc: 19.1 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta_clear.c

index dd2ba402f40e1a7c7e9f9bf798aae6048c06364c..b93ba3e0b294045992c31de99a9c0fd8d216f3ab 100644 (file)
@@ -1688,7 +1688,7 @@ emit_clear(struct radv_cmd_buffer *cmd_buffer,
                if (ds_resolve_clear)
                        ds_att = subpass->ds_resolve_attachment;
 
-               if (ds_att->attachment == VK_ATTACHMENT_UNUSED)
+               if (!ds_att || ds_att->attachment == VK_ATTACHMENT_UNUSED)
                        return;
 
                VkImageLayout image_layout = ds_att->layout;