Skip to content

Add native Series X ultrawide output and HUD controls - #2958

Open
invismann wants to merge 8 commits into
ProjectLeonida:mainfrom
invismann:feat/mandy-ultrawide
Open

invismann wants to merge 8 commits into
ProjectLeonida:mainfrom
invismann:feat/mandy-ultrawide

Conversation

@invismann

@invismann invismann commented Dec 1, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: Native Series X ultrawide.

Depends on: #2889, #2900

What and why

  • Add native Series X presets for 21:9 and 32:9 with independent render height selection. Match monitor selects a fixed preset and reports which one it picked. The 21:9 class includes 2560×1080, 3840×1600, and 5120×2160.
  • Expose aspect ratio and HUD correction in the launchers and F1. The HUD can stay at the screen edges, move inward, or use the stock layout with correction off.
  • Size render-target allocations and shadow tiles for the widescreen scene. Apply the HUD layout to the wider map and its markers while keeping loading artwork centered.

Simulated merges with #2889 and #2900 reported content conflicts in the loader output planner (d3d12/crates/leonida-loader/src/hooks.rs).

Tested

  • Built leonida with the pinned Rust toolchain on Windows. The earlier red/green run found eight launcher tests that failed on the base and passed with this PR.
  • In the review follow-up, two Rust regressions failed before the fixes. On the updated code, 16 focused Rust tests passed, including both synthetic D3D12 compositor readbacks.
  • All five Node launcher cases and 56 Python launcher and switch-doc checks passed. The generated registry check passed on the reviewed head and after the fixes. It lists LEONIDA_DISPLAY_PROFILE_TEST_IMAGE under test-only switches.

GPUs tested: NVIDIA GeForce RTX 4090, driver 621.01, Windows, for synthetic compositor readbacks.

Retail gameplay, in-game HUD and map appearance, and stability with the 7200/8000 MiB render-target heap and 1600 MiB scene-pool budgets remain unverified on this branch. The Foxhound reference port records outdoor shadow, loading, and map checks on Windows with an RTX 4090 at 5120×1440 DLAA.

AI-assisted: yes. Implementation and verification used OpenAI Codex (GPT-6). The independent read-only review used GPT-6.2 Sol.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption. The changed-file clean-room scan passed.
  • The shadow tile rule and its validation are recorded in docs/design.md.

Expose 3440x1440, 3840x1080 and 5120x1440 through the launchers and F1
menu. Keep render height independent of output and apply the retail HUD,
memory and directional-shadow changes through the loader and presenter.

Port the Victory changes through 6944be606 on 4ffd627ce. Use Foxhound PR
readmet3xt-lab/foxhound#281 and its opt-in HUD follow-up cf95b5e3f as
references for the PresentX adaptation.
@andrew-ai

Copy link
Copy Markdown

Found a fractional-DPI edge case in the web launcher's monitor fallback at launcher/index.html:486–489 on 858fdd6. When the server has no monitor hint, a 5120×1440 screen represented as 2926×823 CSS pixels at devicePixelRatio 1.75 reconstructs to 5121×1440. The exact 32:9 comparison then returns false. Match monitor hides the HUD controls and switchArgs omits a selected HUD position, while the native classifier given 5120×1440 selects the superwide profile.

I executed the PR's ultrawideSelected in Node with synthetic window.screen values and a Series X auto configuration. The same panel matched at 100%, 125%, 150%, and 200%, and missed at 175%. An explicit 32:9 selection bypasses the fallback. A regression case with fractional scaling and a tolerance for CSS-pixel rounding would cover this path.

Separately I compiled the PR's output_for and maximum_scene functions in a standalone Rust harness. The three explicit output geometries matched at native size. At 75% the 5120×1440 preset gave a 3840×1080 scene. These are geometry checks with synthetic inputs. No physical ultrawide panel or game run was used. Codex-assisted for #2570.

@merzleckeier

Copy link
Copy Markdown
Contributor

The new HUD readback fails on both adapters with the bundled Microsoft compiler. I tested 858fdd676 merged into 1a52f5b63 with Wine 11.22 / VKD3D-Proton 3.1.0, using RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1).

The stock compose::tests::centers_edge_hud_without_moving_the_middle_on_gpu fails at Composer::for_device(..., true) with 0x80004005 before the texture readback. The existing premultiplied composition test passes and reads the same pixels as main on each adapter. A test-only diagnostic and an isolated D3DCompile call locate the failure with Microsoft d3dcompiler_47.dll 10.0.10150.0 at the wide ps_5_1 entry. It reports X8000, invalid operand type for operand 2 of opcode 138. The wide VS and CS and the existing narrow PS compile with that DLL.

Changing only the wide pixel shader target to ps_5_0 made the complete compose::tests:: selection pass 2/2 on each GPU. The unchanged centered-HUD test reached its synthetic 16×8 readback and checked both moved edges and the unchanged middle. The Wine built-in compiler still fails compositor initialization with that change. Its standalone compilation emits a blob and warns that it ignores RootSignature.

There is also a separate CI failure after #2934. python -I tests/test_d3d12_switches.py passes 19/20 on the merge because eight names are missing from d3d12/docs/switches.md. python -I tools/d3d12_switches.py --out d3d12/docs/switches.md followed by the same test passes 20/20 with only the generated page changed.

Synthetic inputs only. No game run. MEASURED with OpenAI Codex and independent raw-log verification.

@andrew-ai

Copy link
Copy Markdown

Checked the centered-HUD shader on native Windows at 858fdd6, on an RTX 5070 (driver 616.92). The original ps_5_1 target passed the centered-HUD readback and the existing premultiplied-plane control with each of three Microsoft d3dcompiler_47.dll versions:

DLL file version Source GPU readbacks
10.0.17763.132 Windows SDK 2/2 passed
10.0.26100.7175 Windows SDK 2/2 passed
10.0.26100.10068 Windows System32 2/2 passed

Built the compose::tests:: selection with --features diagnostics. I used the same test executable for all three runs, logging the loaded module path and the adapter selected by the compositor. Both hardware branches ran. The narrow control returned the same three RGBA pixels in all three runs.

This adds three known-working compiler versions for the proposed shader on native Windows. The 10.0.10150.0 DLL from the reported Wine failure was outside this comparison, so OS and compiler version are still confounded across the two reports. Synthetic textures only. Codex-assisted for #2570.

Regenerate the switch reference for the drift check added in ProjectLeonida#2934.

Validated four launcher cases, all 20 switch-documentation checks, and both synthetic D3D12 readbacks on Windows with an RTX 4090 (driver 621.01). Independent review used GPT-6.2 Sol.
@andrew-ai

Copy link
Copy Markdown

Confirmed the fractional-DPI fix at e7912f6. At 5120×1440 and 175%, the earlier head emitted only -SeriesX -AspectRatio auto. The revised launcher also emits the selected -HudPosition center.

I exercised both ultrawideSelected and switchArgs from each revision with synthetic CSS screen dimensions. Across six panel geometries (5120×1440, 3840×1080, 3440×1440, 3840×2160, 2560×1440, 1920×1200) and 13 scaling factors from 100% through 400% in 25-point steps, mismatches fell from 14/78 to 0/78. All four new Node regression tests passed. This closes my earlier monitor-fallback finding. Codex-assisted.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid feature, and the fail-closed retail checks (hash first, then expected bytes per patch) are the right shape. The HUD split is correctly UI-only, and I confirmed the pause/Game gating is genuinely covered — replacing !(ui == Game || (wide && ui == Pause)) with ui != Game fails a_queued_present_uses_the_captured_gameplay_state. But I would not merge yet; four things:

  1. The switch registry check fails. python -I tools/d3d12_switches.py --check d3d12/docs/switches.md exits 1 on eight names: LEONIDA_ASPECT_RATIO, LEONIDA_HUD_POSITION, LEONIDA_NATIVE_ULTRAWIDE, LEONIDA_ULTRAWIDE_HUD, LEONIDA_UI_LETTERBOX, LEONIDA_RT_HEAP_MB, LEONIDA_SCENE_POOL_MB, and the test-only LEONIDA_DISPLAY_PROFILE_TEST_IMAGE. Several escape hatches (RT_HEAP_MB, SCENE_POOL_MB, UI_LETTERBOX) are documented nowhere else. Add them, and exempt or document the test hook.
  2. world_marker::fit_sprite is a no-op. It computes scale() * canvas_scale (world_marker.rs:235-237) with scale() = 16H/(9W) (:88-97) and canvas_scale = W*2160/(H*3840), which is exactly 1.0 for every supported preset, and fit_at(..., 1.0) returns the original viewport — so labels are never narrowed into the centered 16:9 band. Use scale() (already 3840/layout_width) and add a fit_sprite unit test; the existing pure test calls fit_at(..., 0.5) directly, so it cannot see this.
  3. Match monitor is default-on, not opt-in. play-nvidia.ps1:642-645 forces LEONIDA_ASPECT_RATIO=auto for every Series X start, which is a real behaviour change for existing users. It also doesn't classify 2560×1080 (common 21:9) or 3840×1600 as wide (aspect.rs:77 requires width >= 3440), so Match monitor returns None there, and on 5120×2160 it silently downshifts to 3440×1440. Either extend classify and warn/test those sizes, or make it explicitly opt-in like the other wide switches.
  4. The visual claims have no on-branch test. The body says "GPUs tested: n/a" and cites an external Foxhound/4090 run; the image-dependent tests self-skip without the retail executable. That may be acceptable, but say "unverified on this branch" explicitly rather than leaving the reader to infer it — especially for the 7200/8000 MiB RT heap and 1600 MiB scene pool, which are magic values with no measurement.

Also: HudLayout::ToEdges/edge_hud looks unreachable because edges = wide_overlay && hud_at_edges() (host.rs:13850), so wide=false, edges=true cannot occur — split-mode coverage is less than it looks. And LEONIDA_DISPLAY_PROFILE_TEST_IMAGE is a test-only hook that should not be user-facing.

No generated artifacts or game data: check_no_game_data passes over all 43 files, the docs tests pass, and every crate suite is green (661 + 420 + 86 + 247 + 51, plus the launcher tests and the wide-shadow semantic fixture). Merge is clean against current main; #2900 conflicts in loader/src/hooks.rs (both touch resolution_levers), #2851 only shares switches.md, and #2915 is clean.

Select the supported fixed preset for more 21:9 panel sizes, remove the unreachable HUD split path, and document the output and memory overrides.

Verified 16 focused Rust tests including both synthetic D3D12 readbacks on Windows with an RTX 4090 (driver 621.01), 5 Node tests, and 56 Python launcher and switch checks. Independent review used GPT-6.2 Sol.
@merzleckeier

Copy link
Copy Markdown
Contributor

The current head passes the centered HUD readback with the Microsoft compiler that previously failed.

I reran compose::tests with Wine 11.22 / VKD3D-Proton 3.1.0 and Microsoft d3dcompiler_47.dll file version 10.0.10150.0. The earlier stock binary at 858fdd676 on 1a52f5b63 still fails Composer::for_device with 0x80004005 for the wide test, and passes the narrow control, on both the RTX 4070 SUPER (620.73.4) and Radeon Raphael (RADV 26.3.1). On 0c9c18977 at main 1abef08d0, both tests pass on each adapter. The wide test reaches command completion and verifies five pixels of the synthetic 16×8 image, including both moved HUD edges and the unchanged middle. The narrow control gives the same readback per adapter as the earlier binary. The build also has the test-only #2884 layered in. The compositor source blob matches #2958 integrated by itself.

With the same DLL in a standalone D3DCompile call, the current wide shader still reports X8000 on ps_5_1. The ps_5_0 target now used by the wide path compiles to 6,304 bytes. The narrow ps_5_1 and wide vertex/compute controls also compile. DLL SHA-256 8c88c162010a8d6b80f2c0433d4ce973ce626afcbc8da5be68bfa2ba68341eba.

The generated switch-registry check exits 0 on this tree. Node display tests pass 5/5 and the Python switch suite passes 20/20. This resolves the Microsoft compiler and registry failures in my earlier report for this head. Synthetic textures only. AI-assisted with OpenAI Codex and independent raw-log verification.

@matthieupl87-spec

Copy link
Copy Markdown

Retail run on a real 21:9 monitor, at the PR head 0c9c18977 (based on main c4ca57615), diag build via build-nvidia.ps1. The build has one local commit outside this PR, in run.rs, unrelated to the display path.

Rig: Ryzen 5 5600X (6 cores), 32 GB DDR4-3600, RTX 5070 Ti 16 GB, driver 621.40, Windows 11 Pro 26300. Monitor: 3440×1440 native.
Launch: scripts\play-d3d12.ps1 -AspectRatio 21:9 -HudPosition edges -Log, Series X profile, the title's own upscaler, no DLSS.

What was seen in game (about 4 min in the world, story save):

  • The picture fills the whole 3440×1440 screen: no bars, no stretch.
  • HUD at the screen edges: minimap, health and weapon placed correctly and readable.
  • Pause map: correct on the wide canvas.
  • The log shows ultrawide: positioning the map cursor relative to its display area layout_width=5160, and images from an ultrawide-… cache.
  • No crash; the window was closed normally.

Numbers (window-title fps sampled every second, 232 samples, first run of this build):

  • Median 14 fps, mean 14.8, p10 5, p90 28. Same machine at 16:9 (main, 1440p render): median 15, p90 19.
  • System RAM: up to 99 % in use (mean 89 %); GPU busy 21 %, CPU 75 %. This box is CPU-bound.
  • Some one-second hitches (frame-time log: 99th percentile around 1.08 s in the first minute). This was the first run of the build, so the pipelines were still being made. With 32 GB, RAM is also near full with the larger render-target budgets.
  • The first start ran the warm precompile for about 9 minutes before the window came up.

Not checked: 32:9, -HudPosition center and off, F1 switching, loading-movie letterboxing.

AI-assisted (Claude Code). Results are from my own run; no game data attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants