Repository navigation
Veshiru 2.0
Memory: one VRAM policy instead of three fighting margins
- Removed the 2,048 MiB "keep free" behaviour: Veshiru 1.x stacked three margins under the
driver budget (a base share, a reaction to every allocation that missed the budget, and a reserve
for the allocator's block space). They reacted to each other: a miss raised the margin by
256–512 MiB, the raised margin made the next allocations miss, and on a 4 GB card the margin
reached its 2 GiB cap, so the cache held half the card free and re-decoded textures every frame
(Out of device memory: keeping 2048 MiB more freeonce per few hundred milliseconds in the
supplied log). A singleCommon::VramPolicynow sizes the reserve from the driver budget alone:
an eighth of it, at most 1 GiB — about 387 MiB on the GTX 1650's ~3 GiB budget, so the texture
cache may fill ~2,709 MiB instead of ~1,734 MiB. The reserve settles instead of ratcheting up. - Removed the dead allocator-pressure feedback:
runtime.MemoryPressureEvents(), the
pressure_eventscounter behind it and the unusedpressure_margin,pressure_quiet_frames,
slack_marginandseen_pressure_eventsstate are gone. An allocation that still misses the
budget is served by the allocator's existing relax/try-fallback path, which did not need the
margin loop. - Small images no longer count as VRAM pressure: every
is over the memory budget; allocating it anywayline in the supplied Mario Kart log was the same 64x64, 7-level depth image — 21 KiB.
The Vulkan allocator's own budget estimate refused it, which counted as pressure and made the
texture cache evict recently used images. Images that cannot exceed 4 MiB now skip the budget
check and fail only if the allocation really fails. - Removed the second hidden cap: a discrete GPU's budget was capped again at 6 GiB plus 1 GiB
per resolution scale step unless VRAM Usage Mode was Aggressive. On a 12 GB card that left
over 4 GiB unused while the cache evicted to stay under the cap. The driver budget less the
reserve is now the whole answer.
Frame delivery: fewer hitches while playing
- NVIDIA pipeline-compile workers: the driver stage of the pipeline build
(vkCreateGraphicsPipelines/vkCreateComputePipelines) took 201 ms at the median in the supplied
log with six workers on a 12-thread laptop. NVIDIA's driver serialises that work behind an
internal lock, so the extra workers only queued while holding their shaders' memory. NVIDIA now
runs two driver workers; other vendors keep the previous scaling. The previously dead
has_broken_parallel_compilingflag is now set for Intel's Windows driver, which shares the lock
too and keeps one worker. - NUP decompression batching:
DecodeToreleased and re-acquired the member's lock once per
512 KiB chunk, so one sequential read of a big asset made dozens of turns: the log shows
Archive.min.bntx.zs(38.6 MiB) taking 514 ms,CmnTex_Tera_Product_Proc_Nrm.bntx.zs228 ms and
main193 ms on the thread that asked for the bytes. A read now decodes up to 16 chunks per turn,
which is five turns for that 38.6 MiB file instead of 77, while still yielding to another reader.
Profile applet: no more stale black frame
- Compositor presents when the visible layer set changes:
HardwareComposer::ComposeLockedonly
presented when a producer handed over a new buffer. A layer that just became visible (the profile
applet over Mario Kart World) or went away left the previous composite on screen until the next
buffer arrived — the reported two-second black frame. The composer now also presents when the set
of layers that should be on screen differs from what the frame can show, without consuming extra
producer buffers.
Game list: a file that goes missing says so
- Moved or deleted game files are reported: a title whose file moved or was deleted simply
stopped appearing, with nothing to distinguish it from never having been added — the reported
"I deleted my MKW.nupand the game vanished". The worker keeps the paths the last scan listed
and, on the next scan, lists a Missing row for each one now absent from a directory still
being scanned, with its old location and a note that saves live in the NAND save data, not in the
game file. Removing a folder from the game list stays silent, since that is not a game going
missing.
Settings
- Memory knobs behind "Show memory expert options": VRAM Usage Mode, VRAM Reserve and
Texture Cache Memory Limit leave the normal Advanced tab and appear only when that box is
ticked (or when a per-game/global override already exists, so an existing choice stays editable).
Veshiru sizes this automatically from the GPU's driver budget; showing the knobs invited users to
cap the cache at 2 GiB and stutter.
Boot
main.npdmis parsed rather than assumed: the NCA loader read the eight bytes at offset
0x28 as a heap size without checking theMETAmagic, and the supplied HOME Menu log shows a
file where that read produced0x7463656c— the ASCII bytes of a text field — as a 1.8 GiB heap,
which then sized the pointer buffer for a heap that does not exist. The heap size is now read
only from a real NPDM, and anything unreasonable falls back to the default pointer buffer.
Tests
- Added
src/tests/common/vram_policy.cpp, covering the reserve, the critical threshold, and the
4 GB case the report described (the cache keeps more than 2 GiB of a ~3 GiB budget).
Veshiru is a Windows-exclusive emulator: it is built and tested for 64-bit Windows 10 and 11 only.
Extract the entire zip and run veshiru.exe, or veshiru-cmd.exe from a terminal.
| Build Type | Standard | PGO (Recommended) | Notes |
|---|---|---|---|
| amd64 / x86_64 | zip | PGO zip | Both built with clang-cl and ThinLTO; the PGO zip uses a balanced multi-game Switch 1 & Switch 2 profile |
The PGO build is compiled with profile-guided optimization using a balanced multi-game Switch 1 & Switch 2 runtime profile (veshiru-windows.profdata). Prefer it on modern x86_64 CPUs.