anv: Allow HiZ clears for multi-view

Now that we're enabling HiZ on multi-layer images, there's no reason why
we can't enable HiZ clears for multi-view.  The only reason I can think
of why we didn't before was because no one thought to and the old code
didn't.  Enabling this means that an attachment will get HiZ cleared if
and only if att_state->fast_clear.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6549>
This commit is contained in:
Jason Ekstrand
2020-07-07 14:10:21 -05:00
committed by Marge Bot
parent 03af98abe2
commit 7c92e413af

View File

@@ -5261,20 +5261,15 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
}
} else if (att_state->pending_clear_aspects & (VK_IMAGE_ASPECT_DEPTH_BIT |
VK_IMAGE_ASPECT_STENCIL_BIT)) {
if (att_state->fast_clear && !is_multiview) {
if (att_state->fast_clear &&
(att_state->pending_clear_aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) {
/* We currently only support HiZ for single-LOD images */
if (att_state->pending_clear_aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
assert(isl_aux_usage_has_hiz(iview->image->planes[0].aux_usage));
assert(iview->planes[0].isl.base_level == 0);
assert(iview->planes[0].isl.levels == 1);
}
anv_image_hiz_clear(cmd_buffer, image,
att_state->pending_clear_aspects,
iview->planes[0].isl.base_level,
iview->planes[0].isl.base_array_layer,
fb->layers, render_area,
att_state->clear_value.depthStencil.stencil);
} else if (is_multiview) {
if (is_multiview) {
uint32_t pending_clear_mask =
get_multiview_subpass_clear_mask(cmd_state, att_state);
@@ -5283,6 +5278,13 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
uint32_t layer =
iview->planes[0].isl.base_array_layer + layer_idx;
if (att_state->fast_clear) {
anv_image_hiz_clear(cmd_buffer, image,
att_state->pending_clear_aspects,
iview->planes[0].isl.base_level,
layer, 1, render_area,
att_state->clear_value.depthStencil.stencil);
} else {
anv_image_clear_depth_stencil(cmd_buffer, image,
att_state->pending_clear_aspects,
att_state->aux_usage,
@@ -5292,8 +5294,17 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
att_state->clear_value.depthStencil.depth,
att_state->clear_value.depthStencil.stencil);
}
}
att_state->pending_clear_views &= ~pending_clear_mask;
} else {
if (att_state->fast_clear) {
anv_image_hiz_clear(cmd_buffer, image,
att_state->pending_clear_aspects,
iview->planes[0].isl.base_level,
iview->planes[0].isl.base_array_layer,
fb->layers, render_area,
att_state->clear_value.depthStencil.stencil);
} else {
anv_image_clear_depth_stencil(cmd_buffer, image,
att_state->pending_clear_aspects,
@@ -5304,6 +5315,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
att_state->clear_value.depthStencil.depth,
att_state->clear_value.depthStencil.stencil);
}
}
} else {
assert(att_state->pending_clear_aspects == 0);
}