<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 11, 2017 at 5:55 PM, 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">Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
---<br>
 src/intel/vulkan/anv_blorp.c       |  9 +++++++--<br>
 src/intel/vulkan/anv_private.h     | 15 +++++++++++++++<br>
 src/intel/vulkan/genX_cmd_<wbr>buffer.c |  5 +----<br>
 3 files changed, 23 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
index 433e82f938..9919ac7ea0 100644<br>
--- a/src/intel/vulkan/anv_blorp.c<br>
+++ b/src/intel/vulkan/anv_blorp.c<br>
@@ -1264,6 +1264,12 @@ anv_cmd_buffer_clear_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
                                            render_area.offset.y +<br>
                                            render_area.extent.height)) {<br>
                clear_with_hiz = false;<br>
+            } else if (clear_att.clearValue.<wbr>depthStencil.depth !=<br>
+                       ANV_HZ_FC_VAL) {<br>
+               /* Don't enable fast depth clears for any color not equal to<br>
+                * ANV_HZ_FC_VAL.<br>
+                */<br>
+               clear_with_hiz = false;<br>
             }<br>
          }<br>
<br>
@@ -1626,8 +1632,7 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,<br>
    struct blorp_surf surf;<br>
    get_blorp_surf_for_anv_image(<wbr>image, VK_IMAGE_ASPECT_DEPTH_BIT,<br>
                                 ISL_AUX_USAGE_HIZ, &surf);<br>
-   surf.clear_color.u32[0] = (uint32_t)<br>
-      cmd_state->attachments[ds].<wbr>clear_value.depthStencil.<wbr>depth;<br>
+   surf.clear_color.u32[0] = (uint32_t) ANV_HZ_FC_VAL;<br></blockquote><div><br></div><div>Ugh... We should really fix this ugly corner of blorp.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    blorp_gen6_hiz_op(&batch, &surf, 0, 0, op);<br>
    blorp_batch_finish(&batch);<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 237308fb3e..98692b5913 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -72,6 +72,21 @@ struct gen_l3_config;<br>
 extern "C" {<br>
 #endif<br>
<br>
+/* Allowing different clear colors requires us to perform a depth resolve at<br>
+ * the end of certain render passes. This is because while slow clears store<br>
+ * the clear color in the HiZ buffer, fast clears (without a resolve) don't.<br>
+ * See the PRMs for examples describing when additional resolves would be<br>
+ * necessary. To enable fast clears without requiring extra resolves, we set<br>
+ * the clear value to a globally-defined one. We could allow different values<br>
+ * if the user doesn't expect coherent data during or after a render passes<br>
+ * (VK_ATTACHMENT_STORE_OP_DONT_<wbr>CARE), but such users (aside from the CTS)<br>
+ * don't seem to exist yet. In almost all Vulkan applications tested thus far,<br>
+ * 1.0f seems to be the only value used. The only application that doesn't set<br>
+ * this value does so through the usage of an seemingly uninitialized clear<br>
+ * value.<br>
+ */<br>
+#define ANV_HZ_FC_VAL 1.0f<br>
+<br>
 #define MAX_VBS         32<br>
 #define MAX_SETS         8<br>
 #define MAX_RTS          8<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 95d0cfc983..baa932e517 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -2283,10 +2283,7 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
    anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_CLEAR_PARAMS), cp) {<br>
       if (has_hiz) {<br>
          cp.DepthClearValueValid = true;<br>
-         const uint32_t ds =<br>
-            cmd_buffer->state.subpass-><wbr>depth_stencil_attachment;<br>
-         cp.DepthClearValue =<br>
-            cmd_buffer->state.attachments[<wbr>ds].clear_value.depthStencil.<wbr>depth;<br>
+         cp.DepthClearValue = ANV_HZ_FC_VAL;<br>
       }<br>
    }<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<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>
</font></span></blockquote></div><br></div></div>