Repository navigation
Texture ID views follow the serials that changed: a pool walk no longer resolves every ID again after each serial table change - #1069
Closed
parsifal295 wants to merge 1 commit into
Closed
parsifal295 wants to merge 1 commit into
parsifal295 wants to merge 1 commit into
Conversation
…er resolves every ID again after each serial table change
seedds
added a commit
that referenced
this pull request
Nov 3, 2026
… few serial changes a frame no longer send every registered ID down the slow path (#1069) A change to one serial's object bumps g_ser_gen through ser_note, which records the serial; ID views are valid for an epoch, and ser_sync clears only the views of IDs registered with a noted serial. A bump without a note, more than 64 notes or any sparse mapping starts a new epoch, as every bump did before. A packaged ID whose pages were not written since its upload keeps its view. Fire Emblem: Fortune's Weave's battle map: the texture pool table no longer rebuilt every frame (1.9 -> 1.2 ms a build). Co-authored-by: parsifal295 <130349765+parsifal295@users.noreply.github.com>
2 of 3 tasks
Owner
|
Landed on main as 6fc3421, with you credited as co-author. I audited the lock coverage: every caller of |
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
… few serial changes a frame no longer send every registered ID down the slow path (seedds#1069) A change to one serial's object bumps g_ser_gen through ser_note, which records the serial; ID views are valid for an epoch, and ser_sync clears only the views of IDs registered with a noted serial. A bump without a note, more than 64 notes or any sparse mapping starts a new epoch, as every bump did before. A packaged ID whose pages were not written since its upload keeps its view. Fire Emblem: Fortune's Weave's battle map: the texture pool table no longer rebuilt every frame (1.9 -> 1.2 ms a build). Co-authored-by: parsifal295 <130349765+parsifal295@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
In Fire Emblem Fortune's Weave's battle map, the submit thread spent about 14 % of its samples in
pool_gpu→tex_by_id→tex_mtl/tex_get. The texture pool table was rebuilt every frame at about 1.9 ms per build.The cause is how texture ID views were cached. A view stayed valid only while
g_ser_gendid not change, and every serial table change bumped it. The game changes a few serials every frame (the per-stage program ring inbind_stagesdoes), so the next lookup sent every registered ID down the slow path.pool_gpuwalks all of them, about 5,000 here. Packaged IDs also took the slow path again after any guest write anywhere.What changes:
g_ser_genthroughser_note, which records the serial.treg_ep), andser_syncinvalidates only the IDs registered with a noted serial (g_treg_serial).tex_mtl_makes.tex_fast_ridreturns the cached resource ID of a viewtex_by_idkept.Other users of
g_ser_genare unchanged.An independent review of the first version found two bugs, both fixed here:
view_serwithtreg_ep()in one expression. The first lookup after a noted change could readview_serbefore the sync cleared it, so the epoch is now read first.fz_p2_drawlooked an ID up withoutg_rmu. The lookup can now runser_sync, so it takes the lock.The reference entry is Texture ID views revalidated only for the serials that changed.
Checked
make -C dm/gfx/tests GAME=04007EF01F8AE000 runpasses on this branch (main 6a16b7d + this change), includingt_cpu_tex.test_docspasses, anddocs_symptoms.pywas run.04007EF01F8AE000, v131072), battle map save, headless, 975 draws a frame.regress.py: not run (see above).regress.py impactlists every NVN game.Docs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)