Skip to content
Permalink
Browse files

gsdx-d3d11: Minor adjustments to DATE code.

Run fast accurate date instead of alpha stencil when accurate date is
enabled on supported calls, also update some logs and comments.
  • Loading branch information...
lightningterror committed Mar 4, 2019
1 parent e48ce1b commit e36976bf8647051c35c5b20808773fc1950694f4
Showing with 10 additions and 11 deletions.
  1. +1 −1 plugins/GSdx/GSDrawingContext.cpp
  2. +9 −10 plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp
@@ -119,7 +119,7 @@ GIFRegTEX0 GSDrawingContext::GetSizeFixedTEX0(int s_n, const GSVector4& st, bool

if((int)TEX0.TW != tw || (int)TEX0.TH != th)
{
GL_INS("%5d:FixedTEX0 %05x %d %d tw %d=>%d th %d=>%d st (%.0f,%.0f,%.0f,%.0f) uvmax %d,%d wm %d,%d (%d,%d,%d,%d)\n",
GL_INS("%5d:FixedTEX0 %05x %d %d tw %d=>%d th %d=>%d st (%.0f,%.0f,%.0f,%.0f) uvmax %d,%d wm %d,%d (%d,%d,%d,%d)",
s_n,
(int)TEX0.TBP0, (int)TEX0.TBW, (int)TEX0.PSM,
(int)TEX0.TW, tw, (int)TEX0.TH, th,
@@ -665,9 +665,9 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
{
if (m_texture_shuffle)
{
// Direct3D doesn't support DATE_GL45 on m_texture_shuffle so keep using the old method.
// Let's leave the check in to ensure the next code cases are hit properly.
// fprintf(stderr, "Slow DATE with alpha %d-%d not supported on texture shuffle\n", m_vt.m_alpha.min, m_vt.m_alpha.max);
// DATE case not supported yet so keep using the old method.
// Leave the check in to make sure other DATE cases are triggered correctly.
// fprintf(stderr, "DATE with texture shuffle\n");
}
else if (m_om_bsel.wa && !m_context->TEST.ATE)
{
@@ -687,14 +687,11 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
}
else if ((m_vt.m_primclass == GS_SPRITE_CLASS /*&& m_drawlist.size() < 50*/) || (m_index.tail < 100))
{
// Direct3D doesn't support Slow DATE_GL45.
// Let's make sure it triggers this check and continues to use the old DATE code to avoid any issues with Fast Accurate Date.
// m_drawlist.size() isn't supported on D3D so there will be more games hitting this code path,
// it should be fine with regular DATE since originally it ran with it anyway.
// Note: Potentially Alpha Stencil might emulate SLOW DATE to some degree. Perhaps some of the code can be implemented here.
// DATE case not supported yet so keep using the old method.
// Leave the check in to make sure other DATE cases are triggered correctly.
// fprintf(stderr, "Slow DATE with alpha %d-%d not supported\n", m_vt.m_alpha.min, m_vt.m_alpha.max);
}
else if (!UserHacks_AlphaStencil)
else
{
if (m_accurate_date)
{
@@ -703,7 +700,6 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
}
else
{
// DATE is already true, no need for another check.
// fprintf(stderr, "Inaccurate DATE with alpha %d-%d\n", m_vt.m_alpha.min, m_vt.m_alpha.max);
}
}
@@ -893,9 +889,11 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
EmulateAtst(1, tex);
}

// FIXME: Purge it when remaining DATE cases in DATE selection are supported properly.
// Destination alpha pseudo stencil hack: use a stencil operation combined with an alpha test
// to only draw pixels which would cause the destination alpha test to fail in the future once.
// Unfortunately this also means only drawing those pixels at all, which is why this is a hack.
// It helps render transparency in Amagami, breaks a lot of other games.
if (UserHacks_AlphaStencil && DATE && !DATE_one && m_om_bsel.wa && !m_context->TEST.ATE)
{
// fprintf(stderr, "Alpha Stencil detected\n");
@@ -915,6 +913,7 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
if (!(m_context->FBA.FBA && m_context->TEST.DATM == 1))
m_om_dssel.date_one = 1;
}
// END OF FIXME

if (tex)
{

0 comments on commit e36976b

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.