Skip to content

dxgi: preserve explicit scaling when matching a physical display mode - #8711

Closed
LukeOsland1 wants to merge 3 commits into
ProjectLeonida:mainfrom
LukeOsland1:codex/dxgi-match-explicit-mode
Closed

LukeOsland1 wants to merge 3 commits into
ProjectLeonida:mainfrom
LukeOsland1:codex/dxgi-match-explicit-mode

Conversation

@LukeOsland1

Copy link
Copy Markdown
Contributor

Depends on: #8482

Coordination claim.

After #8482 both centered and stretched modes are listed, but requesting one by its exact descriptor could still return a different variant. The closest-mode search omitted stretched candidates and treated equal size and refresh as a tie regardless of scaling. It now includes the candidate classes requested and uses the exact rational refresh, scan order, and scaling to break ties. Both closest-mode interfaces share this lookup.

On Windows, I passed every explicitly centered or stretched RGBA8 mode from the two attached monitors to both interfaces and compared each result with native DXGI. The regression in the PR checks one available timing per scaling variant and monitor.

RTX 4070 Ti SUPER display Modes tested per interface Parent b7e39dc mismatches per interface Head 8cad6b1 mismatches per interface
Display 0 440 440 0
Display 1 266 266 0

The regression failed with the parent runtime. The full dxgi_swapchain_test passed on the head with Vulkan validation enabled on the RTX (32.0.16.1088) and integrated AMD Radeon (32.0.21042.62), with zero validation errors. Both monitors attach to the RTX. The Radeon exercised the swapchain suite. Interlaced modes were unavailable on these displays.

AI-assisted with Codex. Synthetic tests only.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head 8cad6b1d5 merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo, NVIDIA GeForce RTX 5060 Ti, driver 610.88):

  • python -I scripts/check_no_game_data.py on both changed files: clean (exit 0)
  • cmake --build runtime/build --target dxgi_swapchain_test --parallel: built cleanly
  • ctest --test-dir runtime/build -R dxgi_swapchain --output-on-failure -V: 2/2 passed (dxgi_swapchain: CreateSwapChainForHwnd: 45 descriptions compared with the host runtime, 0 mismatches, PASS; dxgi_swapchain_count: PASS)

AI-assisted.

@MartinIndra02

Copy link
Copy Markdown
Contributor

Independent build + test: PASS, but the new check is vacuous on this machine

AI-assisted (Claude Code). Windows 11 x64, MSVC 19.44.35220, Ninja RelWithDebInfo, NVIDIA GeForce RTX 3080 driver 621.24 / 32.0.16.2124, one monitor attached.

Head 8cad6b1d5 (on top of #8482's b7e39dc0d), merged locally with current main 867d922f0 (clean merge).

Test Result
dxgi_swapchain_test.exe with LEONIDA_VK_VALIDATION=1 exit 0, PASS (... 0 validation errors), 45 descriptions compared with the host runtime, 0 mismatches
same with runtime/shims/dxgi_com.cpp from the parent b7e39dc0d also exit 0

The parent passes too because this display offers no scaled modes. A temporary probe in same_explicit_matches printed 15 host modes listed, 0 scalings checked, all scaled modes 0 for both head and parent: native GetDisplayModeList1(R8G8B8A8_UNORM, DXGI_ENUM_MODES_SCALING) lists no CENTERED/STRETCHED modes here, so the new comparison silently checks nothing. I can't reproduce the 440/266 mismatch counts from the description on this setup.

Suggestion: print how many scaled modes same_explicit_matches compared, or a SKIP line when there are none, so a pass on a display without scaled modes isn't mistaken for coverage. No issues found in the code.

@lohant27-netizen

Copy link
Copy Markdown

Tested 8cad6b1d5 on Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 (driver 32.0.16.2101, subgroup 32), MSVC with SDK 10.0.26100, Release, merged onto main 867d922f0 together with #8777, #8763, #8762, #8754, #8711 and #8695 (no conflicts): pass.

@MiguelMatMar

Copy link
Copy Markdown

Tested 8cad6b1 on NVIDIA GeForce RTX 4080 SUPER, driver 621.24 (Vulkan 1.4.357), Windows 11 Pro 26300, MSVC 14.44, Ninja RelWithDebInfo (fresh build folder), applied on main 867d922, no game data: pass.

(AI-assisted check, Claude Code.)

@h0useadv

Copy link
Copy Markdown

Tested 8cad6b1d5 (base 6dda0630b, includes #8482) natively on Windows with a physical monitor attached, on AMD Radeon RX 9070 XT (RDNA4), AMD Windows driver 32.0.32029.2010, Windows 11 Pro build 26300: pass, no new failures. Built with clang-cl 23.1.6 + lld-link against an xwin splat (MSVC 14.44, SDK 10.0.26100), RelWithDebInfo; synthetic, no game files.

  • dxgi_swapchain (with the new explicit centered/stretched closest-mode checks against system DXGI): passes on the AMD driver's mode list.
  • dxgi_swapchain_count, dxgi_device: pass.
  • Full ctest -j8, failures rerun with -j1: 264/270; the failures are the ones main has on this GPU, with the same failure lines, plus d3d12_indirect_dispatch_count, which fails because this base predates its fix on main.

AI-assisted (Claude Code).

@BatSmacker84

Copy link
Copy Markdown

Tested 5ff5ca584 on top of #8482 (3a47f3ce4), merged onto main 5d74c2723, on AMD Radeon RX 7800 XT, driver 26.11.2, Windows 11 26200, MSVC 19.44 RelWithDebInfo, Vulkan validation on: 2 of 3 DXGI tests pass, dxgi_swapchain fails.

  • dxgi_swapchain fails mode enumeration on the second output. Shim and native DXGI both report 181 modes, but they differ from the first entry: the shim's is 640x480 @ 60/1, native's is 400x720 @ 70/1.
  • On the first output both explicit scaling types pass.
  • With dxgi: preserve fractional refresh rates and scaled modes on physical outputs #8482 alone (without this PR), the centered-scaling lookup fails (shim scaling 0, native 1), so the PR does fix that case.
  • main's own dxgi_swapchain passes on this machine with zero validation errors.

AI-assisted: Codex GPT-6.2 Sol ran the tests, Claude Opus 5.5 reviewed the report. No game files used.

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.

8 participants