Vulkan 1.0.16 seems to have fixed this. It explicitly states that no entries are made with attachment indices greater than subpasses attachmentCount , or that are explicitly declared by VK_ATTACHMENT_UNUSED . The output variable will be undefined, but nothing will be written to it based on the current subpass description.
This is a very good question. I spent a few minutes reading the specification in the expected places, and yet there is no language explaining what happens when the fragment shader writes to an output location that does not have a subpass attachment. This should be stated in section 14.3, but there is nothing in it.
You can create a Vulkan spec error report .
I assume that the correct behavior will be the same as OpenGL: effectively ignore such exits.
source share