GPU/HW: Force update CLUT on save state

Fixes switching from hardware->software renderer in games that are
drawing without reloading the CLUT.
This commit is contained in:
Stenzek 2024-07-22 21:25:11 +10:00
parent 298f39a0c8
commit e743c5d1b1
No known key found for this signature in database

View file

@ -284,9 +284,17 @@ bool GPU_HW::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_di
{
// Need to download local VRAM copy before calling the base class, because it serializes this.
if (m_sw_renderer)
{
m_sw_renderer->Sync(true);
}
else if (sw.IsWriting() && !host_texture)
{
// If SW renderer readbacks aren't enabled, the CLUT won't be populated, which means it'll be invalid if the user
// loads this state with software instead of hardware renderers. So force-update the CLUT.
ReadVRAM(0, 0, VRAM_WIDTH, VRAM_HEIGHT);
if (IsCLUTValid())
GPU::ReadCLUT(g_gpu_clut, GPUTexturePaletteReg{Truncate16(m_current_clut_reg_bits)}, m_current_clut_is_8bit);
}
if (!GPU::DoState(sw, host_texture, update_display))
return false;