vulkano/pipeline/graphics/vertex_input/
buffers.rs1use super::{definition::VertexDefinition, VertexBufferDescription};
2use crate::{
3 pipeline::graphics::vertex_input::{Vertex, VertexInputState},
4 shader::EntryPoint,
5 ValidationError,
6};
7
8#[deprecated(
10 since = "0.33.0",
11 note = "use `VertexBufferDescription` directly instead as returned by `Vertex::per_vertex` or `Vertex::per_instance`"
12)]
13#[derive(Clone, Debug, Default)]
14pub struct BuffersDefinition(Vec<VertexBufferDescription>);
15
16#[allow(deprecated)]
17impl BuffersDefinition {
18 #[inline]
20 pub fn new() -> Self {
21 BuffersDefinition(Vec::new())
22 }
23
24 pub fn vertex<V: Vertex>(mut self) -> Self {
26 self.0.push(V::per_vertex());
27 self
28 }
29
30 pub fn instance<V: Vertex>(mut self) -> Self {
32 self.0.push(V::per_instance());
33 self
34 }
35
36 pub fn instance_with_divisor<V: Vertex>(mut self, divisor: u32) -> Self {
48 self.0.push(V::per_instance_with_divisor(divisor));
49 self
50 }
51}
52
53#[allow(deprecated)]
54unsafe impl VertexDefinition for BuffersDefinition {
55 #[inline]
56 fn definition(
57 &self,
58 entry_point: &EntryPoint,
59 ) -> Result<VertexInputState, Box<ValidationError>> {
60 self.0.definition(entry_point)
61 }
62}