subpass_needs_clear loops over all color attachments in a subpass, but it doesn't check if the attachment is unused (-1) before it dereferences the attachment array.
There are lots of places where VK_ATTACHMENT_UNUSED is not checked as well. The crashes happen in vkCmdBeginRenderPass. The scenario is where there is one color attachment which is VK_ATTACHMENT_UNUSED (in order to allow a shader to use location = 0 dummy fragment output for depth-only shaders).
Created attachment 130736 [details] [review] Patch to try Thanks for the bug report! Do you have a test-case? If so, could you please try the attached patch. I fixed all of the cases I could find.
The test is just creating a subpass where pColorAttachments = { VK_ATTACHMENT_UNUSED } colorAttachmentCount = 1 That patch helped a bit, it now crashes in genX_cmd_buffer.c:1168 where it tries to emit SET_COLOR_ATTACHMENTS.
Created attachment 130740 [details] [review] Workaround This is the patch I applied locally to make it work for me at least.
Thanks! I've reworked things a bit into this branch: https://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/anv-attachment-unused Mind giving it a go?
On holiday, so won't be able to test until next week.
Tested your branch. Works fine for me.
Cool. The patches have already been merged.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.