From 1059dc028cb063cddd2f64965174540403497e85 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 7 Apr 2023 10:10:11 -0400 Subject: [PATCH] Finish the pipeline --- src/app.rs | 2 ++ src/app/functions.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/app.rs b/src/app.rs index ad448c3..844af22 100644 --- a/src/app.rs +++ b/src/app.rs @@ -60,6 +60,7 @@ impl App { /// Destroys our Vulkan app. pub unsafe fn destroy(&mut self) { + self.device.destroy_pipeline(self.data.pipeline, None); self.device .destroy_pipeline_layout(self.data.pipeline_layout, None); self.device.destroy_render_pass(self.data.render_pass, None); @@ -99,6 +100,7 @@ pub struct AppData { swapchain_image_views: Vec, render_pass: vk::RenderPass, pipeline_layout: vk::PipelineLayout, + pipeline: vk::Pipeline, } impl AppData {} diff --git a/src/app/functions.rs b/src/app/functions.rs index 6150c91..55b6583 100644 --- a/src/app/functions.rs +++ b/src/app/functions.rs @@ -483,6 +483,23 @@ pub(super) unsafe fn create_pipeline(device: &Device, data: &mut AppData) -> Res let layout_info = vk::PipelineLayoutCreateInfo::builder(); 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 device.destroy_shader_module(vert_shader_module, None); device.destroy_shader_module(frag_shader_module, None);