v3dv: only clear depth/stencil attachments if any aspect needs clearing

When we can't perform the clears using the TLB and fallback to
vkCmdClearAttachments make sure we only emit the clear if any of
the depth/stencil aspects actually needs it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga 2020-07-17 10:30:35 +02:00 committed by Marge Bot
parent c4564f62aa
commit c5d07802dc
1 changed files with 7 additions and 5 deletions

View File

@ -2046,11 +2046,13 @@ cmd_buffer_emit_subpass_clears(struct v3dv_cmd_buffer *cmd_buffer)
if (att->desc.stencilLoadOp != VK_ATTACHMENT_LOAD_OP_CLEAR)
aspects &= ~VK_IMAGE_ASPECT_STENCIL_BIT;
atts[att_count].aspectMask = aspects;
atts[att_count].colorAttachment = 0; /* Ignored */
atts[att_count].clearValue =
state->attachments[ds_att_idx].vk_clear_value;
att_count++;
if (aspects) {
atts[att_count].aspectMask = aspects;
atts[att_count].colorAttachment = 0; /* Ignored */
atts[att_count].clearValue =
state->attachments[ds_att_idx].vk_clear_value;
att_count++;
}
}
}