mirror of https://github.com/PCSX2/pcsx2.git
GS: Move force_a_one to IsCoverageAlpha function
This commit is contained in:
parent
c2bb936586
commit
ed76e54904
|
@ -3747,6 +3747,11 @@ bool GSState::IsMipMapActive()
|
|||
return m_mipmap && IsMipMapDraw();
|
||||
}
|
||||
|
||||
bool GSState::IsCoverageAlpha()
|
||||
{
|
||||
return !PRIM->ABE && PRIM->AA1 && (m_vt.m_primclass == GS_LINE_CLASS || m_vt.m_primclass == GS_TRIANGLE_CLASS);
|
||||
}
|
||||
|
||||
GIFRegTEX0 GSState::GetTex0Layer(u32 lod)
|
||||
{
|
||||
// Shortcut
|
||||
|
|
|
@ -217,6 +217,7 @@ protected:
|
|||
bool IsOpaque();
|
||||
bool IsMipMapDraw();
|
||||
bool IsMipMapActive();
|
||||
bool IsCoverageAlpha();
|
||||
|
||||
public:
|
||||
GIFPath m_path[4];
|
||||
|
|
|
@ -1277,11 +1277,9 @@ void GSRendererHW::Draw()
|
|||
// Test if we can optimize Alpha Test as a NOP
|
||||
context->TEST.ATE = context->TEST.ATE && !GSRenderer::TryAlphaTest(fm, fm_mask, zm);
|
||||
|
||||
const bool force_a_one = !PRIM->ABE && PRIM->AA1 && (m_vt.m_primclass == GS_LINE_CLASS || m_vt.m_primclass == GS_TRIANGLE_CLASS);
|
||||
|
||||
// Need to fix the alpha test, since the alpha will be fixed to 1.0 if ABE is disabled and AA1 is enabled
|
||||
// So if it doesn't meet the condition, always fail, if it does, always pass (turn off the test).
|
||||
if (force_a_one && context->TEST.ATE && context->TEST.ATST > 1)
|
||||
if (IsCoverageAlpha() && context->TEST.ATE && context->TEST.ATST > 1)
|
||||
{
|
||||
const float aref = (float)context->TEST.AREF;
|
||||
const int old_ATST = context->TEST.ATST;
|
||||
|
@ -2402,17 +2400,16 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
|
|||
|
||||
// When AA1 is enabled and Alpha Blending is disabled, alpha blending done with coverage instead of alpha.
|
||||
// We use a COV value of 128 (full coverage) in triangles (except the edge geometry, which we can't do easily).
|
||||
const bool force_a_one = !PRIM->ABE && AA1;
|
||||
if (force_a_one)
|
||||
if (IsCoverageAlpha())
|
||||
{
|
||||
m_conf.ps.fixed_one_a = 1;
|
||||
m_conf.ps.blend_c = 0;
|
||||
}
|
||||
|
||||
// Get alpha value
|
||||
const bool alpha_c0_zero = (m_conf.ps.blend_c == 0 && GetAlphaMinMax().max == 0) && !force_a_one;
|
||||
const bool alpha_c0_one = (m_conf.ps.blend_c == 0 && (GetAlphaMinMax().min == 128) && (GetAlphaMinMax().max == 128)) || force_a_one;
|
||||
const bool alpha_c0_high_max_one = (m_conf.ps.blend_c == 0 && GetAlphaMinMax().max > 128) && !force_a_one;
|
||||
const bool alpha_c0_zero = (m_conf.ps.blend_c == 0 && GetAlphaMinMax().max == 0) && !IsCoverageAlpha();
|
||||
const bool alpha_c0_one = (m_conf.ps.blend_c == 0 && (GetAlphaMinMax().min == 128) && (GetAlphaMinMax().max == 128)) || IsCoverageAlpha();
|
||||
const bool alpha_c0_high_max_one = (m_conf.ps.blend_c == 0 && GetAlphaMinMax().max > 128) && !IsCoverageAlpha();
|
||||
const bool alpha_c2_zero = (m_conf.ps.blend_c == 2 && ALPHA.FIX == 0u);
|
||||
const bool alpha_c2_one = (m_conf.ps.blend_c == 2 && ALPHA.FIX == 128u);
|
||||
const bool alpha_c2_high_one = (m_conf.ps.blend_c == 2 && ALPHA.FIX > 128u);
|
||||
|
@ -3284,8 +3281,6 @@ void GSRendererHW::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
|
|||
// DATE: selection of the algorithm. Must be done before blending because GL42 is not compatible with blending
|
||||
if (DATE)
|
||||
{
|
||||
// When Blending is disabled and Edge Anti Aliasing is enabled, the output alpha is Coverage (which we force to 128) so DATE will fail/pass guaranteed on second pass.
|
||||
const bool force_a_one = !PRIM->ABE && PRIM->AA1 && (m_vt.m_primclass == GS_LINE_CLASS || m_vt.m_primclass == GS_TRIANGLE_CLASS);
|
||||
// It is way too complex to emulate texture shuffle with DATE, so use accurate path.
|
||||
// No overlap should be triggered on gl/vk only as they support DATE_BARRIER.
|
||||
if (features.framebuffer_fetch)
|
||||
|
@ -3303,7 +3298,8 @@ void GSRendererHW::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
|
|||
DATE_BARRIER = true;
|
||||
}
|
||||
}
|
||||
else if (m_conf.colormask.wa && (m_context->FBA.FBA || force_a_one))
|
||||
// When Blending is disabled and Edge Anti Aliasing is enabled, the output alpha is Coverage (which we force to 128) so DATE will fail/pass guaranteed on second pass.
|
||||
else if (m_conf.colormask.wa && (m_context->FBA.FBA || IsCoverageAlpha()))
|
||||
{
|
||||
GL_PERF("DATE: Fast with FBA, all pixels will be >= 128");
|
||||
DATE_one = !m_context->TEST.DATM;
|
||||
|
|
Loading…
Reference in New Issue