gpu: report GET_LOD_STATS as "no data yet" instead of every texture wanting mip 0 #1880

Closed
github-bot wants to merge 1 commit from gh-pr/1880/head into gh-pr/1880/base
Owner

@⁠fabled-aesop on GitHub · 2026-10-24 16:21 UTC · original
fabled-aesop:lod-stats-zero → main · +3 −5 · 1 files · 1 commits · closed without merging

Problem

ASTRO BOT (PPSA21564 01.007.000) never leaves the loading screen before its first level. The loading screen keeps rendering at about 39 FPS, but the game keeps reading files at about 400 MB/s: over 125 GB in under 7 minutes, against 3.8 GB for a normal boot to the menus.

A guest file log shows the same 35-44 textures, almost all normal maps (*_n.gnfp), opened and fully read about 110 times each. Their reads alternate between 5.7 MB and 128 KB. The texture streamer loads full detail, drops it, and loads it again, forever.

Cause

The streamer chooses each texture's detail level from the GET_LOD_STATS report:

  • a 64-byte header, whose first dword marks the report valid
  • one 64-bit entry per T# counter: sample count in bits 0..23, finest sampled mip in bits 56..59 (0xF when unsampled)

CpOpGetLodStats zeroes the report and then writes 1 to the first dword (// Hack?). That makes a valid report in which every counter's finest mip is 0. So:

  1. every texture asks for full detail;
  2. the streaming budget overflows;
  3. textures are evicted, and the next report asks for them again.

Fix

Leave the whole report zeroed. With an invalid header, the guest treats it as "no data yet" and stops thrashing. Textures may stream at lower detail, because nothing is ever reported as sampled. Real statistics would need instrumented pixel shaders.

Jetsku's fork reaches the same conclusion. Its ExecLodStats keeps this placeholder as a "legacy" mode that thrashes the streamer, and offers zeroing as the safe fallback (KYTY_LOD_STATS_MODE=zero) next to real GPU statistics (gpu). This change matches the zero mode. I narrowed it down by setting Jetsku's other runtime switches to upstream-like values; Jetsku still loaded with each of them:

  • KYTY_LABEL_MODE=completion
  • KYTY_RT_SOFTWARE=0
  • KYTY_BDA_WRITES=0
  • KYTY_AGC_DONE_MODE=idle
  • KYTY_EQUEUE_COALESCE=0

Testing

Windows 11, RTX 5080, i7-14700K, --amd-cpu:

  • Before: the loading screen never ends (several runs, the longest stopped after about 7 minutes).
  • After: the normal maps are read 3-8 times each, the first gameplay model loads, and the game reaches the level (VS 258 / PS 189 / CS 92 / GS 10). That matches Jetsku's working runs.
  • Builds cleanly on main 8291cfeb.

The game runs came from a branch that also carries other local fixes (#838, the mesh-slice patch from #793, and a DS_APPEND helper-lane fix for #1511). This PR's one commit is the only change aimed at the loading loop. Without it, that same branch stays stuck.

Not tested: other titles that use GET_LOD_STATS.

AI Use: Code and builds generated by Claude. Reviewed and tested changes personally.

**@⁠fabled-aesop** on GitHub · 2026-10-24 16:21 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1880) `fabled-aesop:lod-stats-zero` → `main` · +3 −5 · 1 files · 1 commits · closed without merging ## Problem ASTRO BOT (PPSA21564 01.007.000) never leaves the loading screen before its first level. The loading screen keeps rendering at about 39 FPS, but the game keeps reading files at about 400 MB/s: over 125 GB in under 7 minutes, against 3.8 GB for a normal boot to the menus. A guest file log shows the same 35-44 textures, almost all normal maps (`*_n.gnfp`), opened and fully read about 110 times each. Their reads alternate between 5.7 MB and 128 KB. The texture streamer loads full detail, drops it, and loads it again, forever. ## Cause The streamer chooses each texture's detail level from the GET_LOD_STATS report: - a 64-byte header, whose first dword marks the report valid - one 64-bit entry per T# counter: sample count in bits 0..23, finest sampled mip in bits 56..59 (`0xF` when unsampled) `CpOpGetLodStats` zeroes the report and then writes 1 to the first dword (`// Hack?`). That makes a *valid* report in which every counter's finest mip is 0. So: 1. every texture asks for full detail; 2. the streaming budget overflows; 3. textures are evicted, and the next report asks for them again. ## Fix Leave the whole report zeroed. With an invalid header, the guest treats it as "no data yet" and stops thrashing. Textures may stream at lower detail, because nothing is ever reported as sampled. Real statistics would need instrumented pixel shaders. Jetsku's fork reaches the same conclusion. Its `ExecLodStats` keeps this placeholder as a "legacy" mode that thrashes the streamer, and offers zeroing as the safe fallback (`KYTY_LOD_STATS_MODE=zero`) next to real GPU statistics (`gpu`). This change matches the `zero` mode. I narrowed it down by setting Jetsku's other runtime switches to upstream-like values; Jetsku still loaded with each of them: - `KYTY_LABEL_MODE=completion` - `KYTY_RT_SOFTWARE=0` - `KYTY_BDA_WRITES=0` - `KYTY_AGC_DONE_MODE=idle` - `KYTY_EQUEUE_COALESCE=0` ## Testing Windows 11, RTX 5080, i7-14700K, `--amd-cpu`: - Before: the loading screen never ends (several runs, the longest stopped after about 7 minutes). - After: the normal maps are read 3-8 times each, the first gameplay model loads, and the game reaches the level (VS 258 / PS 189 / CS 92 / GS 10). That matches Jetsku's working runs. - Builds cleanly on main 8291cfeb. The game runs came from a branch that also carries other local fixes (#838, the mesh-slice patch from #793, and a DS_APPEND helper-lane fix for #1511). This PR's one commit is the only change aimed at the loading loop. Without it, that same branch stays stuck. Not tested: other titles that use GET_LOD_STATS. AI Use: Code and builds generated by Claude. Reviewed and tested changes personally.
ASTRO BOT (PPSA21564) never leaves the loading screen before its first
level. The screen keeps rendering (about 39 FPS) while the game reads
about 400 MB/s of files: over 125 GB in under 7 minutes, against 3.8 GB
for a normal boot to the menus. A guest file log shows the same 35-44
textures (almost all normal maps, *_n.gnfp) opened and fully read about
110 times each, alternating a 5.7 MB and a 128 KB read: the texture
streamer loads full detail, drops it and loads it again, forever.

The streamer decides each texture's detail from the GET_LOD_STATS report:
a 64-byte header whose first dword marks it valid, then one 64-bit entry
per T# counter (sample count in bits 0..23, finest sampled mip in bits
56..59, 0xF when unsampled). The placeholder zeroed the report and wrote 1
into the first dword ("Hack?"). That is a valid report in which every
counter's finest mip is 0, so every texture asks for full detail, the
streaming budget overflows, textures are evicted and asked for again on
the next report.

Leave the whole report zero instead. With an invalid header the guest
keeps "no data yet" and stops thrashing; textures can drift to lower
detail, since nothing is ever reported as sampled. Real statistics need
instrumented pixel shaders (Jetsku's fork, KYTY_LOD_STATS_MODE=gpu).

How this was found: Jetsku's int19.4 fork gets through the same loading
screen on the same PC. Jetsku's other runtime switches set to
upstream-like values (KYTY_LABEL_MODE=completion, KYTY_RT_SOFTWARE=0,
KYTY_BDA_WRITES=0, KYTY_AGC_DONE_MODE=idle, KYTY_EQUEUE_COALESCE=0) all
still loaded. Its ExecLodStats documents this placeholder as the "legacy"
mode that "thrashes the streamer" and offers "zero" as the safe fallback,
which this change matches.

Tested on RTX 5080 / i7-14700K with --amd-cpu: the normal maps are read
3-8 times, the first gameplay model loads and the game reaches the level
(VS 258 / PS 189 / CS 92 / GS 10), as in Jetsku's working runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:52 +00:00
github-bot closed this pull request 2026-11-26 10:07:52 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.