[Mesa-dev] [PATCH 04/22] anv: Add color auxiliary buffer helpers

Jason Ekstrand jason at jlekstrand.net
Tue May 2 21:54:07 UTC 2017


On Thu, Apr 27, 2017 at 11:32 AM, Nanley Chery <nanleychery at gmail.com>
wrote:

> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>  src/intel/vulkan/anv_private.h | 42 ++++++++++++++++++++++++++++++
> ++++++++++++
>  1 file changed, 42 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
> private.h
> index dbe1e0475e..ac71537e88 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -1977,6 +1977,48 @@ struct anv_image {
>     struct anv_surface aux_surface;
>  };
>
> +static inline bool
> +anv_image_has_color_aux(const struct anv_image * const image)
> +{
> +   assert(image);
> +
> +   return image->aspects == VK_IMAGE_ASPECT_COLOR_BIT &&
> +          image->aux_surface.isl.size > 0;
> +}
> +
> +/* Returns the number of levels present in the auxiliary buffer of a color
> + * image.
> + */
> +static inline uint8_t
> +anv_color_aux_levels(const struct anv_image * const image)
> +{
> +   assert(image);
> +
> +   /* We expect the image to have a color aux buffer. */
> +   assert(anv_image_has_color_aux(image));
> +
> +   return image->aux_surface.isl.levels;
> +}
> +
> +/* Returns the number of layers present in the auxiliary buffer of a color
> + * image.
> + */
> +static inline uint32_t
> +anv_color_aux_layers(const struct anv_image * const image,
> +                     const uint8_t miplevel)
> +{
> +   assert(image);
> +
> +   /* We expect the image to have a color aux buffer. */
> +   assert(anv_image_has_color_aux(image));
> +
> +   /* The miplevel must exist in the main buffer. */
> +   assert(miplevel < image->levels);
> +
>

I think you may want

if (miplevel >= image->aux_surface.isl.levels)
   return 0;

or something similar to indicate that you may not have all the layers.  Not
sure if that's useful though.  I'll keep reading. :-)


> +   return MAX2(image->aux_surface.isl.logical_level0_px.array_len,
> +               image->aux_surface.isl.logical_level0_px.depth >>
> miplevel);
> +}
> +
>  /* Returns true if a HiZ-enabled depth buffer can be sampled from. */
>  static inline bool
>  anv_can_sample_with_hiz(const struct gen_device_info * const devinfo,
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170502/704841a0/attachment.html>


More information about the mesa-dev mailing list