Commit Graph

4 Commits

Author SHA1 Message Date
cadf43276a d3d12: a title texture tracked again over the same tiles is not read again, and every fill keeps part hashes (RT-TITLE-TEXTURE-WRITE-TRACKED)
Run 60: 80 % of the looks were whole reads, 89 % of them unchanged. index_texture runs at every Map of a
slot-133 texture, at a layout found by a view and at a first naming, and each call re-tracked the texture:
its tiles were released and acquired again (so not armed) and it was named, so the next pass read it whole
although nothing had been written. Tracking again over the same tiles now changes nothing; a texture that
must be read (never filled, or known changed) is touched instead. Fills made outside the refresh (at a
slot-70 view, on the fill worker) now keep part hashes too, so the next written tile is decided by parts
rather than by a whole read. A line every 10 s counts whole reads by why: never filled, no part hashes,
one tile (its part is all of it), every tile written, no tile written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 19:13:24 -05:00
f7c3df1724 d3d12: a title texture over a render target's memory is not filled from it; textures are read at first use and by their written tiles (RT-TITLE-TEXTURE-WRITE-TRACKED)
Blocks of older frames in run 58: a texture without GPU-write flags placed over the memory of a GPU-written
one (a render target, depth or UAV texture) was filled from the title's pages there. Those pages never hold
what our GPU renders into the target's image, only what the CPU last put there, and every write mark over
them (a write-back of a GPU copy, a neighbour's write in the same tile) re-uploaded those old bytes. The
registry now keeps the CPU-view range of every GPU-written texture (DeviceState::gpu_owned), and a texture
over such a range is not watched or filled by the refresh (index_texture); one already watched stops when the
target is registered. Test: d3d12_existing_heap's "texture over a render target's memory" (fails without
this: the written 64 KiB piece shows in the texture).

Upload at first use: a title texture no descriptor names is not read, uploaded or watched. Its first
descriptor of any kind (a D3D12 view, a slot-70 view, a T# the title wrote into a console heap: all reach
Resource::note_shader_view) queues it, and the refresh before that submission reads it whole and uploads it.
A texture whose descriptors are all gone later stays on the write-driven path (nothing counts them down).

Reads by written tiles: each texture keeps a hash of its part in every 64 KiB tile (TilePieces). When some
of its tiles were written, those parts are hashed in place first; equal, and the texture is unchanged
without a whole read. The watch reports writes per 64 KiB tile (the geometry cells' fault reopens a whole
tile), so a neighbour in a written tile costs its share of that tile, not a read of all of it.

The 10 s line: textures written or new, read whole, found unchanged by their parts, uploaded, named for the
first time, not named by any descriptor (not read), ms a pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:41:15 -05:00
9aed60a222 d3d12: title texture tiles over memory not committed yet are armed, and a kernel write in progress is waited out, not read (RT-TITLE-TEXTURE-WRITE-TRACKED)
Run 57 showed 99.9 % of the arms refused, 60,637 tiles not armed and about 8,700 textures looked at per pass
(60-68 ms a pass). The refusals were this watch's own: a tile with any page not committed was refused, so
every streamed texture registered before its memory arrived was named and its arming retried at every pass,
and a texture never filled because its memory was not readable was named again at every pass too.

Now pages not committed are left as they are: xmem's commit or mapping bumps the tile's cell, and the mapping
change makes the textures over it probe their memory again. A texture whose memory is not readable is not
named again until then, except one the title mapped (its pages may be committed under the Map pointer). A tile
pinned for a kernel write is busy: the texture is not read (which uploaded half-written textures at every pass
until the write ended) and is read once the pin is gone. Only a tile whose guard cannot be set is read at every
pass. The log line counts busy looks and arms apart from refusals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:00:13 -05:00
2e16339cd0 d3d12: the title texture refresh looks only at textures whose pages were written, not at every texture's bytes (RT-TITLE-TEXTURE-WRITE-TRACKED)
Before every submission (at most every 16 ms, and not at all when a view held the registry), the refresh hashed
every mapped or stale texture and a round robin of the rest (sampled, a full hash every sixth pass), within
byte and time budgets that could split the planes of one video frame over passes.

Now each title texture filled from memory is watched through the geometry watch's cells: its 64 KiB tiles, at
its CPU view and every other address xmem maps them at, are armed read-only; a write faults once per tile, and
the fault, a mapping change or a kernel write's opening queues the tile (geometry_writes::WriteQueue, new). The
refresh, at every submission and with the registry waited for, takes that queue and reads only the textures over
the written tiles (TitleTextureWatch, src/title_texture_watch.h), arming them again before the read; a texture
nobody wrote costs nothing. A tile that cannot be armed (not committed, pinned, no fault handler) names its
textures at every pass: the one fallback. A fill whose full hash equals the last one uploads nothing. A slot-70
view no longer hashes its texture: it fills only one never filled or known changed.

Removed with the hash pass: LEONIDA_TITLE_TEXTURE_PERIOD_MS, _CHECK_KB, _FILL_MB, _FILL_MS,
LEONIDA_TEXTURE_HASH_BUDGET_US, LEONIDA_TEXTURE_SWEEP_BUDGET_US, LEONIDA_TITLE_EVERY_BUDGET_US,
LEONIDA_TITLE_VIEW_REFRESH_MS and the async mode LEONIDA_TEXTURE_REFRESH_ASYNC (its worker pass, first-use
fills, mapped list and range index). A line every 10 s counts passes, textures looked at, uploaded, unchanged,
written tiles and arms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 17:25:15 -05:00