Creating a buffer
Buffers are the simplest resources because they represent data which can be laid out in memory only linearly, just like in typical C/C++ arrays:

Buffers can be used for various purposes. They can be used in pipelines via descriptor sets to back data stores for uniform buffers, storage buffers, or texel buffers, among others. They can be a source of data for vertex indices or attributes, or can be used as staging resources--intermediate resources for data transfer from the CPU to the GPU. For all these purposes, we just need to create a buffer and specify its usage.
How to do it...
- Take the handle of a created logical device stored in a variable of type
VkDevice
namedlogical_device
. - Create a variable of type
VkDeviceSize
namedsize
, in which store a value that will represent the size of data (in bytes) which a buffer will be able to store. - Think of desired scenarios a buffer will be used for. Create a variable of a bitfield type
VkBufferUsageFlags
namedusage
. Assign a value...