summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VertexManager.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2016-10-04 01:47:59 -0700
committerGitHub <noreply@github.com>2016-10-04 01:47:59 -0700
commitea33405febf183058bb30a22f4f627fed4bb8e17 (patch)
tree6222aceb31b2d6d922a8b3e45331b42fa1abba2d /Source/Core/VideoBackends/Vulkan/VertexManager.cpp
parent037f0a1803c274ce7e9f97ff9b7baed2955b9004 (diff)
parent28e5fa8d261cd486e9339a66d91b4713e83d9a14 (diff)
Merge pull request #4270 from stenzek/vulkan-defer-fix
Vulkan: Miscellaneous minor fixes
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())