microsoft / microsoft/DirectX-Graphics-Samples
DXGI ERROR: IDXGISwapChain::GetContainingOutput: The swapchain's adapter does not control the output on which the swapchain's window resides.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am writing a DX12 sample application from scratch with support for fullscreen toggle following along the D3D12Fullscreen sample code. I am on a Windows 11 Desktop, with an NVIDIA GeForce RTX 2080 SUPER discrete GPU and a Intel(R) UHD Graphics 630 integrated GPU and two monitors.
I noticed that, in my application, if the HDMI cable of one of the monitors is not connected to the NVidia card, and I try to request a fullscreen switch using SetFullScreenState(true, nullptr) while the application's window is on that monitor, it crashes. I also get the error in the title in the logs. I have found a suggestion to suppress the message in the info queue, but the main issue is that, even if I suppress the info queue message, the SetFullscreenState operation actually fails with an error HRESULT: The specified device interface or feature level is not supported on this system. (0x887A0004) and crashes. Doing some more digging, I found out that while selecting the adapters, done using EnumAdapterByGpuPreference by DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, when I enumerate the outputs per adapter, I get one IDXGIOutput for the discrete GPU and the other one for the integrated one like so:
INFO 14_fullscreen_support > Found adapter: `NVIDIA GeForce RTX 2080 SUPER`
INFO 14_fullscreen_support > Adapter Output: `\\.\DISPLAY4`
INFO 14_fullscreen_support > Found adapter: `Intel(R) UHD Graphics 630`
INFO 14_fullscreen_support > Adapter Output: `\\.\DISPLAY1`
INFO 14_fullscreen_support > Found adapter: `Microsoft Basic Render Driver`
INFO 14_fullscreen_support > Selected adapter: `NVIDIA GeForce RTX 2080 SUPER`
The device is then created using the Nvidia GPU adapter.
So I assume the fullscreen state request fails because I am requesting it to the swapchain while the window's bounds intersects an output not controlled by the GPU the swapchain was created on. Which is basically what the debug layer log states, which makes sense, although the HRESULT error seems to be about something different.
The curious thing, which is what I am interested to understand, is that the exact same code and hardware configuration instead works within the D3D12Fullscreen sample in any case! And it does because all outputs are somehow instead assigned to the Nvidia discrete GPU. I have modified a bit the original sample to also enumerate the outputs per adapter, and I get this instead:
***Adapter: NVIDIA GeForce RTX 2080 SUPER
***Output: \\.\DISPLAY1
***Output: \\.\DISPLAY4
***Adapter: Intel(R) UHD Graphics 630
***Adapter: Microsoft Basic Render Driver
***Chosen Adapter: NVIDIA GeForce RTX 2080 SUPER
What's going on? Nothing obvious stands out in the Visual Studio project settings for D3D12Fullscreen sample. Seems that somehow the outputs are forced to be assigned to the discrete GPU, no matter where the monitors are connected to, but it's unclear to me how is this behaviour achieved?
Of course, if I connect both monitors physically to the NVidia card, everything works fine, but I'd like to understand how is this possible. What's the difference between my app and the original D3D12Fullscreen sample? It's definitely not in the code and in the way factory, adapter, device, and swapchain are created and fullscreen state is requested, as all of that is identical.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the D3D12Fullscreen sample on the described dual-GPU, dual-monitor setup and compare its adapter/output enumeration with the issue's application. Inspect the sample's project settings and the paths using EnumAdapterByGpuPreference, device creation, and SetFullScreenState. Done means identifying the concrete difference that causes outputs to be assigned differently and explaining the resulting fullscreen behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100