Add pipeline loader

This commit is contained in:
Florian RICHER 2025-06-09 20:42:35 +02:00
parent 8b982ba089
commit 6099a3e27f
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
5 changed files with 179 additions and 53 deletions

View file

@ -1,4 +1,7 @@
use std::{error::Error, sync::Arc};
use std::{
error::Error,
sync::{Arc, RwLock},
};
use vulkano::{
command_buffer::{AutoCommandBufferBuilder, PrimaryAutoCommandBuffer},
@ -33,16 +36,14 @@ use crate::core::render::{
resources::texture::Texture,
};
pub struct SimplePipeline {
pipeline: Arc<GraphicsPipeline>,
}
pub struct SimplePipeline;
impl SimplePipeline {
pub fn new(
device: &Arc<Device>,
swapchain_format: Format,
depth_format: Format,
) -> Result<Self, Box<dyn Error>> {
) -> Result<Arc<GraphicsPipeline>, Box<dyn Error>> {
let vs = shaders::vs::load(device.clone())?
.entry_point("main")
.ok_or("Failed find main entry point of vertex shader".to_string())?;
@ -111,11 +112,7 @@ impl SimplePipeline {
},
)?;
Ok(Self { pipeline })
}
pub fn pipeline(&self) -> &Arc<GraphicsPipeline> {
&self.pipeline
Ok(pipeline)
}
}