Skip to content

DXGI: validate ResizeBuffers1 node masks and presentation queue types - #2974

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Ryderadzeee:fix/dxgi-resize1-node-and-queue
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Ryderadzeee:fix/dxgi-resize1-node-and-queue

Conversation

@Ryderadzeee

Copy link
Copy Markdown
Contributor

Claimed as a new D3D item in the coordination thread.

Validate supplied ResizeBuffers1 node masks and presentation queue types before unregistering any back buffers. On this single-node path, masks 0 and 1 are valid. Each supplied presentation-queue entry must support ID3D12CommandQueue and describe a direct queue. A zero buffer count validates against the existing count. Omitted arrays use the shim defaults. DXGI API reference.

Native DXGI on WARP and the RX 9070 XT accepted masks 0 and 1 with direct queues. Masks naming another node or multiple bits, a D3D12 device object in the queue array, and a copy queue returned DXGI_ERROR_INVALID_CALL and retained the original buffers. Zero-count resizes also rejected an invalid last entry. The new test failed on upstream 16282101 because the shim accepted an invalid mask on a zero-count resize.

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 check skipped and the presented-image color check passed. Synthetic inputs only.

AI-assisted.

@VeTkN VeTkN left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ed85288 on RTX 5070 (Blackwell), NVIDIA 621.24, Windows 11 Pro (10.0.26200), MSVC 19.51 (VS 2026 Build Tools): pass. The description covers the RX 9070 XT and WARP; this adds an NVIDIA run.

build (scripts/build_runtime.ps1):  OK, no warnings in dxgi_com.cpp / dxgi_swapchain_test.cpp
ctest -R "^(dxgi_swapchain|d3d12_present)$" -V:
                                    2/2 passed
same with LEONIDA_VK_VALIDATION=1:  2/2 passed, both report "validation on", 0 VUID lines in the verbose output
negative control:                   dxgi_com.cpp from the parent 16282101, new test kept:
                                    dxgi_swapchain fails with "FAIL: ResizeBuffers1 invalid node mask with count zero"
  • d3d12_present: the on-screen colour check was skipped in the first run (window not in front) and confirmed on screen in the validation run.

AI-assisted (Claude).

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested ed85288 on Windows 11, RTX 5080 (driver 616.92) and AMD Radeon iGPU gfx1036 (driver 26.10.1): ctest -R "dxgi_swapchain|d3d12_present" (MSVC, RelWithDebInfo, LEONIDA_VK_DEVICE set per run, device line confirmed, validation off) — pass on both, 2/2 each.

  • RTX 5080: dxgi_swapchain_test: PASS (including ResizeBuffers, 0 validation errors); d3d12_present passed (the monitor was in HDR mode, so its on-screen colour check was skipped; the presented-image colour check passed).
  • AMD Radeon (gfx1036): both passed, dxgi_swapchain_test: PASS.

AI-assisted.

@zzEmmazz

Copy link
Copy Markdown
Contributor

Tested ed852888, applied alone on main 16282101: pass. Windows 11 (26200), MSVC 14.50 (VS 2026), Ninja RelWithDebInfo. Two GPUs: Ryzen 7 9700X iGPU (RDNA2, AMD 32.0.21042.62) and RTX 3070 (NVIDIA 610.74), picked with LEONIDA_VK_DEVICE.

  • Only the test change: dxgi_swapchain_test fails on both GPUs with "ResizeBuffers1 invalid node mask with count zero", so the new checks catch the old behaviour.
  • The whole PR: exit 0 on both GPUs.

I did not measure the host's ResizeBuffers1 answers myself.

@FaKL-Code

Copy link
Copy Markdown
Contributor

Tested ed85288 (merged onto main 1628210) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: pass

  • Merges cleanly; no new compiler warnings against main.
  • ctest: 120 of 120 pass (same 8 skips as main), including dxgi_swapchain and d3d12_present. Loader test passes; validation run: 48 tests clean (2 skipped, as on main).
  • Native DXGI on this card (a small host probe on a 3-buffer FLIP_DISCARD chain) agrees with the new rules:
    • count 0 with a last mask of 0x2, 0x3 or 0x80000000: DXGI_ERROR_INVALID_CALL, chain unchanged;
    • a device object in the queue array (count 3): INVALID_CALL;
    • a copy queue (count 0): INVALID_CALL;
    • masks 0/1/1 with direct queues: S_OK, at count 0 and at count 3 with a new width.
  • Merges cleanly with dxgi: implement Adapter::EnumOutputs and IDXGIOutput6 (D3D-313) #2976, which also edits dxgi_com.cpp and dxgi_swapchain_test.cpp.

AI-assisted (Claude).

@steamaze0

Copy link
Copy Markdown

Tested ed85288 on NVIDIA RTX 5060 Ti (Blackwell), NVIDIA 621.01 (Vulkan 1.4.357), Windows 11, VS Build Tools 2022 (MSVC) + Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0: pass.

  • dxgi_swapchain: PASS — includes the new ResizeBuffers1 node-mask / presentation-queue-type validation cases, on native NVIDIA DXGI (independent of the WARP / RX 9070 XT runs).
  • ctest --output-on-failure -j4: 121 passed, 0 failed (game-data/optional skipped) — same as main, no regression.

AI-assisted (Qoder): I built the full runtime with MSVC and ran ctest.

@Doffi4

Doffi4 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independent test of ed852888 on Windows 11 (26200), MSVC 19.44 x64 Release: dxgi_swapchain and d3d12_present passed 2/2 on Radeon 780M (26.11.2) and 2/2 on RTX 5060 Laptop (621.01) with Khronos validation enabled and no validation errors. The DXGI fixture covers valid masks/direct queues and rejection of invalid masks and queue entries without dropping the existing back buffers. The foreground colour check skipped on both GPUs. Synthetic inputs only. AI-assisted testing and reporting.

@ItsNotRexed
ItsNotRexed merged commit ec6847a into ItsNotRexed:main Nov 22, 2026
2 of 4 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.

8 participants