GS: Fix autoflush init after renderer switch

This commit is contained in:
Stenzek 2024-01-04 13:54:24 +10:00 committed by Connor McLaughlin
parent 2a6ecaeb09
commit 9eedf3901a
4 changed files with 12 additions and 6 deletions

View File

@ -188,6 +188,9 @@ static void CloseGSDevice(bool clear_state)
static bool OpenGSRenderer(GSRendererType renderer, u8* basemem)
{
// Must be done first, initialization routines in GSState use GSIsHardwareRenderer().
GSCurrentRenderer = renderer;
if (renderer == GSRendererType::Null)
{
g_gs_renderer = std::make_unique<GSRendererNull>();
@ -205,7 +208,6 @@ static bool OpenGSRenderer(GSRendererType renderer, u8* basemem)
g_gs_renderer->ResetPCRTC();
g_gs_renderer->UpdateRenderFixes();
g_perfmon.Reset();
GSCurrentRenderer = renderer;
return true;
}
@ -777,7 +779,10 @@ void GSSetSoftwareRendering(bool software_renderer, GSInterlaceMode new_interlac
if (!GSIsHardwareRenderer() != software_renderer)
{
if (!GSreopen(false, software_renderer ? GSRendererType::SW : GSConfig.Renderer, std::nullopt))
// Config might be SW, and we're switching to HW -> use Auto.
const GSRendererType renderer = (software_renderer ? GSRendererType::SW :
(GSConfig.Renderer == GSRendererType::SW ? GSRendererType::Auto : GSConfig.Renderer));
if (!GSreopen(false, renderer, std::nullopt))
pxFailRel("Failed to reopen GS for renderer switch.");
}
}

View File

@ -24,12 +24,12 @@ int GSState::s_transfer_n = 0;
static __fi bool IsAutoFlushEnabled()
{
return (GSConfig.Renderer == GSRendererType::SW) ? GSConfig.AutoFlushSW : (GSConfig.UserHacks_AutoFlush != GSHWAutoFlushLevel::Disabled);
return GSIsHardwareRenderer() ? (GSConfig.UserHacks_AutoFlush != GSHWAutoFlushLevel::Disabled) : GSConfig.AutoFlushSW;
}
static __fi bool IsFirstProvokingVertex()
{
return (GSConfig.Renderer != GSRendererType::SW && !g_gs_device->Features().provoking_vertex_last);
return (GSIsHardwareRenderer() && !g_gs_device->Features().provoking_vertex_last);
}
constexpr int GSState::GetSaveStateSize()

View File

@ -3467,7 +3467,8 @@ bool GSTextureCache::Move(u32 SBP, u32 SBW, u32 SPSM, int sx, int sy, u32 DBP, u
// DX11/12 is a bit lame and can't partial copy depth targets. We could do this with a blit instead,
// but so far haven't seen anything which needs it.
if (GSConfig.Renderer == GSRendererType::DX11 || GSConfig.Renderer == GSRendererType::DX12)
const GSRendererType renderer = GSGetCurrentRenderer();
if (renderer == GSRendererType::DX11 || renderer == GSRendererType::DX12)
{
if (spsm_s.depth || dpsm_s.depth)
return false;

View File

@ -984,7 +984,7 @@ void MTGS::SetSoftwareRendering(bool software, GSInterlaceMode interlace, bool d
if (display_message)
{
Host::AddIconOSDMessage("SwitchRenderer", ICON_FA_MAGIC, software ?
TRANSLATE_STR("GS", "Switching to software renderer...") : TRANSLATE_STR("GS", "Switching to hardware renderer..."),
TRANSLATE_STR("GS", "Switching to Software Renderer...") : TRANSLATE_STR("GS", "Switching to Hardware Renderer..."),
Host::OSD_QUICK_DURATION);
}