Finalize only the slots a texture object registered itself, so the next streamed piece of ground keeps its heightmap.

Ocarina streams its terrain heightmaps (R32F, 260x260) through a fixed set of storage. It initializes the next piece's texture at the storage of the one before, registers it in the texture pool, and only then finalizes the old texture object, which has the same parameters. vk_texture.c vk_texture_release marked every slot at the storage with the same parameters as finalized, the new registration too. A finalized CPU-written slot takes no image made from its storage again (slot_resolve's stale rule), so the new piece drew the zero stand-in and was drawn at height zero, far below the ground around it: the holes and stretched ground of issues #453 and #569, through which the sky shows. A finalize now marks only the slots registered with its own texture object (the initialization serial); a slot registered with another texture object at the same storage names that one, which is still live.

From pull request #535 by MartinIsla, in its final form, which no longer skips the whole release while another texture with the same parameters is live (that kept textures the game had released and drew dark lines in Kakariko's fog). --probe-vkmem gets the pull request's check: a release leaves another live texture's slot current and marks its own; it fails on the old rule and passes with this one, with and without shadow storage.

Added here: under the perf trace a line every 60 frames counts the slots a finalize marked, the slots of another live texture it left current and the lookups the stale rule answered with the stand-in, the terrain's heightmaps counted apart, so a run shows whether the case comes up and whether stand-ins are still drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-11 12:18:52 -05:00
parent bdcf07bbf6
commit ae0c8140a2
3 changed files with 40 additions and 3 deletions

View File

@@ -100,7 +100,9 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
(`vk_exec_draw.c pool_sync`); slots that resolve alike share one lookup.
Finalization is retained on registered slots independently of image-cache eviction: a stale CPU-backed descriptor
cannot recreate an image from freed storage or follow newly reused CPU bytes. Registration makes it current again;
finalized descriptors may still follow live GPU-owned content.
finalized descriptors may still follow live GPU-owned content. A finalize marks only the slots its own texture
object registered (by initialization serial): the game initializes and registers the next terrain heightmap at the
storage of the previous one before it finalizes that one (`vk_texture.c vk_texture_release`).
- Shaders: Ampere (SM86) code is lowered to Maxwell (`tools/xlate/AmpereLowering.cs`) and translated to SPIR-V by the
pinned shader translator (`tools/vendor/ryujinx`, 1.3.2) with our patches (`tools/xlate/patches/`), built with .NET 10 NativeAOT as
`nx2navi_xlate.exe` and run as separate processes. Translations are cached on disk; shaders and pipelines seen in