Skip to content

Commit

Permalink
Vulkan: Handle both destination alpha and logic ops being enabled
Browse files Browse the repository at this point in the history
Same way as GL with the dual-pass fallback. Not highly accurate, but does
fix the Kirby shadow bug.
  • Loading branch information
stenzek committed Oct 3, 2016
1 parent f595fe0 commit 28e5fa8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/Core/VideoBackends/Vulkan/VertexManager.cpp
Expand Up @@ -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())
Expand Down

0 comments on commit 28e5fa8

Please sign in to comment.