Repository navigation
dxgi: implement Factory CreateSwapChain delegation, GetParent, and SwapChain GetCoreWindow/GetRestrictToOutput - #1818
Merged
ItsNotRexed merged 3 commits intoNov 22, 2026
Conversation
Vonsek
reviewed
Nov 22, 2026
Vonsek
left a comment
Contributor
There was a problem hiding this comment.
I checked the legacy entry point at 3476c82f against the system DXGI factory on Windows build 26200. These probes only created an IDXGIFactory1 and did not create a device or swapchain.
CreateSwapChain(nullptr, nullptr, nullptr)andCreateSwapChain(nullptr, nullptr, &out)both returnDXGI_ERROR_INVALID_CALL(0x887a0001) in native DXGI. The new test currently locks inE_POINTERandE_INVALIDARGfor the same calls. A non-null COM pointer with a null description also returnsDXGI_ERROR_INVALID_CALL, which agrees with the documented null-description and null-output cases.Factory::GetParentcleared a non-null output sentinel and returnedE_NOINTERFACE(0x80004002) for each ofIID_IUnknown,IID_IDXGIFactory1, andIID_IDXGIAdapter. The proposed test expectsDXGI_ERROR_NOT_FOUNDfor the first of those.- One source-review gap in the delegation:
CreateSwapChainbuildsfs_desc, butCreateSwapChainForHwnddiscards that parameter andGetFullscreenStatealways reports windowed. Could the PR description scope the delegation to windowed flip-model creation, or add explicit coverage for a fullscreen request? Native legacy creation specifiesDXGI_STATUS_OCCLUDEDwhen it falls back to windowed mode.
AI-assisted.
Claimed in the coordination issue as: #1745 (comment)
What and why
IDXGIFactory::CreateSwapChainparameter handling and delegation:Many D3D12/D3D11 rendering pipelines and startup tools call the classic
IDXGIFactory::CreateSwapChain(device, &desc, &out)entry point. Previously, this was a stub returningE_NOTIMPL.DXGI_ERROR_INVALID_CALL(0x887a0001) if!out || !device || !desc.DXGI_SWAP_CHAIN_DESCfields intoDXGI_SWAP_CHAIN_DESC1and delegates toCreateSwapChainForHwnd(device, desc->OutputWindow, &desc1, &fs_desc, nullptr, &sc1).Windowed == FALSE), the layer falls back to the windowed flip-model chain and returnsDXGI_STATUS_OCCLUDEDper Microsoft DXGI specification.IDXGIFactory::GetParent:As the root object in the DXGI COM hierarchy,
IDXGIObject::GetParentis specified and confirmed on native DXGI to returnE_NOINTERFACE(0x80004002) while setting*out = nullptr. ReturningE_NOTIMPLpreviously broke COM hierarchy traversal in engine setup routines.IDXGISwapChain1::GetCoreWindow&GetRestrictToOutput:GetCoreWindowvalidates arguments and returnsDXGI_ERROR_INVALID_CALLon HWND swapchains as specified by DXGI.GetRestrictToOutputstores and returns the output restriction handle or returnsDXGI_ERROR_NOT_FOUNDwhen unrestricted, replacing the priorE_NOTIMPLstub.Tested
runtime/test/dxgi_swapchain_test.cpp:Factory::GetParentreturnsE_NOINTERFACEand clears output pointer (E_POINTERon null).SwapChain::GetCoreWindowreturnsDXGI_ERROR_INVALID_CALLon HWND swapchain.SwapChain::GetRestrictToOutputreturnsDXGI_ERROR_NOT_FOUNDon unrestricted swapchain (E_INVALIDARGon null).IDXGIFactory::CreateSwapChainparameter validation (DXGI_ERROR_INVALID_CALLacross null device, null desc, and null output), successful creation ofIDXGISwapChain, verification ofGetDesc, and successful frame presentation.Windowed == FALSEfullscreen request falls back to windowed chain, returnsDXGI_STATUS_OCCLUDED, and maintains windowed state.Checklist
docs/design.md, with how it was confirmed.