rotex_vulkan/backend/vulkan/graphics_pipeline/
vertex.rs1use ash::vk;
2
3pub struct VertexInputDescriptor {
4 pub binding_descriptions: Vec<vk::VertexInputBindingDescription>,
5 pub attribute_descriptions: Vec<vk::VertexInputAttributeDescription>,
6 pub flags: vk::PipelineVertexInputStateCreateFlags,
7}
8
9pub trait Vertex {
10 fn descriptor() -> VertexInputDescriptor;
11}
12
13impl VertexInputDescriptor {
14 pub fn default() -> Self {
15 Self {
16 binding_descriptions: Vec::new(),
17 attribute_descriptions: Vec::new(),
18 flags: vk::PipelineVertexInputStateCreateFlags::empty(),
19 }
20 }
21
22 pub fn with_binding(mut self, description: vk::VertexInputBindingDescription) -> Self {
23 self.binding_descriptions.push(description);
24 self
25 }
26
27 pub fn with_attribute(mut self, description: vk::VertexInputAttributeDescription) -> Self {
28 self.attribute_descriptions.push(description);
29 self
30 }
31
32 pub fn with_flags(mut self, flags: vk::PipelineVertexInputStateCreateFlags) -> Self {
33 self.flags |= flags;
34 self
35 }
36}