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
VkDevicenamedlogical_device. - Take the handle of a created buffer and store it in a variable of type
VkBuffernamedbuffer. - Choose a format for a buffer view (how the buffer's contents should be interpreted) and use it to initialize a variable of type
VkFormatnamedformat. - 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
VkDeviceSizenamedmemory_offset. Define the size of this memory through a variable of typeVkDeviceSizenamedmemory_range. - Create a variable of type
VkBufferViewCreateInfonamedbuffer_view_create_info. Use the following values to initialize its members:VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO...