ocornut / imgui

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

Rendering issue enabling Dockspace with multi-viewports. #5655

Open gamecoder-nz opened 1 year ago

gamecoder-nz commented 1 year ago

Version/Branch of Dear ImGui:

Version: 1.89 Branch: Docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp Compiler: Visual Studio 2022 Operating System: Windows 10

My Issue/Question:

Run the GLFW OpenGL3 example and move the Hello World panel to outside the main window. Then enable Dockspace. The Hello World window gets corrupted

Screenshots/Video

image

gamecoder-nz commented 1 year ago

The same thing happens when you enable dockspace by default static bool show_app_dockspace = true; and it opens with an ImGUI window outside the main window.

ocornut commented 1 year ago

What do you mean by enabling Dockspace ?

Have you checked the many other similar OpenGL rendering issues? What is your GPU and drivers version ?

gamecoder-nz commented 1 year ago

If you go to the Demo Window and click Examples -> Dockspace to enable it. I have just turned off ImGuiConfigFlags_ViewportsEnable and there is no issue.

My GPU is Intel UHD and drive version 26.20.100.7463

ocornut commented 1 year ago

LIkely same as #5617, #4832

Could you uncomment the //printf() line in imgui_impl_opengl3.cpp, share your values for vendor, renderer etc. Confirm the resulting value of UseBufferSubData? And see if inverting this value to use the other code path makes a difference for you?

I'm desperate to find a correct solution for OpenGL support has become a minefield and more big applications are white-listed and tailor supported by drivers, dear imgui being a library makes it difficult so we'll have to keep poking to find a solution.

gamecoder-nz commented 1 year ago

GL_MAJOR_VERSION = 3 GL_MINOR_VERSION = 0 GL_VENDOR = 'Intel' GL_RENDERER = 'Intel(R) UHD Graphics'

Yes inverting UserBufferSubData fixed the issue.

WerWolv commented 1 year ago

Hey, I also ran into this same issues on a computer that only has Intel HD Graphics.

GL_MAJOR_VERSION = 3
GL_MINOR_VERSION = 0
GL_VENDOR = 'Intel'
GL_RENDERER = 'Intel(R) HD Graphics 630'

Interestingly enough, this seems to be a recent phenomena. I was using older drivers first which caused immediate crashes due to heap corruption deep inside of the Intel driver code when swapBuffers was called after undocking a window from the main window. After updating the drivers to the latest version available, the crash is gone but the artifacts mentioned above are visible. For me it can also be fixed by setting UseBufferSubData to false but I guess that's not really a solution since it seems to fix the issues on other systems.

image

I really don't understand how Intel's drivers can be so horribly broken. I had to disable a bunch of other features too on Intel HD Graphics since they lead to rendering issues there. Most notably, the entire window content was just offset weirdly when disabling Windows' window boarders

image

ocornut commented 1 year ago

Thanks for the extra data point. I'm currently gathering info from the many posts and will act upon that. Stay tuned.

ocornut commented 1 year ago

Posting a shared recap here: (will update as necessary) https://gist.github.com/ocornut/89ae5820c497510761e4c313ef5e0219

ocornut commented 1 year ago

@WerWolv @gamecoder-nz & others

Could you cherry-pick this: https://github.com/ocornut/imgui/commit/036ad55 And see if you get anything? EDIT 2022/09/27 merged 11f5be0ca you can now uncomment #define IMGUI_IMPL_OPENGL_DEBUG.

(You may alter the fprintf statement to be whatever works best in your codebase)

ocornut commented 1 year ago

EDIT Please use 3a68146 instead. Please also try with both values of bd->UseBufferSubData (you may simply alter the if (bd->UseBufferSubData) statement into true/false.

ocornut commented 1 year ago

Could you also try both code path using GL_DYNAMIC_DRAW instead of GL_STREAM_DRAW ?

bzroom commented 1 year ago

Hi, I'm having the same issue. The HelloWorld docking example very frequently results in a corrupt frozen window with GLFW/OGL3. Can you please let me know the latest work around? Thank you!

Update: I added: #define GL_DYNAMIC_DRAW 0x88E8 to the top of imconfig.h and it's working MUCH better. Update2: I still see corruption occasionally but it doesn't crash anymore. Update3: I set UseBufferSubData = false and it's working even better.