Finish the pipeline

This commit is contained in:
Timothy Warren 2023-04-07 10:10:11 -04:00
parent 2ea377d91f
commit 1059dc028c
2 changed files with 19 additions and 0 deletions

View File

@ -60,6 +60,7 @@ impl App {
/// Destroys our Vulkan app. /// Destroys our Vulkan app.
pub unsafe fn destroy(&mut self) { pub unsafe fn destroy(&mut self) {
self.device.destroy_pipeline(self.data.pipeline, None);
self.device self.device
.destroy_pipeline_layout(self.data.pipeline_layout, None); .destroy_pipeline_layout(self.data.pipeline_layout, None);
self.device.destroy_render_pass(self.data.render_pass, None); self.device.destroy_render_pass(self.data.render_pass, None);
@ -99,6 +100,7 @@ pub struct AppData {
swapchain_image_views: Vec<vk::ImageView>, swapchain_image_views: Vec<vk::ImageView>,
render_pass: vk::RenderPass, render_pass: vk::RenderPass,
pipeline_layout: vk::PipelineLayout, pipeline_layout: vk::PipelineLayout,
pipeline: vk::Pipeline,
} }
impl AppData {} impl AppData {}

View File

@ -483,6 +483,23 @@ pub(super) unsafe fn create_pipeline(device: &Device, data: &mut AppData) -> Res
let layout_info = vk::PipelineLayoutCreateInfo::builder(); let layout_info = vk::PipelineLayoutCreateInfo::builder();
data.pipeline_layout = device.create_pipeline_layout(&layout_info, None)?; data.pipeline_layout = device.create_pipeline_layout(&layout_info, None)?;
let stages = &[vert_stage, frag_stage];
let info = vk::GraphicsPipelineCreateInfo::builder()
.stages(stages)
.vertex_input_state(&vertex_input_state)
.input_assembly_state(&input_assembly_state)
.viewport_state(&viewport_state)
.rasterization_state(&rasterization_state)
.multisample_state(&multisample_state)
.color_blend_state(&color_blend_state)
.layout(data.pipeline_layout)
.render_pass(data.render_pass)
.subpass(0);
data.pipeline = device
.create_graphics_pipelines(vk::PipelineCache::null(), &[info], None)?
.0;
// Cleanup // Cleanup
device.destroy_shader_module(vert_shader_module, None); device.destroy_shader_module(vert_shader_module, None);
device.destroy_shader_module(frag_shader_module, None); device.destroy_shader_module(frag_shader_module, None);