Creating an image
Images represent data that can have one, two, or three dimensions, and can have additional mipmap levels and layers. Each element of an image's data (a texel) can also have one or more samples.
Images can be used for many different purposes. We can use them as a source of data for copy operations. We can bind images to pipelines via descriptor sets and use them as textures (similarly to OpenGL). We can render into images, in which case we use images as color or depth attachments (render targets).
We specify image parameters such as size, format, and its intended usages during image creation.
How to do it...
- Take the handle of a logical device on which we want to create an image. Store it in a variable of type
VkDevice
namedlogical_device
. - Choose an image type (if an image should have one, two, or three dimensions) and use a proper value to initialize a variable of type
VkImageType
namedtype
. - Select the image's format--the number of components and number of bits each image's...