Skip to content
Permalink
Browse files

gsdx-d3d11: Extend sw blending to BLEND_NO_BAR which is also free and…

… 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 Jun 26, 2019
1 parent cc1a320 commit 2cd9aff86761549bfcf2101a8be43a49b3f1db55
Showing with 11 additions and 3 deletions.
  1. +11 −3 plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp
@@ -529,14 +529,18 @@ void GSRendererDX11::EmulateBlending()
uint8 blend_index = uint8(((ALPHA.A * 3 + ALPHA.B) * 3 + ALPHA.C) * 3 + ALPHA.D);
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);

switch (m_sw_blending)
{
case ACC_BLEND_HIGH_D3D11:
case ACC_BLEND_MEDIUM_D3D11:
case ACC_BLEND_BASIC_D3D11:
sw_blending |= accumulation_blend;
sw_blending |= free_blend;
// fall through
default: break;
}
@@ -549,6 +553,9 @@ void GSRendererDX11::EmulateBlending()
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)
{
m_ps_sel.blend_a = ALPHA.A;
@@ -572,8 +579,9 @@ void GSRendererDX11::EmulateBlending()
}
else
{
// We shouldn't hit this path as currently only accumulation blend is implemented
ASSERT(0);
// Disable HW blending
// Only BLEND_NO_BAR should hit this code path for now.
m_om_bsel.abe = 0;
}

// Require the fix alpha vlaue

0 comments on commit 2cd9aff

Please sign in to comment.
You can’t perform that action at this time.