ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
60.63k stars 10.23k forks source link

DRAW_EMPTY_SCISSOR_RECTANGLE warnings and example_win32_directx12.exe crash #4775

Closed MichaelKv closed 2 years ago

MichaelKv commented 2 years ago

Hello, From imgui.h // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)

define IMGUI_VERSION "1.86 WIP"

define IMGUI_VERSION_NUM 18510

define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))

define IMGUI_HAS_TABLE

OS: Windows 2016 Server, x64 Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30136 for x64

I have a lot of problems with DRAW_EMPTY_SCISSOR_RECTANGLE warning in ImPlot (it makes Visual Studio Output Window totally unusable) so I have decided to reproduce the problem with ImGUI official demo. But instead of zillions of DRAW_EMPTY_SCISSOR_RECTANGLE messages example_win32_directx12.exe just crashes when I run it under the VS debugger. The last VS Output Window content is as following:

D3D12 WARNING: ID3D12CommandList::DrawIndexedInstanced: Viewport: 0 is non-empty while the corresponding scissor rectangle is empty. Nothing will be written to the render target when this viewport is selected. In D3D12, scissor testing is always enabled. [ EXECUTION WARNING #695: DRAW_EMPTY_SCISSOR_RECTANGLE] D3D12: BREAK enabled for the previous message, which was: [ WARNING EXECUTION #695: DRAW_EMPTY_SCISSOR_RECTANGLE ] Exception thrown at 0x00007FFD6B7D4F38 (KernelBase.dll) in example_win32_directx12.exe: 0x0000087A (parameters: 0x0000000000000002, 0x000000800D13B3D8, 0x000000800D13D2D0). Unhandled exception at 0x00007FFD6B7D4F38 (KernelBase.dll) in example_win32_directx12.exe: 0x0000087A (parameters: 0x0000000000000002, 0x000000800D13B3D8, 0x000000800D13D2D0).

The steps to reproduce the problem are as following:

  1. run imgui_examples.sln
  2. select example_win32_directx12 as the startup item
  3. select x64/Debug configuration
  4. run it (F5).
  5. select the “Dear ImGui Demo” window
  6. open as many items as you can to make the vertical scroll bar to appear and make sure the plotting item is expanded and some graphics run
  7. begin to scroll the area back and forth (probably unnecessary but it leads to a lot of DRAW_EMPTY_SCISSOR_RECTANGLE warnings in the VS Output window for ImPlot, no crash)
  8. begin to resize the height of the “Dear ImGui Demo” window from the minimal possible size to some extent (rather quickly). No more than ten rather quick resizings will lead to the crash as above.

Please, notice that if you do not expand some tree-items to make the right scrollbar to appear than ImGui will likely survive the manipulations. Additional question: is it possible to fix the situation by choosing another backend? I need the most reliable solution for Windows x64. Thank you in advance.

ocornut commented 2 years ago

Thanks for reporting this. This is a bug partly caused by 2b0bd40b, now pushed a fix 440824d ! AFAIK only DX12 warns in this situation, but it is sane to make the same change for all back-end.

But specifically, the bug would not generally manifest as often before more recently, we made some fix for navigation leading to the current navigated item not being clipped: here you can see an arrow in the clipped area (where the draw cmd would normally be culled): image

This is because we currently conflate clipping for logic and clipping for render, which we will change later.