gpu_descriptor_types/
types.rs

1bitflags::bitflags! {
2    /// Flags to augment descriptor pool creation.
3    ///
4    /// Match corresponding bits in Vulkan.
5    #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
6    pub struct DescriptorPoolCreateFlags: u32 {
7        /// Allows freeing individual sets.
8        const FREE_DESCRIPTOR_SET = 0x1;
9
10        /// Allows allocating sets with layout created with matching backend-specific flag.
11        const UPDATE_AFTER_BIND = 0x2;
12    }
13}
14
15/// Number of descriptors of each type.
16///
17/// For `InlineUniformBlock` this value is number of bytes instead.
18#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
19pub struct DescriptorTotalCount {
20    pub sampler: u32,
21    pub combined_image_sampler: u32,
22    pub sampled_image: u32,
23    pub storage_image: u32,
24    pub uniform_texel_buffer: u32,
25    pub storage_texel_buffer: u32,
26    pub uniform_buffer: u32,
27    pub storage_buffer: u32,
28    pub uniform_buffer_dynamic: u32,
29    pub storage_buffer_dynamic: u32,
30    pub input_attachment: u32,
31    pub acceleration_structure: u32,
32    pub inline_uniform_block_bytes: u32,
33    pub inline_uniform_block_bindings: u32,
34}
35
36impl DescriptorTotalCount {
37    pub fn total(&self) -> u32 {
38        self.sampler
39            + self.combined_image_sampler
40            + self.sampled_image
41            + self.storage_image
42            + self.uniform_texel_buffer
43            + self.storage_texel_buffer
44            + self.uniform_buffer
45            + self.storage_buffer
46            + self.uniform_buffer_dynamic
47            + self.storage_buffer_dynamic
48            + self.input_attachment
49            + self.acceleration_structure
50            + self.inline_uniform_block_bytes
51            + self.inline_uniform_block_bindings
52    }
53}