<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 27, 2017 at 11:32 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">Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
---<br>
 src/intel/vulkan/genX_cmd_<wbr>buffer.c | 18 +++++++++++++++---<br>
 1 file changed, 15 insertions(+), 3 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 0ea378fde2..a981b00f67 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -216,7 +216,7 @@ color_is_zero_one(<wbr>VkClearColorValue value, enum isl_format format)<br>
 }<br>
<br>
 static void<br>
-color_attachment_compute_aux_<wbr>usage(struct anv_device *device,<br>
+color_attachment_compute_aux_<wbr>usage(struct anv_cmd_buffer * const cmd_buffer,<br></blockquote><div><br></div><div>I t may be better to just pass in the framebuffer and attachment index rather than the whole command buffer.  Slso, I think you're getting a bit over-excited with the constness. :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                    struct anv_attachment_state *att_state,<br>
                                    struct anv_image_view *iview,<br>
                                    VkRect2D render_area,<br>
@@ -249,7 +249,8 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device *device,<br>
       att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;<br>
    } else {<br>
       att_state->aux_usage = ISL_AUX_USAGE_CCS_D;<br>
-      if (isl_format_supports_ccs_e(&<wbr>device->info, iview->isl.format)) {<br>
+      if (isl_format_supports_ccs_e(&<wbr>cmd_buffer->device->info,<br>
+                                    iview->isl.format)) {<br>
          /* SKL can sample from CCS with one restriction.<br>
           *<br>
           * From the Sky Lake PRM, RENDER_SURFACE_STATE::<wbr>AuxiliarySurfaceMode:<br>
@@ -305,6 +306,17 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device *device,<br>
       if (GEN_GEN <= 8 && !att_state->clear_color_is_<wbr>zero_one)<br>
          att_state->fast_clear = false;<br>
<br>
+      /* We can't fast clear a proper subset of a layered image. See<br>
+       * add_clear_values() for more information.<br>
+       */<br>
+      const uint32_t fb_layers = cmd_buffer->state.framebuffer-<wbr>>layers;<br>
+      const uint32_t aux_layers = anv_color_aux_layers(iview-><wbr>image,<br>
+                                                       iview->isl.base_level);<br>
+      if (fb_layers != aux_layers) {<br>
+         assert(fb_layers < aux_layers);<br>
+         att_state->fast_clear = false;<br>
+      }<br>
+<br>
       if (att_state->fast_clear) {<br>
          memcpy(fast_clear_color->u32, att_state->clear_value.color.<wbr>uint32,<br>
                 sizeof(fast_clear_color->u32))<wbr>;<br>
@@ -498,7 +510,7 @@ genX(cmd_buffer_setup_<wbr>attachments)(struct anv_cmd_buffer *cmd_buffer,<br>
<br>
          union isl_color_value clear_color = { .u32 = { 0, } };<br>
          if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
-            color_attachment_compute_aux_<wbr>usage(cmd_buffer->device,<br>
+            color_attachment_compute_aux_<wbr>usage(cmd_buffer,<br>
                                                &state->attachments[i],<br>
                                                iview, begin->renderArea,<br>
                                                &clear_color);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.12.2<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>