Creating a combined image sampler
From the application (API) perspective, samplers and sampled images are always separate objects. But inside shaders, they can be combined into one object. On some platforms, sampling from combined image samplers inside shaders may be more optimal than using separate samplers and sampled images.
How to do it...
- Create a sampler object and store its handle in a variable of type
VkSampler
namedsampler
(refer to the Creating a sampler recipe). - Create a sampled image. Store the handle of the created image in a variable of type
VkImage
namedsampled_image
. Create an appropriate view for the sampled image and store its handle in a variable of typeVkImageView
namedsampled_image_view
(refer to the Creating a sampled image recipe).
How it works...
Combined image samplers are created in our application in the same way as normal samplers and sampled images. They are just used differently inside shaders.
Note
Combined image samplers can be bound to descriptors of a VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER...