GS/HW: Rename RTCorrect/Decorrect to ScaleAlpha

This commit is contained in:
Stenzek 2024-04-28 21:30:04 +10:00 committed by lightningterror
parent e734eb415c
commit 107a3fda44
4 changed files with 22 additions and 22 deletions

View File

@ -1416,7 +1416,7 @@ bool GSHwHack::MV_Ico(GSRendererHW& r)
const GSVector4i draw_rc = GSVector4i(0, 0, RWIDTH, RHEIGHT).rintersect(dst->GetUnscaledRect()); const GSVector4i draw_rc = GSVector4i(0, 0, RWIDTH, RHEIGHT).rintersect(dst->GetUnscaledRect());
dst->UpdateValidChannels(PSMCT32, 0); dst->UpdateValidChannels(PSMCT32, 0);
dst->UpdateValidity(draw_rc); dst->UpdateValidity(draw_rc);
dst->RTADecorrect(); dst->UnscaleRTAlpha();
GSHWDrawConfig& config = GSRendererHW::GetInstance()->BeginHLEHardwareDraw( GSHWDrawConfig& config = GSRendererHW::GetInstance()->BeginHLEHardwareDraw(
dst->GetTexture(), nullptr, dst->GetScale(), src->GetTexture(), src->GetScale(), draw_rc); dst->GetTexture(), nullptr, dst->GetScale(), src->GetTexture(), src->GetScale(), draw_rc);

View File

@ -4407,7 +4407,7 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, bool& DAT
if (!full_cover) if (!full_cover)
{ {
rt->RTACorrect(); rt->ScaleRTAlpha();
m_conf.rt = rt->m_texture; m_conf.rt = rt->m_texture;
} }
@ -5558,7 +5558,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
{ {
can_scale_rt_alpha = false; can_scale_rt_alpha = false;
rt->RTADecorrect(); rt->UnscaleRTAlpha();
m_conf.rt = rt->m_texture; m_conf.rt = rt->m_texture;
if (req_src_update) if (req_src_update)
@ -5574,7 +5574,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
else if (m_cached_ctx.FRAME.FBMSK & 0xFFFC0000) else if (m_cached_ctx.FRAME.FBMSK & 0xFFFC0000)
{ {
can_scale_rt_alpha = false; can_scale_rt_alpha = false;
rt->RTADecorrect(); rt->UnscaleRTAlpha();
m_conf.rt = rt->m_texture; m_conf.rt = rt->m_texture;
if (req_src_update) if (req_src_update)
@ -5587,7 +5587,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
if (m_conf.ps.tales_of_abyss_hle || (tex && tex->m_from_target && tex->m_from_target == rt && m_conf.ps.channel == ChannelFetch_ALPHA) || partial_fbmask || rt_new_alpha_max > 128) if (m_conf.ps.tales_of_abyss_hle || (tex && tex->m_from_target && tex->m_from_target == rt && m_conf.ps.channel == ChannelFetch_ALPHA) || partial_fbmask || rt_new_alpha_max > 128)
{ {
can_scale_rt_alpha = false; can_scale_rt_alpha = false;
rt->RTADecorrect(); rt->UnscaleRTAlpha();
m_conf.rt = rt->m_texture; m_conf.rt = rt->m_texture;
if (req_src_update) if (req_src_update)
@ -5602,7 +5602,7 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
else else
{ {
can_scale_rt_alpha = false; can_scale_rt_alpha = false;
rt->RTADecorrect(); rt->UnscaleRTAlpha();
m_conf.rt = rt->m_texture; m_conf.rt = rt->m_texture;
if (req_src_update) if (req_src_update)
@ -6117,7 +6117,7 @@ GSRendererHW::CLUTDrawTestResult GSRendererHW::PossibleCLUTDraw()
m_cached_ctx.TEX0.TBP0, m_cached_ctx.TEX0.TBW, m_cached_ctx.TEX0.PSM, r); m_cached_ctx.TEX0.TBP0, m_cached_ctx.TEX0.TBW, m_cached_ctx.TEX0.PSM, r);
if (tgt) if (tgt)
{ {
tgt->RTADecorrect(); tgt->UnscaleRTAlpha();
bool is_dirty = false; bool is_dirty = false;
for (const GSDirtyRect& rc : tgt->m_dirty) for (const GSDirtyRect& rc : tgt->m_dirty)
{ {

View File

@ -940,7 +940,7 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const bool is_depth, c
dst = t; dst = t;
if (GSUtil::GetChannelMask(TEX0.PSM) & 0x8) if (GSUtil::GetChannelMask(TEX0.PSM) & 0x8)
t->RTADecorrect(); t->UnscaleRTAlpha();
inside_target = false; inside_target = false;
break; break;
@ -1373,7 +1373,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const bool is_color, const
// The hack can fix glitches in some games. // The hack can fix glitches in some games.
if (!t->m_drawn_since_read.rempty()) if (!t->m_drawn_since_read.rempty())
{ {
t->RTADecorrect(); t->UnscaleRTAlpha();
Read(t, t->m_drawn_since_read); Read(t, t->m_drawn_since_read);
@ -2261,7 +2261,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(GIFRegTEX0 TEX0, const GSVe
} }
else if (dst_match->m_texture->GetState() == GSTexture::State::Dirty) else if (dst_match->m_texture->GetState() == GSTexture::State::Dirty)
{ {
dst_match->RTADecorrect(); dst_match->UnscaleRTAlpha();
g_gs_device->StretchRect(dst_match->m_texture, sRect, dst->m_texture, dRect, shader, false); g_gs_device->StretchRect(dst_match->m_texture, sRect, dst->m_texture, dRect, shader, false);
g_perfmon.Put(GSPerfMon::TextureCopies, 1); g_perfmon.Put(GSPerfMon::TextureCopies, 1);
} }
@ -2689,7 +2689,7 @@ GSTextureCache::Target* GSTextureCache::LookupDisplayTarget(GIFRegTEX0 TEX0, con
return can_create ? CreateTarget(TEX0, size, size, scale, RenderTarget, true, 0, true) : nullptr; return can_create ? CreateTarget(TEX0, size, size, scale, RenderTarget, true, 0, true) : nullptr;
} }
void GSTextureCache::Target::RTACorrect() void GSTextureCache::Target::ScaleRTAlpha()
{ {
if (!m_rt_alpha_scale && m_type == RenderTarget) if (!m_rt_alpha_scale && m_type == RenderTarget)
{ {
@ -2697,7 +2697,7 @@ void GSTextureCache::Target::RTACorrect()
{ {
const GSVector2i rtsize(m_texture->GetSize()); const GSVector2i rtsize(m_texture->GetSize());
const GSVector4i valid_rect = GSVector4i(GSVector4(m_valid) * GSVector4(m_scale)); const GSVector4i valid_rect = GSVector4i(GSVector4(m_valid) * GSVector4(m_scale));
GL_PUSH("RTACorrect(valid=(%dx%d %d,%d=>%d,%d))", m_valid.width(), m_valid.height(), m_valid.x, m_valid.y, m_valid.z, m_valid.w); GL_PUSH("ScaleRTAlpha(valid=(%dx%d %d,%d=>%d,%d))", m_valid.width(), m_valid.height(), m_valid.x, m_valid.y, m_valid.z, m_valid.w);
if (GSTexture* temp_rt = g_gs_device->CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::Color, !GSVector4i::loadh(rtsize).eq(valid_rect))) if (GSTexture* temp_rt = g_gs_device->CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::Color, !GSVector4i::loadh(rtsize).eq(valid_rect)))
{ {
@ -2715,7 +2715,7 @@ void GSTextureCache::Target::RTACorrect()
} }
} }
void GSTextureCache::Target::RTADecorrect() void GSTextureCache::Target::UnscaleRTAlpha()
{ {
if (m_rt_alpha_scale && m_type == RenderTarget) if (m_rt_alpha_scale && m_type == RenderTarget)
{ {
@ -2723,7 +2723,7 @@ void GSTextureCache::Target::RTADecorrect()
{ {
const GSVector2i rtsize(m_texture->GetSize()); const GSVector2i rtsize(m_texture->GetSize());
const GSVector4i valid_rect = GSVector4i(GSVector4(m_valid) * GSVector4(m_scale)); const GSVector4i valid_rect = GSVector4i(GSVector4(m_valid) * GSVector4(m_scale));
GL_PUSH("RTADecorrect(valid=(%dx%d %d,%d=>%d,%d))", m_valid.width(), m_valid.height(), m_valid.x, m_valid.y, m_valid.z, m_valid.w); GL_PUSH("UnscaleRTAlpha(valid=(%dx%d %d,%d=>%d,%d))", m_valid.width(), m_valid.height(), m_valid.x, m_valid.y, m_valid.z, m_valid.w);
if (GSTexture* temp_rt = g_gs_device->CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::Color, !GSVector4i::loadh(rtsize).eq(valid_rect))) if (GSTexture* temp_rt = g_gs_device->CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::Color, !GSVector4i::loadh(rtsize).eq(valid_rect)))
{ {
@ -3739,8 +3739,8 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
const bool cover_whole_target = dst->m_type == RenderTarget && GSVector4i(dx, dy, dx + w, dy + h).rintersect(dst->m_valid).eq(dst->m_valid); const bool cover_whole_target = dst->m_type == RenderTarget && GSVector4i(dx, dy, dx + w, dy + h).rintersect(dst->m_valid).eq(dst->m_valid);
if (!cover_whole_target) if (!cover_whole_target)
{ {
src->RTADecorrect(); src->UnscaleRTAlpha();
dst->RTADecorrect(); dst->UnscaleRTAlpha();
} }
// If the copies overlap, this is a validation error, so we need to copy to a temporary texture first. // If the copies overlap, this is a validation error, so we need to copy to a temporary texture first.
@ -3911,7 +3911,7 @@ bool GSTextureCache::ShuffleMove(u32 BP, u32 BW, u32 PSM, int sx, int sy, int dx
const GSVector4i bbox = write_rg ? GSVector4i(dx, dy, dx + w, dy + h) : GSVector4i(sx, sy, sx + w, sy + h); const GSVector4i bbox = write_rg ? GSVector4i(dx, dy, dx + w, dy + h) : GSVector4i(sx, sy, sx + w, sy + h);
if (read_ba || !write_rg) if (read_ba || !write_rg)
tgt->RTADecorrect(); tgt->UnscaleRTAlpha();
GSHWDrawConfig& config = GSRendererHW::GetInstance()->BeginHLEHardwareDraw(tgt->m_texture, nullptr, tgt->m_scale, tgt->m_texture, tgt->m_scale, bbox); GSHWDrawConfig& config = GSRendererHW::GetInstance()->BeginHLEHardwareDraw(tgt->m_texture, nullptr, tgt->m_scale, tgt->m_texture, tgt->m_scale, bbox);
config.colormask.wrgba = (write_rg ? (1 | 2) : (4 | 8)); config.colormask.wrgba = (write_rg ? (1 | 2) : (4 | 8));
@ -4745,7 +4745,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
{ {
if (dst->m_rt_alpha_scale) if (dst->m_rt_alpha_scale)
{ {
dst->RTADecorrect(); dst->UnscaleRTAlpha();
sTex = dst->m_texture; sTex = dst->m_texture;
} }
@ -5494,7 +5494,7 @@ GSTexture* GSTextureCache::LookupPaletteSource(u32 CBP, u32 CPSM, u32 CBW, GSVec
offset = this_offset; offset = this_offset;
*scale = t->m_scale; *scale = t->m_scale;
t->RTADecorrect(); t->UnscaleRTAlpha();
return t->m_texture; return t->m_texture;
} }
@ -6210,7 +6210,7 @@ void GSTextureCache::Target::Update(bool cannot_scale)
if (m_type == RenderTarget && transferring_alpha && bpp >= 16) if (m_type == RenderTarget && transferring_alpha && bpp >= 16)
{ {
if (alpha_minmax.second > 128 || (m_TEX0.PSM & 0xf) == PSMCT24) if (alpha_minmax.second > 128 || (m_TEX0.PSM & 0xf) == PSMCT24)
RTADecorrect(); UnscaleRTAlpha();
else if (!cannot_scale && total_rect.eq(m_valid)) else if (!cannot_scale && total_rect.eq(m_valid))
m_rt_alpha_scale = true; m_rt_alpha_scale = true;
} }

View File

@ -244,8 +244,8 @@ public:
void ResizeValidity(const GSVector4i& rect); void ResizeValidity(const GSVector4i& rect);
void UpdateValidity(const GSVector4i& rect, bool can_resize = true); void UpdateValidity(const GSVector4i& rect, bool can_resize = true);
void RTACorrect(); void ScaleRTAlpha();
void RTADecorrect(); void UnscaleRTAlpha();
void Update(bool cannot_scale = false); void Update(bool cannot_scale = false);