d3d12: textures flicker black, view records written to the title's heap by unwatched writers (port_descriptors fallback can't keep up) #3394
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Reference
No Branch/Tag specified
Notifications
4 participants
Due date
No due date set.
Reference
leonida/mandy#3394
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
In game, textures flicker black for a few frames at a time. Every run logs thousands of
renderer port 2: a view record in the title's heap that no store told of (found by the fallback; made now). A slot whose view record no mark told of shows its old view, or none, until the port_descriptors fallback reaches its page, and the fallback falls behind.Commit
Current
mainas of 2026-12-03 (FILL IN:git rev-parse --short HEAD). No local patches.System
LEONIDA_OUTPUT=2560x1440),-HardwareRT. - The same warnings show on an RTX 4070, about 4,100 in a 7-minute run.Where
assets
Command and steps
Launcher defaults plus
-HardwareRT, Series X, 1440p. Play from a save, on foot and driving. It happens every run, within the first minute.Output
Phase 2 of the diagnostics in #3429 was run by @Otavmacedo (RTX 3070 8 GB, 427 s in the world, n=1), and it changes the picture:
VCRUNTIME140.dll's copy routine and two addresses in one page that no module holds; the title's own sites drop out of the top six after the first minute.memcpy/memmovecalls into the heap a frame, marking 0 records: the title's own copies carry no view records.leonida.exeimportsVCRUNTIME140.dll, so a copy made by the runtime itself is the leading candidate for the writer.Next step worth taking: capture one frame up from those
VCRUNTIME140sites (the caller ofmemcpy) and name its module — that is what the current instrumentation cannot show. It is not in #3429 (diagnostics only); anyone can take it under this item.The follow-up phase 2 asked for is now in #3429 (
1cd95b811): one copy in 64 into the heap is sampled and its caller outside our own image is named (module.dll+0x…), printed after the writers.A
LEONIDA_PORT_DESCRIPTORS=1run will name the code that callsVCRUNTIME140's copy — the remaining unknown in the phase-2 report. That run is still open for anyone with a machine free; no game run was made here.Ran #3467 (
3587853c72,LEONIDA_PORT_DESCRIPTORS=1, NVIDIA RTX 5070 12 GB, Windows 11, 315 s) and symbolized theleonida.execaller recorded at theVCRUNTIME140.dllguard faults (full report on #3467):VCRUNTIME140.dllwriters share one caller:d3d12/crates/leonida-gpu/src/port_descriptors.rs:543(port_descriptors::copy→copied()→real(to, from, n)), our ownmemcpywrapper — not an unrelated runtime copy.copied()already checks the full range and saw0view records (0off-grid tags) across4,016heap copies/frame,VCRUNTIME140.dllis an attribution artifact ofport_descriptors::faulted()tracking one writer per 64 KiB block (off >> 16): frequent non-viewmemcpycalls into the same 64 KiB block overwritea.writers[block]and mask the real missed writer before the fallback runs.912warnings — looks like a dynamic stub/trampoline) and three sites inside the title's image (268,262, and65warnings). Skippinga.writersupdates duringport_descriptors::copy/shift(or tracking per 4 KiB page) should uncover the remaining masked writers cleanly.AI-assisted.
I prepared two additional generated descriptor layouts for the fallback and writer-attribution work. The adjacent-view case complements the sampler-straddle check.
A0/B0before publication andA1/B1afterward. The two control views retain their pixels. Observing both dirty pages should rebuild the straddling record once.These are proposed GPU and fault-trace checks. The independent synthetic archive tests for this issue already verified equal Present windows, an
unknowncaller group, and partial status when counter snapshots or flash markers cannot be aligned. Keeping the unattributed remainder visible avoids overstating what a per-block sample says about a specific descriptor. Issue #3394 · Writer attribution #3467 · Sampler straddle #3448 · Fallback #3477The generated views start at byte offsets 65,532 and 65,564 around a 65,536-byte boundary. In the attribution control, the descriptor is at offset 128 and the ordinary 64-byte copies start at offsets 8,192 and 73,728 for the same-block and other-block variants.
I have a generated descriptor-report fixture that compares equal confirmed HostPresent windows and keeps missing writer/caller attribution visible. It covers reports with incomplete writer tallies, a missing Present, an archive binding mismatch, unresolved flash times, and a missing route boundary. The generated fixture passed on Windows. It distinguishes a report UTC window from a confirmed per-frame attribution window.
The companion hardware controls remain the previously posted two generated SRV layouts. Existing layouts · Caller tracing #3467
The adjacent-view case passed against the actual
plan_partsimplementation fromf4b0404e95fain a standalone Windows CPU harness. Four 32-byte records begin 36 bytes before a 64 KiB watch-page boundary. With only the second page dirty, the plan emits the crossing record once as its own span and groups the next two records. With both pages dirty, it adds the first-page neighbor and still emits the crossing record once.The generated case, using byte ranges relative to the page boundary and exclusive end offsets, expects:
[-4, 28),[28, 92)[-36, -4),[-4, 28),[28, 92)The test-only patch applies to that base. Generated GPU pixel readback for both views is still pending. Earlier layout · Merged fallback #3477
AI-assisted.
Follow-up to the adjacent-view CPU check. The in-tree Windows Cargo test passed at
f4b0404e95fa. I ran the same assertions in a standalone harness with the exactplan_partsimplementation from575c55c6b424, the first parent of the #3477 merge. The old planner emitted only[28, 92)when the second page was dirty. The assertion caught the missing crossing span[-4, 28). Earlier result · Merged planner change #3477The generated fixture can be added to the existing
testsmodule inport_descriptors.rs.Generated GPU pixel readback for the two views remains pending. AI-assisted.