Skip to content

DXGI: validate flip-model swapchain sample descriptions - #1940

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Ryderadzeee:fix/dxgi-swapchain-sample-desc
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Ryderadzeee:fix/dxgi-swapchain-sample-desc

Conversation

@Ryderadzeee

Copy link
Copy Markdown
Contributor

Claimed as a new D3D item in the coordination thread.

The DXGI shim ignored SampleDesc and created a single-sample chain even for invalid descriptions. Require count 1 and quality 0 before creating a flip-model swapchain. CreateSwapChainForHwnd returns DXGI_ERROR_INVALID_CALL for other values, and the implemented CoreWindow path inherits the check through its HWND forwarding. Microsoft's flip-model requirements.

Native HWND and legacy desktop creation on WARP and an RX 9070 XT accepted (1, 0) and rejected (0, 0), (2, 0), (4, 0), and (1, 1) with DXGI_ERROR_INVALID_CALL. The shim regression covers the same invalid descriptions on a Win32 HWND and a mock CoreWindow backed by a real Win32 window. It failed on the upstream parent when the shim created a chain for an invalid description.

Built the runtime and passed dxgi_swapchain and d3d12_present on Windows 11 Pro build 26300, MSVC 19.51, Radeon RX 9070 XT driver 32.0.32029.2010, and Vulkan-Headers 1.4.363. Vulkan validation was off. The foreground-window color check skipped. Synthetic inputs only.

AI-assisted.

@JavierBlanco23

Copy link
Copy Markdown
Contributor

Tested 09857dfa on NVIDIA GeForce RTX 5080, driver 616.56, Windows 11 (MSVC 19.44, Ninja): pass.

  • cmake --build runtime/build --target dxgi_swapchain_test
  • dxgi_swapchain_test.exe: dxgi_swapchain_test: PASS (CreateSwapChainForHwnd, CreateSwapChainForCoreWindow, occlusion status, GetBuffer+GetDesc, clear+readback, Present, ResizeBuffers; 0 validation errors).

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): no regression from this PR. RTX 4080 SUPER: 111/113 pass. On current main three tests fail the same way on every PR I built, so they're not from this PR: d3d12_draw (bundle blend, bisected to #1660's merge, see #1902), d3d12_compute on both GPUs (line 515: device_proxy_ref_count(device.p) == 1), and d3d12_subgroup on the Intel UHD 770 (line 611: fragment_default). I'm bisecting the last two. Other Intel failures are the known d3d12_present and d3d12_m3_frame.

@XFlawless1

Copy link
Copy Markdown
Contributor

Tested 09857df natively on Windows with NVIDIA and AMD: pass, no regressions.

Setup: Windows 11 Pro 10.0.26300, MSVC 19.44.35230 (VS 2022 Build Tools), Vulkan SDK 1.4.363.0, scripts/build_runtime.ps1 (Ninja, RelWithDebInfo). Two GPUs, each selected with LEONIDA_VK_DEVICE:

  • NVIDIA GeForce RTX 5080, driver 621.14 (Vulkan 1.4.357)
  • AMD Radeon iGPU, Ryzen 7 9800X3D (RDNA2, 0x13C0), driver 32.0.21042.62 (Vulkan 1.4.315)

VK_LOADER_LAYERS_DISABLE=~implicit~. Full ctest -j1, with this PR merged onto main 6a6704df, compared with 6a6704df alone on the same PC.

AI-assisted (Claude Code).

@ezwinxdlmao

Copy link
Copy Markdown
Contributor

Tested 09857df on an NVIDIA GeForce RTX 3050 Laptop GPU, driver 32.0.16.2101, Windows 11, native MSVC (VS 2022 Build Tools, Ninja, RelWithDebInfo): pass.

  • ctest -R dxgi_swapchain: pass. dxgi_swapchain_test reports PASS for CreateSwapChainForHwnd, CreateSwapChainForCoreWindow, occlusion status, GetBuffer+GetDesc, clear+readback, Present and ResizeBuffers.
  • Full ctest -j3: 111/113. The two failures are d3d12_compute (device_proxy_ref_count(device.p) == 1, line 515) and d3d12_draw (bundle blend pixel 127,0,127,255; TEST-266). Both fail identically at this PR's merge base 6a6704df on the same GPU.

AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit cd63047 into ItsNotRexed:main Nov 22, 2026
10 of 11 checks passed
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