From db5534e79d626f8a0acc71cd53b7e2197e58dbb4 Mon Sep 17 00:00:00 2001 From: "Erik W. Gren" Date: Sat, 28 Dec 2024 16:40:19 +0100 Subject: [PATCH] vulkan: missing to account for cull_mode --- blade-graphics/src/vulkan/pipeline.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/blade-graphics/src/vulkan/pipeline.rs b/blade-graphics/src/vulkan/pipeline.rs index f1b1229..fb1ff47 100644 --- a/blade-graphics/src/vulkan/pipeline.rs +++ b/blade-graphics/src/vulkan/pipeline.rs @@ -491,6 +491,10 @@ impl crate::traits::ShaderDevice for super::Context { }) .front_face(map_front_face(desc.primitive.front_face)) .line_width(1.0); + if let Some(face) = desc.primitive.cull_mode { + vk_rasterization = vk_rasterization.cull_mode(map_cull_face(face)); + } + let mut vk_depth_clip_state = vk::PipelineRasterizationDepthClipStateCreateInfoEXT::default() .depth_clip_enable(false); @@ -666,6 +670,13 @@ fn map_front_face(front_face: crate::FrontFace) -> vk::FrontFace { } } +fn map_cull_face(face: crate::Face) -> vk::CullModeFlags { + match face { + crate::Face::Front => vk::CullModeFlags::FRONT, + crate::Face::Back => vk::CullModeFlags::BACK, + } +} + fn map_comparison(fun: crate::CompareFunction) -> vk::CompareOp { use crate::CompareFunction as Cf; match fun {