mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 15:59:59 -04:00
Keep the driver's cache of stage libraries warm, link a missing pipeline instead of skipping its draw, and count the texture cache's waits in time.
The preparation builds every stage library once so the driver's disk cache holds it and a library a draw needs later takes under a millisecond. Turning dynamic vertex input off for AMD's RDNA 3 and newer driver changed the dynamic states every library lists, which gave each one another entry in the driver's cache, and nothing built them again: an update carried the prepared shaders over without the driver step. On an RX 7900 XT (26.10.1) all 42,142 prepared libraries were cold, 93 ms a vertex and 242 ms a fragment library on average. With no pipeline recorded, a walk through a village skipped 11,180 draws while their pipelines built and made 94 draws wait 5.5 s in all, four of them 1.0 to 2.0 s; a player's session log shows up to 114,834 draws skipped in 600 frames and 181 waits of 251 ms on average. Skipped ground and walls appear and disappear, and a skipped lighting pass is a black frame with the interface intact. - The game checks the driver's cache at every start (vk_pipeline.c lw_start): a sample of the prepared fragment libraries is built, and when their median time says the cache is cold the whole prepared list is built into it again on idle-priority threads while the game runs. shader-warm.txt records a warm in progress, so the next start goes on with one a run ended, and stops the tries on a driver that does not keep the libraries. This also covers a driver update and a cache the driver emptied. - An update that carries the prepared shaders over runs the game's --warm-shaders (tools/make_game.py warm_driver_cache): 11 s with the libraries there, about 8 minutes with all of them cold on that card. - A draw whose pipeline is missing waits for its fast link from a budget of 6 ms a presented frame, 3 ms at most each (NX2NAVI_PIPE_LINK_MS), before it is skipped: with warm libraries the link is done within that. - Full-screen draws wait from their 50 ms budget again instead of being skipped (NX2NAVI_PIPE_SKIP = any is the default; fullscreen stays selectable). With warm libraries the wait is a millisecond. The same walk afterwards: libraries 0.3 and 0.7 ms on average, 1,605 draws skipped, 1,473 of them in the scene's first 600 frames and 8 to 80 in each 600 after, and 19 waits of 60 ms in all. First visits to four other saves (a mountain pass, the Lost Woods, Kokiri Forest, a river) waited 12 to 84 ms in all except the Lost Woods, where mesh shader pipelines, which have no stage libraries, and vertex libraries that need added outputs still compiled once: 23 waits, 2.1 s in all, the longest 776 ms. The texture cache counted its waits in presents chosen at 60 a second: at 165 presents a second the 1800 that stood for thirty seconds were 11 s, so a released render target went sooner than meant and a texture out of view for 11 s was retired and showed its stand-in for some frames when it came back. The counts are now taken times the present rate over 60 (presents_for), and a texture is retired after two minutes without a sample instead of thirty seconds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,17 @@ of them.
|
||||
|
||||
Without this step the first launch compiles shaders and pipelines during play and stutters until the caches fill.
|
||||
The AMD driver keeps its pipeline cache per exe path and holds a limited amount: preparing another build folder can
|
||||
evict this one's. `nx2navi.exe --warm-shaders` rebuilds it from the shader cache.
|
||||
evict this one's. `nx2navi.exe --warm-shaders` rebuilds it from the shader cache. A driver update empties the
|
||||
driver's cache too, and a change to what a stage library is built with gives every library another entry in it.
|
||||
So an update that carries the prepared shaders over runs `--warm-shaders` (`tools/make_game.py`
|
||||
`warm_driver_cache`: seconds while the libraries are there, minutes when they are not), and the game itself checks
|
||||
at every start: it builds a sample of the prepared fragment libraries and, when their median time says the cache
|
||||
is cold, builds the whole prepared list into the driver's cache again on idle-priority threads while it runs
|
||||
(`runtime/vk_pipeline.c` `lw_start`, `NX2NAVI_LIB_WARM`; `shader-warm.txt` next to the caches says where that
|
||||
stands). With the cache cold every pipeline a draw first needs compiles in play: on an RX 7900 XT a library took
|
||||
93 ms (vertex) and 242 ms (fragment) on average against 0.3 and 0.6 ms from the cache, and a first walk through a
|
||||
village skipped 11,180 draws and made 94 draws wait 5.5 s in all, against 1,605 skipped (1,473 of them in the
|
||||
scene's first frames) and 60 ms of waits with the cache warm.
|
||||
When the driver's shader compiler crashes on a variant (NVIDIA 615.78.08 on an RTX 5080 does, issue #30),
|
||||
`prepare_shaders.py` runs the driver step again with `--warm-shaders`, up to three times, without the variants the
|
||||
driver was building at the crash. `shader-prepare-skip.txt` next to the exe lists them with the GPU and driver
|
||||
|
||||
@@ -15,6 +15,15 @@ Draft notes for the release after 0.6.1. The version number is not decided yet.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Ground, walls and characters that appeared and disappeared, black or unlit frames, and stalls of up to two seconds
|
||||
wherever something was shown for the first time (a new area, a cutscene). The graphics driver's cache had lost the
|
||||
shader libraries prepared at install, so every new pipeline compiled during play: after a driver update, or after
|
||||
an update of NX2navi that changes how the libraries are built (this one does on AMD RX 7000 and RX 9000 cards,
|
||||
where it also ends the 20 second start). The game now checks the driver's cache at every start and fills it again in the background by
|
||||
itself, an update fills it again before you play, draws wait a moment for a pipeline that only needs linking
|
||||
instead of being left out, and lighting passes are no longer left out at all.
|
||||
- Textures out of view for 11 seconds at 165 fps (30 seconds were meant) could show a blank stand-in for a few frames
|
||||
when they came back while memory was short. The wait is now two minutes of real time at any frame rate.
|
||||
- Settings menu, mouse: a setting changes only on the two framed arrows beside its value, and the arrows stay in one
|
||||
place. A click anywhere on a row used to step the setting, and the left arrow moved with the value's width, so
|
||||
clicking through the values landed on the row and stepped the wrong way. Holding the button on an arrow repeats.
|
||||
|
||||
Reference in New Issue
Block a user