Samplers define a set of parameters that control how image data is loaded inside shaders (sampled). These parameters include address calculations (that is, wrapping or repeating), filtering (linear or nearest), or using mipmaps. To use samplers from within shaders, we first need to create them.
Creating a sampler
How to do it...
- Take a handle of a logical device and store it in a variable of type VkDevice named logical_device.
- Create a variable of type VkSamplerCreateInfo named sampler_create_info and use the following values for its members:
- VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO value for sType
- nullptr value for pNext
- 0 value for flags
- The desired magnification and minification filtering mode (VK_FILTER_NEAREST or VK_FILTER_LINEAR) for magFilter and minFilter ...