diff options
| author | Stenzek <stenzek@gmail.com> | 2017-04-30 15:54:45 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-09-11 19:40:26 +1000 |
| commit | 2869c570f1d0b67d2ee4304ea528bef3ef4b563e (patch) | |
| tree | 2f10d4f34da42a5e9f81706f853451bd8a59a701 /Source/Core/VideoBackends/Vulkan/Renderer.cpp | |
| parent | 4d36f0cc87d2cc2bc40ec1c36a65623dc3822f01 (diff) | |
Renderer: Move depth state to VideoCommon and seperate from bpmem
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/Renderer.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/Renderer.cpp | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 7a94572b1e..97c23ca2ef 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -459,10 +459,10 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha blend_state.colorupdate = color_enable; blend_state.alphaupdate = alpha_enable; - DepthStencilState depth_state = Util::GetNoDepthTestingDepthStencilState(); - depth_state.test_enable = z_enable ? VK_TRUE : VK_FALSE; - depth_state.write_enable = z_enable ? VK_TRUE : VK_FALSE; - depth_state.compare_op = VK_COMPARE_OP_ALWAYS; + DepthState depth_state = Util::GetNoDepthTestingDepthStencilState(); + depth_state.testenable = z_enable; + depth_state.updateenable = z_enable; + depth_state.func = ZMode::ALWAYS; RasterizationState rs_state = Util::GetNoCullRasterizationState(); rs_state.per_sample_shading = g_ActiveConfig.bSSAA ? VK_TRUE : VK_FALSE; @@ -476,7 +476,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha g_shader_cache->GetPassthroughGeometryShader(), m_clear_fragment_shader); draw.SetRasterizationState(rs_state); - draw.SetDepthStencilState(depth_state); + draw.SetDepthState(depth_state); draw.SetBlendState(blend_state); draw.DrawColoredQuad(target_rc.left, target_rc.top, target_rc.GetWidth(), target_rc.GetHeight(), @@ -1303,45 +1303,9 @@ void Renderer::SetGenerationMode() StateTracker::GetInstance()->SetRasterizationState(new_rs_state); } -void Renderer::SetDepthMode() +void Renderer::SetDepthState(const DepthState& state) { - DepthStencilState new_ds_state = {}; - new_ds_state.test_enable = bpmem.zmode.testenable ? VK_TRUE : VK_FALSE; - new_ds_state.write_enable = bpmem.zmode.updateenable ? VK_TRUE : VK_FALSE; - - // Inverted depth, hence these are swapped - switch (bpmem.zmode.func) - { - case ZMode::NEVER: - new_ds_state.compare_op = VK_COMPARE_OP_NEVER; - break; - case ZMode::LESS: - new_ds_state.compare_op = VK_COMPARE_OP_GREATER; - break; - case ZMode::EQUAL: - new_ds_state.compare_op = VK_COMPARE_OP_EQUAL; - break; - case ZMode::LEQUAL: - new_ds_state.compare_op = VK_COMPARE_OP_GREATER_OR_EQUAL; - break; - case ZMode::GREATER: - new_ds_state.compare_op = VK_COMPARE_OP_LESS; - break; - case ZMode::NEQUAL: - new_ds_state.compare_op = VK_COMPARE_OP_NOT_EQUAL; - break; - case ZMode::GEQUAL: - new_ds_state.compare_op = VK_COMPARE_OP_LESS_OR_EQUAL; - break; - case ZMode::ALWAYS: - new_ds_state.compare_op = VK_COMPARE_OP_ALWAYS; - break; - default: - new_ds_state.compare_op = VK_COMPARE_OP_ALWAYS; - break; - } - - StateTracker::GetInstance()->SetDepthStencilState(new_ds_state); + StateTracker::GetInstance()->SetDepthState(state); } void Renderer::SetBlendingState(const BlendingState& state) |
