[Mesa-dev] [PATCH v2 2/3] anv/blorp: honor pending clear views in clear_depth_stencil_attachment
Iago Toral Quiroga
itoral at igalia.com
Fri Feb 16 11:54:25 UTC 2018
We can call this for both subpass load clears and VkCmdClearAttachments.
In the former case, when multiview is active, we need to honor the mask
of pending clear views so we don't clear layers that have already been
cleared by a previous subpass, just like we do for subpass load color
clears.
---
src/intel/vulkan/anv_blorp.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index ac3a434c94..25035909b6 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1040,7 +1040,8 @@ static void
clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer,
struct blorp_batch *batch,
const VkClearAttachment *attachment,
- uint32_t rectCount, const VkClearRect *pRects)
+ uint32_t rectCount, const VkClearRect *pRects,
+ bool is_subpass_load)
{
static const union isl_color_value color_value = { .u32 = { 0, } };
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
@@ -1073,8 +1074,15 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer,
/* If multiview is enabled we ignore baseArrayLayer and layerCount */
if (subpass->view_mask) {
+ struct anv_attachment_state *att_state =
+ &cmd_buffer->state.attachments[att_idx];
+
+ uint32_t clear_mask = is_subpass_load ?
+ get_multiview_subpass_clear_mask(&cmd_buffer->state, att_state) :
+ subpass->view_mask;
+
uint32_t view_idx;
- for_each_bit(view_idx, subpass->view_mask) {
+ for_each_bit(view_idx, clear_mask) {
for (uint32_t r = 0; r < rectCount; ++r) {
const VkOffset2D offset = pRects[r].rect.offset;
const VkExtent2D extent = pRects[r].rect.extent;
@@ -1088,6 +1096,9 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer,
false, color_value,
clear_depth, value.depth,
clear_stencil ? 0xff : 0, value.stencil);
+
+ if (is_subpass_load)
+ att_state->pending_clear_views &= ~(1 << view_idx);
}
}
return;
@@ -1135,7 +1146,7 @@ void anv_CmdClearAttachments(
} else {
clear_depth_stencil_attachment(cmd_buffer, &batch,
&pAttachments[a],
- rectCount, pRects);
+ rectCount, pRects, false);
}
}
@@ -1433,7 +1444,7 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
if (!clear_with_hiz) {
clear_depth_stencil_attachment(cmd_buffer, &batch,
- &clear_att, 1, &clear_rect);
+ &clear_att, 1, &clear_rect, true);
}
cmd_state->attachments[ds].pending_clear_aspects = 0;
--
2.14.1
More information about the mesa-dev
mailing list