From 0f2747293f51d2e716dc4eb5443075e09e9f453d Mon Sep 17 00:00:00 2001 From: zomseffen Date: Sun, 2 Jun 2024 15:44:38 +0200 Subject: [PATCH] fixes vertice and index creation in geometry shader mode --- src/app_data.rs | 2 ++ src/main.rs | 3 ++- src/scene.rs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app_data.rs b/src/app_data.rs index 9cc625e..e3489fb 100644 --- a/src/app_data.rs +++ b/src/app_data.rs @@ -53,4 +53,6 @@ pub struct AppData { pub color_image_memory: vk::DeviceMemory, pub color_image_view: vk::ImageView, pub use_geometry_shader: bool, + + pub topology: vk::PrimitiveTopology, } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 67005a7..208902e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -162,7 +162,7 @@ impl App { let loader = LibloadingLoader::new(LIBRARY)?; let entry = Entry::new(loader).map_err(|b| anyhow!("{}", b))?; let mut data = app_data::AppData::default(); - data.use_geometry_shader = false; + data.use_geometry_shader = true; let mut scene_handler = scene::Scene::default(); //load_model::load_model(&mut data)?; @@ -676,6 +676,7 @@ unsafe fn create_pipeline(device: &Device, data: &mut app_data::AppData) -> Resu if data.use_geometry_shader { topology = vk::PrimitiveTopology::POINT_LIST; } + data.topology = topology; let input_assembly_state = vk::PipelineInputAssemblyStateCreateInfo::builder() .topology(topology) diff --git a/src/scene.rs b/src/scene.rs index 6f08f70..d85274c 100644 --- a/src/scene.rs +++ b/src/scene.rs @@ -37,7 +37,7 @@ impl Scene { tex_coord: vec2(0.0, 0.0) }; - cube.draw(&vk::PrimitiveTopology::TRIANGLE_LIST, index, self); + cube.draw(&data.topology, index, self); } }