diff options
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/ShaderCache.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/ShaderCache.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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<VkCompareOp, 8> 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 |
