When I try to create a framebuffer via vkCreateFramebuffer
, I get an error in my debug report callback about the conflict in VkFramebufferCreateInfo
attachments. It says that my image views have a conflict in their image usages, while I don't expect this error because as a rule one of them must be a color attachment and the other must be a depth-stencil attachement.
The exact error message is:
Framebuffer Attachment(0) conflicts with image's IMAGE_USAGE flags (VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT).
I even already have seen other examples, they are exactly the same.
My source code (Rust):
https://github.com/Hossein-Noroozpour/vulkust/blob/master/src/vulkan/swapchain.rs#L218
Well, I can explain how the error works. If in doubt it is useful to dig into layers source code:
https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/tree/master/layers
It would be issued on vkCreateFramebuffer()
.
It would check the provided render pass and its subpasses vs the image views.
If a VkImageView
is used at least once as an Input Attachment then it expects the VkImage
of the VkImageView
to have been created with VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
.
Similarly for Color Attachment with VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
, and DS Attachment with VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
.
Check that you meet these requirements.
Layer bugs are a thing too. If you are running the latest ones and confirm a bug, then reports belong here:
https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues
UPDATE (after seeing your source code):
I fail to see where you set depth_reference.attachment
. You preinitialize it to 0
, so that could mean you assign the color attachment as depth to the subpass.