Repository navigation
Conversation
Text and thin lines of a retail title looked jagged in the XCL window. Root cause: the title presents 3840x2160, present.rs copied it into a swap chain of the same size (DXGI_SCALING_STRETCH) and DWM shrank it to the window (1280x720 by default) with a single bilinear tap per pixel: at 3x or 1.5x it skips texels, so strokes get uneven and edges stair-step. A full-size frame dump of the same frame is clean. When the window's client area is smaller than the image on either side, the swap chain now takes the client size (ResizeBuffers on resize) and a full-screen triangle draws the image into it: its pixel shader averages the whole footprint of each window pixel (area filter, exact partial texel weights), in linear light - 8/10-bit UNORM decoded and encoded with the sRGB curve (the swap chain's default colour space), an _SRGB source through its view, FP16 (scRGB) as is. A window as large as the image keeps the copy; a minimized one (0x0) shows nothing and keeps its swap chain. Without DXC (or a pipeline the device refuses) the copy stays, with one log line. Frame dumps still read the title's own image. One "present:" line names the route and the sizes. Resizes: the presenter draws on the title's adopted device, whose CreateRenderTargetView hook (note_rtv) keeps a reference to every view's resource; the filter's view of a back buffer would hold one swap chain buffer and make every ResizeBuffers fail (DXGI_ERROR_INVALID_CALL), so Scaler::record forgets its own view at once. A refused ResizeBuffers is logged once per size and asked for again twice a second; the frame is still shown, drawn at the swap chain's current size. present_now's per-frame work is present_frame, so a test can drive it. Tests: the route decision; a GPU test drawing 1-pixel lines and a checker from 3840x2160 and 1920x1080 into 1280x720 against a CPU area filter (within 1.5 of 255); a GPU test on an adopted device with a hidden window: frames at 1280x720, 1920x1080, 800x450 (each new back buffer matches the CPU filter), minimized, 1280x720 again, and a refused resize that still shows the frame. Assisted-by: Claude Code (Claude Opus 5.5)
Dropping a Presenter released the swap chain, the scaler's descriptor heaps and the title's image while its last present's command list could still be running on the GPU. swap_chain_follows_the_window drops its presenter right after the last present_frame; when the list was still running, the device was suspended (0x887A0005) and the GPU tests that ran after it failed. That happens intermittently and depends on timing. The drop now waits for the presenter's fence (2 s at most; not after a failed Signal, when the presenter is disabled). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 16:9 image in a window of another shape (a 21:9 or 16:10 screen) was stretched to it. The swap chain is now the client area's size and the image is placed in it by `scaling` (xcl.toml, XCL_SCALING): - "fit" (default): the aspect ratio is kept, with black bars - "integer": whole multiples only (falls back to fit in a smaller window) - "stretch": the old behaviour An image that lands 1:1 (3840x2160 in a 5120x2160 client area) is copied texel for texel at its place (Route::Place, after clearing the bars). Other sizes go through the area filter, which now draws into a rectangle (viewport + an origin root constant) with the bars cleared to black. Without DXC the old stretched copy stays. Tests: place() for each scaling, the routes, and on the GPU a 1280x720 image placed 1:1 in 1680x720 (exact texels, black bars) and filtered into 1032x432 (against a CPU area filter). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oice At 125 % display scaling Windows enlarged the DPI-unaware XCL window, so the game's image was drawn smaller and blurred back up. - The process is per-monitor DPI aware (V2), set in host_main before the window exists. window_width / window_height are at 100 % and scaled by the monitor's DPI, and WM_DPICHANGED takes the size Windows suggests. - `fullscreen` (XCL_FULLSCREEN): a borderless window over the monitor at its native resolution. Alt+Enter or F11 switches while running. - `monitor` (XCL_MONITOR): "primary", a number from the list logged at start, or a device name. "auto" placement centres on a named monitor. Test: pick_monitor() for each kind of setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 xcl-dev#505.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test run and review of Tested
Review
Not tested
AI use
|
|
Tested on Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32). Tested
Regression run ( main ( PR #735 ( Not tested: Ultrawide AI use: Antigravity ( |
|
Test run of Tested
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 Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
@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#1. (Claude Code, Claude Opus 5.5) |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Stacked 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 (bdab194 and 91f9a5e; bdab194 had passed with 4 threads earlier the same night, and the driver logs GPU errors). Single-threaded,main91f9a5e passes (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