Skip to main content

vulkano/buffer/
usage.rs

1use crate::macros::vulkan_bitflags;
2
3vulkan_bitflags! {
4    #[non_exhaustive]
5
6    /// Describes how a buffer is going to be used. This is **not** just an optimization.
7    ///
8    /// If you try to use a buffer in a way that you didn't declare, an error will be returned.
9    BufferUsage = BufferUsageFlags(u32);
10
11    /// The buffer can be used as a source for transfer, blit, resolve and clear commands.
12    TRANSFER_SRC = TRANSFER_SRC,
13
14    /// The buffer can be used as a destination for transfer, blit, resolve and clear commands.
15    TRANSFER_DST = TRANSFER_DST,
16
17    /// The buffer can be used as a uniform texel buffer in a descriptor set.
18    UNIFORM_TEXEL_BUFFER = UNIFORM_TEXEL_BUFFER,
19
20    /// The buffer can be used as a storage texel buffer in a descriptor set.
21    STORAGE_TEXEL_BUFFER = STORAGE_TEXEL_BUFFER,
22
23    /// The buffer can be used as a uniform buffer in a descriptor set.
24    UNIFORM_BUFFER = UNIFORM_BUFFER,
25
26    /// The buffer can be used as a storage buffer in a descriptor set.
27    STORAGE_BUFFER = STORAGE_BUFFER,
28
29    /// The buffer can be used as an index buffer.
30    INDEX_BUFFER = INDEX_BUFFER,
31
32    /// The buffer can be used as a vertex or instance buffer.
33    VERTEX_BUFFER = VERTEX_BUFFER,
34
35    /// The buffer can be used as an indirect buffer.
36    INDIRECT_BUFFER = INDIRECT_BUFFER,
37
38    /// The buffer's device address can be retrieved.
39    ///
40    /// A buffer created with this usage can only be bound to device memory allocated with the
41    /// [`MemoryAllocateFlags::DEVICE_ADDRESS`] flag, unless the [`ext_buffer_device_address`]
42    /// extension is enabled on the device.
43    ///
44    /// [`MemoryAllocateFlags::DEVICE_ADDRESS`]: crate::memory::MemoryAllocateFlags::DEVICE_ADDRESS
45    /// [`ext_buffer_device_address`]: crate::device::DeviceExtensions::ext_buffer_device_address
46    SHADER_DEVICE_ADDRESS = SHADER_DEVICE_ADDRESS
47    RequiresOneOf([
48        RequiresAllOf([APIVersion(V1_2)]),
49        RequiresAllOf([DeviceExtension(khr_buffer_device_address)]),
50        RequiresAllOf([DeviceExtension(ext_buffer_device_address)]),
51    ]),
52
53    /* TODO: enable
54    // TODO: document
55    VIDEO_DECODE_SRC = VIDEO_DECODE_SRC_KHR
56    RequiresOneOf([
57        RequiresAllOf([DeviceExtension(khr_video_decode_queue)]),
58    ]),*/
59
60    /* TODO: enable
61    // TODO: document
62    VIDEO_DECODE_DST = VIDEO_DECODE_DST_KHR
63    RequiresOneOf([
64        RequiresAllOf([DeviceExtension(khr_video_decode_queue)]),
65    ]),*/
66
67    /* TODO: enable
68    // TODO: document
69    TRANSFORM_FEEDBACK_BUFFER = TRANSFORM_FEEDBACK_BUFFER_EXT
70    RequiresOneOf([
71        RequiresAllOf([DeviceExtension(ext_transform_feedback)]),
72    ]),*/
73
74    /* TODO: enable
75    // TODO: document
76    TRANSFORM_FEEDBACK_COUNTER_BUFFER = TRANSFORM_FEEDBACK_COUNTER_BUFFER_EXT
77    RequiresOneOf([
78        RequiresAllOf([DeviceExtension(ext_transform_feedback)]),
79    ]),*/
80
81    /* TODO: enable
82    // TODO: document
83    CONDITIONAL_RENDERING = CONDITIONAL_RENDERING_EXT
84    RequiresOneOf([
85        RequiresAllOf([DeviceExtension(ext_conditional_rendering)]),
86    ]),*/
87
88    /// The buffer can be used as input data for an acceleration structure build operation.
89    ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY = ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_KHR
90    RequiresOneOf([
91        RequiresAllOf([DeviceExtension(khr_acceleration_structure)]),
92    ]),
93
94    /// An acceleration structure can be created from the buffer.
95    ACCELERATION_STRUCTURE_STORAGE = ACCELERATION_STRUCTURE_STORAGE_KHR
96    RequiresOneOf([
97        RequiresAllOf([DeviceExtension(khr_acceleration_structure)]),
98    ]),
99
100
101    // TODO: document
102    SHADER_BINDING_TABLE = SHADER_BINDING_TABLE_KHR
103    RequiresOneOf([
104        RequiresAllOf([DeviceExtension(khr_ray_tracing_pipeline)]),
105        RequiresAllOf([DeviceExtension(nv_ray_tracing)]),
106    ]),
107
108    /* TODO: enable
109    // TODO: document
110    VIDEO_ENCODE_DST = VIDEO_ENCODE_DST_KHR
111    RequiresOneOf([
112        RequiresAllOf([DeviceExtension(khr_video_encode_queue)]),
113    ]),*/
114
115    /* TODO: enable
116    // TODO: document
117    VIDEO_ENCODE_SRC = VIDEO_ENCODE_SRC_KHR
118    RequiresOneOf([
119        RequiresAllOf([DeviceExtension(khr_video_encode_queue)]),
120    ]),*/
121
122    /* TODO: enable
123    // TODO: document
124    SAMPLER_DESCRIPTOR_BUFFER = SAMPLER_DESCRIPTOR_BUFFER_EXT
125    RequiresOneOf([
126        RequiresAllOf([DeviceExtension(ext_descriptor_buffer)]),
127    ]),*/
128
129    /* TODO: enable
130    // TODO: document
131    RESOURCE_DESCRIPTOR_BUFFER = RESOURCE_DESCRIPTOR_BUFFER_EXT
132    RequiresOneOf([
133        RequiresAllOf([DeviceExtension(ext_descriptor_buffer)]),
134    ]),*/
135
136    /* TODO: enable
137    // TODO: document
138    PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER = PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_EXT
139    RequiresOneOf([
140        RequiresAllOf([DeviceExtension(ext_descriptor_buffer)]),
141    ]),*/
142
143    /* TODO: enable
144    // TODO: document
145    MICROMAP_BUILD_INPUT_READ_ONLY = MICROMAP_BUILD_INPUT_READ_ONLY_EXT
146    RequiresOneOf([
147        RequiresAllOf([DeviceExtension(ext_opacity_micromap)]),
148    ]),*/
149
150    /* TODO: enable
151    // TODO: document
152    MICROMAP_STORAGE = MICROMAP_STORAGE_EXT
153    RequiresOneOf([
154        RequiresAllOf([DeviceExtension(ext_opacity_micromap)]),
155    ]),*/
156}