Skip to content

Commit

Permalink
GS: Remove fm_mask parameter from TryAlphaTest.
Browse files Browse the repository at this point in the history
Not used, we get the value locally instead.
  • Loading branch information
lightningterror committed Sep 17, 2023
1 parent 83da177 commit d9bdb0d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pcsx2/GS/GSState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3912,7 +3912,7 @@ void GSState::CalcAlphaMinMax(const int tex_alpha_min, const int tex_alpha_max)
m_vt.m_alpha.valid = true;
}

bool GSState::TryAlphaTest(u32& fm, const u32 fm_mask, u32& zm)
bool GSState::TryAlphaTest(u32& fm, u32& zm)
{
// Shortcut for the easy case
if (m_context->TEST.ATST == ATST_ALWAYS)
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/GS/GSState.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class GSState : public GSAlignedClass<32>
u8 uses_boundary; ///< Whether or not the usage touches the left, top, right, or bottom edge (and therefore needs wrap modes preserved)
};
TextureMinMaxResult GetTextureMinMax(GIFRegTEX0 TEX0, GIFRegCLAMP CLAMP, bool linear, bool clamp_to_tsize);
bool TryAlphaTest(u32& fm, const u32 fm_mask, u32& zm);
bool TryAlphaTest(u32& fm, u32& zm);
bool IsOpaque();
bool IsMipMapDraw();
bool IsMipMapActive();
Expand Down
4 changes: 2 additions & 2 deletions pcsx2/GS/Renderers/HW/GSHwHack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ bool GSHwHack::GSC_MetalGearSolid3(GSRendererHW& r, int& skip)
// For some reason, instead of being sensible and masking Z, they set up AFAIL instead.
if (!RZMSK)
{
u32 fm = 0, fm_mask = 0, zm = 0;
if (!r.m_cached_ctx.TEST.ATE || !r.TryAlphaTest(fm, fm_mask, zm) || zm == 0)
u32 fm = 0, zm = 0;
if (!r.m_cached_ctx.TEST.ATE || !r.TryAlphaTest(fm, zm) || zm == 0)
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ void GSRendererHW::Draw()
m_mem.m_clut.Read32(m_cached_ctx.TEX0, env.TEXA);

// Test if we can optimize Alpha Test as a NOP
m_cached_ctx.TEST.ATE = m_cached_ctx.TEST.ATE && !GSRenderer::TryAlphaTest(fm, fm_mask, zm);
m_cached_ctx.TEST.ATE = m_cached_ctx.TEST.ATE && !GSRenderer::TryAlphaTest(fm, zm);

// 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).
Expand Down Expand Up @@ -2210,7 +2210,7 @@ void GSRendererHW::Draw()

u32 new_fm = m_context->FRAME.FBMSK;
u32 new_zm = m_context->ZBUF.ZMSK || m_context->TEST.ZTE == 0 ? 0xffffffff : 0;
if (m_cached_ctx.TEST.ATE && GSRenderer::TryAlphaTest(new_fm, fm_mask, new_zm))
if (m_cached_ctx.TEST.ATE && GSRenderer::TryAlphaTest(new_fm, new_zm))
{
m_cached_ctx.TEST.ATE = false;
m_cached_ctx.FRAME.FBMSK = new_fm;
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/GS/Renderers/HW/GSRendererHWMultiISA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ bool GSRendererHWFunctions::SwPrimRender(GSRendererHW& hw, bool invalidate_tc, b

if (context->TEST.ATE)
{
if (!hw.TryAlphaTest(fm, fm_mask, zm))
if (!hw.TryAlphaTest(fm, zm))
{
gd.sel.atst = context->TEST.ATST;
gd.sel.afail = context->TEST.GetAFAIL(context->FRAME.PSM);
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/GS/Renderers/SW/GSRendererSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data)

if (context->TEST.ATE)
{
if (!TryAlphaTest(fm, fm_mask, zm))
if (!TryAlphaTest(fm, zm))
{
gd.sel.atst = context->TEST.ATST;
gd.sel.afail = context->TEST.GetAFAIL(context->FRAME.PSM);
Expand Down

0 comments on commit d9bdb0d

Please sign in to comment.