Skip to content

D3D12.X: borderless fullscreen on Alt+Enter / F11, the image at its aspect - #604

Closed
simnJS wants to merge 2 commits into
xcl-dev:mainfrom
simnJS:window-fullscreen
Closed

simnJS wants to merge 2 commits into
xcl-dev:mainfrom
simnJS:window-fullscreen

Conversation

@simnJS

@simnJS simnJS commented Nov 24, 2026 •

Copy link
Copy Markdown

Stacked on #555; only the top commit (a452faa) belongs here.

The XCL window was a fixed WS_OVERLAPPEDWINDOW and DXGI's Alt+Enter is off (DXGI_MWA_NO_ALT_ENTER), so a player could not fill the screen; and the area filter of #555 stretched the image over the whole client area whatever its shape. Alt+Enter or F11 now toggles borderless fullscreen on the window's monitor and back (previous style, size and position restored), fullscreen = true in xcl.toml starts in it, and when the client's shape differs from the image's the image keeps its aspect ratio, centred, with black bars. Not exclusive fullscreen; Alt+Enter does not press A.

What is in it

  • D3D12.X: borderless fullscreen on Alt+Enter / F11, the image at its aspect (one commit, +360 / -20):
    • crates/xcl/src/hle/d3d12x/window_mode.rs (new): the key decision (Alt+Enter, F11; auto-repeat and the Alt+Enter WM_SYSCHAR eaten), the toggle (WS_POPUP over the monitor's full rectangle, Get/SetWindowPlacement on the way back), letterbox (the largest centred rectangle of the image's aspect), the tests.
    • present/downscale.rs: Scaler::record draws into that rectangle (viewport, scissor, its origin in the shader's constants) after clearing the back buffer to opaque black. The Copy route is unchanged.
    • present.rs: the keys in wndproc, the start in fullscreen in window_thread, the rectangle on the Filter route.
    • kbm.rs: Enter held with Alt is not A until Enter is released; config.rs: fullscreen (default false); README.md (Controls).

Tested

  • NVIDIA GeForce RTX 4080 SUPER (driver 621.01, 32-lane waves), AMD Ryzen 9 7950X3D, 63 GB; Windows 11 Pro build 26300; Rust 1.99.1 (stable-x86_64-pc-windows-msvc); DXC 1.8.2502.11 (Windows SDK 10.0.26100.0).
  • scripts/test.ps1 (debug) on a452faa: 687 passed, 0 failed, 41 ignored.
  • SKIPPED on this adapter (no wave64): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware.
  • New tests: window_mode (rectangle for 16:10, 21:9, 32:9, 4:3, same-ratio and odd clients; monitor rectangle and style; key decision; a real hidden window toggled and restored; a GPU draw into two other-shaped clients: bars opaque black – fails without the clear –, the image area equal to the CPU area filter into the rectangle), kbm (alt_enter_is_not_a), config (the new key).
  • Retail title 1.0.2.1 (release build of 2aa5b70, the same change on D3D12.X: shrink the game image to the window with an area filter #555's previous base): a script posted F11 / Alt+Enter to the window and reshaped it during a 60 s run. F11: client 2560x1440 at 0,0, style WS_POPUP; Alt+Enter: back to 1280x720 at its place with its frame; a 1280x1000 client (letterboxed); 1280x720; F11 twice. Each change logged present: swap chain WxH, no ResizeBuffers refusal, no device removal, 1526 of 1526 PresentX shown.

Regression run

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: NVIDIA GeForce RTX 4080 SUPER
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1568 (PresentX 1568)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14799 MB
xcl-smoke v1
commit: a452faa3c541ea61c753ba8d49dfc9ef3fb5d99c
gpu: NVIDIA GeForce RTX 4080 SUPER
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1576 (PresentX 1576)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15204 MB

Same title for 60 s, XCL_NETWORK=0, a 1280x720 window (windowed: the fullscreen code path is not taken in this run), the title's save folder emptied before each run.

Not tested

  • The black bars by eye on the retail title (checked by the GPU test), a monitor that is not 16:9, several monitors, DPI changes.
  • Exclusive fullscreen (not offered), HDR.
  • AMD and Intel GPUs, Windows 10.

AI use

  • Claude Code with Claude Opus 5.5: wrote the code and the tests (a Claude Code worker session, Claude Opus 5.5), ran the test suite, the fullscreen script and the regression runs, and wrote this description.

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)
…spect

The XCL window was a fixed WS_OVERLAPPEDWINDOW and DXGI's Alt+Enter is
off (DXGI_MWA_NO_ALT_ENTER), so a player could not fill the screen; and
the area filter stretched the image over the whole client area whatever
its shape.

- hle/d3d12x/window_mode.rs (new): Alt+Enter / F11 toggle borderless
  fullscreen – WS_POPUP over the whole rectangle of the window's monitor
  (not its work area), the previous style and placement restored on the
  way back (Get/SetWindowPlacement). Still no exclusive fullscreen.
  Auto-repeat and the Alt+Enter WM_SYSCHAR (DefWindowProc beeps) are
  eaten. `letterbox`: the largest centred rectangle of the image's
  aspect in the client area (a side within a pixel of the client's
  fills it, so rounding leaves no 1-pixel bar).
- present/downscale.rs: Scaler::record draws into that rectangle
  (viewport, scissor, its origin in the shader's constants) after
  clearing the back buffer to opaque black. The Copy route (client as
  large as the image on both sides) is unchanged.
- present.rs: integration lines only – the keys in wndproc, the start
  in fullscreen in window_thread, the rectangle passed on the Filter
  route.
- kbm.rs: Enter held with Alt is not A (gameinput::keyboard reads
  Enter as A), until Enter is released; Space still is.
- config.rs: `fullscreen = false` in xcl.toml, true starts in it.

Tests: window_mode (rectangle for 16:10, 21:9, 32:9, 4:3, same-ratio
and odd clients; monitor rectangle and style; key decision; a real
hidden window toggled and restored; a GPU draw into two other-shaped
clients: bars opaque black – the test fails without the clear –, the
image area equal to the CPU area filter into the rectangle), kbm
(Alt+Enter is not A), config (the new key).

Assisted-by: Claude Code (Claude Opus 5.5)
@futurepro62

Copy link
Copy Markdown

Tested exact head a452faa (on its base 9ce2070).

Tested

Not tested

  • Alt+Enter / F11 and the downscale (no interactive run), the whole workspace suite to the end on this head (lib tests only, above), a retail title or scripts/smoke.ps1 (no title on this machine), AMD, a release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of a452faa3c541ea61c753ba8d49dfc9ef3fb5d99c on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge), so the tree tested includes the stack under it (#555).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 710 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 669 passed, 0 failed, 21 ignored
  • 0 SKIPPED; alt_enter_and_f11_toggle_plain_enter_does_not and fullscreen_covers_the_monitor_without_a_frame pass.

Review: It overlaps #734 in purpose (borderless fullscreen and the image at its aspect on top of #555), so the maintainer will want one of the two; I did not compare them line by line.

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 onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

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.

3 participants