<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 13, 2018 at 11:02 AM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Feb 05, 2018 at 02:34:56PM -0800, Jason Ekstrand wrote:<br>
> This moves the decision out of begin_subpass and into BeginRenderPass<br>
> like the decision for color clears. We use a similar name for the<br>
> function for depth/stencil as for color even though no aux usage is<br>
> really getting computed.<br>
> ---<br>
> src/intel/vulkan/genX_cmd_<wbr>buffer.c | 84 +++++++++++++++++++++++-------<wbr>--------<br>
> 1 file changed, 50 insertions(+), 34 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> index 21fdc6b..ab79fbf 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -350,6 +350,52 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
> }<br>
> }<br>
><br>
> +static void<br>
> +depth_stencil_attachment_<wbr>compute_aux_usage(struct anv_device *device,<br>
> + struct anv_cmd_state *cmd_state,<br>
> + uint32_t att, VkRect2D render_area)<br>
> +{<br>
> + struct anv_attachment_state *att_state = &cmd_state->attachments[att];<br>
> + struct anv_image_view *iview = cmd_state->framebuffer-><wbr>attachments[att];<br>
> +<br>
> + /* These will be initialized after the first subpass transition. */<br>
> + att_state->aux_usage = ISL_AUX_USAGE_NONE;<br>
> + att_state->input_aux_usage = ISL_AUX_USAGE_NONE;<br>
> +<br>
> + if (att_state->aux_usage != ISL_AUX_USAGE_HIZ) {<br>
<br>
</div></div>We set this to NONE 3 lines above. I think you meant to have your<br>
variable be: iview->image->planes[plane].<wbr>aux_usage ?<br></blockquote><div><br></div><div>Yup. You're right. Fixed locally.<br><br>This means I accidentally disabled HiZ clears entirely. :( This is going to need another jenkins run.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This is a nice cleanup. With the above fixed, this patch is<br>
Reviewed-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
<div><div class="h5"><br>
<br>
> + att_state->fast_clear = false;<br>
> + return;<br>
> + } else if (!(att_state->pending_clear_<wbr>aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) {<br>
> + /* If we're just clearing stencil, we can always HiZ clear */<br>
> + att_state->fast_clear = true;<br>
> + return;<br>
> + }<br>
> +<br>
> + if (!blorp_can_hiz_clear_depth(<wbr>GEN_GEN,<br>
> + iview->planes[0].isl.format,<br>
> + iview->image->samples,<br>
> + render_area.offset.x,<br>
> + render_area.offset.y,<br>
> + render_area.offset.x +<br>
> + render_area.extent.width,<br>
> + render_area.offset.y +<br>
> + render_area.extent.height)) {<br>
> + att_state->fast_clear = false;<br>
> + } else if (att_state->clear_value.<wbr>depthStencil.depth != ANV_HZ_FC_VAL) {<br>
> + att_state->fast_clear = false;<br>
> + } else if (GEN_GEN == 8 &&<br>
> + anv_can_sample_with_hiz(&<wbr>device->info, iview->image)) {<br>
> + /* Only gen9+ supports returning ANV_HZ_FC_VAL when sampling a<br>
> + * fast-cleared portion of a HiZ buffer. Testing has revealed that Gen8<br>
> + * only supports returning 0.0f. Gens prior to gen8 do not support this<br>
> + * feature at all.<br>
> + */<br>
> + att_state->fast_clear = false;<br>
> + } else {<br>
> + att_state->fast_clear = true;<br>
> + }<br>
> +}<br>
> +<br>
> static bool<br>
> need_input_attachment_state(<wbr>const struct anv_render_pass_attachment *att)<br>
> {<br>
> @@ -1125,12 +1171,9 @@ genX(cmd_buffer_setup_<wbr>attachments)(struct anv_cmd_buffer *cmd_buffer,<br>
> add_image_view_relocs(cmd_<wbr>buffer, iview, 0,<br>
> state->attachments[i].color);<br>
> } else {<br>
> - /* This field will be initialized after the first subpass<br>
> - * transition.<br>
> - */<br>
> - state->attachments[i].aux_<wbr>usage = ISL_AUX_USAGE_NONE;<br>
> -<br>
> - state->attachments[i].input_<wbr>aux_usage = ISL_AUX_USAGE_NONE;<br>
> + depth_stencil_attachment_<wbr>compute_aux_usage(cmd_buffer-><wbr>device,<br>
> + state, i,<br>
> + begin->renderArea);<br>
> }<br>
><br>
> if (need_input_attachment_state(&<wbr>pass->attachments[i])) {<br>
> @@ -3541,34 +3584,7 @@ cmd_buffer_begin_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> VK_IMAGE_ASPECT_STENCIL_BIT));<br>
><br>
> if (att_state->pending_clear_<wbr>aspects) {<br>
> - bool clear_with_hiz = att_state->aux_usage == ISL_AUX_USAGE_HIZ;<br>
> - if (clear_with_hiz &&<br>
> - (att_state->pending_clear_<wbr>aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) {<br>
> - if (!blorp_can_hiz_clear_depth(<wbr>GEN_GEN,<br>
> - iview->planes[0].isl.format,<br>
> - iview->image->samples,<br>
> - render_area.offset.x,<br>
> - render_area.offset.y,<br>
> - render_area.offset.x +<br>
> - render_area.extent.width,<br>
> - render_area.offset.y +<br>
> - render_area.extent.height)) {<br>
> - clear_with_hiz = false;<br>
> - } else if (att_state->clear_value.<wbr>depthStencil.depth != ANV_HZ_FC_VAL) {<br>
> - clear_with_hiz = false;<br>
> - } else if (GEN_GEN == 8 &&<br>
> - anv_can_sample_with_hiz(&cmd_<wbr>buffer->device->info,<br>
> - iview->image)) {<br>
> - /* Only gen9+ supports returning ANV_HZ_FC_VAL when sampling a<br>
> - * fast-cleared portion of a HiZ buffer. Testing has revealed<br>
> - * that Gen8 only supports returning 0.0f. Gens prior to gen8<br>
> - * do not support this feature at all.<br>
> - */<br>
> - clear_with_hiz = false;<br>
> - }<br>
> - }<br>
> -<br>
> - if (clear_with_hiz) {<br>
> + if (att_state->fast_clear) {<br>
> /* We currently only support HiZ for single-layer images */<br>
> assert(iview->planes[0].isl.<wbr>base_level == 0);<br>
> assert(iview->planes[0].isl.<wbr>base_array_layer == 0);<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>