Now, I want to do post-processing and use subpass way to do it. I have created two subpasses and draw a big triangle in the screen in the second subpass.
But the problem is I don't how to get the render result of the first subpass because I need to feed it to the fragment shader of the second subpass, and then I can do some effect in the fragment shader of the second subpass.
I guess the result is swapchain_imageView. But I cannot use it. Vulkan show me that
Cannot use image 0x8 with specific layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL that doesn't match the actual current layout VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.
I guess the way is wrong.
How to get the correct render result for next subpass?
VkAttachmentReference inputAttachmentRef = {}; inputAttachmentRef.attachment = 0; inputAttachmentRef.layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; VkSubpassDescription subpass2 = {}; subpass2.inputAttachmentCount = 1; subpass2.pInputAttachments = &inputAttachmentRef;Because I set inputAttachment in subpass 2, I guess the system should send the render result of the subpass 1 to my fragment shader of the subpass 2 automatically. But I just guess. I really don't know about it. - user8201562