Creating a 2D image and view
The most common image type that is used in many popular applications or games is typical 2D textures with four RGBA components and 32 bits per texel. To create such a resource in Vulkan, we need to create a 2D image and a proper image view.
How to do it...
- Take a handle of a logical device and use it to initialize a variable of type
VkDevice
namedlogical_device
. - Select the data format used in the image and initialize a variable of type
VkFormat
namedformat
with the selected value. - Choose the size of the image. Store it in a variable of type
VkExtent2D
namedsize
. - Choose the number of mipmap levels that should compose the image. Initialize a variable of type
uint32_t
namednum_mipmaps
with the selected number of mipmaps. - Specify the number of image layers using a variable of type
uint32_t
namednum_layers
. - Select the number of per texel samples and store it in a variable of type
VkSampleCountFlagBits
namedsamples
. - Think of all the purposes for which the image will...