Creating a uniform texel buffer
Uniform texel buffers allow us to read data in a way similar to reading data from images--their contents are interpreted not as an array of single (scalar) values but as formatted pixels (texel) with one, two, three, or four components. But through such buffers, we can access data that is much larger than the data provided through usual images.
We need to specify a VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT
usage when we want to use a buffer as a uniform texel buffer.
How to do it...
- Take the handle of a physical device and store it in a variable of type
VkPhysicalDevice
namedphysical_device
. - Select a format in which the buffer data will be stored. Use the format to initialize a variable of type
VkFormat
namedformat
. - Create a variable of type
VkFormatProperties
namedformat_properties
. - Call
vkGetPhysicalDeviceFormatProperties( physical_device, format, &format_properties )
and provide the handle of the physical device, theformat
variable, and a pointer to the...