VkBufferUsageFlagBits用于说明VkBuffer的用途
源码如下:
typedef enum VkBufferUsageFlagBits {
VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001,
VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002,
VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004,
VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010,
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020,
VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 0x00020000,
VK_BUFFER_USAGE_RAY_TRACING_BIT_KHR = 0x00000400,
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR =
VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferUsageFlagBits;
- VK_BUFFER_USAGE_TRANSFER_SRC_BIT:表示这个buffer可以作为transfer command的源buffer。
- VK_BUFFER_USAGE_TRANSFER_DST_BIT:表示这个buffer可以作为transfer command的目的buffer。
- VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT:表示这个buffer可以用来创建占用VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER类型的VkDescriptorSet的槽位
- VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT:表示这个buffer可以用来创建占用VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER类型的VkDescriptorSet的槽位
- VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT:表示这个buffer可以用在一个VkDescriptorBufferInfo中,其适合占用一个VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
或VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC类型的VkDescriptorSet的槽位 - VK_BUFFER_USAGE_STORAGE_BUFFER_BIT:表示这个buffer适合用来作为传输到vkCmdBindIndexBuffer的缓存参数
- VK_BUFFER_USAGE_VERTEX_BUFFER_BIT:表示这个buffer适合作为传到vkCmdBindVertexBuffers的pBuffer数组的一个元素
- VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT:表示这个buffer适合作为传递到vkCmdDrawIndirect, vkCmdDrawIndexedIndirect或vkCmdDispatchIndirect的buffer参数
- VK_BUFFER_USAGE_RAY_TRACING_BIT_KHR:表示这个buffer适合用在vkCmdTraceRaysKHR和vkCmdBuildAccelerationStructureKHR中
- VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT:表示这个buffer可以用来通过vkGetBufferDeviceAddress访问缓存的设备地址,使用这个地址可以访问缓存在shader中的内存。