Skip to content

Storage first use: IMAGE keeps only uncompressed textures out (Pokopia's icons) - #1125

Closed
aksmith-git wants to merge 1 commit into
seedds:mainfrom
aksmith-git:pr/image-bc
Closed

aksmith-git wants to merge 1 commit into
seedds:mainfrom
aksmith-git:pr/image-bc

Conversation

@aksmith-git

Copy link
Copy Markdown
Contributor

tex_cpu_content takes a block-compressed texture the CPU wrote from its storage at first use, but only if the texture lacks the IMAGE flag. Shaders cannot write a block-compressed texture, so for those formats IMAGE says nothing about who writes the texels.

Pokémon Pokopia gives nearly every texture IMAGE (flags 0x4); its icons are BC1 / BC7 in a CPU_UNCACHED pool. Left to the one-time fill, a new icon over storage another icon had used got that icon's picture back from the sharing table. Icons were right just after booting, then showed other items' pictures once the store or the Pokédex had reused the storage.

Change: IMAGE now keeps only uncompressed textures out.

Credit: found and fixed by xFractals/pokopia-native (issue #1, a fork of nxnative for Pokopia), tested there on an iPhone with a large save: three passes through the store, the Pokédex and the Habitat Dex, 832 textures taken from their storage, every picture right. This is the same change on main.

Checked here:

  • dmhost builds (Wonder), and lint_c.py tidy stays at the baseline.
  • test_docs.py passes. I updated the rule list in nvn-objects.md's Block-compressed storage the CPU wrote before first use and added the Pokopia case.

🤖 Generated with Claude Code

…a's icons; after xFractals/pokopia-native seedds#1)

tex_cpu_content took a block-compressed texture from its storage only
without the IMAGE flag, but shaders cannot write a block-compressed
texture. Pokemon Pokopia gives nearly every texture IMAGE (flags 0x4);
its icons are BC1 / BC7 in a CPU_UNCACHED pool. Left to the one-time fill,
a new icon over storage another icon had used got that icon's picture back
from the sharing table: correct right after booting, then shuffled once the
store or the Pokedex had reused the storage. Found and fixed in
xFractals/pokopia-native (issue seedds#1, tested on an iPhone with a large save:
832 textures taken from their storage, every picture right).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) docs Documentation labels Nov 3, 2026
seedds added a commit that referenced this pull request Nov 3, 2026
…pped; IMAGE keeps only uncompressed textures from taking their storage at first use; the compute hoist scans only when a dispatch follows (#1107, #1125, #1121)

- #1107: the shader's cps_failed flag: Mario Kart World asked Metal 3,138 times
  in 60 s for pipelines it refused, with no shader named.
- #1125: shaders cannot write a block-compressed texture, so IMAGE says nothing
  about who writes its texels: Pokemon Pokopia's IMAGE BC1 / BC7 icons over
  reused storage showed other items' pictures.
- #1121: csh_dispatch_ahead looks ahead by op codes; most passes have no
  dispatch, and the full scan saved and restored the whole replay state at each
  pass's first draw (BotW: -3.5% submit-thread instructions per draw).
  DM_NVN_CSH_PRESCAN=0 keeps the old scan.

Co-authored-by: legoxz <351176948+legoxz@users.noreply.github.com>
Co-authored-by: aksmith-git <242086076+aksmith-git@users.noreply.github.com>
Co-authored-by: Xipzer <60103178+Xipzer@users.noreply.github.com>
@seedds

seedds commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Landed on main in 04ef91e, with #1107, #1121 and #1125 together, and you credited as co-author. I took an earlier session's rework of the three: #1107 keeps a cps_failed flag on the shader instead of a global set, and #1125 got a t_initial_uncached case (IMAGE on ASTC). t_initial_uncached passes (244 checks), the host builds, and regress.py check on Tears of the Kingdom, Super Mario Bros. Wonder and Breath of the Wild shows no new red lines from these, 0 changed MSL, and fps p50 within 0.1. Thanks!

@seedds seedds closed this Nov 3, 2026
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…pped; IMAGE keeps only uncompressed textures from taking their storage at first use; the compute hoist scans only when a dispatch follows (seedds#1107, seedds#1125, seedds#1121)

- seedds#1107: the shader's cps_failed flag: Mario Kart World asked Metal 3,138 times
  in 60 s for pipelines it refused, with no shader named.
- seedds#1125: shaders cannot write a block-compressed texture, so IMAGE says nothing
  about who writes its texels: Pokemon Pokopia's IMAGE BC1 / BC7 icons over
  reused storage showed other items' pictures.
- seedds#1121: csh_dispatch_ahead looks ahead by op codes; most passes have no
  dispatch, and the full scan saved and restored the whole replay state at each
  pass's first draw (BotW: -3.5% submit-thread instructions per draw).
  DM_NVN_CSH_PRESCAN=0 keeps the old scan.

Co-authored-by: legoxz <351176948+legoxz@users.noreply.github.com>
Co-authored-by: aksmith-git <242086076+aksmith-git@users.noreply.github.com>
Co-authored-by: Xipzer <60103178+Xipzer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants