From ea08a296fe226f5e67366b4db420c2322f38774c Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sun, 23 Jul 2017 21:59:01 +0200 Subject: radv: Handle VK_ATTACHMENT_UNUSED in color attachments. This just sets them to INVALID COLOR, instead of shifting the attachments together. This also fixes a number of cases where we use it first and only then check if it is VK_ATTACHMENT_UNUSED. Signed-off-by: Bas Nieuwenhuizen Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver" Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_meta_resolve.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/amd/vulkan/radv_meta_resolve.c') diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index a0edfb915cd..6cd0c381a54 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -560,6 +560,11 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer) for (uint32_t i = 0; i < subpass->color_count; ++i) { VkAttachmentReference src_att = subpass->color_attachments[i]; VkAttachmentReference dest_att = subpass->resolve_attachments[i]; + + if (src_att.attachment == VK_ATTACHMENT_UNUSED || + dest_att.attachment == VK_ATTACHMENT_UNUSED) + continue; + struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image; struct radv_image *src_img = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment->image; @@ -582,10 +587,13 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer) for (uint32_t i = 0; i < subpass->color_count; ++i) { VkAttachmentReference src_att = subpass->color_attachments[i]; VkAttachmentReference dest_att = subpass->resolve_attachments[i]; - struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image; - if (dest_att.attachment == VK_ATTACHMENT_UNUSED) + + if (src_att.attachment == VK_ATTACHMENT_UNUSED || + dest_att.attachment == VK_ATTACHMENT_UNUSED) continue; + struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image; + if (dst_img->surface.dcc_size) { radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff); cmd_buffer->state.attachments[dest_att.attachment].current_layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; -- cgit v1.2.3