Skip to content

DirectX 11 Swap chain freezes on present when using viewports with mixed swap effects #5437

Open
@kudaba

Description

Version/Branch of Dear ImGui:

Version: 1.85 (Custom)
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler: MSVC
Operating System: Windows 10

This is more of a PSA than an issue. I've been tracking an issue for months where the application would freeze when users drag a window out into it's own viewport. Sometimes it would happen right away, or it could take a while. When looking into the frozen application you would see this callstack:

	win32u.dll!NtGdiDdDDIPresent()
 	d3d11.dll!CallAndLogImpl<long (*)(struct _D3DKMT_PRESENT *),struct _D3DKMT_PRESENT *>(long (*)(struct _D3DKMT_PRESENT *),char const *,struct _D3DKMT_PRESENT *)
 	d3d11.dll!NDXGI::CDevice::PresentCB()
 	igd10iumd64.dll!00007ffddff07467()
 	igd10iumd64.dll!00007ffddff07646()
 	d3d11.dll!NDXGI::CDevice::PresentImpl(struct DXGI_PRESENTSURFACE const *,unsigned int,struct IDXGIResource *,void *,unsigned int,unsigned int,unsigned int *)
 	d3d11.dll!NDXGI::CDevice::Present()
 	dxgi.dll!CDXGISwapChain::PresentImplCore()
 	dxgi.dll!CDXGISwapChain::PresentImpl()
 	dxgi.dll!CDXGISwapChain::Present()

To make matters worse this only happened on certain hardware configurations. The root cause of this was that we were creating our main application swap chain with DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL if support for HDR in windowed mode was detected. ImGui uses DXGI_SWAP_EFFECT_DISCARD. It seems that some hardware doesn't like having mixed swap chain effects. I tried changing the ImGui viewport swap effect to discard but DirectX didn't seem to like that so I just made it that our application reverts to discard if ImGui viewport support is enabled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions