Skip to content

Commit

Permalink
GS/HW: Resize target in Ico move fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek authored and refractionpcsx2 committed Sep 23, 2023
1 parent f887eae commit a997845
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pcsx2/GS/Renderers/HW/GSHwHack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,6 @@ static bool GetMoveTargetPair(GSRendererHW& r, GSTextureCache::Target** src, GIF
return true;
}

// Disabled to avoid compiler warnings, enable when it is needed.
static bool GetMoveTargetPair(GSRendererHW& r, GSTextureCache::Target** src, GSTextureCache::Target** dst,
bool req_target = false, bool preserve_target = false)
{
Expand Down Expand Up @@ -1399,17 +1398,23 @@ bool GSHwHack::MV_Ico(GSRendererHW& r)
// Store B -> A using a channel shuffle.
u32 pal[256];
for (u32 i = 0; i < std::size(pal); i++)
pal[i] = i << 24;
pal[i] = i << 24;
std::shared_ptr<GSTextureCache::Palette> palette = g_texture_cache->LookupPaletteObject(pal, 256, true);
if (!palette)
return false;

const GSVector4i draw_rc = GSVector4i(0, 0, RWIDTH, RHEIGHT);
if (dst->GetUnscaledWidth() < static_cast<int>(RWIDTH) || dst->GetUnscaledHeight() < static_cast<int>(RHEIGHT))
{
if (!dst->ResizeTexture(dst->GetUnscaledWidth(), static_cast<int>(RWIDTH), std::max(dst->GetUnscaledHeight(), static_cast<int>(RHEIGHT))))
return false;
}

const GSVector4i draw_rc = GSVector4i(0, 0, RWIDTH, RHEIGHT).rintersect(dst->GetUnscaledRect());
dst->UpdateValidChannels(PSMCT32, 0);
dst->UpdateValidity(draw_rc);

GSHWDrawConfig& config = GSRendererHW::GetInstance()->BeginHLEHardwareDraw(dst->GetTexture(), nullptr,
dst->GetScale(), src->GetTexture(), src->GetScale(), draw_rc);
GSHWDrawConfig& config = GSRendererHW::GetInstance()->BeginHLEHardwareDraw(
dst->GetTexture(), nullptr, dst->GetScale(), src->GetTexture(), src->GetScale(), draw_rc);
config.pal = palette->GetPaletteGSTexture();
config.ps.channel = ChannelFetch_BLUE;
config.ps.depth_fmt = 1;
Expand Down

0 comments on commit a997845

Please sign in to comment.