Skip to content

Commit

Permalink
gsdx-d3d11: Extend sw blending to BLEND_NO_BAR which is also free and…
Browse files Browse the repository at this point in the history
… doesn't require rt sample nor any barriers.

It helps light rendering in SW Battlefront 2, VP2 also triggers it but needs to be further tested what it does.
  • Loading branch information
lightningterror committed Jul 7, 2019
1 parent cc1a320 commit 2cd9aff
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp
Expand Up @@ -529,14 +529,18 @@ void GSRendererDX11::EmulateBlending()
uint8 blend_index = uint8(((ALPHA.A * 3 + ALPHA.B) * 3 + ALPHA.C) * 3 + ALPHA.D); uint8 blend_index = uint8(((ALPHA.A * 3 + ALPHA.B) * 3 + ALPHA.C) * 3 + ALPHA.D);
int blend_flag = m_dev->GetBlendFlags(blend_index); int blend_flag = m_dev->GetBlendFlags(blend_index);


// SW free blend.
bool free_blend = !!(blend_flag & (BLEND_NO_BAR|BLEND_ACCU));

// Do the multiplication in shader for blending accumulation: Cs*As + Cd or Cs*Af + Cd
bool accumulation_blend = !!(blend_flag & BLEND_ACCU); bool accumulation_blend = !!(blend_flag & BLEND_ACCU);


switch (m_sw_blending) switch (m_sw_blending)
{ {
case ACC_BLEND_HIGH_D3D11: case ACC_BLEND_HIGH_D3D11:
case ACC_BLEND_MEDIUM_D3D11: case ACC_BLEND_MEDIUM_D3D11:
case ACC_BLEND_BASIC_D3D11: case ACC_BLEND_BASIC_D3D11:
sw_blending |= accumulation_blend; sw_blending |= free_blend;
// fall through // fall through
default: break; default: break;
} }
Expand All @@ -549,6 +553,9 @@ void GSRendererDX11::EmulateBlending()
m_ps_sel.hdr = 1; m_ps_sel.hdr = 1;
} }


/*fprintf(stderr, "%d: BLEND_INFO: %d/%d/%d/%d. Clamp:%d. Prim:%d number %d (sw %d)\n",
s_n, ALPHA.A, ALPHA.B, ALPHA.C, ALPHA.D, m_env.COLCLAMP.CLAMP, m_vt.m_primclass, m_vertex.next, sw_blending);*/

if (sw_blending) if (sw_blending)
{ {
m_ps_sel.blend_a = ALPHA.A; m_ps_sel.blend_a = ALPHA.A;
Expand All @@ -572,8 +579,9 @@ void GSRendererDX11::EmulateBlending()
} }
else else
{ {
// We shouldn't hit this path as currently only accumulation blend is implemented // Disable HW blending
ASSERT(0); // Only BLEND_NO_BAR should hit this code path for now.
m_om_bsel.abe = 0;
} }


// Require the fix alpha vlaue // Require the fix alpha vlaue
Expand Down

0 comments on commit 2cd9aff

Please sign in to comment.