mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-29 09:05:41 +00:00
GPU/HW: Ensure CLUT cache is synced when using SW-for-readbacks
This commit is contained in:
parent
6cad97b404
commit
10df7ba319
|
@ -1481,6 +1481,11 @@ void GPU::InvalidateCLUT()
|
||||||
m_current_clut_is_8bit = false;
|
m_current_clut_is_8bit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GPU::IsCLUTValid() const
|
||||||
|
{
|
||||||
|
return (m_current_clut_reg_bits != std::numeric_limits<decltype(m_current_clut_reg_bits)>::max());
|
||||||
|
}
|
||||||
|
|
||||||
void GPU::ClearDisplay()
|
void GPU::ClearDisplay()
|
||||||
{
|
{
|
||||||
ClearDisplayTexture();
|
ClearDisplayTexture();
|
||||||
|
|
|
@ -311,6 +311,7 @@ protected:
|
||||||
void HandleGetGPUInfoCommand(u32 value);
|
void HandleGetGPUInfoCommand(u32 value);
|
||||||
void UpdateCLUTIfNeeded(GPUTextureMode texmode, GPUTexturePaletteReg clut);
|
void UpdateCLUTIfNeeded(GPUTextureMode texmode, GPUTexturePaletteReg clut);
|
||||||
void InvalidateCLUT();
|
void InvalidateCLUT();
|
||||||
|
bool IsCLUTValid() const;
|
||||||
|
|
||||||
// Rendering in the backend
|
// Rendering in the backend
|
||||||
virtual void ReadVRAM(u32 x, u32 y, u32 width, u32 height);
|
virtual void ReadVRAM(u32 x, u32 y, u32 width, u32 height);
|
||||||
|
|
|
@ -2594,10 +2594,16 @@ void GPU_HW::UpdateSoftwareRenderer(bool copy_vram_from_hw)
|
||||||
FlushRender();
|
FlushRender();
|
||||||
ReadVRAM(0, 0, VRAM_WIDTH, VRAM_HEIGHT);
|
ReadVRAM(0, 0, VRAM_WIDTH, VRAM_HEIGHT);
|
||||||
|
|
||||||
// Sync the drawing area.
|
// Sync the drawing area and CLUT.
|
||||||
GPUBackendSetDrawingAreaCommand* cmd = sw_renderer->NewSetDrawingAreaCommand();
|
GPUBackendSetDrawingAreaCommand* clip_cmd = sw_renderer->NewSetDrawingAreaCommand();
|
||||||
cmd->new_area = m_drawing_area;
|
clip_cmd->new_area = m_drawing_area;
|
||||||
sw_renderer->PushCommand(cmd);
|
sw_renderer->PushCommand(clip_cmd);
|
||||||
|
|
||||||
|
GPUBackendUpdateCLUTCommand* clut_cmd = sw_renderer->NewUpdateCLUTCommand();
|
||||||
|
FillBackendCommandParameters(clut_cmd);
|
||||||
|
clut_cmd->reg.bits = m_current_clut_reg_bits;
|
||||||
|
clut_cmd->clut_is_8bit = m_current_clut_is_8bit;
|
||||||
|
sw_renderer->PushCommand(clut_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sw_renderer = std::move(sw_renderer);
|
m_sw_renderer = std::move(sw_renderer);
|
||||||
|
@ -3115,6 +3121,16 @@ void GPU_HW::UpdateCLUT(GPUTexturePaletteReg reg, bool clut_is_8bit)
|
||||||
// Not done in HW
|
// Not done in HW
|
||||||
GL_INS_FMT("Reloading CLUT from {},{}, {} not implemented", reg.GetXBase(), reg.GetYBase(),
|
GL_INS_FMT("Reloading CLUT from {},{}, {} not implemented", reg.GetXBase(), reg.GetYBase(),
|
||||||
clut_is_8bit ? "8-bit" : "4-bit");
|
clut_is_8bit ? "8-bit" : "4-bit");
|
||||||
|
|
||||||
|
// But need to forward through to SW if using that for readbacks
|
||||||
|
if (m_sw_renderer)
|
||||||
|
{
|
||||||
|
GPUBackendUpdateCLUTCommand* cmd = m_sw_renderer->NewUpdateCLUTCommand();
|
||||||
|
FillBackendCommandParameters(cmd);
|
||||||
|
cmd->reg.bits = reg.bits;
|
||||||
|
cmd->clut_is_8bit = clut_is_8bit;
|
||||||
|
m_sw_renderer->PushCommand(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_HW::FlushRender()
|
void GPU_HW::FlushRender()
|
||||||
|
|
Loading…
Reference in a new issue