diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 01:03:37 -0500 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 15:18:01 -0500 |
| commit | 40902b09c7b86de7cf12f26839241f26925d04b5 (patch) | |
| tree | 1a0403bb25a8ab44f37e270564fb4a105ed1e6b9 /src/video_core/memory_manager.cpp | |
| parent | 81746294f8114f93d82de1e1984b00d0194f25ba (diff) | |
nx2: leave unwritten sparse blocks without memory when they get zeros
Title 1 clears about 1 GB of its sparse regions at boot through the GPU
memory manager. Every block the clear touched got 4 MiB of guest memory,
which the clear itself then committed on the host, and counted as written,
so the texture cache gave the images over it device memory too. A block
nobody wrote reads zero already: when the part of a write that lands on
it is all zero, leave it as it is.
(cherry picked from commit 0d7ff63fd1a373cecff6ba91022c9027e801e53f)
Diffstat (limited to 'src/video_core/memory_manager.cpp')
| -rw-r--r-- | src/video_core/memory_manager.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index a7d8aec382..ddfd2529fd 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -302,7 +302,7 @@ void MemoryManager::Write(GPUVAddr addr, T data) { return; } // A Switch 2 sparse block nobody wrote yet gets its memory now. - Tegra::Nx2BackSparseWrite(addr, sizeof(T)); + Tegra::Nx2BackSparseWrite(addr, sizeof(T), &data); if (auto page_pointer{GetPointer(addr)}; page_pointer) { std::memcpy(page_pointer, &data, sizeof(T)); return; @@ -469,7 +469,7 @@ void MemoryManager::ReadBlockUnsafe(GPUVAddr gpu_src_addr, void* dest_buffer, co void MemoryManager::WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffer, std::size_t size, [[maybe_unused]] VideoCommon::CacheType which, bool unsafe) { // Give Switch 2 sparse pages the write lands on their memory first (otherwise it is dropped). - Tegra::Nx2BackSparseWrite(gpu_dest_addr, size); + Tegra::Nx2BackSparseWrite(gpu_dest_addr, size, src_buffer); auto just_advance = [&]([[maybe_unused]] std::size_t page_index, [[maybe_unused]] std::size_t offset, std::size_t copy_amount) { src_buffer = static_cast<const u8*>(src_buffer) + copy_amount; }; |
