PE loader: render_resolution renders RAGE titles at the screen's aspect #735
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!735
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-735"
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?
@MrCheese5 on GitHub · 2026-11-24 04:17 UTC · original
MrCheese5:uw-c-render-resolution→main· +1431 −37 · 9 files · 5 commits · openStacked on #555, #732, #733 and #734; only the top commit belongs here. It uses
present::screen_size()from #734.On a 21:9 screen the newer retail game still rendered 16:9, so it was pillarboxed. RAGE titles take their back buffer size from a mode table in read-only data:
{w, h, 60, 1}× 5, the largest 3840x2160. Withrender_resolution("native" by default, so nothing changes unless it is set; "WxH"; or "screen";XCL_RENDER_RES), three things are patched when the executable is mapped. Each is found by its bytes, never by an address, and when a pattern is not found, a warning is logged and nothing is patched:The arena does not grow (5120x2160 overran it by 22 MB, and 4416x1864 by 1.9 MB through 128x128 tile padding), so a size must fit 3840x2176 in tiles. "screen" picks the largest 128-aligned size within 2 % of the monitor's aspect ratio: 4224x1792 for 21:9, 4992x1408 for 32:9, 3456x2176 for 16:10, and no change for 16:9.
What is in it
crates/xcl/src/widescreen.rs: the render size from the setting and the three patches, with unit tests on synthetic bytes (render size settings, only the largest mode rewritten, the break becoming a nop, the output-size loads retargeted and others left alone, and nothing done without the setter)crates/xcl/src/loader.rs:patch_imagewhen the main executable is mapped, before page protectionscrates/xcl/src/hle/d3d12x/present.rs:screen_size()crates/xcl/src/config.rs,crates/xcl/src/lib.rs,README.md:render_resolutionTested
cargo test -p xcl --lib widescreen: covered by the suite run belowcargo test --workspace -- --test-threads=1: 702 passed, 0 failed, 41 ignored; SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64)--test-threads=4, GPU tests on this machine hang or lose the device tonight onmaintoo (bdab194and91f9a5e;bdab194had passed with 4 threads earlier the same night, and the driver logs GPU errors). Single-threaded,main91f9a5epasses (cargo test -p xcl --lib -- --test-threads=1: 647 passed, 0 failed).render_resolution = "screen"on a 5120x2160 monitor (the newer retail game's account screen, intro video and loading art): a 4224x1792 back buffer at 30 fps. The UI spans the full width with its prompts in the wide screen's corner, round icons stay round, and the video and art fill 21:9. The smoke run below is with the default "native", which patches nothing.Regression run
Both runs use a fresh data root of their own and the default settings (a 1280x720 window, nothing new turned on), so this shows that nothing else changes.
Not tested
render_resolutionset (expected to log that no display-mode table was found and change nothing; not run).AI use
🤖 Generated with Claude Code
On a 21:9 screen the newer retail game still rendered 16:9, so it was pillarboxed. RAGE titles take their back buffer size from a mode table in read-only data ({w, h, 60, 1} x 5, the largest 3840x2160). With `render_resolution` ("native" by default, "WxH", or "screen"; XCL_RENDER_RES), three things are patched when the executable is mapped. Each is found by its bytes, not by an address: - The table's largest mode becomes the render size. - A debug break after the full-size targets are allocated becomes a nop. It fires when their arena has more than 2 MB left over, and its normal path follows it. - The loads of the title's output size (3840x2160, the console's output; it sits next to the render size its setter writes) read the render size instead. Without this the UI was laid out for the render size but drawn as if the screen were 4K: scaled by render/4K twice, with the bottom 17 % black and the right-hand prompts off the screen. The arena does not grow (5120x2160 overran it by 22 MB, 4416x1864 by 1.9 MB through 128x128 tile padding), so a size must fit 3840x2176 in tiles. "screen" picks the largest 128-aligned size within 2 % of the monitor's aspect ratio: 4224x1792 on a 5120x2160 monitor. Measured on the newer retail game (account screen, intro video, loading art; RTX 4090): a 4224x1792 back buffer at 30 fps, the UI spanning the full width with its prompts in the wide screen's corner and round icons (not stretched), and the video and art filling 21:9. The 3D projection is not checked yet, because the world still stops at #505. Co-Authored-By: Claude Opus 5.5 <[email protected]>@RandomGithub12309 on GitHub · 2026-11-24 04:39 UTC · original
Test run and review of
0c43a53620aba918699412e4ba25c314b45a3b73merged cleanly ontomain(f4ce27c):Tested
32.0.16.2114, wave32, SM 6.6), Intel Core Ultra 7 255HX (20 cores), Windows 11 Build 26300,rustc 1.100.0stable-x86_64-pc-windows-msvc, debug buildcargo test --workspace -- --test-threads=4:669 passed, 1 failedinsrc/lib.rs—hle::d3d12x::real::readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_statepanicked onVirtualFree(mem, 0, MEM_RELEASE) != 0(real.rs:5388, an unrelatedOpenExistingHeapFromAddressteardown timing flake onmain).coherent_buffer_sanitizes_console_flags_and_state): 1 passed, 0 failed.cargo test --workspace -- --test-threads=4): 711 passed, 0 failed, 41 ignored (downscale::tests::*,pick_monitor_by_setting, and all 4widescreen::tests::*pass).SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Review
#732/#555's pre-Presentq.Signalordering incrates/xcl/src/hle/d3d12x/present.rs.crates/xcl/src/widescreen.rs:render_size("WxH", ...)returnsSome((w, h))andpatch_imagestill rewrites the executable's mode table when!fits(w, h), logging only a warning afterward;patch_output_size(widescreen.rs:174) also subtracts0x20fromdisp32with checked subtraction instead ofwrapping_sub(0x20).Not tested
xcl run, AMD / wave64AI use
0c43a53ontof4ce27c, auditedwidescreen.rsand the stacked changes, ran the workspace suite, and wrote this report.@LocranKing on GitHub · 2026-11-24 04:46 UTC · original
Tested on Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32).
Tested
0c43a53620aba918699412e4ba25c314b45a3b73(pr-735, clean tree)8024 MiB VRAM, driver32.0.16.2101),rustc 1.100.0(x86_64-pc-windows-msvc, MSVC14.44.35207), DXC1.9.2602.17(SDK10.0.26100.0),--releasecargo test --workspace --release --no-fail-fast -- --test-threads=4: 702 passed, 0 failed, 41 ignored, exit0;2 (no wave64)skipped (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware)Regression run (
scripts/smoke.ps1, 60 s,XCL_NETWORK=0, defaultrender_resolution = "native", title folder name redacted)main (
64b3f35):PR #735 (
0c43a53):Not tested: Ultrawide
XCL_RENDER_RES=screen/WxHpatching on a non-16:9 monitor, debug build,XCL_SAMPLE_*tests on this branch, AMD / wave64 hardware.AI use: Antigravity (
Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.@MesshM on GitHub · 2026-11-24 04:47 UTC · original
Test run of
0c43a53620aba918699412e4ba25c314b45a3b73on AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge), so the tree tested includes the stack under it (#555, #732, #733, #734).Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 711 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 670 passed, 0 failed, 21 ignoredSKIPPED; allpresent/downscaletests pass,downscale_matches_a_cpu_area_filterincluded.Review: Patching a RAGE title's mode table in read-only data to the screen's aspect is title-specific and needs a retail title to check, which I do not have; I can only report that the stack builds and the suite passes on AMD, and I reviewed the top commit's structure, not its patch offsets.
Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@adriadam10 on GitHub · 2026-11-25 11:08 UTC · original
@MrCheese5 below 2560x1440 the title still allocates its display targets at 2560x1440 (it takes the largest mode, and only the last entry is rewritten); a one-commit fix on top of your branch, with a 854x480 smoke run on a GTX 1050 Ti: MrCheese5/xcl#1. (Claude Code, Claude Opus 5.5)
@DavidM1911 on GitHub · 2026-11-25 11:38 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@pickles976 on GitHub · 2026-11-25 19:24 UTC · original · edited 2026-11-25 19:28 UTC
720p runtime finding: the shipped FSR4 DLL rejects the requested output dimensions. This is a compatibility constraint to account for when exposing lower render sizes, not a request for a GPU-specific patch.
Tested a local integration of this PR's resolution changes plus MrCheese5/xcl#1 (
2dfece0b480d7d740b03ad810180efd0f6579a9a), withXCL_RENDER_RES=1280x720, Series S/lockhart, retail 1.0.2.1. Linux 6.17.0-40, Wine/vkd3d-proton, RTX 4060 Laptop 8 GB, NVIDIA 590.48.01. Not the exact stacked PR tree: our build also carries sparse-mapping, Wine-vtable/guard and GPU-source-staging changes; primary-monitor query replaces the selected-monitor helper, andscreenwas not used. Focused widescreen tests: 5 passed; release cross-build passed.Observed in a 60-second wall-bounded, isolated-Xvfb trial:
The other two patches matched too (one arena check; five output-size loads). Source frame dumps 20/140 were black; 260 through 740 were 1280x720 but a flat dark background. Inspected frame 740 visually: no visible menu or world. Later activity logs show about 60 presents/2s, which is NOT gameplay at 30fps. I have not established that the FSR rejection causes the flat background.
The loaded
amd_fidelityfx_upscaler_xbox.dllis a symlink to the supplied asset, with matching SHA-256faff02f294a7e9149ce079dffe3dedbcabe99b1f180ab14222aa8689e00a75fa; no binary patch to it. Its UTF-16 strings contain this fixed-resolution diagnostic plus fixed maxRenderSize/per-frame-renderSize and dynamic-resolution restrictions. Merely removing the validation would not establish that the packaged shader tables support another size.Guard stopped the entire trial at 60s (forced termination, exit 137; wrapper 61.04s). Peak sampled NVIDIA memory 5804 MiB; minimum available RAM 7638.8 MiB. No new kernel log entries; GPU returned to 11 MiB. Missing EDID/display-metadata errors from Xvfb also remain. Not verified: error-free execution, correct UI/world rendering, sustained gameplay performance, or 15-minute stability. No matched VRAM A/B claim.
Earlier offline/mode-table verification is on the existing follow-up: https://github.com/MrCheese5/xcl/pull/1#issuecomment-7171997029 . Rather than duplicate that work, I am reporting this additional runtime constraint here. Existing VIctory PC-FidelityFX work is tracked in Marvisak/VIctory#730 (now in its main module, with remaining Series X scale work in #1793); that may be a useful implementation reference, not something tested in this XCL run.
AI assistance: OpenAI coding assistant adapted the local integration, ran these checks, and wrote this report from observed outputs.
Follow-up with
XCL_RENDER_RES=1920x1080(compatible output size): the frame dump was 1920x1080 and noFSR_API_DEBUG_ERRORappeared before cutoff. The existingfsr4_console_upscaler_creates_a_context_probeinconsole_dlls_e2e.rsalready documents 1280x720 input / 1920x1080 output for this packaged DLL; output dimensions must not be confused with internal render dimensions. I have not captured the running title's FFX description/return code, so this is not proof of successful upscaling or its internal size.The same conservative post-freeze guard terminated this trial at 42.95 s sampled / 43.67 s wrapper time: NVIDIA memory reached 6058 MiB against the 6000 MiB cutoff, available RAM 7609.9 MiB. This is not hardware OOM; the cutoff intentionally reserves headroom after a previous whole-host freeze. Last XCL accounting: target pages 812 MB (832 MB pools), sparse pools 4096 MB (4036 MB mapped), arenas 195 MB in use / 258 MB made. Logs also reported same-recording command-list resubmission while a previous submit remained on the GPU (debug layer id 553); no causal attribution here. No new kernel entries and GPU returned to 11 MiB. Gameplay was not reached, and the guard was not relaxed to force a longer run.
@claudetools-gh on GitHub · 2026-11-26 07:51 UTC · original
@MrCheese5 one thing for sizes below 2560x1440:
patchrewrites only the largest mode, so withXCL_RENDER_RES=1920x1080the title still finds its 2560x1440 mode and takes that one. On an RTX 5070 Ti with the retail title, the log said the largest mode was now 1920x1080, and every frame was still presented at 2560x1440.Rewriting every mode with more pixels than the render size fixes it. The back buffer is then 1920x1080, and the 3-D targets are 1280x720 (a target dump in the world:
render target … 1280x720 format 10). The world went from about 2.1 to about 3.2 presents a second in the same scene. The change we run, insidepatch's loop over the tables:and a test:
Your 5120x2160 case is unchanged (no mode is larger), and
patch_rewrites_the_largest_mode_onlystill passes. Tested on a port of your top commit ontomain08db802without the rest of the stack:cargo test --release -p xcl --lib -- widescreen, 5 passed.Not tested: sizes between the table's modes other than 1920x1080; the UI at that size (the movement hint drew correctly at 1920x1080).
AI-assisted.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.