<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 28, 2017 at 2:14 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">For readability, bring the assignment of CCS closer to the assignment of<br>
NONE and MCS.<br>
<br>
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 | 62 ++++++++++++++++++------------<wbr>--------<br>
 1 file changed, 30 insertions(+), 32 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 49ad41edbd..1aa79c8e7b 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -253,6 +253,36 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
       att_state->input_aux_usage = ISL_AUX_USAGE_MCS;<br>
       att_state->fast_clear = false;<br>
       return;<br>
+   } else if (iview->image->aux_usage == ISL_AUX_USAGE_CCS_E) {<br>
+      att_state->aux_usage = ISL_AUX_USAGE_CCS_E;<br>
+      att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;<br></blockquote><div><br></div>I'm not sure if this actually improves readability as-is.  The no aux case and MCS cases are early returns.  Maybe what we want is something like this:<br><br></div><div class="gmail_quote">if (aux_surface.isl.size == 0) {<br></div><div class="gmail_quote">   /* set to none */<br></div><div class="gmail_quote">   return;<br></div><div class="gmail_quote">}<br><br></div><div class="gmail_quote">switch (aux_usage) {<br></div><div class="gmail_quote">case MCS:<br></div><div class="gmail_quote">case CCS_E:<br></div><div class="gmail_quote">   aux_state->aux_usage = iview->image->aux_usage;<br>   aux_state->input_aux_usage = iview->image->aux_usage;<br></div><div class="gmail_quote">   break;<br><br></div><div class="gmail_quote">case NONE:<br></div><div class="gmail_quote">   assert(samples == 1);<br></div><div class="gmail_quote">   /* stuff below */<br></div><div class="gmail_quote">   break;<br><br></div><div class="gmail_quote">default:<br></div><div class="gmail_quote">   unreachable();<br></div><div class="gmail_quote">}<br><br></div><div class="gmail_quote">/* Now we determine whether or not we want to fast-clear */<br><br></div><div class="gmail_quote">if (samples > 1) {<br></div><div class="gmail_quote">   perf_debug();<br></div><div class="gmail_quote">   fast_clear = false;<br></div><div class="gmail_quote">   return;<br></div><div class="gmail_quote">}<br><br></div><div class="gmail_quote">/* Other fast clear determination. */<br><br></div><div class="gmail_quote">Incidentally, it may be cleaner in the long run if we split this into two functions: compute_ccs_usage and compute_mcs_usage.<br><br></div><div class="gmail_quote">Just thoughts BTW.  I'm not 100% sure how to make this the most readable.<br></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+   } else {<br>
+      att_state->aux_usage = ISL_AUX_USAGE_CCS_D;<br>
+      /* From the Sky Lake PRM, RENDER_SURFACE_STATE::<wbr>AuxiliarySurfaceMode:<br>
+       *<br>
+       *    "If Number of Multisamples is MULTISAMPLECOUNT_1, AUX_CCS_D<br>
+       *    setting is only allowed if Surface Format supported for Fast<br>
+       *    Clear. In addition, if the surface is bound to the sampling<br>
+       *    engine, Surface Format must be supported for Render Target<br>
+       *    Compression for surfaces bound to the sampling engine."<br>
+       *<br>
+       * In other words, we can only sample from a fast-cleared image if it<br>
+       * also supports color compression.<br>
+       */<br>
+      if (isl_format_supports_ccs_e(&<wbr>device->info, iview->isl.format)) {<br>
+         /* TODO: Consider using a heuristic to determine if temporarily enabling<br>
+          * CCS_E for this image view would be beneficial.<br>
+          *<br>
+          * While fast-clear resolves and partial resolves are fairly cheap in the<br>
+          * case where you render to most of the pixels, full resolves are not<br>
+          * because they potentially involve reading and writing the entire<br>
+          * framebuffer.  If we can't texture with CCS_E, we should leave it off and<br>
+          * limit ourselves to fast clears.<br>
+          */<br>
+         att_state->input_aux_usage = ISL_AUX_USAGE_CCS_D;<br>
+      } else {<br>
+         att_state->input_aux_usage = ISL_AUX_USAGE_NONE;<br>
+      }<br>
    }<br>
<br>
    assert(iview->image->aux_<wbr>surface.isl.usage & ISL_SURF_USAGE_CCS_BIT);<br>
@@ -315,38 +345,6 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
    } else {<br>
       att_state->fast_clear = false;<br>
    }<br>
-<br>
-   /**<br>
-    * TODO: Consider using a heuristic to determine if temporarily enabling<br>
-    * CCS_E for this image view would be beneficial.<br>
-    *<br>
-    * While fast-clear resolves and partial resolves are fairly cheap in the<br>
-    * case where you render to most of the pixels, full resolves are not<br>
-    * because they potentially involve reading and writing the entire<br>
-    * framebuffer.  If we can't texture with CCS_E, we should leave it off and<br>
-    * limit ourselves to fast clears.<br>
-    */<br>
-   if (iview->image->aux_usage == ISL_AUX_USAGE_CCS_E) {<br>
-      att_state->aux_usage = ISL_AUX_USAGE_CCS_E;<br>
-      att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;<br>
-   } else {<br>
-      att_state->aux_usage = ISL_AUX_USAGE_CCS_D;<br>
-      /* From the Sky Lake PRM, RENDER_SURFACE_STATE::<wbr>AuxiliarySurfaceMode:<br>
-       *<br>
-       *    "If Number of Multisamples is MULTISAMPLECOUNT_1, AUX_CCS_D<br>
-       *    setting is only allowed if Surface Format supported for Fast<br>
-       *    Clear. In addition, if the surface is bound to the sampling<br>
-       *    engine, Surface Format must be supported for Render Target<br>
-       *    Compression for surfaces bound to the sampling engine."<br>
-       *<br>
-       * In other words, we can only sample from a fast-cleared image if it<br>
-       * also supports color compression.<br>
-       */<br>
-      if (isl_format_supports_ccs_e(&<wbr>device->info, iview->isl.format))<br>
-         att_state->input_aux_usage = ISL_AUX_USAGE_CCS_D;<br>
-      else<br>
-         att_state->input_aux_usage = ISL_AUX_USAGE_NONE;<br>
-   }<br>
 }<br>
<br>
 static bool<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.13.1<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>