Skip to content

Commit

Permalink
GS/TextureCache: Fix incorrect alpha min/max read on block offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Apr 1, 2024
1 parent c650b4b commit c9fdd01
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7119,11 +7119,10 @@ void GSTextureCache::PreloadTexture(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE
{
rtx(mem, off, block_rect, map.bits, map.pitch, TEXA);
tex->Unmap();

// Temporary, can't read the texture here so we need to come up with a smarter solution, but this will get around it being broken.
if (alpha_minmax)
{
*alpha_minmax = std::make_pair<u8, u8>(0, 255);
}
}
else
{
Expand All @@ -7134,11 +7133,10 @@ void GSTextureCache::PreloadTexture(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE

const u8* ptr = buff + (pitch * static_cast<u32>(rect.top - block_rect.top)) +
(static_cast<u32>(rect.left - block_rect.left) << (paltex ? 0 : 2));

if (alpha_minmax)
{
pxAssert(GSLocalMemory::m_psm[TEX0.PSM].pal == 0);
*alpha_minmax = GSGetRGBA8AlphaMinMax(buff, unoffset_rect.width(), unoffset_rect.height(), pitch);
}
*alpha_minmax = GSGetRGBA8AlphaMinMax(ptr, unoffset_rect.width(), unoffset_rect.height(), pitch);

tex->Update(unoffset_rect, ptr, pitch, level);
}
}
Expand Down

0 comments on commit c9fdd01

Please sign in to comment.