sharpemu/tests/SharpEmu.Libs.Tests
kuba 775141d58c
[GPU] Sweep CPU writes at memory visibility points instead of before every device-address program (#1033)
* [GPU] Sweep CPU writes for device-address programs at memory visibility points

A device-address program may read any mapped page, so before each such
draw or dispatch the buffer cache uploaded every CPU-dirty page whenever
the global CPU-dirty epoch had moved. A guest that streams its per-draw
ring while the command stream is being translated moves the epoch between
almost every pair of draws, and each upload ended the rendering scope and
drained the GPU with an ALL_COMMANDS barrier pair - about 670 times per
frame in Silent Hill: The Short Message's menu.

CPU writes only need to be visible at memory visibility points: when a
submission slice starts, when a wait packet is satisfied, and after a
command-processor memory write (later commands may read those bytes through
device addresses). The sweep now runs at the first device-address program
after such a point, and its uploads share one barrier pair instead of one
per buffer. SHARPEMU_BDA_SWEEP_EVERY_DRAW=1 restores the per-draw sweep.
Menu GPU time drops from about 435 to 290 ms per frame.

(cherry picked from commit fafe92b71271cf750dd89251891bac20fb87f1ff)

* [GPU] Let command-processor DMA writes turn pages CPU-dirty instead of copying

A DMA fill or copy into memory without GPU-written bytes is executed on
the CPU, and the bytes were then pushed into every overlapping cache
buffer through a staging copy and a barrier pair, which ends the
rendering scope (~60 per frame in Silent Hill: The Short Message's menu).

When no GPU-written byte shares the written pages, the pages now simply
turn CPU-dirty: every later GPU reader synchronizes CPU-dirty pages before
reading (bound buffers on obtain, device-address programs at the next
memory visibility point, which the write now raises), so the bytes still
arrive in command order. Pages that hold GPU-written bytes keep the
staging copy. SHARPEMU_DEFER_HOST_WRITES=0 restores the copy.

(cherry picked from commit 3fe21faa3821551fa99b9398064f0652e45d2e84)

* [GPU] Keep hot CPU-written pages writable across device-address sweeps

A page the guest rewrites every frame turns hot after two upload/write
cycles, and the bound-buffer path then serves it from the stream ring so
the page stays writable. The device-address sweep and the range
synchronization still re-protected hot pages after every upload, so the
guest's next write to each ring page took a protection fault - about
5,000 faults per second on Silent Hill: The Short Message's render
thread, each a signal round trip under Rosetta plus page-guard lock
traffic shared with the command worker.

Both sweeps now preserve hot pages: they stay dirty and writable and are
copied again on the next sweep, a few hundred KiB of ring memory per
sweep. Faults drop to a third and the menu goes from 3.8 to 4.2 FPS.
SHARPEMU_BDA_SWEEP_REPROTECT_HOT=1 restores the re-protection.

(cherry picked from commit 65d2b55ddc07644d52e5ad3112cbe323a2421abd)

* [GPU] Refresh writable hot pages at every BDA visibility point
2026-10-07 11:52:12 +02:00
..
Agc [GPU] Restore scene visibility and half-wave shuffles (#1025) 2026-10-07 11:21:15 +02:00
Ampr Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
AppContent Alpha Rebuild Progress (#887) 2026-09-20 04:09:27 +03:00
Audio Page fixes (#1023) 2026-10-04 19:07:37 +03:00
AvPlayer Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Cli [macOS] Fix the Rosetta GC wedge, a CPU-flip buffer-wait deadlock and frozen host movies (#1051) 2026-10-07 11:02:17 +02:00
Cpu [HLE/Cpu] Remove host lock contention from POSIX memory queries, thread resumes and timed waits (#1031) 2026-10-07 10:56:03 +02:00
Fiber Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Font [Font] Fix font face creation (#1010) 2026-10-03 05:04:56 +03:00
GUI [GPU] Add internal render resolution scaling (#1038) 2026-10-07 11:47:58 +02:00
Gpu [GPU] Sweep CPU writes at memory visibility points instead of before every device-address program (#1033) 2026-10-07 11:52:12 +02:00
HLE Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Ime Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Json Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Kernel Unity fixes 1016p1 (#1043) 2026-10-06 18:43:21 +03:00
LibcInternal Add libc heap trace contract tests (#409) 2026-07-19 03:25:42 +03:00
Loader Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Logging Reject undefined numeric LogLevel values (#390) 2026-07-18 15:47:19 +03:00
Media Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Memory [GPU/HLE] Cut per-draw and per-call managed allocations on hot paths (#1054) 2026-10-07 11:36:27 +02:00
Network Gran Turismo 7 Fixes, AvPlayer, Razor CPU stubs, Net stubs (#927) 2026-09-30 01:37:56 +03:00
Ngs2 Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
Np Unity fixes 1016p1 (#1043) 2026-10-06 18:43:21 +03:00
Pad Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
PlayGo [PlayGo] Reject authoritative unknown chunk loci (#242) 2026-07-16 19:22:33 +03:00
Pthread Unity fixes 1016p1 (#1043) 2026-10-06 18:43:21 +03:00
Random [HLE] Add RandomExports HLE (#413) 2026-07-18 23:44:57 +03:00
Remoteplay fix(gta): restore wiped GTA foundation and gameplay path (PPSA04264) (#650) 2026-07-27 01:58:55 +03:00
Rtc Fix sceRtcConvertLocalTimeToUtc failing on non-UTC hosts (#210) 2026-07-16 00:04:35 +03:00
SaveData Alpha Rebuild Progress (#887) 2026-09-20 04:09:27 +03:00
ShaderCompiler Perf computed shaders (#1013) 2026-10-03 04:49:43 +03:00
SystemService [GUI/CLI] Add support for console settings and language selection (#907) 2026-09-26 00:17:25 +03:00
Tls [AGC/Vulkan] Extend PS5 runtime and rendering compatibility (#216) 2026-07-16 02:02:34 +03:00
VideoOut [GPU] Add internal render resolution scaling (#1038) 2026-10-07 11:47:58 +02:00
AerolibCatalogTests.cs [SourceGenerators] Compile-time SysAbi export registry, analyzers, and build-generated aerolib.bin (#204) 2026-07-16 00:00:32 +03:00
AllocationMeasurement.cs Astrobot / Demon's soul performance improvement (#955) 2026-09-30 18:14:21 +03:00
FakeCpuMemory.cs Alpha Rebuild Progress (#887) 2026-09-20 04:09:27 +03:00
LibcStdioExportsTests.cs Fix/gen5 shader resource handling (GTA 5) (#1015) 2026-10-03 04:00:32 +03:00
NativeExecutionRequirements.cs Alpha Rebuild Progress (#887) 2026-09-20 04:09:27 +03:00
NativePageProtectionRequirements.cs Alpha Rebuild Progress (#887) 2026-09-20 04:09:27 +03:00
SaveDataStorageTests.cs Sdl backend (#670) 2026-07-28 03:33:26 +03:00
SharpEmu.Libs.Tests.csproj [macOS] Fix the Rosetta GC wedge, a CPU-flip buffer-wait deadlock and frozen host movies (#1051) 2026-10-07 11:02:17 +02:00
SysAbiRegistryTests.cs Alpha Rebuild Progress (#887) 2026-09-20 04:09:27 +03:00