[Mesa-dev] [PATCH] anv: fix bug when VK_REMAINING_ARRAY_LAYERS is used in vkCmdClearAttachments()

Jason Ekstrand jason at jlekstrand.net
Mon Dec 18 15:45:48 UTC 2017


On Mon, Dec 18, 2017 at 2:55 AM, Samuel Iglesias Gonsálvez <
siglesias at igalia.com> wrote:

>
>
> On 15/12/17 16:46, Jason Ekstrand wrote:
> > Ugh... The problem here is that we may not know the framebuffer in
> > CmdCearAttachments if it's in a secondary command buffer.  I'm not
> > actually sure what to do in that case.  I guess we could store the
> > number of later somewhere and teach blorp how to do an indirect draw.
> > Really, I think it makes more sense to just disallow VK_REMAINING_LAYERS
> > in that function.
> >
>
> Makes sense. How do you want to disallow it? assert(), print an error
> and return...? because this function doesn't return a VkResult.
>

Assert should be fine.  Looking at the spec, I don't think it allows it.
In particular, the struct passed into vkCmdClearAttachment is *not* a
VkImageSubresourceLayout.

--Jason


> Sam
>
> > --Jason
> >
> >
> > On December 15, 2017 03:36:07 Samuel Iglesias Gonsálvez
> > <siglesias at igalia.com> wrote:
> >
> >> Blorp was not supporting the use of the constant
> >> VK_REMAINING_ARRAY_LAYERS
> >> (whose value is ~0) in the VkClearRect structure. If we receive it, we
> >> need
> >> to calculate the layer count as the image layers count minus the base
> >> array
> >> layer.
> >>
> >> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> >> ---
> >>  src/intel/vulkan/anv_blorp.c | 14 ++++++++++++--
> >>  1 file changed, 12 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> >> index e244468e03..4ab4458246 100644
> >> --- a/src/intel/vulkan/anv_blorp.c
> >> +++ b/src/intel/vulkan/anv_blorp.c
> >> @@ -989,10 +989,15 @@ clear_color_attachment(struct anv_cmd_buffer
> >> *cmd_buffer,
> >>     for (uint32_t r = 0; r < rectCount; ++r) {
> >>        const VkOffset2D offset = pRects[r].rect.offset;
> >>        const VkExtent2D extent = pRects[r].rect.extent;
> >> +      unsigned layer_count =
> >> +         anv_get_layerCount(
> >> +            cmd_buffer->state.framebuffer-
> >attachments[att_idx]->image,
> >> +            &pRects[r]);
> >> +
> >>        blorp_clear_attachments(batch, binding_table,
> >>                                ISL_FORMAT_UNSUPPORTED,
> pass_att->samples,
> >>                                pRects[r].baseArrayLayer,
> >> -                              pRects[r].layerCount,
> >> +                              layer_count,
> >>                                offset.x, offset.y,
> >>                                offset.x + extent.width, offset.y +
> >> extent.height,
> >>                                true, clear_color, false, 0.0f, 0, 0);
> >> @@ -1059,11 +1064,16 @@ clear_depth_stencil_attachment(struct
> >> anv_cmd_buffer *cmd_buffer,
> >>     for (uint32_t r = 0; r < rectCount; ++r) {
> >>        const VkOffset2D offset = pRects[r].rect.offset;
> >>        const VkExtent2D extent = pRects[r].rect.extent;
> >> +      unsigned layer_count =
> >> +         anv_get_layerCount(
> >> +            cmd_buffer->state.framebuffer-
> >attachments[att_idx]->image,
> >> +            &pRects[r]);
> >> +
> >>        VkClearDepthStencilValue value =
> >> attachment->clearValue.depthStencil;
> >>        blorp_clear_attachments(batch, binding_table,
> >>                                depth_format, pass_att->samples,
> >>                                pRects[r].baseArrayLayer,
> >> -                              pRects[r].layerCount,
> >> +                              layer_count,
> >>                                offset.x, offset.y,
> >>                                offset.x + extent.width, offset.y +
> >> extent.height,
> >>                                false, color_value,
> >> --
> >> 2.14.1
> >>
> >> _______________________________________________
> >> 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/20171218/ebc3f897/attachment-0001.html>


More information about the mesa-dev mailing list