aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp1
-rw-r--r--src/video_core/nx2.h6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 2be24e3f57..12923496fb 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -132,6 +132,7 @@ Module::Module(Core::System& system)
// (their table filled up, so the new game's GPU waits never completed) and the Switch 2 flags.
Devices::Nx2GpuMemoryRegistry::Get().Reset();
Tegra::Nx2ClearSemaphoreRegions();
+ Tegra::Nx2ClearSparseRegions();
Devices::g_nx2_driver = false;
Tegra::g_nx2_ampere = false;
Core::g_nx2_present_count = 0;
diff --git a/src/video_core/nx2.h b/src/video_core/nx2.h
index 4b0d3d5f62..824dc76044 100644
--- a/src/video_core/nx2.h
+++ b/src/video_core/nx2.h
@@ -116,6 +116,12 @@ inline void Nx2SparseRegionDestroyed(u64 gpu_address) {
g_nx2_sparse_state.erase(gpu_address);
}
+/// A new emulation session: the previous game's regions are gone (nvdrv's Module clears them).
+inline void Nx2ClearSparseRegions() {
+ std::scoped_lock lk{g_nx2_sparse_state_mutex};
+ g_nx2_sparse_state.clear();
+}
+
inline void Nx2SparseBlockWritten(u64 region_address, u64 block) {
std::scoped_lock lk{g_nx2_sparse_state_mutex};
if (const auto it = g_nx2_sparse_state.find(region_address); it != g_nx2_sparse_state.end()) {