From a80b6034c54ebf74d971bfd3e8c148069ce9225d Mon Sep 17 00:00:00 2001 From: redstrate <54911369+redstrate@users.noreply.github.com> Date: Sun, 7 Feb 2021 16:34:22 -0500 Subject: [PATCH] Support all depth mode types on Vulkan --- engine/gfx/vulkan/src/gfx_vulkan.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/engine/gfx/vulkan/src/gfx_vulkan.cpp b/engine/gfx/vulkan/src/gfx_vulkan.cpp index a787e57..cd60a73 100755 --- a/engine/gfx/vulkan/src/gfx_vulkan.cpp +++ b/engine/gfx/vulkan/src/gfx_vulkan.cpp @@ -821,7 +821,18 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate if (info.depth.depth_mode != GFXDepthMode::None) { depthStencil.depthTestEnable = VK_TRUE; depthStencil.depthWriteEnable = VK_TRUE; - depthStencil.depthCompareOp = info.depth.depth_mode == GFXDepthMode::Less ? VK_COMPARE_OP_LESS : VK_COMPARE_OP_LESS_OR_EQUAL; + + switch (info.depth.depth_mode) { + case GFXDepthMode::Less: + depthStencil.depthCompareOp = VK_COMPARE_OP_LESS; + break; + case GFXDepthMode::LessOrEqual: + depthStencil.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL; + break; + case GFXDepthMode::Greater: + depthStencil.depthCompareOp = VK_COMPARE_OP_GREATER; + break; + } } std::vector dynamicStates = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_DEPTH_BIAS};