cuboid and cube pipeline working

This commit is contained in:
zomseffen 2024-09-15 14:02:00 +02:00
parent 4494b68c26
commit 912659bb52
13 changed files with 230 additions and 162 deletions

View file

@ -8,8 +8,8 @@ use std::ptr::copy_nonoverlapping as memcpy;
pub type Mat4 = cgmath::Matrix4<f32>;
use crate::app_data;
use crate::vertex;
use crate::command_buffer;
use crate::vertex::VertexContainer;
pub unsafe fn create_buffer(
instance: &Instance,
@ -44,13 +44,13 @@ pub unsafe fn create_buffer(
Ok((buffer, buffer_memory))
}
pub unsafe fn create_vertex_buffer(
pub unsafe fn create_vertex_buffer<const COUNT: usize, T: VertexContainer<COUNT>>(
instance: &Instance,
device: &Device,
data: &app_data::AppData,
vertices: &Vec<vertex::Vertex>
vertices: &Vec<T>
) -> Result<(vk::Buffer, vk::DeviceMemory)> {
let size = (size_of::<vertex::Vertex>() * vertices.len()) as u64;
let size = (size_of::<T>() * vertices.len()) as u64;
let (staging_buffer, staging_buffer_memory) = create_buffer(
instance,