summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VertexManager.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2016-10-02 23:56:55 +1000
committerStenzek <stenzek@gmail.com>2016-10-03 19:11:50 +1000
commit28e5fa8d261cd486e9339a66d91b4713e83d9a14 (patch)
treec2d940bbde4f2778ccd539137970d0a5b1fb57bf /Source/Core/VideoBackends/Vulkan/VertexManager.cpp
parentf595fe080f49613195ab52a7c7fd711aa5c1fe56 (diff)
Vulkan: Handle both destination alpha and logic ops being enabled
Same way as GL with the dual-pass fallback. Not highly accurate, but does fix the Kirby shadow bug.
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VertexManager.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VertexManager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VertexManager.cpp b/Source/Core/VideoBackends/Vulkan/VertexManager.cpp
index e95c1d6ade..02be335aea 100644
--- a/Source/Core/VideoBackends/Vulkan/VertexManager.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VertexManager.cpp
@@ -198,8 +198,14 @@ void VertexManager::vFlush(bool use_dst_alpha)
vkCmdDrawIndexed(g_command_buffer_mgr->GetCurrentCommandBuffer(), index_count, 1,
m_current_draw_base_index, m_current_draw_base_vertex, 0);
- // If we can't do single pass dst alpha, we now need to draw the alpha pass.
- if (use_dst_alpha && !g_vulkan_context->SupportsDualSourceBlend())
+ // If the GPU does not support dual-source blending, we can approximate the effect by drawing
+ // the object a second time, with the write mask set to alpha only using a shader that outputs
+ // the destination/constant alpha value (which would normally be SRC_COLOR.a).
+ //
+ // This is also used when logic ops and destination alpha is enabled, since we can't enable
+ // blending and logic ops concurrently (and the logical operation applies to all channels).
+ bool logic_op_enabled = bpmem.blendmode.logicopenable && !bpmem.blendmode.blendenable;
+ if (use_dst_alpha && (!g_vulkan_context->SupportsDualSourceBlend() || logic_op_enabled))
{
m_state_tracker->CheckForShaderChanges(m_current_primitive_type, DSTALPHA_ALPHA_PASS);
if (!m_state_tracker->Bind())