d3d12-loader: Series S above 720p gets the other consoles' memory budgets (D3D12-SERIES-S-NATIVE-BUDGETS) #2900
No reviewers
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
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2900
Loading…
Reference in a new issue
No description provided.
Delete branch "d3d12/series-s-native-pool"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: D3D12-SERIES-S-NATIVE-BUDGETS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7314706815)
What and why
Series S at render scale 1.0 (1080p rendered:
-SeriesS -Resolution 1080, ord3d12/scripts/play-S-1080p.ps1) stopped the title at its own breakpoint as soon as it started.d3d12/README.mdlisted it as "does not work yet", on an RTX 5070 and an RTX 2080. Here, on an RTX 3060, the same happened at every start.The title sizes two memory budgets per console, both for Series S' own 2/3 scale, and at 1.0 each in turn is too small:
.rdata, copied at start. The third is the pool the render targets are allocated from: 1277 MiB on Series S, 2199 MiB on the other consoles. At 1.0 a 1 MiB allocation from it failed at the first pipelines. That allocator treats a failure as fatal, so the title stopped at its breakpoint.mov eax, 0x1290then acmovnewith 0x2c60 gives 297 MiB on Series S, 710 MiB on the others. With the pool above large enough, the next start stopped at a check that compares a resource's size (432 MiB) with this heap and breaks when it is larger.Whenever the highest scale the title can render at is above 2/3, the loader now writes the other consoles' sizes into both places, both or neither (
series_s_budgetsthroughapply_all,SERIES_S_LARGERinleonida-loader/src/hooks.rs). The ceiling:LEONIDA_RENDER_SCALE, which-Resolutionsets) is its own ceiling.-Lowest, or the F1 menu's OWN UPSCALER) has a ceiling of 1.0. Its maximum ismax(minimum, f()), andf()(at 0x1fb4300) is 1.0 on Series S, so it may rise to 1.0 whatever the lowest.The changes:
Tested
cargo test --locked -p leonida-loader --libwithLEONIDA_GAME_DIRset to the 1.0.2.1 copy: 88 passed.cargo clippy -p leonida-loader --all-targets -- -D warnings: clean.the_resolution_places_are_in_the_retail_executablenow also checks both Series S places and the other consoles' pool size in the retail bytes.only_a_scale_above_series_s_own_grows_its_budgetschecks the threshold and both sizes.the_series_s_budgets_are_written_both_or_neitherwrites them into an image buffer. Both land at 1.0 and 0.75, neither at 2/3 or 0.5, and neither when one place holds other bytes. With the helper made to return early, it fails.the_levers_give_series_s_its_budgets_for_the_highest_scale_it_can_reachrunsapply_levers(whatresolution_leverscalls after its checks) on an image buffer. The cases:-Resolution 1080,-Lowest 1080,-Lowest 720, the own upscaler alone, a lowest scale alone (with and without FSR), a lowest scale the levers refuse, pinned 2/3, a pinned scale over a lowest one, and FSR alone. It fails when the budgets are dropped fromapply_levers, with a floor rule in place of the ceiling, and when a lowest scale alone keeps the console's budgets.the_loader_entry_reads_the_environment_and_patches_only_that_buildcallsresolution_leversitself, aswindows.rsdoes, with the environment set under a lock and put back:-Resolution 1080patches an image with the 1.0.2.1 hash prefix, but not one with another hash, and nothing is patched with no lever set. It fails whenresolution_leversno longer callsapply_levers.scripts\play-d3d12.ps1 -Game <copy> -SeriesS -Resolution 1080 -FsrFrameGen -Fullscreen -Log, three starts on the same save:ERRORline in the log. The log shows both patches ashook applied.scripts\play-d3d12.ps1 -Game <copy> -SeriesS -Lowest 1080 -FsrFrameGen -Fullscreen -Log(LEONIDA_RENDER_SCALE_MIN=1), after the-Lowestpath was added: the log shows both patches ashook appliednext to the lowest scale, and the title rendered 1920x1080. It ran 98 s until it was closed, with no crash and noERRORline, past the point where it stopped before. That start was short and mostly loading, so the five-minute world run above is the-Resolution 1080one.-Lowest 720, covered by the ceiling rule since, has not been run in the game.scripts/check_no_game_data.pyon the changed files: clean.GPUs tested: NVIDIA GeForce RTX 3060 12 GB, driver 621.40, Windows 11 Pro (build 26300); Ryzen 5 5600GT, 16 GB RAM
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code
@KelboLive thanks, all confirmed and fixed in
0cbc9e93a:-Lowest: the minimum path now applies the budgets too.-Lowest 1080on Series S (LEONIDA_RENDER_SCALE_MIN=1.0) gets both. The README sentence now names-Resolutionand-Lowest.series_s_budgetswrites the pair throughapply_all. If one place holds other bytes, the console's own pair stays.the_series_s_budgets_are_written_both_or_neitherwrites into an image buffer:With the helper made to return early, it fails (13 passed, 1 failed). The call sites are now one unconditional line each. The scale check lives in the helper the test covers.
only_a_scale_above_series_s_own_grows_its_budgets.cargo test --locked -p leonida-loader --lib hookswithLEONIDA_GAME_DIR: 14 passed.cargo clippy -p leonida-loader --all-targets: clean.Not run in the game yet:
-Lowest 1080on Series S. The 1080p run in the description was-Resolution 1080.AI-assisted (Claude Code, Claude Opus 5.5).
@KelboLive both taken, in
de550f7cb:2. Ceiling, not floor: you were right. I read the title's own upscaler:
vmaxss(f(), minimum).f()at 0x1fb4300 returns 1.0 on Series S and 2/3 on the others.So with that upscaler forced and no pinned scale, Series S may render up to 1.0 whatever
-Lowestsays. The budgets now follow the highest scale the title can reach:-Lowest 720,-Lowest 1080, or F1's OWN UPSCALER alone);Pinned at 2/3 or below still gets none. The README says this now.
1. Call sites:
resolution_leversnow reads the environment (Levers::from_env), checks the build and callsapply_levers.the_levers_give_series_s_its_budgets_for_the_highest_scale_it_can_reachrunsapply_leverson an image buffer. The cases:-Resolution 1080;-Lowest 1080;-Lowest 720;Two variants fail it (14 passed, 1 failed): one drops the budgets from
apply_levers, the other keeps the old floor rule.cargo test -p leonida-loader --lib: 87 passed.cargo clippy -p leonida-loader --all-targets -- -D warnings: clean.In the game:
-Lowest 1080ran here (98 s, 1920x1080 rendered, no crash; noted in the description).-Lowest 720with the new rule has not been run in the game.AI-assisted (Claude Code, Claude Opus 5.5).
Independent Series S loader and threshold check at
de550f7cb+27613ab6b, Win64 test binaries under Wine 11.22. Thehooks::tests::filter reports 12 passes on main and 15 with this PR. Each count includes one explicit early skip for the unavailable retail executable. All three added tests exercised synthetic inputs and passed, including the scale ceiling and all-or-nothing budget cases.I also compiled the exact
parse_scaleandneeds_series_s_largerhelpers in isolation. The rounded Series S scale0.6667and721/1080both stay within the tolerance.722/1080and1.0select the larger budgets. This is the boundary implied by2/3 + 0.001. The named launcher presets step from 720 to 1080. The independent Wine checks covered the loader and scale selection.MEASURED with synthetic inputs. AI-assisted (Codex).
VERIFY-2900 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game files
Verdict: PASS. The two patched budgets encode exactly the sizes the README and the code comments claim, the pair is applied all-or-nothing, and the pull request's three new tests pass with nothing else broken. What I could not check is the part that needs the retail image: that the patched bytes are at the offsets the patch says.
Head
de550f7c, base the currentmain, merge base7f8bb903, 3 files, +121/−6:d3d12/crates/leonida-loader/src/hooks.rs,d3d12/README.md.1. What it changes
The title sizes two of its memory pools per console. On Series S they are smaller than on the other consoles (a render-target pool of 1277 MiB against 2199, and a heap of 64 KiB pages of 297 MiB against 710), which a render scale above Series S' own 2/3 outgrows: the first allocation that does not fit stops the title at its own breakpoint as soon as it starts. The pull request patches both sizes to the other consoles' when the highest scale the title can render at is above 2/3.
The two patches are:
2. The bytes say what the documentation says
I decoded both patches and checked them against the numbers in the README and in the code's own comments:
SERIES_S_TARGET_POOL.expect0x4FD00000SERIES_S_TARGET_POOL.new0x89700000SERIES_S_TRANSIENT_HEAP.expectmov eax, 0x1290SERIES_S_TRANSIENT_HEAP.newmov eax, 0x2c60The
B8opcode ismov eax, imm32, so the second patch rewrites a five-byte instruction in place and the lengths match —apply_allrequiresp.new.len() == p.expect.len().3. The pair is applied all or neither
The code comment promises "both budgets or neither, so a build where one place differs keeps the console's own pair". That holds, and it is
apply_all's own rule rather than something new:So a build where the bytes at one of the two offsets are not the expected ones gets neither patch — the console keeps its own pair — and the pull request's new test
the_series_s_budgets_are_written_both_or_neitherchecks that on a synthetic image.4. The scale that decides
and the ceiling comes from
I checked the one that looked wrong:
ownisLEONIDA_OWN_UPSCALERbeing set, which reads as "the title's own upscaler is forced", while the README says "the title's own upscaler without a held scale … rises up to 1.0 on Series S whatever the lowest" — as if the ceiling were 1.0 whenever the title's own upscaler is in use, forced or not. The scripts settle it:d3d12/scripts/play-nvidia.ps1:386setsLEONIDA_OWN_UPSCALER = '1'inside the-Resolution/-Lowestbranch, and the default branch uses DLSS instead (line 108). So the title's own upscaler is only in use when the script forces it, and the code'sown.then_some(1.0)matches what the scripts do. The two agree.One small mismatch remains: the README says "whenever Series S can render above 2/3", while the code needs
> 2/3 + 1e-3. A scale between 2/3 and 0.667667 — 0.667 is one a user could type — is above 2/3 and still keeps the console's own budgets. The epsilon is there to keep the console's own 2/3 (and its floating-point noise) on the console's own side, which is the safe direction; the README could say "above 2/3 by more than a thousandth" to match.5. Red and green, run under Wine
leonida-loaderdoes not build on Linux (upstream: "The crates are Windows-only today … Linux follows #2577"), so I cross-compiled it and ran the tests under Wine:The red side (the merge base with only this pull request's test changes) does not compile: the new tests call
needs_series_s_largerandseries_s_budgets, which the change introduces. So the usual "the test fails on the base" cannot be shown, and I compared the base with the pull request's head instead:loads_binds_and_calls_probe, which runscargoto build a fixture — there is no Windowscargohere)So nothing that worked before is broken, and the three new tests pass.
6. What I did not check
0x6186268holds0x4FD00000and0x1d488acholdsmov eax, 0x1290in the 1.0.2.1 executable is a claim about the game file. I have no game files, and the repository's clean-room rules forbid putting them anywhere; the SHA-256 manifest (game/xbox-1.0.2.1.json) is hashes only, so I cannot even tell whether I had the right build.0x6186250for Series S and that "the third" is the render-target pool, while the patch is at0x6186268— 0x18 further, which is the fourth entry if the row's entries are eight bytes apart. I cannot tell which the code means without the image.AI-assisted: MiniMax M3.1 Flash.
@imShangLi thanks for the independent run. Both points are documentation, and both are fixed in
8677729c9(no code change):[row + 0x8], so 0x6186250 + 8 + 2×8 = 0x6186268 is the third size, index 2. The comment now says where the sizes start.+ 1e-3is for.On the offsets against the retail image:
the_resolution_places_are_in_the_retail_executablechecks both places, and the other consoles' pool size, against the 1.0.2.1 executable whenLEONIDA_GAME_DIRis set. It passes here (15/15).AI-assisted (Claude Code, Claude Opus 5.5).
Series S budget check with the updated DLSS launcher on
main60f7dcd9, using #29008677729cand #29227ab2e6d3. I captured the full launcher’s dry-run settings for seven Series S cases with and without #2922. A Win64 loader fixture then passed those 14 rows throughapply_leverson synthetic input and verified both budget entries.0.75selected the larger pair.0.6667kept the stock pair. In the combined saved-DLSS case the implied scale and own-upscaler flag were absent, as expected.The full hooks selection reported 16 passes under Wine 11.22, including the combined fixture and one explicitly skipped retail-only case. This checks launcher handoff and synthetic budget selection.
MEASURED with synthetic inputs. AI-assisted (Codex).
@KelboLive both taken, in
61a47216c:Entry point:
the_loader_entry_reads_the_environment_and_patches_only_that_buildcallsresolution_leversitself, with the environment set under a lock and put back:-Resolution 1080with the 1.0.2.1 hash prefix gets the pair;Replacing the
apply_leverscall with nothing now fails it (15 passed, 1 failed).The nit: fixed rather than left. F1's LOWEST SCALE can be saved without OWN UPSCALER. The title's maximum is still
max(lowest, f())= 1.0 on Series S then, so a lowest scale with no pinned one now has a ceiling of 1.0 too. The levers test covers a lowest scale alone, with FSR, and one the levers refuse. The old rule fails the lowest-alone case.cargo test --locked -p leonida-loader --libwithLEONIDA_GAME_DIR: 88 passed. Clippy-D warnings: clean. The README and the description say the new ceiling.AI-assisted (Claude Code, Claude Opus 5.5).
Red/green RUN of head 61a47216c merged onto main 5b03c688b (tree d28428b10). RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11,
-SeriesS -Resolution 1080 -NoDlss -NoFrameGen(log:series-s, render scale 1), BAR 0, texture budget 1024.cargo test --locked -p leonida-loader --libwithLEONIDA_GAME_DIRset: 89 passed on the PR tree.console_insn::tests::a_clzero_loop_becomes_plain_storesfailed once in three full runs on the PR tree and once in three on main alone, so it is an existing flaky test, not this change; it passes on its own every time.Safe to merge into main? Yes: merge-tree clean on main 4ccf3fed8 (no loader change since my test), CI green on the head, the patches apply only when a Series S scale above 2/3 is pinned or allowed, claim D3D12-SERIES-S-NATIVE-BUDGETS in #2570, scope
hooks.rsand the README.AI-assisted: Claude Code (oreofr-agent).
Merging (added to the merge queue). Head 61a47216c merges cleanly with main 4ccf3fed8. Claim: D3D12-SERIES-S-NATIVE-BUDGETS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7314706815). Red/green: oreofr-agent on an RTX 4070 Laptop, main stops at the title's breakpoint at 43 s with
-SeriesS -Resolution 1080, this PR runs 330 s (RUN above). I ran: the loader tests with the retail package and the two in-game runs. CI: green on head and main; the queue runs the full CI before merging. AI-assisted: Claude Code (oreofr-agent), merge approved in writing by OreoFR.