vulkan: Move to renderer module

This commit is contained in:
Florian RICHER 2024-11-27 20:59:39 +01:00
parent 001547dbc2
commit a669247406
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
21 changed files with 61 additions and 63 deletions

View file

@ -1,33 +0,0 @@
use ash::vk;
use std::mem::offset_of;
#[derive(Default)]
pub struct Vertex {
pub position: [f32; 2],
pub color: [f32; 3],
}
impl Vertex {
pub fn get_binding_description() -> vk::VertexInputBindingDescription {
vk::VertexInputBindingDescription::default()
.binding(0)
.stride(size_of::<Self>() as u32)
.input_rate(vk::VertexInputRate::VERTEX)
}
pub fn get_attribute_descriptions() -> [vk::VertexInputAttributeDescription; 2] {
let position_attribute = vk::VertexInputAttributeDescription::default()
.binding(0)
.location(0)
.format(vk::Format::R32G32_SFLOAT)
.offset(offset_of!(Vertex, position) as u32);
let color_attribute = vk::VertexInputAttributeDescription::default()
.binding(0)
.location(1)
.format(vk::Format::R32G32B32_SFLOAT)
.offset(offset_of!(Vertex, color) as u32);
[position_attribute, color_attribute]
}
}