Repository navigation
DXGI: CreateSwapChainForHwnd refuses what the host runtime's DXGI refuses (D3D-317) - #3531
Conversation
…uses Measured on RTX 5070 / 621.14: bitblt effects, window-incompatible scaling and alpha modes, flags outside 0x2/0x20/0x40/0x800/0x1000/0x2000, shared/read-only/discard-on-present/UAV usage, a null or non-queue device, null window/description/output are DXGI_ERROR_INVALID_CALL; a side above 16384 is E_INVALIDARG. dxgi_swapchain_test compares 40 descriptions with the host. The CoreWindow path keeps its old checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
Code read of AI-assisted. |
|
Tested
That's 72 descriptions in all, 0 mismatches. The four untested flag bits may be worth adding to the test, since the "any other bit" rule currently rests on 0x1, 0x4, 0x80, 0x400, 0x4000 and 0x80000000. AI-assisted (Claude Code). |
Kam471
left a comment
There was a problem hiding this comment.
Tested e6274435 on Windows 11, MSVC 19.44.35228 + Ninja, real RTX 5070 Ti. Build needed -DBUILD_TESTING=ON and -DLEONIDA_BUILD_WINDOWS_RUNTIME=ON; the D3D12 shim tests are gated under if(TARGET g6rt ...) (runtime/CMakeLists.txt:997, test at :1586), so the OFF/OFF recipe in the description yields no target. With both on, dxgi_swapchain_test built 11/11.
dxgi_swapchain_test.exe-> 40 descriptions compared, 0 mismatches, PASS.ctest -R dxgi_swapchain --output-on-failure-> 1/1 passed, 0.81 s.- The new refusals match this host's DXGI (
0x887A0001): swap effect DISCARD/SEQUENTIAL/99, scaling ASPECT_RATIO_STRETCH/7, alpha PREMULTIPLIED/STRAIGHT/9, all invalid flags, SHARED/READ_ONLY/DISCARD_ON_PRESENT/UNORDERED_ACCESS usage, 1 buffer, MSAA 4, null queue/window/desc/out, device instead of queue; over-wide 16385 ->0x80070057. Accepted cases match too (NONE, IGNORE, ALLOW_MODE_SWITCH, DISPLAY_ONLY, waitable, tearing, 0x1000/0x2000, usage 0/shader-input, flip-sequential x3).
Two follow-ups, neither blocking:
- Multi-fault precedence: a bad format, MSAA 4, or BufferCount 1 combined with width 16385 gives the shim
E_INVALIDARGbut the hostDXGI_ERROR_INVALID_CALL, because the width check runs before the format/count/MSAA checks. The tests are one-fault-per-case, so they do not see it. Low severity (both FAILED), but worth matching the host order. - BufferCount 16: both succeed, but
GetDesc1reports 8 from the shim vs 16 from the host (dxgi_swapchain.h:485VulkanmaxImageCountclamp). That is pre-existing D3D-389 and is fixed in #3597.
Parity holds for every single-fault case. No game files.
…ore the size, like the host A description with width 16385 and MSAA 4, one buffer or a bad format is DXGI_ERROR_INVALID_CALL on the host runtime's DXGI, not E_INVALIDARG (found by Kam471 in the review of ItsNotRexed#3531). Five multi-fault cases added to the side-by-side comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
Not checked: which error the host gives when two of these are wrong at once (the order of the checks); the CoreWindow path; the rest of ctest. |
|
Thanks @Kam471. Follow-up 1 is fixed in Tested
Follow-up 2 (BufferCount 16 reported as 8) is left to #3597 (D3D-389). AI-assisted (Claude), on behalf of dev-ewann. |
|
Tested e627443 on Windows 11, RTX 5080 (driver 616.92) and AMD Radeon iGPU gfx1036 (driver 26.10.1):
No negative control run. AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested e627443 (on its base
AI-assisted (Claude Code). |
Claimed in the coordination issue as: D3D-317 (claim)
What and why
IDXGIFactory2::CreateSwapChainForHwndaccepted descriptions that the host runtime's DXGI refuses for a D3D12 swap chain on a window, so a bad description returnedS_OKhere and failed on Windows. Measured side by side on the host (RTX 5070 / 621.14):DXGI_ERROR_INVALID_CALL: the bitblt effects (DISCARD,SEQUENTIAL) and unknown effects;Scalingother thanSTRETCH/NONE;AlphaModeother thanUNSPECIFIED/IGNORE; anyFlagsbit outside 0x2, 0x20, 0x40, 0x800, 0x1000, 0x2000;BufferUsagewithSHARED,READ_ONLY,DISCARD_ON_PRESENTorUNORDERED_ACCESS; a null queue or anID3D12Devicein place of the queue; a null window, description or output pointer (ours wasE_INVALIDARG/E_POINTER).E_INVALIDARG: a width or height above 16384.check_hwnd_swap_chainruns these checks before the swap chain is built; the build itself moves tocreate_swap_chain, whichCreateSwapChainForCoreWindownow calls directly, so the CoreWindow path keeps its current checks (its host rules can't be compared without a real CoreWindow).dxgi_swapchain_testgets a host comparison: 40 descriptions, each sent to our factory and toCreateDXGIFactory2from the systemdxgi.dllon a real window and host queue, with the HRESULTs compared.Touches the same two files as #2791, #2808 and #2822 (other methods); whichever lands first, the other rebases.
Tested
On
mainf847748 with this commit (e627443), Windows 11 build 26300, RTX 5070, driver 621.14, MSVC 19.44, Vulkan SDK 1.4.363.1:dxgi_swapchain_test: 40 host comparisons, 0 mismatches. Counter-check withmain'sdxgi_com.cppand the new test: 25 mismatches.ctest: 140/140 pass.dxgi_com.cppmakedxgi_swapchain_testfail.AI-assisted (Claude), on behalf of dev-ewann.
Checklist
docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code