Skip to content

dxgi: SetFullscreenState is remembered, so GetFullscreenState and the descriptors agree - #7169

Open
tedin7 wants to merge 2 commits into
ItsNotRexed:mainfrom
tedin7:c2-fullscreen
Open

tedin7 wants to merge 2 commits into
ItsNotRexed:mainfrom
tedin7:c2-fullscreen

Conversation

@tedin7

@tedin7 tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What

IDXGISwapChain::SetFullscreenState now remembers the state and GetFullscreenState reports it. After Set(TRUE, target), Get returns TRUE and the output (AddRef'd; with a null target, the output containing the window). Set(FALSE) returns the chain to FALSE with no output. The state lives in the swap chain object behind its own mutex, and the output reference is released on change and in the destructor. GetDesc and GetFullscreenDesc report Windowed from the same state (FALSE after Set(TRUE), TRUE after Set(FALSE)). Set(FALSE, output) returns DXGI_ERROR_INVALID_CALL and changes nothing, as Microsoft documents. Still a borderless window: no mode switch.

Why

Before, Set answered S_OK and stored nothing, so Get always said windowed. Games that toggle fullscreen and then read the state back saw the toggle never take effect. Windows documents that Get reflects the last Set. Checked #4610 and the closed/merged swap chain PRs: none change this.

Tested

  • dxgi_swapchain_test (new block): new chain is windowed with no output; Set(TRUE) then Get is TRUE with a non-null output; Set(FALSE) then Get is FALSE with null output; null out params accepted.
  • Also checked in the same test: GetDesc/GetFullscreenDesc Windowed flips with the state; Set(FALSE, output) returns INVALID_CALL and leaves the chain fullscreen.
  • Negative: with the previous shim the test fails with "GetDesc after SetFullscreenState(TRUE) should report Windowed=FALSE". With the fix: 0 FAIL lines, exit 0.
  • Run on a pod under Wine with the host-comparison early exit (argument_mismatches) disabled locally, because Wine's host D3D12 answers differ there (18 mismatches, same on unmodified main). That change is not in this PR.

@ItsNotRexed: an exe PR, as you asked.

Claim: #6910 (comment)

Known limit (from the review): while fullscreen, GetContainingOutput still follows the window instead of the fullscreen target.

@moistman7

Copy link
Copy Markdown

Tested 355bda2d merged onto main e0816d6a (clean) on native Windows 11 26200 (not Wine), MSVC 2022 Build Tools, RelWithDebInfo, RTX 5090 (617.42), from an interactive session, so the host comparison runs: pass.

@Pierrot1398

Copy link
Copy Markdown

Tested 355bda2 on NVIDIA GeForce RTX 5060 Ti, driver 621.24 (32.0.16.2124), Windows 11 Pro 26300, MSVC (VS 18 Build Tools) RelWithDebInfo, Vulkan headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON: pass.

  • dxgi_swapchain_test: 3/3 runs, PASS (includes the new SetFullscreenState / GetFullscreenState / GetDesc / GetFullscreenDesc round trip and the SetFullscreenState(FALSE, output) → DXGI_ERROR_INVALID_CALL case).

Read the diff first: the remembered state and the output's AddRef/Release pairing look balanced (released on replace and in the destructor). No game files. AI-assisted (Claude Code).

@nullmarsh

Copy link
Copy Markdown

Tested 355bda2d on RX 9060 XT (RDNA4, AMD 26.11.2), Windows 11, MSVC 14.44: pass. This is the first AMD run; the earlier two were NVIDIA. ctest -R dxgi: dxgi_device, dxgi_swapchain and dxgi_swapchain_count, 3/3 pass.

AI-assisted (Claude Code), no game files.

@Sangonapou

Copy link
Copy Markdown

Tested 355bda2 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows (not Wine): pass

Built with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0).

  • dxgi_swapchain_test on this branch: exit 0, 0 FAIL lines. The host comparison runs here, so the early exit you had to disable under Wine was not needed: CreateSwapChainForHwnd: 45 descriptions compared with the host runtime, 0 mismatches. The new SetFullscreenState block sits on the unconditional path before the final PASS, so it ran.
  • Same test on the base d327ddf4: exit 0, PASS (no fullscreen block there).
  • Negative check: this branch's test with the base's runtime/shims/dxgi_com.cpp swapped back in fails, exit 1: FAIL: GetFullscreenState after SetFullscreenState(TRUE) should be TRUE. (It stops at the Get check, one step before the GetDesc message in your description.)

@justrealyme

Copy link
Copy Markdown

Tested 355bda2 on NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 build 26300, VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, RelWithDebInfo: pass.

Built dxgi_swapchain_test and ran ctest -R ^dxgi_swapchain$: Passed (1.6 s).

AI-assisted (Claude 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.

6 participants