gsdx hw: update TEST.ATE field after ATE optimization

Otherwise DoFirstPass/DoSecondPass will give you result based on pre-ATE optimization

Close #1607
This commit is contained in:
Gregory Hainaut 2016-10-05 09:41:28 +02:00
parent 3653a7746a
commit 1cc696ab31
4 changed files with 6 additions and 8 deletions

View File

@ -53,7 +53,7 @@ void GSRendererDX::EmulateAtst(const int pass, const GSTextureCache::Source* tex
static const uint32 inverted_atst[] = { ATST_ALWAYS, ATST_NEVER, ATST_GEQUAL, ATST_GREATER, ATST_NOTEQUAL, ATST_LESS, ATST_LEQUAL, ATST_EQUAL }; static const uint32 inverted_atst[] = { ATST_ALWAYS, ATST_NEVER, ATST_GEQUAL, ATST_GREATER, ATST_NOTEQUAL, ATST_LESS, ATST_LEQUAL, ATST_EQUAL };
int atst = (pass == 2) ? inverted_atst[m_context->TEST.ATST] : m_context->TEST.ATST; int atst = (pass == 2) ? inverted_atst[m_context->TEST.ATST] : m_context->TEST.ATST;
if (!m_ATE) return; if (!m_context->TEST.ATE) return;
switch (atst) { switch (atst) {
case ATST_LESS: case ATST_LESS:
@ -98,7 +98,7 @@ void GSRendererDX::EmulateAtst(const int pass, const GSTextureCache::Source* tex
// to only draw pixels which would cause the destination alpha test to fail in the future once. // 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. // Unfortunately this also means only drawing those pixels at all, which is why this is a hack.
// The interaction with FBA in D3D9 is probably less than ideal. // The interaction with FBA in D3D9 is probably less than ideal.
if (UserHacks_AlphaStencil && DATE && dev->HasStencil() && om_bsel.wa && !m_ATE) if (UserHacks_AlphaStencil && DATE && dev->HasStencil() && om_bsel.wa && !m_context->TEST.ATE)
{ {
if (!m_context->FBA.FBA) if (!m_context->FBA.FBA)
{ {

View File

@ -31,7 +31,6 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc)
, m_upscale_multiplier(1) , m_upscale_multiplier(1)
, m_tc(tc) , m_tc(tc)
, m_channel_shuffle(false) , m_channel_shuffle(false)
, m_ATE(false)
{ {
m_upscale_multiplier = theApp.GetConfigI("upscale_multiplier"); m_upscale_multiplier = theApp.GetConfigI("upscale_multiplier");
m_large_framebuffer = theApp.GetConfigB("large_framebuffer"); m_large_framebuffer = theApp.GetConfigB("large_framebuffer");
@ -422,7 +421,7 @@ void GSRendererHW::Draw()
m_mem.m_clut.Read32(context->TEX0, env.TEXA); m_mem.m_clut.Read32(context->TEX0, env.TEXA);
// Test if we can optimize Alpha Test as a NOP // Test if we can optimize Alpha Test as a NOP
m_ATE = context->TEST.ATE && !GSRenderer::TryAlphaTest(fm, zm); context->TEST.ATE = context->TEST.ATE && !GSRenderer::TryAlphaTest(fm, zm);
context->FRAME.FBMSK = fm; context->FRAME.FBMSK = fm;
context->ZBUF.ZMSK = zm != 0; context->ZBUF.ZMSK = zm != 0;

View File

@ -153,7 +153,6 @@ protected:
int m_userhacks_round_sprite_offset; int m_userhacks_round_sprite_offset;
bool m_channel_shuffle; bool m_channel_shuffle;
bool m_ATE;
public: public:
GSRendererHW(GSTextureCache* tc); GSRendererHW(GSTextureCache* tc);

View File

@ -201,7 +201,7 @@ void GSRendererOGL::EmulateAtst(const int pass, const GSTextureCache::Source* te
static const uint32 inverted_atst[] = {ATST_ALWAYS, ATST_NEVER, ATST_GEQUAL, ATST_GREATER, ATST_NOTEQUAL, ATST_LESS, ATST_LEQUAL, ATST_EQUAL}; static const uint32 inverted_atst[] = {ATST_ALWAYS, ATST_NEVER, ATST_GEQUAL, ATST_GREATER, ATST_NOTEQUAL, ATST_LESS, ATST_LEQUAL, ATST_EQUAL};
int atst = (pass == 2) ? inverted_atst[m_context->TEST.ATST] : m_context->TEST.ATST; int atst = (pass == 2) ? inverted_atst[m_context->TEST.ATST] : m_context->TEST.ATST;
if (!m_ATE) return; if (!m_context->TEST.ATE) return;
switch (atst) { switch (atst) {
case ATST_LESS: case ATST_LESS:
@ -1179,7 +1179,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
m_require_full_barrier = true; m_require_full_barrier = true;
DATE_GL45 = true; DATE_GL45 = true;
DATE = false; DATE = false;
} else if (m_om_csel.wa && !m_ATE) { } else if (m_om_csel.wa && !m_context->TEST.ATE) {
// Performance note: check alpha range with GetAlphaMinMax() // Performance note: check alpha range with GetAlphaMinMax()
// Note: all my dump are already above 120fps, but it seems to reduce GPU load // Note: all my dump are already above 120fps, but it seems to reduce GPU load
// with big upscaling // with big upscaling
@ -1210,7 +1210,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
DATE = false; DATE = false;
} }
} }
} else if (!m_om_csel.wa && !m_ATE) { } else if (!m_om_csel.wa && !m_context->TEST.ATE) {
// TODO: is it legal ? Likely but it need to be tested carefully // TODO: is it legal ? Likely but it need to be tested carefully
// DATE_GL45 = true; // DATE_GL45 = true;
// m_require_one_barrier = true; << replace it with a cheap barrier // m_require_one_barrier = true; << replace it with a cheap barrier