[Mesa-stable] [Mesa-dev] [PATCH 4/4] anv: Handle VK_WHOLE_SIZE properly for buffer views

Jason Ekstrand jason at jlekstrand.net
Fri Jul 15 17:56:51 UTC 2016


On Fri, Jul 15, 2016 at 9:57 AM, Nanley Chery <nanleychery at gmail.com> wrote:

> On Thu, Jul 14, 2016 at 09:20:08PM -0700, Jason Ekstrand wrote:
> > The old calculation, which used view->offset, encorporated buffer->offset
> > into the size calculation where it doesn't belong.  This meant that, if
> > buffer->offset > buffer->size, you would always get a negative size.
> This
> > fixes 170 dEQP-VK.renderpass.attachment.* Vulkan CTS tests on Haswell.
> >
>
> Nice patch.
>
> > Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> > Cc: "12.0" <mesa-stable at lists.freedesktop.org>
> > ---
> >  src/intel/vulkan/anv_image.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> > index 23fdd93..fe5b124 100644
> > --- a/src/intel/vulkan/anv_image.c
> > +++ b/src/intel/vulkan/anv_image.c
> > @@ -631,7 +631,7 @@ void anv_buffer_view_init(struct anv_buffer_view
> *view,
> >     view->bo = buffer->bo;
> >     view->offset = buffer->offset + pCreateInfo->offset;
> >     view->range = pCreateInfo->range == VK_WHOLE_SIZE ?
> > -                 buffer->size - view->offset : pCreateInfo->range;
> > +                 buffer->size - pCreateInfo->offset :
> pCreateInfo->range;
> >
>
> This is almost correct. The range member definition (11.2. Buffer Views)
> has a corner case for VK_WHOLE_SIZE. It states that if
> R = (buffer_size - buffer_view_offset) is not a multiple of
> buffer_view_format_size, then you must set the range member to
> the nearest smaller multiple of buffer_view_format_size.
>

Thanks for your care!  I was not thinking of that corner-case.


> Which is to say,
>  if (requested_range == VK_WHOLE_SIZE)
>     actual_range = ALIGN_DOWN(R, buffer_view_format_size);
>

That said, the hardware packet is in number of elements so we divide by the
format size and round down in isl_buffer_fill_state so I think it's ok.
--Jason


>
> - Nanley
>
> >     if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) {
> >        view->surface_state = alloc_surface_state(device, cmd_buffer);
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > 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-stable/attachments/20160715/334d7d4a/attachment.html>


More information about the mesa-stable mailing list