From 2869c570f1d0b67d2ee4304ea528bef3ef4b563e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 30 Apr 2017 15:54:45 +1000 Subject: Renderer: Move depth state to VideoCommon and seperate from bpmem --- Source/Core/VideoBackends/Vulkan/ShaderCache.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/ShaderCache.cpp') diff --git a/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp b/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp index 7d5c3e2379..fb62560ad9 100644 --- a/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp @@ -122,16 +122,21 @@ GetVulkanMultisampleState(const RasterizationState& rs_state) }; } -static VkPipelineDepthStencilStateCreateInfo -GetVulkanDepthStencilState(const DepthStencilState& state) +static VkPipelineDepthStencilStateCreateInfo GetVulkanDepthStencilState(const DepthState& state) { + // Less/greater are swapped due to inverted depth. + static constexpr std::array funcs = { + {VK_COMPARE_OP_NEVER, VK_COMPARE_OP_GREATER, VK_COMPARE_OP_EQUAL, + VK_COMPARE_OP_GREATER_OR_EQUAL, VK_COMPARE_OP_LESS, VK_COMPARE_OP_NOT_EQUAL, + VK_COMPARE_OP_LESS_OR_EQUAL, VK_COMPARE_OP_ALWAYS}}; + return { VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, // VkStructureType sType nullptr, // const void* pNext 0, // VkPipelineDepthStencilStateCreateFlags flags - state.test_enable, // VkBool32 depthTestEnable - state.write_enable, // VkBool32 depthWriteEnable - state.compare_op, // VkCompareOp depthCompareOp + state.testenable, // VkBool32 depthTestEnable + state.updateenable, // VkBool32 depthWriteEnable + funcs[state.func], // VkCompareOp depthCompareOp VK_FALSE, // VkBool32 depthBoundsTestEnable VK_FALSE, // VkBool32 stencilTestEnable {}, // VkStencilOpState front -- cgit v1.2.3