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

Nanley Chery nanleychery at gmail.com
Thu May 11 17:29:53 UTC 2017


On Tue, May 02, 2017 at 02:54:07PM -0700, Jason Ekstrand wrote:
> 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. :-)
> 
> 

Good catch. Fixed in local v2.


More information about the mesa-dev mailing list