<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 11, 2017 at 8:05 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com" target="_blank">nanley.g.chery@intel.com</a>><br>
---<br>
 src/intel/vulkan/anv_image.c       | 17 +++++++++++++----<br>
 src/intel/vulkan/genX_cmd_buf<wbr>fer.c | 10 ++++------<br>
 2 files changed, 17 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
index d821629191..f8a21c2982 100644<br>
--- a/src/intel/vulkan/anv_image.c<br>
+++ b/src/intel/vulkan/anv_image.c<br>
@@ -182,6 +182,14 @@ make_surface(const struct anv_device *dev,<br>
        */<br>
       if (!(image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_A<wbr>TTACHMENT_BIT)) {<br>
          /* It will never be used as an attachment, HiZ is pointless. */<br>
+      } else if (image->usage & VK_IMAGE_USAGE_INPUT_ATTACHMEN<wbr>T_BIT) {<br>
+         /* It will never have a layout of<br>
+          * VK_IMAGE_LAYOUT_DEPTH_STENCIL_<wbr>ATTACHMENT_OPTIMAL, so HiZ is<br>
+          * currently pointless. If transfer operations learn to use the HiZ<br>
+          * buffer, we can enable HiZ for VK_IMAGE_LAYOUT_GENERAL and support<br>
+          * input attachments.<br>
+          */<br></blockquote><div><br></div></span><div>From the 1.0.37 spec:<br><br>"An attachment used as an input attachment and depth/stencil attachment <span class="m_-6832031934812412273gmail-normative">must</span>
be in either <code class="m_-6832031934812412273gmail-code">VK_IMAGE_LAYOUT_GENERAL</code> or
<code class="m_-6832031934812412273gmail-code">VK_IMAGE_LAYOUT_DEPTH_STENCIL_<wbr>READ_ONLY_OPTIMAL</code>."<br><br></div><div>So it can happen.  Since gen8 can texture from HiZ, this shouldn't be a problem.  I think we'll need this for gen7 though.<br></div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+         anv_finishme("Implement HiZ for input attachments");<br>
       } else if (!env_var_as_boolean("INTEL_VK<wbr>_HIZ", dev->info.gen >= 8)) {<br>
          anv_finishme("Implement gen7 HiZ");<br>
       } else if (vk_info->mipLevels > 1) {<br>
@@ -529,14 +537,15 @@ anv_CreateImageView(VkDevice _device,<br>
    if (surf_usage == ISL_AUX_USAGE_HIZ)<br>
       surf_usage = ISL_AUX_USAGE_NONE;<br>
<br>
-   /* Input attachment surfaces for color or depth are allocated and filled<br>
+   /* Input attachment surfaces for color are allocated and filled<br>
     * out at BeginRenderPass time because they need compression information.<br>
-    * Stencil image do not support compression so we just use the texture<br>
-    * surface from the image view.<br>
+    * Compression is not yet enabled for depth textures and stencil doesn't<br>
+    * allow compression so we can just use the texture surface state from the<br>
+    * view.<br>
     */<br>
    if (image->usage & VK_IMAGE_USAGE_SAMPLED_BIT ||<br>
        (image->usage & VK_IMAGE_USAGE_INPUT_ATTACHMEN<wbr>T_BIT &&<br>
-        (iview->aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT))) {<br>
+        !(iview->aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT))) {<br>
       iview->sampler_surface_state = alloc_surface_state(device);<br>
<br>
       struct isl_view view = iview->isl;<br>
diff --git a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
index baa932e517..1793c4df26 100644<br>
--- a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
@@ -303,11 +303,11 @@ need_input_attachment_state(co<wbr>nst struct anv_render_pass_attachment *att)<br>
    if (!(att->usage & VK_IMAGE_USAGE_INPUT_ATTACHMEN<wbr>T_BIT))<br>
       return false;<br>
<br>
-   /* We only allocate input attachment states for color and depth surfaces.<br>
-    * Stencil doesn't allow compression so we can just use the texture surface<br>
-    * state from the view<br>
+   /* We only allocate input attachment states for color surfaces. Compression<br>
+    * is not yet enabled for depth textures and stencil doesn't allow<br>
+    * compression so we can just use the texture surface state from the view.<br>
     */<br>
-   return vk_format_is_color(att->format<wbr>) || vk_format_has_depth(att->forma<wbr>t);<br>
+   return vk_format_is_color(att->format<wbr>);<br>
 }<br>
<br>
 static enum isl_aux_usage<br>
@@ -518,8 +518,6 @@ genX(cmd_buffer_setup_attachme<wbr>nts)(struct anv_cmd_buffer *cmd_buffer,<br>
             const struct isl_surf *surf;<br>
             if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
                surf = &iview->image->color_surface.i<wbr>sl;<br>
-            } else {<br>
-               surf = &iview->image->depth_surface.i<wbr>sl;<br>
             }<br></blockquote></div></div></div></div></div></blockquote><div><br></div><div>I think we can just drop conditional all together.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
             struct isl_view view = iview->isl;<br>
<span class="m_-6832031934812412273gmail-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" target="_blank">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></div></div><br></div></div>
</blockquote></div><br></div></div>