Creating an input attachment
Attachments are images into which we render during drawing commands, inside render passes. In other words, they are render targets.
Input attachments are image resources from which we can read (unfiltered) data inside fragment shaders. We just need to remember that we can access only one location corresponding to a processed fragment.
Usually, for input attachments, resources that were previously color or depth/stencil attachments are used. But we can also use other images (and their image views). We just need to create them with a VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
usage.
How to do it...
- Take the physical device on which operations are performed and store its handle in a variable of type
VkPhysicalDevice
namedphysical_device
. - Select a format for an image and use it to initialize a variable of type
VkFormat
namedformat
. - Create a variable of type
VkFormatProperties
namedformat_properties
. - Call
vkGetPhysicalDeviceFormatProperties( physical_device, format, &format_properties...