Creating a buffer view
When we want to use a given buffer as a uniform texel buffer or as a storage texel buffer, we need to create a buffer view for it.
How to do it...
- Take the handle of a logical device from which a given buffer was created. Store it in a variable of type
VkDevice
namedlogical_device
. - Take the handle of a created buffer and store it in a variable of type
VkBuffer
namedbuffer
. - Choose a format for a buffer view (how the buffer's contents should be interpreted) and use it to initialize a variable of type
VkFormat
namedformat
. - Select the part of a buffer's memory for which a view should be created. Set the starting point of this memory (offset from the beginning of the buffer's memory) in a variable of type
VkDeviceSize
namedmemory_offset
. Define the size of this memory through a variable of typeVkDeviceSize
namedmemory_range
. - Create a variable of type
VkBufferViewCreateInfo
namedbuffer_view_create_info
. Use the following values to initialize its members:VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO...