Skip to content

Commit

Permalink
GPUThread: Fix order of updating state
Browse files Browse the repository at this point in the history
Fixes unoverwritten textures not dumping on system shutdown.
  • Loading branch information
stenzek committed Jan 22, 2025
1 parent 8eaa1f3 commit f045a17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/core/gpu_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,12 +805,6 @@ bool GPUThread::CreateGPUBackendOnThread(GPURenderer renderer, bool upload_vram,

void GPUThread::ReconfigureOnThread(GPUThreadReconfigureCommand* cmd)
{
// Store state.
s_state.requested_vsync = cmd->vsync_mode;
s_state.requested_allow_present_throttle = cmd->allow_present_throttle;
s_state.requested_fullscreen_ui = cmd->start_fullscreen_ui.value_or(s_state.requested_fullscreen_ui);
s_state.game_serial = std::move(cmd->game_serial);

// Are we shutting down everything?
if (!cmd->renderer.has_value() && !s_state.requested_fullscreen_ui)
{
Expand All @@ -820,6 +814,11 @@ void GPUThread::ReconfigureOnThread(GPUThreadReconfigureCommand* cmd)
return;
}

// Store state.
s_state.requested_vsync = cmd->vsync_mode;
s_state.requested_allow_present_throttle = cmd->allow_present_throttle;
s_state.requested_fullscreen_ui = cmd->start_fullscreen_ui.value_or(s_state.requested_fullscreen_ui);
s_state.game_serial = std::move(cmd->game_serial);
g_gpu_settings = g_settings;

// Readback old VRAM for hardware renderers.
Expand Down
6 changes: 3 additions & 3 deletions src/core/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4185,9 +4185,6 @@ void System::UpdateRunningGame(const std::string& path, CDImage* image, bool boo
}
}

if (!booting)
GPUThread::SetGameSerial(s_state.running_game_serial);

if (!IsReplayingGPUDump())
{
if (booting)
Expand All @@ -4204,7 +4201,10 @@ void System::UpdateRunningGame(const std::string& path, CDImage* image, bool boo
ApplySettings(true);

if (s_state.running_game_serial != prev_serial)
{
GPUThread::SetGameSerial(s_state.running_game_serial);
UpdateSessionTime(prev_serial);
}

UpdateRichPresence(booting);

Expand Down

0 comments on commit f045a17

Please # to comment.