summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-04-30 15:54:45 +1000
committerStenzek <stenzek@gmail.com>2017-09-11 19:40:26 +1000
commit2869c570f1d0b67d2ee4304ea528bef3ef4b563e (patch)
tree2f10d4f34da42a5e9f81706f853451bd8a59a701 /Source/Core/VideoBackends/Vulkan/ShaderCache.cpp
parent4d36f0cc87d2cc2bc40ec1c36a65623dc3822f01 (diff)
Renderer: Move depth state to VideoCommon and seperate from bpmem
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/ShaderCache.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/ShaderCache.cpp15
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