mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Cleanup date and rt alpha min max function.
Always make sure rt is checked for date, no need for individual checks. Code cleanup. Some other cleanups.
This commit is contained in:
parent
5a91ecd16a
commit
4e06d51a00
|
@ -5206,7 +5206,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
|||
#endif
|
||||
|
||||
const GSDrawingEnvironment& env = *m_draw_env;
|
||||
bool DATE = m_cached_ctx.TEST.DATE && m_cached_ctx.FRAME.PSM != PSMCT24;
|
||||
bool DATE = rt && m_cached_ctx.TEST.DATE && m_cached_ctx.FRAME.PSM != PSMCT24;
|
||||
bool DATE_PRIMID = false;
|
||||
bool DATE_BARRIER = false;
|
||||
bool DATE_one = false;
|
||||
|
@ -5242,12 +5242,8 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
|||
const GSDevice::FeatureSupport features = g_gs_device->Features();
|
||||
|
||||
if (DATE)
|
||||
{
|
||||
// Should always be true, but sanity check...
|
||||
if (rt)
|
||||
{
|
||||
const bool is_overlap_alpha = m_prim_overlap != PRIM_OVERLAP_NO && !(m_cached_ctx.FRAME.FBMSK & 0x80000000);
|
||||
|
||||
if (m_cached_ctx.TEST.DATM == 0)
|
||||
{
|
||||
// Some pixles are >= 1 so some fail, or some pixels get written but the written alpha matches or exceeds 1 (so overlap doesn't always pass).
|
||||
|
@ -5267,7 +5263,6 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int fail_type = m_cached_ctx.TEST.GetAFAIL(m_cached_ctx.FRAME.PSM);
|
||||
const int aref = static_cast<int>(m_cached_ctx.TEST.AREF);
|
||||
|
@ -5280,18 +5275,11 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
|||
int rt_new_alpha_min = 0, rt_new_alpha_max = 255;
|
||||
if (rt)
|
||||
{
|
||||
rt_new_alpha_min = rt->m_alpha_min;
|
||||
rt_new_alpha_max = rt->m_alpha_max;
|
||||
blend_alpha_min = rt_new_alpha_min = rt->m_alpha_min;
|
||||
blend_alpha_max = rt_new_alpha_max = rt->m_alpha_max;
|
||||
|
||||
blend_alpha_min = rt_new_alpha_min;
|
||||
blend_alpha_max = rt_new_alpha_max;
|
||||
|
||||
const bool is_24_bit = (GSLocalMemory::m_psm[rt->m_TEX0.PSM].trbpp == 24);
|
||||
// On DX FBMask emulation can be missing on lower blend levels, so we'll do whatever the API does.
|
||||
const u32 fb_mask = m_conf.colormask.wa ? (m_conf.ps.fbmask ? m_conf.cb_ps.FbMask.a : 0) : 0xFF;
|
||||
const u32 alpha_mask = (GSLocalMemory::m_psm[rt->m_TEX0.PSM].fmsk & 0xFF000000) >> 24;
|
||||
const int fba_value = m_draw_env->CTXT[m_draw_env->PRIM.CTXT].FBA.FBA * 128;
|
||||
|
||||
const bool is_24_bit = (GSLocalMemory::m_psm[rt->m_TEX0.PSM].trbpp == 24);
|
||||
if (is_24_bit)
|
||||
{
|
||||
// C24/Z24 - alpha is 1.
|
||||
|
@ -5308,6 +5296,9 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
|||
const bool always_passing_alpha = !m_cached_ctx.TEST.ATE || afail_always_fb_alpha || (m_cached_ctx.TEST.ATE && m_cached_ctx.TEST.ATST == ATST_ALWAYS);
|
||||
const bool full_cover = rt->m_valid.rintersect(m_r).eq(rt->m_valid) && PrimitiveCoversWithoutGaps() && !(DATE || !always_passing_alpha || !IsDepthAlwaysPassing());
|
||||
|
||||
// On DX FBMask emulation can be missing on lower blend levels, so we'll do whatever the API does.
|
||||
const u32 fb_mask = m_conf.colormask.wa ? (m_conf.ps.fbmask ? m_conf.cb_ps.FbMask.a : 0) : 0xFF;
|
||||
const u32 alpha_mask = (GSLocalMemory::m_psm[rt->m_TEX0.PSM].fmsk & 0xFF000000) >> 24;
|
||||
if ((fb_mask & alpha_mask) == 0)
|
||||
{
|
||||
if (full_cover)
|
||||
|
|
Loading…
Reference in New Issue