Skin (face/head) stays black on a low-frame-rate machine: RECHECK_FRAMES is counted in frames, so its time window doubles at half the console's frame rate #2608
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?
Imported from ubiquitarianism/leonida. Originally posted by zhengyuanrouying-code on 2026-11-29T08:41:54Z.
Summary
On my machine (Ryzen 5 5600, RTX 4070, 24 GB, Windows 11) the d3d12 runtime runs the world at 12–14 fps, about a third of the console's 30. At that rate Jason's body skin appeared but his head/face stayed black for the whole run, no matter how long I waited.
The cause turned out to be
RECHECK_FRAMESincrates/leonida-gpu/src/draw.rs:These are frame counts, not seconds. They sum to 576 frames:
The textures are streamed and rewritten well after their views are written. At 14 fps the early re-looks (4, 12, 40 frames) happen while the texture is still being written, so each look finds it changed and uploads it again — and the texture never settles. The head texture is much larger than the hands', so it needs longer to finish writing, and it kept losing the race.
Making the schedule slower fixed it. I changed it to:
At 14 fps that is 82 s, but the texture now finishes writing before the look, so it is uploaded once, correctly, instead of being re-uploaded repeatedly. Body and head then both appear within about a minute.
Reproduction
LEONIDA_PAGE_WRITES=all(needed for the body; without it the body stays black too)-Resolution 1080, stockRECHECK_FRAMESChanging
LEONIDA_HEAP_RECHECK_EVERYalone does not help here — that variable only governs the looks after the five inRECHECK_FRAMES, and by then the damage is done.Measurements
RECHECK_FRAMES[4, 12, 40, 120, 400](stock)[2, 6, 20, 60, 120][8, 24, 80, 240, 800]Frame breakdown at 12.6 fps, 4,326 draws/frame:
Suggestion
Two possible fixes, both small:
RECHECK_FRAMESas a switch (e.g.LEONIDA_HEAP_RECHECK_FRAMES=8,24,80,240,800) so low-frame-rate machines can retune it without patching the source.LEONIDA_HEAP_RECHECK_EVERYalready exists and does not cover this — users reasonably assume it does.Environment
Other observations from the same session (lower confidence)
LEONIDA_HEAP_RECHECK_EVERY=100made the frame rate collapse to 3–6 fps with 150–240 MB of texture uploads per frame; the default 300 is much better and reaches the same visual result onceRECHECK_FRAMESis given enough time.LEONIDA_CARD_BUFFERS_MB=768(down from the default 1536) raisedcopying backfrom ~10 ms to ~50 ms on this 12 GB card. The default is right.LEONIDA_WINDOWS_BAR_MB=0had the same effect (~50 mscopying back), consistent with #2578's finding that the setting does not change fps, but on this card it made the copy-back path slower.Happy to test a patch. Thank you for the project — it is the only way I get to play this.
Imported from ubiquitarianism/leonida. Originally posted by zhengyuanrouying-code on 2026-11-29T09:26:57Z.
Confirmed with screenshots, and a narrower window than I first thought
Two screenshots from the same spot, same save, same settings — the only difference is
RECHECK_FRAMES:[9, 27, 90, 270, 900](2.25×) — the man stays black:[8, 24, 80, 240, 800](2×) — both characters render:Note the earlier state on the same run,
[9, 27, 90, 270, 900]at 17:10 — the woman is already correct while the man is still black, so the two characters are not on the same schedule:The window is narrow
RECHECK_FRAMES[4, 12, 40, 120, 400](stock)[2, 6, 20, 60, 120][6, 18, 60, 180, 600][7, 21, 70, 210, 700][8, 24, 80, 240, 800][9, 27, 90, 270, 900]The re-upload count is the useful signal: it bottoms out at 2× (219) and doubles at 1.75× (472). 2.25× is close in count (226) but still misses, which suggests the last look's timing matters as much as the total.
So a single "scale by frame time" factor is probably not enough. What would help more:
RECHECK_FRAMES, keep looking every N frames regardless ofLEONIDA_HEAP_RECHECK_EVERY, so a texture that settles late is still caught.LEONIDA_HEAP_RECHECK_FRAMES=8,24,80,240,800lets each machine find its own window without a rebuild. That is all I needed in the end.Everything else about the runtime is working well for me at 12–14 fps, which I understand is in line with the project's current numbers. Thanks again.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T12:37:54Z.
The test branch at
5b3900bc0exposes the five initial intervals. With the same executable and save, leaveLEONIDA_HEAP_RECHECK_FRAMESunset for the original4,12,40,120,400, or set$env:LEONIDA_HEAP_RECHECK_FRAMES = "8,24,80,240,800"in PowerShell before starting the existing launcher. KeepLEONIDA_HEAP_RECHECK_EVERYat the same value in both runs. An invalid list uses the original values.The Windows x64 build and targeted parser test passed under Wine 11.22. Four isolated processes verified unset, valid and invalid input, and independence from
LEONIDA_HEAP_RECHECK_EVERY. The full crate suite had 534 passes, with the same four failures as unmodifiedcc0f662aunder this Wine setup. The visual result on the reported setup is still open. Coordination claim. AI-assisted with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-29T16:59:12Z.
PROVISIONAL (n=1 each way, not yet a clean A/B): a data point from a different machine. With the stock schedule the face was missing, and with
LEONIDA_HEAP_RECHECK_FRAMES=8,24,80,240,800from merzleckeier's test commit it was drawn. The two runs differ in more than that variable (listed below), so this is not proof yet.What differs besides the variable: the executable (RUN 1 has no test commit), cold against warm caches, the frame rate (under 1 fps against 7.6), and the driver's shader cache size. What would refute the reading: the face also being drawn with RUN 2's executable and the variable unset, at the same spot with warm caches. That would mean RUN 1's cold first session explains the missing face, not the intervals. That same-executable A/B is the next run here, and I'll post it under this comment.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-29T17:19:42Z.
Follow-up to my PROVISIONAL data point above: a same-executable A/B refutes my reading for this machine.
RUN 2 and RUN 3 used the same executable, warm caches and the same driver setting. The face was drawn with the stock intervals (RUN 3) as well as with
8,24,80,240,800(RUN 2). So on this machine, at 7 to 8 rendered fps, the missing face in RUN 1 came with the cold first session (under 1 fps while pipelines compiled), not from the recheck intervals, and my RUN 2 is no evidence for the change here. This does not contradict the 12-14 fps report at the top, which comes from a different machine.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T04:33:21Z.
A narrow point that saves whoever fixes this a second investigation: the C++ runtime does not have the same frame-counted schedule, so this change does not need a counterpart there.
What I checked in
runtime/(grep forRECHECK,FRAMES, frame-counted comparisons):runtime/shims/d3d12_compute_input_probe.h:207has arecheck()but it is a per-state probe, not a schedule;runtime/shims/d3d12_vulkan_device.cpp:16925onwards is the title's texture rechecks - the same problem area as yourRECHECK_FRAMES- and it is counted in wall time and attempts (probes,waited,rechecks[where] += waited), with the totals printed at:17801. Nothing there is measured in frames, so a machine at 12 fps does not get a longer window by construction.So the frame/seconds confusion is in
crates/leonida-gpu/src/draw.rsalone, which is what your fix addresses.One thing worth deciding before the change lands, and it is the only part of your report I would push back on: doubling the schedule fixes the symptom by making the window longer than the write, which means on a fast machine it now waits ~80 s of frames before the last look - the texture is correct, but late. If the ordering guarantee is what is missing (the view written before the texture finishes), an event or "upload when the write lands" is the fix that does not trade one machine's correctness for another machine's latency. Your measurement proves the window is too short at 14 fps; it does not yet show that a longer window is the only way to close it.
What I cannot do: this machine has no
cargo, sod3d12/does not build here and I cannot measure either version. The above is read from the C++ side, which I can build and run.Written with an AI assistant.