fix(ffx): normalize unsupported Series S render sizes before context creation #3022
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3022"
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 maestroBR on 2026-12-02T00:13:44Z.
Coordination: #2570. A claim has not yet been posted; update this line with the claim link before submission.
What and why
Fix context creation for intercepted FFX dispatch when a Series S profile requests a 960x540 render allocation with 1920x1080 output.
The previous normalization checked only the output dimensions. Because 1080p output already matched the shipped configuration, an unsupported render allocation reached the console FSR DLL unchanged. Context creation was rejected; the existing failure path can subsequently produce a zero jitter-phase count and an integer divide-by-zero after loading.
Normalize valid-looking descriptions when either the output or the render allocation is unsupported. Preserve both accepted render allocations (1280x720 tight and 1920x1080 legacy), invalid-input passthrough, and restoration of the caller's original description after context creation. The existing interception remains limited to stretch/DLSS dispatch; native FSR rendering is unchanged.
Regression assertions cover 960x540 and 1152x648 render allocations at 1080p output, plus the accepted legacy allocation. Only d3d12/crates/leonida-hle/src/modules/ffx.rs is included.
Tested
Targeted command, from d3d12/ with the MSVC environment and NVIDIA SDK configured:
The full library suite used the same command without the modules::ffx::tests filter.
GPUs tested: n/a for automated validation. The reported failure was observed locally on Windows with an NVIDIA RTX 5060 Ti 8 GB. Post-fix gameplay, frame rate and long-session stability have not been verified; this PR makes no performance guarantee.
AI-assisted: yes. Implementation and validation assisted by Codex (exact serving model identifier unavailable); independent read-only review by chatgpt/gpt-6.1-sol.
Checklist
2705632c56with the identical final ffx.rs blob3cc0e689f8.Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-02T00:15:28Z.
Checked the 640x360 case mentioned in #3013 in addition to the two sizes in the regression test. I compiled sizes_to_stand_in and SHIPPED unchanged from the parent and
755833d88on Windows. At 1920x1080 output, the parent passed through 640x360, 960x540 and 1152x648. The PR substitutes 1280x720 for all three. Both revisions leave the accepted 1280x720 and 1920x1080 allocations alone, as well as a zero-width control. This verifies the context size selection only. I did not run a scene or reproduce the reported crash. Codex-assisted.Imported from ubiquitarianism/leonida. Originally posted by limittox on 2026-12-02T04:36:15Z.
Tested #3022 in game on an RTX 3060 Ti 8 GB: the crash is fixed, but the 3D scene is black at render scale 0.5
Applied
755833d88on top ofmain002bd88f8(cherry-picked, nothing else changed),target\diagbuilt with DLSS (diagnostics,dlss,mimalloc).System: NVIDIA GeForce RTX 3060 Ti 8 GB, driver 610.88, Resizable BAR off, Intel Core i5-12600K, 32 GB RAM, Windows 11 Pro 26300.
Scripted route from a save in the opening boat scene, about 6 minutes a run. Frame time is the median over in-world frame lines.
-Dlss performance(0.5)made_for=([1280, 720], [1920, 1080])-Dlss quality-NoDlss+LEONIDA_RENDER_SCALE=0.5(stretch)Before this PR, the same
-Dlss performancestart crashed every time on this PC with 0xc0000094 at title+0x28f03e8: 2 of 2 stock starts atf9f3ec4, plus 3 more with my own patch attempts (side note below). With it, none of the 3 runs crashed.The black scene shows with DLSS and with the plain stretch alike, so it doesn't look DLSS-specific. DLSS logs
feature made input=(960, 540) output=(1920, 1080), and the upscale dispatches carrycolour_size=(960, 540), so the dispatch itself looks right. My guess is that the colour rendered at 960x540 is already black before the upscale, but I haven't checked that. DLSS quality on the same build is fine.Side note from before this PR: noting the FidelityFX quality mode at +0x28ef69a and dropping the "FSR maximum = scaled size" patch both left the crash in place. That fits the context sizes being the cause, which is what this PR changes.
GPUs tested: NVIDIA GeForce RTX 3060 Ti 8 GB, driver 610.88, Windows 11 Pro 26300.
AI-assisted: the tests were run and this comment was written with Claude Opus 5.5 (Anthropic), and reviewed by me before posting.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:37:01Z.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by limittox on 2026-12-02T18:06:56Z.
Run report for
755833d88merged ontomain: render scale 0.5 no longer crashes and the 3D scene draws (4 of 4 runs);mainalone crashed in 3 of 3Head
755833d883, merged withgit mergeontomainacc3507455(no conflicts, nothing else changed). For comparison,mainalone at the sameacc3507455.mainhas moved since (45dc41f95when I posted this). None of the commits afteracc3507455touchffx.rsorleonida-loader. They do change:leonida-gpu(fg.rs,host.rs) and one shader-optimizer file;scripts/play-d3d12.ps1now precompiles every recorded pipeline by default, andplay-nvidia.ps1has new default settings;The head still merges cleanly onto
45dc41f95(git merge-tree), but I didn't rerun on it.Both builds are
target\diag(diagnostics,dlss,mimalloc).System: NVIDIA GeForce RTX 3060 Ti 8 GB, driver 610.88, Resizable BAR off, Intel Core i5-12600K, 32 GB RAM, Windows 11 Pro 26300.
I used the launcher's default settings. The only extras are
LEONIDA_KEYSandLEONIDA_KEYS_FILE, which drive my scripted route:Each run loads one save in the opening boat scene and goes through three stretches, about 11 minutes in the world in all:
The two builds took turns over 10 runs.
-Dlss performance(0.5)mainLEONIDA_RENDER_SCALE=0.5main-Dlss qualitymainmaincrashes. All three are an unhandled 0xc0000094 at title+0x28f03e8, the same address as in my earlier report. Each came about 46 s after the runtime started, right after the title's first upscale dispatch. That is while loading, before the first world frame.render=[960, 540] upscale=[1920, 1080] made_for=([1280, 720], [1920, 1080]) flags=0x29 result=0. DLSS performance logsfeature made input=(960, 540) output=(1920, 1080).-Dlss qualitymakes its context as asked, at 1280x720, on both builds.-Dlss quality. This PR shouldn't change that path, and the PR andmainstay within run-to-run spread: standing medians 24.8 and 24.8 fps against 24.8 and 24.0.Why the scene is no longer black. This updates my earlier report. In that report, this PR on
main002bd88f8left the 3D scene black at 0.5. Onacc3507455the scene draws.To rule out my settings: the earlier runs added
LEONIDA_FPS_CAP=30,LEONIDA_TEXTURE_BUDGET_MB=3000andLEONIDA_WINDOWS_BAR_MB=0, and the runs above don't. I did one extra PR run onacc3507455with-Dlss performanceand those three settings, and it also drew normally:So the settings don't explain the earlier black scene; the newer
maindoes.60 pull requests were merged between
002bd88f8andacc3507455. Two of them change the render-scale patches inleonida-loader, and none touchffx.rs:591bd23a7). Its commit message describes the same symptom on Series X: the HUD over a black world at render scales below 1.0.The logs fit #2756:
hook applied what="render scale: FSR maximum = scaled size"(5 resolution levers applied).So #2756 is the most likely fix. I haven't bisected it, though.
Not counted:
-Dlss quality. It didn't crash.AI-assisted: Claude Opus 5.5 (Anthropic) scripted the runs and wrote this report while I was away. Two separate read-only reviewer agents rechecked the numbers against the raw logs and the wording against the project's rules. I haven't reviewed it myself yet.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:12:09Z.
Reviewed #3022 (code review only, not built here: Windows-only). The change stops the 0xC0000094 crash, but the only in-game run reports a black 3D scene at render scale 0.5 with it, and that has not been answered.
755833d883(unchanged since 1 December)main45dc41f95cgit merge-tree); merge base913b88b905, 313 commits behindd3d12/crates/leonida-hle/src/modules/ffx.rspython -I tools/d3d12_switches.py --check d3d12/docs/switches.md: exit 0Review
sizes_to_stand_in(ffx.rs:241-246on the head) now stands in the shipped1280x720 -> 1920x1080pair whenever the render size is neither1280x720nor1920x1080, even when the output is already1920x1080. That turns Series S960x540 -> 1920x1080(and1152x648) from "context refused, title divides by zero" into "context made for other sizes". The unit test pins exactly that.1280x720is harmless when the title renders960x540. The doc comment says only the context's queries (jitter sequence) are used, but the jitter phase count FSR derives from the render/output ratio differs between 1.5x and 2x. A wrong phase count or jitter scale is a plausible cause of a broken picture.-Dlss performanceand with the plain stretch atLEONIDA_RENDER_SCALE=0.5.-Dlss quality(1280x720, no stand-in) was normal. The black scene shows only where the stand-in is used, so this PR is the first suspect until shown otherwise.Verdict: defects. Before merging: explain or fix the black scene at 0.5 (for example, check that the jitter the title gets from the stand-in context matches what it gets for its own sizes), and post the in-game run. A crash that becomes a black screen is not yet a fix for Series S users.
AI-assisted: Claude Opus 5.5 (Claude Code), review only.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:19:04Z.
VERIFY-3022 — Windows nativo:
red then green, y el caso que cambia la lógica está en las aserciones que el PR actualiza(this PR)mainb41763227main—merge-treeclean,git merge --no-ffcleanRan
Negative control (synthetic): I put the exact old condition back (
(size(render) && size(upscale) && upscale != SHIPPED.1).then_some(SHIPPED)) and rebuilt:The updated test bites on the logic the PR changes, not just on its own existence.
What the change is: the stand-in context now accepts a render size equal to the shipped output (
render == SHIPPED.1) as well as the shipped render size, and rejects the case where only the output matches (upscale != SHIPPED.1 || !accepted_render). The comment says why: "Series S at 960x540 to 1920x1080 has the same failure: a shipped output size alone does not make its smaller render allocation valid" — 960x540 → 1920x1080 now gets the shipped pair, and 1920x1080 → 1920x1080 gets none.What I could not test: the failure it fixes is a
0xC0000094inside the title's own FFX context; the tests drivesizes_to_stand_inwith sizes, and no title was run. A test-only change to a guard:red then greenhere, nothing more.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by limittox on 2026-12-02T23:23:58Z.
On the review: my run report (posted just before your review) covers the black scene, and at 0.5 the jitter repeats every 32 upscales (the 2x period), not every 18 (the stand-in's 1.5x)
The black scene. My run report went up five minutes before the review:
mainacc3507455, render scale 0.5 drew the 3D scene in 4 of 4 runs, with no crash. One of the four used my earlier settings (FPS cap, texture budget, no BAR windows).mainalone crashed in 3 of 3.render scale: FSR maximum = scaled size; the new runs don't. I haven't bisected it.The jitter. To check your concern, I logged what the title passes to each upscale with
LEONIDA_UPSCALE_PROBE=1. The probe logs the first 12 upscales, then one in every 300.755833d88merged ontoacc3507455.-Dlss performance-Dlss quality"Periods that fit" lists each P from 2 to 128 for which any two upscales logged with jitter have the same jitter exactly when their upscale numbers are equal modulo P. The first 3 upscales, before the title's first reset, carry no jitter and are left out. FSR's phase count is 8 × (output / render)²: 32 at 2x and 18 at 1.5x.
This fits the doc comment: the phase-count query names its own render and output widths, so the sizes the context was made for don't enter it.
Neither run had a crash, device removal, panic or other fault. The 0.5 run drew normally: 17 screenshots average 124 brightness out of 255. They stay local and aren't attached.
What this doesn't check: picture quality beyond "draws normally", or how DLSS uses the jitter. That code path is the same at quality, where no stand-in is involved.
AI-assisted: Claude Opus 5.5 (Claude Code) scripted the runs, wrote the period check and this reply. A separate read-only reviewer agent rechecked it against the raw logs.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T09:37:50Z.
RUN (in game, before and after, RTX 4060 8 GB, driver 610.88, Windows 11). Series S,
-Dlss performance(960x540 to 1920x1080) without the DLSS files, so the title's own FidelityFX upscaler path, frame generation 2x,LEONIDA_FG_LIMIT_FPS=30,-PrecompileUsed, the same walking route, 330 s.d9b618f10aloned9b618f10+ this head755833d88(git merge --no-ff)made_for=([1280, 720], [1920, 1080]),result=0; the title's sizes put back0xC0000094) in the title imageThe crash without this change is the one several players report as code 3221225620 with
-SeriesS -Dlss performance; this reproduces it and shows it gone with this head.Verdict: PASS for the in-game gate on this head, and the crash it targets is reproduced on
mainand absent with it.Limits: one run each way. The DLSS files were absent, so the DLSS path itself was not exercised (the setting fell back to the title's upscaler, which is the path this change is about). Pictures were not checked for the upscale's quality. 1152x648 (the other size the change covers) was not tried. If this pull request changes its head, this run no longer covers it.
AI-assisted (Claude Code).