<div dir="ltr"><div class="gmail_extra"><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/anv_private.h | 42 ++++++++++++++++++++++++++++++<wbr>++++++++++++<br>
 1 file changed, 42 insertions(+)<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index dbe1e0475e..ac71537e88 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -1977,6 +1977,48 @@ struct anv_image {<br>
    struct anv_surface aux_surface;<br>
 };<br>
<br>
+static inline bool<br>
+anv_image_has_color_aux(const struct anv_image * const image)<br>
+{<br>
+   assert(image);<br>
+<br>
+   return image->aspects == VK_IMAGE_ASPECT_COLOR_BIT &&<br>
+          image->aux_surface.isl.size > 0;<br>
+}<br>
+<br>
+/* Returns the number of levels present in the auxiliary buffer of a color<br>
+ * image.<br>
+ */<br>
+static inline uint8_t<br>
+anv_color_aux_levels(const struct anv_image * const image)<br>
+{<br>
+   assert(image);<br>
+<br>
+   /* We expect the image to have a color aux buffer. */<br>
+   assert(anv_image_has_color_<wbr>aux(image));<br>
+<br>
+   return image->aux_surface.isl.levels;<br>
+}<br>
+<br>
+/* Returns the number of layers present in the auxiliary buffer of a color<br>
+ * image.<br>
+ */<br>
+static inline uint32_t<br>
+anv_color_aux_layers(const struct anv_image * const image,<br>
+                     const uint8_t miplevel)<br>
+{<br>
+   assert(image);<br>
+<br>
+   /* We expect the image to have a color aux buffer. */<br>
+   assert(anv_image_has_color_<wbr>aux(image));<br>
+<br>
+   /* The miplevel must exist in the main buffer. */<br>
+   assert(miplevel < image->levels);<br>
+<br></blockquote><div><br></div><div>I think you may want<br><br></div><div>if (miplevel >= image->aux_surface.isl.levels)<br></div><div>   return 0;<br><br></div><div>or something similar to indicate that you may not have all the layers.  Not sure if that's useful though.  I'll keep reading. :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   return MAX2(image->aux_surface.isl.<wbr>logical_level0_px.array_len,<br>
+               image->aux_surface.isl.<wbr>logical_level0_px.depth >> miplevel);<br>
+}<br>
+<br>
 /* Returns true if a HiZ-enabled depth buffer can be sampled from. */<br>
 static inline bool<br>
 anv_can_sample_with_hiz(const struct gen_device_info * const devinfo,<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>