Crashed randomly when calling NewFrame


I’m using the newest dx12/win32 version of imgui.

version number:
master - 526e2303bc1bfec7ca98e1328c15ce835cb47bc5 - May 4, 2019

When I call NewFrame() in the first frame the window crashes sometimes.
If I recompile or run it again the problem is gone, but it will always reappear later.
And my whole screen sometimes turned black when I start running my app. (I’m not sure if the black-screen problem was caused by ImGui)

ImGuiIO& io = ImGui::GetIO(); (void)io;
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;  // Enable Keyboard Controls
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;   // Enable Gamepad Controls

// Setup Dear ImGui style

// Setup Platform/Renderer bindings
ImGui_ImplDX12_Init(pDevice, NumFrameResources,


// Start the Dear ImGui frame
ImGui::NewFrame();  //Crashed here



There’s no BeginFrame function in dear imgui. You are calling things through a GDxImGui wrapper and it would be better to ask whoever made this wrapper/setup/engine as we don’t know how it works.


I’m sorry it’s just a typo. The title should be “Crashed randomly when calling NewFrame”
GDxImgui is my own wrapper and it simply calls NewFrame of ImGui
void GDxImgui::BeginFrame()
// Start the Dear ImGui frame


Does the example_win32_dx12 demo works on your machine?

You should probably check what that HR value is…

1 Like

The demo works fine, and imgui works fine in my engine most of the time_(:з」∠)_

After I run it 3 or 4 times this problem will occur once, and I have to recompile all the code to make it work again


And I guess this problem only happens in dx12 version(


I think I finally find the reason.
It seems Windows TDR caused this problem, not ImGui.
Still thank you so much for your reply. I should’ve checked the hr value first.(:з」∠)