Skip to content

DXGI warning with DX11 backend about DXGI_SWAP_EFFECT_DISCARD #7607

@seanmiddleditch

Description

@seanmiddleditch

Version/Branch of Dear ImGui:

Version 1.90.6 WIP, Branch: docking (commit e391fe2)

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx11.cpp

Compiler, OS:

Windows 11 + MSVC 17.10.0 Preview 7.0

Full config/build information:

Dear ImGui 1.90.6 (19060)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1940
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000441
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoAutoMerge
io.ConfigViewportsNoDefaultParent
io.ConfigDockingTransparentPayload
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMoveFromTitleBarOnly
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1264.00,761.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

My Issue/Question:

Previously noted in #2970 (comment) by another user.

Using the DX11 backend using a device with the D3D11_CREATE_DEVICE_DEBUG creation flag set results in runtime warnings (only tested on docking branch). I believe that this is another consequence of needing a resolution to handling SDK versions as noted in #2970 (comment).

DXGI WARNING: IDXGIFactory::CreateSwapChain: Blt-model swap effects (DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL) are legacy swap effects that are predominantly superceded by their flip-model counterparts (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL and DXGI_SWAP_EFFECT_FLIP_DISCARD). Please consider updating your application to leverage flip-model swap effects to benefit from modern presentation enhancements. More information is available at http://aka.ms/dxgiflipmodel. [ MISCELLANEOUS WARNING #294: ]

This is of course super low-priority, but it is annoying when trying to verify that the app is clean of any runtime warnings/errors (without customizing the backend).

I verifyed that changing ImGui_ImplDX11_CreateWindow (and the example app's CreateDeviceD3D, if testing there) like so resolves the warning (unsurprisingly):

sd.BufferCount = 2; // was 1
sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; // was DXGI_SWAP_EFFECT_DISCARD

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

Uncomment this line in examples/example_win32_directx11/main.cpp:

//createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;

Debug in Visual Studio and observe the DXGI warning in the IDE's Output window. More show up if dragging imgui windows out into their own viewports.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions