[−][src]Macro vulkayes_core::vertex_input_description
Generates input binding descriptions and input attribute descriptions for pipeline shaders.
Usage:
vulkayes_core::offsetable_struct! { struct Vertex { position: [f32; 3], color: [f32; 3] } repr(C) as VertexOffsets } vulkayes_core::offsetable_struct! { struct Normal { Value: [f32; 3] } repr(C) as NormalOffsets } let (bindings, attributes) = vertex_input_description!( Vertex {@vk::VertexInputRate::VERTEX} { => layout(location = 0) in vec3 position; // Leaving out the field name defaults the offset to 0 .color => layout(location = 2) in vec3 color; } Normal { => layout(location = 1) in vec3 normal; } ); assert_eq!(bindings[0].binding, 0); assert_eq!(bindings[0].stride, std::mem::size_of::<Vertex>() as u32); assert_eq!(bindings[0].input_rate, vk::VertexInputRate::VERTEX); assert_eq!(bindings[1].binding, 1); assert_eq!(bindings[1].stride, std::mem::size_of::<Normal>() as u32); assert_eq!(bindings[1].input_rate, vk::VertexInputRate::VERTEX); assert_eq!(attributes[0].location, 0); assert_eq!(attributes[0].binding, 0); assert_eq!(attributes[0].format, vk::Format::R32G32B32_SFLOAT); assert_eq!(attributes[0].offset, 0); assert_eq!(attributes[1].location, 2); assert_eq!(attributes[1].binding, 0); assert_eq!(attributes[1].format, vk::Format::R32G32B32_SFLOAT); assert_eq!(attributes[1].offset, 12); assert_eq!(attributes[2].location, 1); assert_eq!(attributes[2].binding, 1); assert_eq!(attributes[2].format, vk::Format::R32G32B32_SFLOAT); assert_eq!(attributes[2].offset, 0);