Repository navigation
dxgi: return E_ACCESSDENIED for occupied or invalid HWNDs on swap chain creation - #8929
emirtugra-dag wants to merge 1 commit into
Conversation
|
Tested Results (
|
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Independent Windows host review (commit \13d8cdab4337dd711bb7d23a16357b572a4f084e)
What changed:
untime/shims/dxgi_com.cpp:- Implements thread-safe \HwndClaim\ via process-wide active window set to track live swap chains across factories.
- In \Factory::create_swap_chain, checks !IsWindow(hwnd)\ and returns \E_ACCESSDENIED\ (\
|
Tested on AMD Radeon RX 7700 XT (RDNA3), AMD Windows driver 32.0.32029.2010, Windows 11, MSVC 14.51 Release, at 13d8cda. Full No regression. The only failures are the same 5 as on AI-assisted (Claude Code). |
|
Tested
AI-assisted (Claude Code). |
Claimed in the coordination issue as: #8683 (comment) (
dxgi: return E_ACCESSDENIED from CreateSwapChainForHwnd / CreateSwapChain on a window with an existing swap chain, a destroyed window, or an invalid HWND, from @Maraco91's finding in #8683)Depends on: none
What and why
runtime/shims/dxgi_com.cpp,Factory::create_swap_chainpreviously passed invalid, destroyed, or already-occupiedHWNDs straight through toVulkanSwapchain::create, returningE_FAIL(0x80004005) (or succeeding depending on Vulkan surface behavior) instead of host DXGI'sE_ACCESSDENIED(0x80070005).HwndClaim(declared beforeSwapChain::swapchain_so destructor teardown destroysVkSwapchainKHR/VkSurfaceKHRbefore freeing theHWNDslot for reuse).Factory::create_swap_chain, after all descriptor/format/buffer/sample validations pass (preservingDXGI_ERROR_INVALID_CALLandE_INVALIDARGpriority), checks!IsWindow(hwnd)and!sc->claim_hwnd(hwnd)and returnsE_ACCESSDENIEDwith*out == nullptr. BecauseIDXGIFactory::CreateSwapChaindelegates toCreateSwapChainForHwnd, both entry points (andCreateSwapChainForCoreWindow) match host DXGI.existing swap chain on window,destroyed window,garbage window, and descriptor-error precedence cases) and explicit assertions (including cross-factory collision, legacyCreateSwapChain, release-then-recreate, and*out == nullptr) inruntime/test/dxgi_swapchain_test.cpp.Tested
upstream/main+ new test):dxgi_swapchain_test.exefailed with 3 mismatches against host Windowsdxgi.dll:CreateSwapChainForHwnd existing swap chain on window: ours 0x80004005, host 0x80070005CreateSwapChainForHwnd destroyed window: ours 0x80004005, host 0x80070005CreateSwapChainForHwnd garbage window: ours 0x80004005, host 0x8007000513d8cdab4):runtime/build/dxgi_swapchain_test.exe:CreateSwapChainForHwnd: 52 descriptions compared with the host runtime, 0 mismatches; PASS.runtime/build/dxgi_swapchain_count_test.exe: PASS (3 cases).runtime/build/dxgi_device_test.exe: 3 backend(s) passed.ctest --test-dir runtime/build -R "dxgi|present|frame" --output-on-failure: 11/11 passed (100%).python -I scripts/check_no_game_data.py runtime/shims/dxgi_com.cpp runtime/test/dxgi_swapchain_test.cpp: exit 0.AI-assisted: yes
Checklist
dxgi.dlland green after fix on AMD Radeon RX 7600