Repository navigation
dxgi: GetWindowAssociation answers a null pointer with DXGI_ERROR_INVALID_CALL and reports no window, as the host does - #8419
Conversation
IDXGIFactory::GetWindowAssociation answered a null pointer with E_INVALIDARG and handed back the window given to MakeWindowAssociation. The host dxgi.dll answers a null pointer with DXGI_ERROR_INVALID_CALL and reports a null window even after MakeWindowAssociation gave the factory one (measured on Windows 11, RTX 3080, driver 621.24, with flags 0, DXGI_MWA_NO_ALT_ENTER and DXGI_MWA_NO_WINDOW_CHANGES); Wine's dxgi does the same. The layer's factory now gives both answers. dxgi_swapchain_test checks the two answers and compares them with the host dxgi.dll when one is present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
al3xar
left a comment
There was a problem hiding this comment.
Tested 52e2dfd4c on NVIDIA GeForce RTX 3060 (Ampere), driver 621.24 (Vulkan 1.4.357, Vulkan SDK 1.4.363.0), Windows 11 x64, MSVC 19.44.35230.0, CMake + Ninja RelWithDebInfo (no game files): pass.
- Merges cleanly onto
upstream/main(70a0addc8). - Built
dxgi_swapchain_testanddxgi_device_testcleanly with zero new warnings inruntime/shims/dxgi_com.cppandruntime/test/dxgi_swapchain_test.cpp. - PR head (
52e2dfd4c) withLEONIDA_VK_VALIDATION=1:dxgi_swapchain_test.exe: PASS (exit 0;GetWindowAssociationmatches hostdxgi.dll,CreateSwapChainForHwnd: 45 descriptions compared with the host runtime, 0 mismatches, 0 validation errors).dxgi_device_test.exe: PASS (exit 0;3 backend(s) passed).
- Negative control (
runtime/shims/dxgi_com.cppreverted toupstream/main, PR test kept): fails as expected (FAIL: GetWindowAssociation(nullptr) should be DXGI_ERROR_INVALID_CALL, exit 1). python -I scripts/check_no_game_data.py runtime/shims/dxgi_com.cpp runtime/test/dxgi_swapchain_test.cpp: clean (exit 0).
AI-assisted.
|
Checked native IDXGIFactory::GetWindowAssociation on Windows 11 (system32 dxgi.dll, factories from CreateDXGIFactory1 and CreateDXGIFactory2; standalone program outside the repo):
That matches the shim (runtime/shims/dxgi_com.cpp:1399-1402) and the test (runtime/test/dxgi_swapchain_test.cpp:496-525). LGTM. Optional nits: assoc_hwnd_ (dxgi_com.cpp:1393, declared :1678) is now written but never read; dxgi_swapchain_test.cpp:506 loads dxgi.dll with a plain LoadLibraryW while :164 uses LoadLibraryExA(..., LOAD_LIBRARY_SEARCH_SYSTEM32), and matching that would guarantee the "host" side is the system DLL, not a stray dxgi.dll beside the test. AI-assisted (Claude Code). |
Claimed in the coordination issue as: #8186 (comment)
Depends on: none
What and why
IDXGIFactory::GetWindowAssociationnow answers as the hostdxgi.dlldoes.Factory::GetWindowAssociation(runtime/shims/dxgi_com.cpp:1396) differed from the host in two ways:mainGetWindowAssociation(nullptr)DXGI_ERROR_INVALID_CALLE_INVALIDARGDXGI_ERROR_INVALID_CALLMakeWindowAssociation(hwnd, flags), thenGetWindowAssociation(&w)S_OK,w == nullptrS_OK,w == hwndS_OK,w == nullptrMeasured in-process against the host
dxgi.dllon the machine below, with flags0,DXGI_MWA_NO_ALT_ENTERandDXGI_MWA_NO_WINDOW_CHANGES. Wine's dxgi gives the same answers (itsGetWindowAssociationwrites NULL, noting that the tests show Windows always does).MakeWindowAssociationand its flag checks are unchanged. The window it records stays inassoc_hwnd_; I left that member in place because #7876 has it as context. Nothing else reads it.runtime/test/dxgi_swapchain_test.cppchecks both answers. When a hostdxgi.dllis present, it also makes the same three calls on a host factory with the test's window and compares the results.Claimed in #8186 (#8186 (comment)). Doesn't overlap #4540 (
CreateSoftwareAdapter,GetSharedResourceAdapterLuid, the teardown event), #7999 (adapter enumeration) or #8023 (CheckFeatureSupport). My other PR from the same claim, #8398, changesOutput::GetFrameStatistics, which is a different function and test block.Tested
Windows 11 x64, MSVC 19.44.35220, NVIDIA GeForce RTX 3080 (driver 621.24 / 32.0.16.2124). RelWithDebInfo, Ninja. Synthetic tests only, no game data.
dxgi_swapchain_test: before the fix, it fails withFAIL: GetWindowAssociation(nullptr) should be DXGI_ERROR_INVALID_CALL. After the fix, it printsdxgi_swapchain_test: PASS (...; 0 validation errors)andCreateSwapChainForHwnd: 45 descriptions compared with the host runtime, 0 mismatches, and the host comparison passes too.dxgi_device_test:3 backend(s) passed.python -I scripts/check_no_game_data.py runtime/shims/dxgi_com.cpp runtime/test/dxgi_swapchain_test.cppandgit diff --check: clean.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)🤖 Generated with Claude Code