D3D12.X: shrink the game image to the window with an area filter #555
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!555
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/555/head"
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?
@simnJS on GitHub · 2026-11-24 01:43 UTC · original
present-area-filter→main· +669 −31 · 2 files · 1 commits · closed without mergingA window smaller than the title's image showed jagged text and thin lines. The title presents 3840x2160;
present.rscopied that image into a swap chain of the same size (DXGI_SCALING_STRETCH) and DWM shrank it to the XCL window (1280x720 by default) with one bilinear tap per window pixel, which skips texels at 3x or 1.5x. Now, when the client area is smaller than the image, the swap chain takes the client size and XCL draws the image into it with an area filter (each texel weighted by the area it covers, in linear light). A window as large as the image keeps the copy; a minimized one shows nothing; without DXC the copy stays, with one log line.Fixes #554
Rebased on main
9ce2070(merges cleanly withcb868b2too). Since the first push:swap_chain_follows_the_windowwaits for its last frame before dropping its presenter – dropping it with the filter's draw still on the GPU hung the device every GPU test of the process shares (DXGI_ERROR_DEVICE_HUNG), which failedtitle_textures/vramtests in most--test-threads=4runs; 6 of 6 green with the wait.What is in it
D3D12.X: shrink the game image to the window with an area filter(one commit):crates/xcl/src/hle/d3d12x/present/downscale.rs(new):route(Copy / Filter / Skip),Scaler(full-screen triangle, area-filter pixel shader with its root signature, compiled withdxc::compile_cached), the tests.crates/xcl/src/hle/d3d12x/present.rs:present_frame(the per-frame work ofpresent_now, so a test can drive it), the swap chain at the client size,client_size,scaler_ready, a logged and throttledResizeBuffersrefusal that still shows the frame at the current size, onepresent:line for the route.note_rtvat once: the adopted device'sCreateRenderTargetViewhook keeps a reference to every view's resource, and one held swap chain buffer made everyResizeBuffersfail (DXGI_ERROR_INVALID_CALL).Tested
scripts/test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4, debug) on57a13c1: 687 passed, 0 failed, 41 ignored.gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware.route_filters_only_when_the_window_is_smaller;downscale_matches_a_cpu_area_filter(1-pixel lines and a checker, 3840x2160 and 1920x1080 into 1280x720, within 1.5 of 255; fails by 73 with the sRGB decode removed from the shader);swap_chain_follows_the_window(adopted device, hidden window: 1280x720, 1920x1080, 800x450, minimized, 1280x720, and a refused resize that still shows the frame; fails at 1920x1080 with 0x887A0001 without thenote_rtvline).present: 3840x2160 image in a 1280x720 client area – area filter into a swap chain of the client size; menu text is clean where main's is jagged (checked against a full-sizeXCL_FRAME_DUMP_FULL=1dump of the same screen).present: swap chain WxH, noResizeBuffersrefusal, no device removal; 1682 of 1802 PresentX were shown, the other 120 during the 4 s minimized. Without thenote_rtvline: 635 of 1156.Regression run
Same title for 60 s,
XCL_NETWORK=0, a 1280x720 window (the PR's run uses the filter), the title's save folder emptied before each run.Not tested
README.mdis not changed; #450 also changespresent.rs.AI use
@alpz1000 on GitHub · 2026-11-24 02:53 UTC · original · edited 2026-11-24 02:57 UTC
Independent Present/downscale check of
57a13c110e1f5e81f7e8409968630cd28eb6a339on RTX 3060 12 GB, driver 610.88 (32.0.16.1088), Intel i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc, SDK DXC 1.9.2602.17, debug.XCL_ADAPTER=3060.Tested:
cargo test --locked -p xcl --lib d3d12x::present:: -- --test-threads=4 --nocapturepassed 9/9 with no skips, including GPU/CPU area-filter comparison and the hidden-window swap-chain resize test. I then ran the same filter in six fresh processes with four test threads. All six passed all nine, with no skip or device-hung messages.Not tested: full workspace concurrency with texture/VRAM tests, visual retail gameplay, or other adapters.
AI use: OpenAI Codex (GPT-6) ran the local tests and drafted this report.
Follow-up: parallel GPU test groups. Same RTX 3060 and toolchain. I ran
cargo test --locked -p xcl --lib -- --test-threads=4 --nocapture d3d12x::present::downscale::tests d3d12x::title_textures::tests d3d12x::vram::teststhree times per revision, withXCL_ADAPTER=3060.9ce2070eccf436d7bd38601c90407da447df34f3: 3/3 clean, 15 tests per run. It has no downscale tests.57a13c110e1f5e81f7e8409968630cd28eb6a339: 2/3 clean, 18 tests in each successful run. Run 3 exited with D3D12 device removal0x887a0006.swap_chain_follows_the_windowhad already reported ok. The next relevant line was the placed-texture test's512 unreleased 1 MiB textures over 16 MiBmemory summary, then device removal before that test completed.This shows an intermittent device hang with the combined test groups on this setup. The base comparison does not isolate the cause because it lacks the three added tests. No retail files or full workspace run. Codex ran the checks and summarized the logs.
@Chrysana on GitHub · 2026-11-24 03:04 UTC · original
Test report for
57a13c1on AMD RDNA4, which Not tested lists: the shrunk image is visibly smoother on this card, and the runs show no regression.Setup: AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 25H2 build 26200.9974, rustc 1.100.0
x86_64-pc-windows-msvc, DXC 1.9.2602.17. Retail title 1.0.2.1 (presents 3840x2160), XCL's window not resized. Debug build for the tests, release builds for the runs.Tests:
cargo test --workspace --no-fail-fast -- --test-threads=4at57a13c1: 687 passed, 0 failed, 41 ignored.SKIPPED: the two debug-layer tests (the D3D12 debug layer isn't installed here).By eye: I watched eight runs:
mainand this PR merged ontomainback to back, then six more, knowing which build each was. The menu's button-prompt text was smooth and anti-aliased in all three runs with this change (merged ontomaintwice, and at its own head) and jagged in the five without it (maintwice, another PR merged ontomaintwice, and that PR's head).Title runs:
scripts/smoke.ps1 -Game <folder> -Seconds 60withXCL_PRESS_A_AT=14,17,21, same saved state.57a13c1merged ontomain18c105a(clean, local merge2873e09, not pushed):main18c105a57a13c1merged onto18c105a57a13c1(its own base9ce2070)On
18c105athe title reaches its first menu a little later, so the scripted presses (last at 21 s) come too early and the runs stay in the menus (a manual press goes on). The head's own base reaches the intro video. No crash or device removal in any run.Regression run:
main:PR merged onto
main:PR head:
Not tested: a resized or minimized window; a window larger than the image; HDR; moving between monitors; no pixel-level comparison (by eye only).
AI use: Claude Code with Claude Opus 5.5 built the commits, ran the tests and the title runs, and wrote this report. The visual comparison was done by me.
Pull request closed