Imgui: Imgui flickering using Double Buffering in Debug with VSync off in DX12

Created on 10 Oct 2019  ·  2Comments  ·  Source: ocornut/imgui

Version/Branch of Dear ImGui:

Version: HEAD, 1.73
Branch: master, tag v.1.73

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + custom DirectX 12 backend
Compiler: msvc2019_(if the question is related to building or platform specific features)_
Operating System: Windows 10

My Issue/Question:

When using Double Buffering with V-Sync disabled and compiled in Debug mode, Imgui starts flickering on RTX2070 and GT960 video cards (not tested on the other cards). In any other configuration - Triple Buffering or V-Sync On or Release mode - everything is OK.

Note, that if application is started from NVIDIA NSight (trying to debug it), the NSight's overlay also starts flickering.
If application is started from RenderDoc flickering does not occur.
When trying to capture "flickering" application using screen rec/screenshot capturing software, flickering does not occur, but imgui is drawn instead.
If using triple buffering, problem does not occur.

Code is not using SetMaximumFrameLatency() nor DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT flag for swapchain

Screenshots/Video

Standalone:
https://cdn.discordapp.com/attachments/520689895245611009/631109665467400193/IMG_1025.MOV

Under NSight:
https://cdn.discordapp.com/attachments/520689895245611009/631122672042115072/video0.mov

Standalone, minimal, complete and verifiable example:
Actually, while custom backend is used, you can checkout https://github.com/jpvanoosten/LearningDirectX12

To enable Double Buffering in DX12Lib\inc\Window.h change static const UINT BufferCount = 3; to 2
To disable V-Sync - use imgui menu in the sample app.
Launch Tutorial 4.

backenbinding bug dx12

Most helpful comment

@ocornut
V-Syncを無効にして、
"ClearRenderTargetView"を行うcommand_list_Aと
"ImGui_ImplDX12_RenderDrawData"を行うcommand_list_B
二つのcommand_listを作り
"ExecuteCommandLists(A);"
"ExecuteCommandLists(B);"
の順に実行した場合
高フレームレートの環境下でこれが発生しました。
フレームレートが下がると発生しません。

追記:
デバッグモードでのみこれが発生します。
"ExecuteCommandLists(A);"これの"WaitForSingleObject"は"ExecuteCommandLists(B);"よりも前に行っています。

Translation by goolge

Disable V-Sync,
Command_list_A to do "ClearRenderTargetView" and
Command_list_B that performs "ImGui_ImplDX12_RenderDrawData"
Create two command_lists
"ExecuteCommandLists (A);"
"ExecuteCommandLists (B);"
When executed in the order
This happened in a high frame rate environment.
It does not occur when the frame rate decreases.

Postscript:
This only happens in debug mode.
"ExecuteCommandLists (A);" This "WaitForSingleObject" is done before "ExecuteCommandLists (B);".

All 2 comments

Hello @b2soft

It is unclear what you are asking for.
You are reporting a rendering issue while saying that all the rendering code is yours/custom.
Therefore if this is not a problem in imgui_impl_dx12.cpp this is not a problem to solve here. Could you clarify your problem?

@ocornut
V-Syncを無効にして、
"ClearRenderTargetView"を行うcommand_list_Aと
"ImGui_ImplDX12_RenderDrawData"を行うcommand_list_B
二つのcommand_listを作り
"ExecuteCommandLists(A);"
"ExecuteCommandLists(B);"
の順に実行した場合
高フレームレートの環境下でこれが発生しました。
フレームレートが下がると発生しません。

追記:
デバッグモードでのみこれが発生します。
"ExecuteCommandLists(A);"これの"WaitForSingleObject"は"ExecuteCommandLists(B);"よりも前に行っています。

Translation by goolge

Disable V-Sync,
Command_list_A to do "ClearRenderTargetView" and
Command_list_B that performs "ImGui_ImplDX12_RenderDrawData"
Create two command_lists
"ExecuteCommandLists (A);"
"ExecuteCommandLists (B);"
When executed in the order
This happened in a high frame rate environment.
It does not occur when the frame rate decreases.

Postscript:
This only happens in debug mode.
"ExecuteCommandLists (A);" This "WaitForSingleObject" is done before "ExecuteCommandLists (B);".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KaungZawHtet picture KaungZawHtet  ·  3Comments

SlNPacifist picture SlNPacifist  ·  3Comments

NPatch picture NPatch  ·  3Comments

GrammarLord picture GrammarLord  ·  3Comments

the-lay picture the-lay  ·  3Comments