Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with with viewports when using OpenGL3 backend #4468

Closed
parbo opened this issue Aug 23, 2021 · 40 comments
Closed

Memory leak with with viewports when using OpenGL3 backend #4468

parbo opened this issue Aug 23, 2021 · 40 comments

Comments

@parbo
Copy link

parbo commented Aug 23, 2021

Dear ImGui 1.84 WIP (18307)
--------------------------------
sizeof(size_t): 4, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _MSC_VER=1929
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000441
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001406
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1280.00,720.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

My Issue/Question:

When using the opengl3 backend with viewports enabled there is a memory leak of a couple of MB per second after dragging a window outside the main viewport. It recovers if the windows is dragged back into the main viewport. I can reproduce with both example_sdl_opengl3 and example_glfw_opengl3. It does not happen with the opengl2 backend.

To reproduce: start the example, drag the "Hello, world!" window out of the viewport.

@AidanSun05
Copy link

I think this is what you're talking about:

image

This extra memory allocation is for supporting a second platform context for the window that was just dragged out, and I'm pretty sure there's no leak.
A memory leak is when a process doesn't deallocate its memory when it terminates. In the case of multi-viewports, the memory graph dipped down shortly after the window was dragged back into the viewport. This indicates that the extra memory was freed correctly, making it not leaked.

@parbo
Copy link
Author

parbo commented Aug 23, 2021

@AidanSun05 Keep it outside the main viewport. Memory usage grows indefinitely. While not a true memory leak in that the memory is returned, it is still a resource usage that makes extra viewports unusable.

@ocornut
Copy link
Owner

ocornut commented Aug 23, 2021

@AidanSun05 I presume @parbo is referring to an actual leak, as per the "a couple MB per second" comment.

It's probably highly dependent on the GPU driver and platform and there might be a possibility that updating drivers could fix it. OpenGL tends to be poorly supported. Even if the drivers are faulty, it would also really be worthwhile to investigate the cause.

For what it is worth, on my home laptop I do not see a memory increase in that window.

We get that sort of stuff mentioned from time to time (e.g. #3381 and #2981) but nobody with a repro could investigate further.

@parbo
Copy link
Author

parbo commented Aug 23, 2021

This is having the window outside the main viewport for 6 minutes, then putting it back. So the resources are eventually returned when the second viewport is no longer used, but the memory usage grows indefinitely until then.

image

@AidanSun05
Copy link

@ocornut - Thanks for clearing things up. (I couldn't reproduce this on my machine either)

@parbo - This is apparently caused by your OS, your GPU, or its driver. Updating your software might help, though as previously mentioned, we can't really investigate/solve this issue because there's no way to repro it.

@ocornut
Copy link
Owner

ocornut commented Aug 23, 2021

I tried with my Intel HD integrated card and Nvidia GTX 1060M and couldn't get things to grow here.
Confirmed GPU by printing

    #define GL_VENDOR    0x1F00
    #define GL_RENDERER  0x1F01
    const GLubyte* vendor = glGetString(GL_VENDOR);
    const GLubyte* renderer = glGetString(GL_RENDERER);
    printf("vendor = '%s'\n", vendor);
    printf("renderer = '%s'\n", renderer);

This is apparently caused by your OS, your GPU, or its driver.

We have to stay open-minded in the sense that OpenGL is a known pile of legacy mess, and there might be GL programming idioms that won't trigger driver issues the same way.

The "problem" if if you update your drivers now and it magically fixes it, it won't be investigated (again). So maybe best to take a chance and investigate.

Some ideas

  • Apparently there's an OpenGL Idiom called "buffer orphaning" which might help the driver?
  • I wonder if using RenderDoc could lead to any hint?

@parbo
Copy link
Author

parbo commented Aug 23, 2021

It only happens with my Intel GPU, not with the Nvidia. I have a Dell XPS 15 in case it helps. The Intel UHD graphics driver version is 27.20.100.9168.

@ocornut
Copy link
Owner

ocornut commented Aug 23, 2021

Here what I would do

  • Comment all the code out in ImGui_ImplOpenGL3_RenderWindow() and verify if it still happen or not
  • Comment the ImGui_ImplOpenGL3_RenderDrawData() call in ImGui_ImplOpenGL3_RenderWindow() and verify if it still happen or not

If it is indeed the call to ImGui_ImplOpenGL3_RenderDrawData() that does it,

  • Comment out the whole loop for (int n = 0; n < draw_data->CmdListsCount; n++) in ImGui_ImplOpenGL3_RenderDrawData() and see if it still happens

If it is that loop, would you be able to look into OpenGL buffer orphaning idiom and see if modifying the code in that loop (presumably the glBufferData call) see if using orphaning idioms fixes it for you.

@parbo
Copy link
Author

parbo commented Aug 23, 2021

Kind of tricky doing anything when the main viewport isn't rendering, so I did bool is_main = ImGui::GetMainViewport() == draw_data->OwnerViewport; and used is_main as an additional condition in the two loops in ImGui_ImplOpenGL3_RenderDrawData(). It is definitely the glBufferData calls. I assume the calling pattern with multiple viewports makes the driver keep around old buffers for some reason.

I have very little experience with OpenGL, so I'm not sure it's anywhere near correct, but this hack seems to fix it:

    static GLsizeiptr v_max_size = 0;
    auto v_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert);
    if (v_size > v_max_size) {
      v_max_size = v_size;
      glBufferData(GL_ARRAY_BUFFER, v_max_size, NULL, GL_STREAM_DRAW);
    }
    static GLsizeiptr i_max_size = 0;
    auto i_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx);
    if (i_size > i_max_size) {
      i_max_size = i_size;
      glBufferData(GL_ELEMENT_ARRAY_BUFFER, i_max_size, NULL, GL_STREAM_DRAW);
    }
    // Upload vertex/index buffers
    glBufferSubData(GL_ARRAY_BUFFER, 0, v_size, (const GLvoid *)cmd_list->VtxBuffer.Data);
    glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, i_size, (const GLvoid *)cmd_list->IdxBuffer.Data);

It should probably be done in some nicer way.

@ocornut
Copy link
Owner

ocornut commented Aug 23, 2021

Great to hear, that's one piece of the puzzle.

I think we would need to gather a maximum number of references (from other thread/issues) about what effectively works best with drivers. e.g. I worry that glBufferSubData() may carry its own source of bizarre issues.

Have you tried this?

        glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), NULL, GL_STREAM_DRAW);
        glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), NULL, GL_STREAM_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);

@ocornut
Copy link
Owner

ocornut commented Aug 23, 2021

It would be worth trying to solution. We're going to have to have any of those change run on a maximum of platforms and measure performances (and possible "leaks"). I think @floooh had experience with that sort of thing?

@parbo
Copy link
Author

parbo commented Aug 24, 2021

Unfortunately, this does not fix it for me.

        glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), NULL, GL_STREAM_DRAW);
        glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), NULL, GL_STREAM_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);

@floooh
Copy link
Contributor

floooh commented Aug 26, 2021

I think @floooh had experience with that sort of thing?

I'm seeing temporary memory spikes in my own swapchain wrapper code during window resizing, the exact nature depends on the operating system and 3D backend, but it goes from "memory usage goes up but remains stable during resize and recovers about a second after resize", to "memory keeps growing during resize and only recovers after the resize has finished" - but this is swapchain-surface related. But I haven't really found a solution to fix those memory spike issues (except of course not resizing the swapchain during window resizing).

I'm not as far yet with my ImGui-multiviewport-experiments to have a GL backend, so in this specific situation I can't help with an alternative implementation to check against unfortunately.

@ocornut
Copy link
Owner

ocornut commented Aug 26, 2021

I pushed a branch https://github.com/ocornut/imgui/tree/features/opengl_buffer_update (forked from docking)

To validate this nicely I think we would need people to test both branches (docking 58f5092 vs this fork 009c1e0)

  • compare unthrotted framerate (by changing the glfwSwapInterval or SDL_GL_SetSwapInterval call to 0)
  • compare memory consumption

[ ] windows nvidia:
[ ] windows amd:
[ ] windows intel:
[ ] linux
[ ] osx
[ ] webgl
[ ] raspberry pi

If someone can run the updated backend for webgl, osx, raspberry pi, that'd be nice.

@AidanSun05
Copy link

AidanSun05 commented Aug 26, 2021

I have some Raspberry Pi 3's and 4's that I can run the backend on.

@AidanSun05
Copy link

I ran a few tests on my Raspberry Pis. First, some notes:

  • The Pi4 only supports OpenGL ES 3, not the traditional desktop OpenGL 3.
  • The Pi3 supports neither OpenGL 3 nor OpenGL ES 3 (only 2), so I was unable to test this new branch on any Pi3.
  • I'm using a 1440p, 60Hz monitor (so the capped framerates are at or close to 60 FPS).

Relevant code changes:

imconfig.h:

#define IMGUI_IMPL_OPENGL_ES3

GLFW example:

// Decide GL+GLSL versions
const char* glsl_version = "#version 300 es";
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);

SDL example:

// Decide GL+GLSL versions
const char* glsl_version = "#version 300 es";
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

Here's the data I collected from the GLFW and SDL examples:

Metric Docking Branch OpenGL Buffer Update Branch
Idle memory consumption 35-40 MB 35-40 MB
Demo window outside main viewport and resized constantly 140 MB +/- 10 135 MB +/- 10
Capped framerate 55-60 FPS 55-60 FPS
Unthrottled framerate 75-105 FPS 60-80 FPS

So the new buffer update seems to be helping (i.e. reducing the memory usage) in terms of the Raspberry Pi 4.

@floooh
Copy link
Contributor

floooh commented Aug 27, 2021

...looking at the new update code reminds me... I've been changing my buffer updates in the draw loop somewhat recently to only do one update per buffer per frame, this was because glBufferSubData() (more specifically: doing multiple glBufferSubData() on the same buffer per frame, even if the data is appended, not overwritten) had pretty bad performance problems on some devices (mainly Android, and some browsers when running in WebGL via WASM).

So what I'm doing now is a two-step copy: first loop over all commands and copy the per-command vertex- and index-data into continuous memory buffers, and then do one glBufferData() each for the vertex- and index-data:

https://github.com/floooh/sokol/blob/42d757c7a47a7096f15b48d491f06ef54fddb162/util/sokol_imgui.h#L1916-L1965

...later in the draw loop I'm adjusting the vertex buffer offset to the start of the per-command vertex chunk so that the indices point to the right vertices (under the hood this simply calls glVertexAttribPointer() with an offset as the last parameter):

https://github.com/floooh/sokol/blob/42d757c7a47a7096f15b48d491f06ef54fddb162/util/sokol_imgui.h#L1991-L1993

...but this was done purely for performance on some platforms (and it helped a lot), not for memory consumption.

PS: It would be nice if Dear ImGui had an option which writes the vertices and indices into such all-in-one buffers directly, maybe even let the buffers be provided by the API user. Only makes sense if ImGui directly writes the vertices to those buffers instead of doing extra memory copies though (which I assume might be non-trivial).

@rokups
Copy link
Contributor

rokups commented Aug 27, 2021

example_sdl_opengl3 on Linux, plasma desktop, amdgpu driver:

Metric Docking Branch OpenGL Buffer Update Branch
Idle memory consumption 30.6 MB 30.1 MB
Demo window outside main viewport and resized constantly 31.4 MB 31.0 MB
Capped framerate 143-144 FPS 143-144 FPS
Unthrottled framerate 9000-9700 FPS 9000-9700 FPS

Memory consumption remains constant at all times.

@straywriter
Copy link

hi,I found a way to solve this problem。
I have done some debugging work, but I still haven't found the specific cause. It may be the cause of OpengL or the incompatibility between GLFW creation window and OpengL. However, I haven't tested the CASE of SDL, so I'm not sure.
However, I found that the main problem occurred here:

static void ImGui_ImplOpenGL3_InitPlatformInterface()
{
    ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
    platform_io.Renderer_RenderWindow = ImGui_ImplOpenGL3_RenderWindow;
}

I took advantage of OpengL's backward compatibility features to solve this problem for the time being. This solution may not seem perfect, but at least it will keep memory from leaking.
Porting opengL2 ImGui_ImplOpenGL2_RenderWindow to opengl3 can solve the problem effectively.

static void ImGui_ImplOpenGL2_InitPlatformInterface()
{
    ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
    platform_io.Renderer_RenderWindow = ImGui_ImplOpenGL2_RenderWindow;
}

What do you think about that

cc

@ocornut
Copy link
Owner

ocornut commented Sep 3, 2021

@straywriter You have ignored my past message. We understand that "not using the opengl3 backend" fixes the issue for you but here we are trying to get the opengl3 backend fixed.
Could you please try the branch mentioned here? #4468 (comment)

@straywriter
Copy link

@ocornut
thanks, My computer works fine on features/opengl_buffer_update

Version: dear imgui, v1.84 WIP
Branch: features/opengl_buffer_update

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

My GPU:
GeForce GTX 1050 Ti
Version:457.49

@straywriter
Copy link

@ocornut hi I find a new bug in features/opengl_buffer_update,What do you think of this

Version: dear imgui, v1.84 WIP
Branch: features/opengl_buffer_update

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: Visual Studio 2019
Operating System: Windows 10
My GPU:
GeForce GTX 1050 Ti
Version:457.49

The following bug occurs when using DockerSpace when the Dear ImGui Demo window is initialized outside

dd

@AidanSun05
Copy link

@straywriter Interesting bug report. Noticed a few things, so here's a still shot of your Visual Studio crash screen for reference:

image

  1. It says "ig9icd32.(pdb/dll)", which is actually related to Intel GPUs/drivers (from a quick Google search).
  2. Based on this, I'm pretty sure your machine has both an NVIDIA GPU (as you mentioned) and an Intel GPU, but your process is actually using the latter.

So I borrowed a laptop with an Intel UHD Graphics 620 (driver version 27.20.100.9664; June 1, 2021), and sure enough, I was able to replicate an extremely similar bug:

Animation

Except that this time, when interacting with the distorted window, the code crashes on line 666 of imgui_impl_glfw.cpp, as shown at the end of the above GIF.

viewport->PlatformHandleRaw = glfwGetWin32Window(vd->Window);

I was not able to replicate this behavior on my main dev machine with an NVIDIA GTX 1080 (driver version 471.96; August 31, 2021).

@captnjameskirk
Copy link

Thought I'd chime in with some data points. I tested the docking branch with and without the patched OpenGL3 backend, with SDL and GLFW, and with vsync and unthrottled. The good news is that the patch fixed the memory leak, with a surprise bonus of better cpu/gpu usage as well.

Tested on a 2018 MBP, Intel Core i7 2.6Ghz, Radeon Pro 560X.

The test app used 3 ImGui windows dragged out from the main viewport (demo window, style editor, and metrics/debugger). Also note that I used the current docking branch with the two patched opengl3 files copied over.

With vsync (60 fps):

Build CPU GPU mem
SDL/unpatched 16 24 +1MB/s
GLFW/unpatched 13 23 +1MB/s
SDL/patched 10 24 +0MB/s
GLFW/patched 9 23 +0MB/s

Unthrottled (about 300 fps on my system in all cases):

Build CPU GPU mem
SDL/unpatched 65 97 +5MB/s
GLFW/unpatched 45 97 +3MB/s
SDL/patched 32 92 +0MB/s
GLFW/patched 29 87 +0MB/s

A couple of things I took away from this:

  • GLFW is more efficient than SDL in every case (although this may be my system and/or build)
  • CPU improvement is significant with the patched version (GPU less so, but noticeable when unthrottled)
  • Not noted in the tables above, but with the 3 windows still contained within the main viewport, CPU usage is about 60% less than when they're all dragged out (in all cases).

Thanks @ocornut for the work on this patch. It's made multi-viewports usable, at least for me. 😄

@ocornut
Copy link
Owner

ocornut commented Sep 14, 2022

@parbo Can you still repro this leak if you force make it use the simple path?

            glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
            glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);

If so, how about an alternative to: #4468 (comment)
I then asked you to use:

        glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), NULL, GL_STREAM_DRAW);
        glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), NULL, GL_STREAM_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);

Can you make the 1st and 3st call use 0 size?

@ocornut
Copy link
Owner

ocornut commented Sep 14, 2022

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

@ocornut
Copy link
Owner

ocornut commented Sep 14, 2022

Anyone affected by corruption or leak issue,
could you cherry-pick this:
3a68146b
And see if you get anything printed?
EDIT 2022/09/27 merged 11f5be0 you can now uncomment #define IMGUI_IMPL_OPENGL_DEBUG.

(You may alter the fprintf statement to be whatever works best in your codebase)
Please also try with both values of UseBufferSubData (you may alter the if (bd->UseBufferSubData) check, turning it into true/false to try both paths). Please report with GPU/Drivers to ease parsing the information. Thanks!

@ocornut
Copy link
Owner

ocornut commented Sep 14, 2022

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

  • Does it fix corruptions on setups that have them? (with/without UseBufferSubData)
  • Does it fix leaks on setups that have them (with/without UseBufferSubData)
    Due to how your compact/minimal loader is generated, you may need to temporarily add:
#define GL_DYNAMIC_DRAW                   0x88E8

To the code. Thank you!

@ocornut ocornut reopened this Sep 27, 2022
@ocornut
Copy link
Owner

ocornut commented Sep 27, 2022

Help on this would be useful. @parbo @gamecoder-nz @WerWolv

ocornut added a commit that referenced this issue Sep 27, 2022
fangshun2004 added a commit to fangshun2004/imgui that referenced this issue Sep 29, 2022
commit e74a50f
Author: Andrew D. Zonenberg <azonenberg@drawersteak.com>
Date:   Wed Sep 28 08:19:34 2022 -0700

    Added GetGlyphRangesGreek() helper for Greek & Coptic glyph range. (ocornut#5676, ocornut#5727)

commit d17627b
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 17:38:41 2022 +0200

    InputText: leave state->Flags uncleared for the purpose of backends emitting an on-screen keyboard for passwords. (ocornut#5724)

commit 0a7054c
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 17:00:45 2022 +0200

    Backends: Win32: Convert WM_CHAR values with MultiByteToWideChar() when window class was registered as MBCS (not Unicode). (ocornut#5725, ocornut#1807, ocornut#471, ocornut#2815, ocornut#1060)

commit a229a7f
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 16:57:09 2022 +0200

    Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (ocornut#5725)

commit e0330c1
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 14:54:38 2022 +0200

    Fonts, Text: Fixed wrapped-text not doing a fast-forward on lines above the clipping region. (ocornut#5720)

    which would result in an abnormal number of vertices created.

commit 4d4889b
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:42:06 2022 +0200

    Refactor CalcWordWrapPositionA() to take on the responsability of minimum character display. Add CalcWordWrapNextLineStartA(), simplify caller code.

    Should be no-op but incrementing IMGUI_VERSION_NUM just in case.
    Preparing for ocornut#5720

commit 5c4426c
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:22:34 2022 +0200

    Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (ocornut#5721)

commit 12c0246
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:07:43 2022 +0200

    Removed support for 1.42-era IMGUI_DISABLE_INCLUDE_IMCONFIG_H / IMGUI_INCLUDE_IMCONFIG_H. (ocornut#255)

commit 73efcec
Author: ocornut <omar@miracleworld.net>
Date:   Tue Sep 27 22:21:47 2022 +0200

    Examples: disable GL related warnings on Mac + amend to ignore list.

commit a725db1
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Sep 27 18:47:20 2022 +0200

    Comments for flags discoverability + add to debug log (ocornut#3795, ocornut#4559)

commit 325299f
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 14 15:46:27 2022 +0200

    Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709)

commit 56c3eae
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Sep 27 14:24:21 2022 +0200

    ImDrawList: asserting on incorrect value for CurveTessellationTol (ocornut#5713)

commit 04316bd
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 16:32:09 2022 +0200

    ColorEdit3: fixed id collision leading to an assertion. (ocornut#5707)

commit c261dac
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 14:50:46 2022 +0200

    Demo: moved ShowUserGuide() lower in the file, to make main demo entry point more visible + fix using IMGUI_DEBUG_LOG() macros in if/else.

commit 51bbc70
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 14:44:26 2022 +0200

    Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows, and don't capture mouse when drag and dropping. (ocornut#5710)

commit 7a9045d
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 11:55:07 2022 +0200

    Backends: WGPU: removed Emscripten version check (currently failing on CI, ensure why, and tbh its redundant/unnecessary with changes of wgpu api nowadays)

commit 83a0030
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 10:33:44 2022 +0200

    Added ImGuiMod_Shortcut which is ImGuiMod_Super on Mac and ImGuiMod_Ctrl otherwise. (ocornut#456)

commit fd408c9
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 22 18:58:33 2022 +0200

    Renamed and merged keyboard modifiers key enums and flags into a same set:. ImGuiKey_ModXXX -> ImGuiMod_XXX and ImGuiModFlags_XXX -> ImGuiMod_XXX. (ocornut#4921, ocornut#456)

    Changed signature of GetKeyChordName() to use ImGuiKeyChord.
    Additionally SetActiveIdUsingAllKeyboardKeys() doesn't set ImGuiKey_ModXXX but we never need/use those and the system will be changed in upcoming commits.

# Conflicts:
#	imgui_demo.cpp
fangshun2004 added a commit to fangshun2004/imgui that referenced this issue Sep 29, 2022
commit cc5058e
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 21:59:32 2022 +0200

    IO: Filter duplicate input events during the AddXXX() calls. (ocornut#5599, ocornut#4921)

commit fac8295
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 21:31:36 2022 +0200

    IO: remove ImGuiInputEvent::IgnoredAsSame (revert part of 839c310), will filter earlier in next commit. (ocornut#5599)

    Making it a separate commit as this leads to much indentation change.

commit 9e7f460
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 20:42:45 2022 +0200

    Fixed GetKeyName() for ImGuiMod_XXX values, made invalid MousePos display in log nicer.  (ocornut#4921, ocornut#456)

    Amend fd408c9

commit 0749453
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 19:51:54 2022 +0200

    Menus, Nav: Fixed not being able to close a menu with Left arrow when parent is not a popup. (ocornut#5730)

commit 9f6aae3
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 19:48:27 2022 +0200

    Nav: Fixed race condition pressing Esc during popup opening frame causing crash.

commit bd2355a
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 19:25:26 2022 +0200

    Menus, Nav: Fixed using left/right navigation when appending to an existing menu (multiple BeginMenu() call with same names). (ocornut#1207)

commit 3532ed1
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 18:07:35 2022 +0200

    Menus, Nav: Fixed keyboard/gamepad navigation occasionally erroneously landing on menu-item in parent when the parent is not a popup. (ocornut#5730)

    Replace BeginMenu/MenuItem swapping g.NavWindow with a more adequate ImGuiItemFlags_NoWindowHoverableCheck.
    Expecting more subtle issues to stem from this.
    Note that NoWindowHoverableCheck is not supported by IsItemHovered() but then IsItemHovered() on BeginMenu() never worked: fix should be easy in BeginMenu() + add test is IsItemHovered(), will do later

commit d5d7050
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 17:26:52 2022 +0200

    Various comments

    As it turns out, functions like IsItemHovered() won't work on an open BeginMenu() because LastItemData is overriden by BeginPopup(). Probably an easy fix.

commit e74a50f
Author: Andrew D. Zonenberg <azonenberg@drawersteak.com>
Date:   Wed Sep 28 08:19:34 2022 -0700

    Added GetGlyphRangesGreek() helper for Greek & Coptic glyph range. (ocornut#5676, ocornut#5727)

commit d17627b
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 17:38:41 2022 +0200

    InputText: leave state->Flags uncleared for the purpose of backends emitting an on-screen keyboard for passwords. (ocornut#5724)

commit 0a7054c
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 17:00:45 2022 +0200

    Backends: Win32: Convert WM_CHAR values with MultiByteToWideChar() when window class was registered as MBCS (not Unicode). (ocornut#5725, ocornut#1807, ocornut#471, ocornut#2815, ocornut#1060)

commit a229a7f
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 16:57:09 2022 +0200

    Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (ocornut#5725)

commit e0330c1
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 14:54:38 2022 +0200

    Fonts, Text: Fixed wrapped-text not doing a fast-forward on lines above the clipping region. (ocornut#5720)

    which would result in an abnormal number of vertices created.

commit 4d4889b
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:42:06 2022 +0200

    Refactor CalcWordWrapPositionA() to take on the responsability of minimum character display. Add CalcWordWrapNextLineStartA(), simplify caller code.

    Should be no-op but incrementing IMGUI_VERSION_NUM just in case.
    Preparing for ocornut#5720

commit 5c4426c
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:22:34 2022 +0200

    Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (ocornut#5721)

commit 12c0246
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:07:43 2022 +0200

    Removed support for 1.42-era IMGUI_DISABLE_INCLUDE_IMCONFIG_H / IMGUI_INCLUDE_IMCONFIG_H. (ocornut#255)

commit 73efcec
Author: ocornut <omar@miracleworld.net>
Date:   Tue Sep 27 22:21:47 2022 +0200

    Examples: disable GL related warnings on Mac + amend to ignore list.

commit a725db1
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Sep 27 18:47:20 2022 +0200

    Comments for flags discoverability + add to debug log (ocornut#3795, ocornut#4559)

commit 325299f
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 14 15:46:27 2022 +0200

    Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709)

commit 56c3eae
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Sep 27 14:24:21 2022 +0200

    ImDrawList: asserting on incorrect value for CurveTessellationTol (ocornut#5713)

commit 04316bd
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 16:32:09 2022 +0200

    ColorEdit3: fixed id collision leading to an assertion. (ocornut#5707)

commit c261dac
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 14:50:46 2022 +0200

    Demo: moved ShowUserGuide() lower in the file, to make main demo entry point more visible + fix using IMGUI_DEBUG_LOG() macros in if/else.

commit 51bbc70
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 14:44:26 2022 +0200

    Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows, and don't capture mouse when drag and dropping. (ocornut#5710)

commit 7a9045d
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 11:55:07 2022 +0200

    Backends: WGPU: removed Emscripten version check (currently failing on CI, ensure why, and tbh its redundant/unnecessary with changes of wgpu api nowadays)

commit 83a0030
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 10:33:44 2022 +0200

    Added ImGuiMod_Shortcut which is ImGuiMod_Super on Mac and ImGuiMod_Ctrl otherwise. (ocornut#456)

commit fd408c9
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 22 18:58:33 2022 +0200

    Renamed and merged keyboard modifiers key enums and flags into a same set:. ImGuiKey_ModXXX -> ImGuiMod_XXX and ImGuiModFlags_XXX -> ImGuiMod_XXX. (ocornut#4921, ocornut#456)

    Changed signature of GetKeyChordName() to use ImGuiKeyChord.
    Additionally SetActiveIdUsingAllKeyboardKeys() doesn't set ImGuiKey_ModXXX but we never need/use those and the system will be changed in upcoming commits.

# Conflicts:
#	imgui.cpp
#	imgui.h
#	imgui_demo.cpp
fangshun2004 added a commit to fangshun2004/imgui that referenced this issue Sep 30, 2022
commit 5884219
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Wed Sep 28 23:37:39 2022 -0400

    imgui_freetype: Assert if bitmap size exceed chunk size to avoid buffer overflow. (ocornut#5731)

commit f2a522d
Author: ocornut <omarcornut@gmail.com>
Date:   Fri Sep 30 15:43:27 2022 +0200

    ImDrawList: Not using alloca() anymore, lift single polygon size limits. (ocornut#5704, ocornut#1811)

commit cc5058e
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 21:59:32 2022 +0200

    IO: Filter duplicate input events during the AddXXX() calls. (ocornut#5599, ocornut#4921)

commit fac8295
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 21:31:36 2022 +0200

    IO: remove ImGuiInputEvent::IgnoredAsSame (revert part of 839c310), will filter earlier in next commit. (ocornut#5599)

    Making it a separate commit as this leads to much indentation change.

commit 9e7f460
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 20:42:45 2022 +0200

    Fixed GetKeyName() for ImGuiMod_XXX values, made invalid MousePos display in log nicer.  (ocornut#4921, ocornut#456)

    Amend fd408c9

commit 0749453
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 19:51:54 2022 +0200

    Menus, Nav: Fixed not being able to close a menu with Left arrow when parent is not a popup. (ocornut#5730)

commit 9f6aae3
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 19:48:27 2022 +0200

    Nav: Fixed race condition pressing Esc during popup opening frame causing crash.

commit bd2355a
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 19:25:26 2022 +0200

    Menus, Nav: Fixed using left/right navigation when appending to an existing menu (multiple BeginMenu() call with same names). (ocornut#1207)

commit 3532ed1
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 18:07:35 2022 +0200

    Menus, Nav: Fixed keyboard/gamepad navigation occasionally erroneously landing on menu-item in parent when the parent is not a popup. (ocornut#5730)

    Replace BeginMenu/MenuItem swapping g.NavWindow with a more adequate ImGuiItemFlags_NoWindowHoverableCheck.
    Expecting more subtle issues to stem from this.
    Note that NoWindowHoverableCheck is not supported by IsItemHovered() but then IsItemHovered() on BeginMenu() never worked: fix should be easy in BeginMenu() + add test is IsItemHovered(), will do later

commit d5d7050
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 29 17:26:52 2022 +0200

    Various comments

    As it turns out, functions like IsItemHovered() won't work on an open BeginMenu() because LastItemData is overriden by BeginPopup(). Probably an easy fix.

commit e74a50f
Author: Andrew D. Zonenberg <azonenberg@drawersteak.com>
Date:   Wed Sep 28 08:19:34 2022 -0700

    Added GetGlyphRangesGreek() helper for Greek & Coptic glyph range. (ocornut#5676, ocornut#5727)

commit d17627b
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 17:38:41 2022 +0200

    InputText: leave state->Flags uncleared for the purpose of backends emitting an on-screen keyboard for passwords. (ocornut#5724)

commit 0a7054c
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 17:00:45 2022 +0200

    Backends: Win32: Convert WM_CHAR values with MultiByteToWideChar() when window class was registered as MBCS (not Unicode). (ocornut#5725, ocornut#1807, ocornut#471, ocornut#2815, ocornut#1060)

commit a229a7f
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 16:57:09 2022 +0200

    Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (ocornut#5725)

commit e0330c1
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 14:54:38 2022 +0200

    Fonts, Text: Fixed wrapped-text not doing a fast-forward on lines above the clipping region. (ocornut#5720)

    which would result in an abnormal number of vertices created.

commit 4d4889b
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:42:06 2022 +0200

    Refactor CalcWordWrapPositionA() to take on the responsability of minimum character display. Add CalcWordWrapNextLineStartA(), simplify caller code.

    Should be no-op but incrementing IMGUI_VERSION_NUM just in case.
    Preparing for ocornut#5720

commit 5c4426c
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:22:34 2022 +0200

    Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (ocornut#5721)

commit 12c0246
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 28 12:07:43 2022 +0200

    Removed support for 1.42-era IMGUI_DISABLE_INCLUDE_IMCONFIG_H / IMGUI_INCLUDE_IMCONFIG_H. (ocornut#255)

commit 73efcec
Author: ocornut <omar@miracleworld.net>
Date:   Tue Sep 27 22:21:47 2022 +0200

    Examples: disable GL related warnings on Mac + amend to ignore list.

commit a725db1
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Sep 27 18:47:20 2022 +0200

    Comments for flags discoverability + add to debug log (ocornut#3795, ocornut#4559)

commit 325299f
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Sep 14 15:46:27 2022 +0200

    Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709)

commit 56c3eae
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Sep 27 14:24:21 2022 +0200

    ImDrawList: asserting on incorrect value for CurveTessellationTol (ocornut#5713)

commit 04316bd
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 16:32:09 2022 +0200

    ColorEdit3: fixed id collision leading to an assertion. (ocornut#5707)

commit c261dac
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 14:50:46 2022 +0200

    Demo: moved ShowUserGuide() lower in the file, to make main demo entry point more visible + fix using IMGUI_DEBUG_LOG() macros in if/else.

commit 51bbc70
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 14:44:26 2022 +0200

    Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows, and don't capture mouse when drag and dropping. (ocornut#5710)

commit 7a9045d
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 11:55:07 2022 +0200

    Backends: WGPU: removed Emscripten version check (currently failing on CI, ensure why, and tbh its redundant/unnecessary with changes of wgpu api nowadays)

commit 83a0030
Author: ocornut <omarcornut@gmail.com>
Date:   Mon Sep 26 10:33:44 2022 +0200

    Added ImGuiMod_Shortcut which is ImGuiMod_Super on Mac and ImGuiMod_Ctrl otherwise. (ocornut#456)

commit fd408c9
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Sep 22 18:58:33 2022 +0200

    Renamed and merged keyboard modifiers key enums and flags into a same set:. ImGuiKey_ModXXX -> ImGuiMod_XXX and ImGuiModFlags_XXX -> ImGuiMod_XXX. (ocornut#4921, ocornut#456)

    Changed signature of GetKeyChordName() to use ImGuiKeyChord.
    Additionally SetActiveIdUsingAllKeyboardKeys() doesn't set ImGuiKey_ModXXX but we never need/use those and the system will be changed in upcoming commits.

# Conflicts:
#	docs/CHANGELOG.txt
#	imgui.h
#	imgui_demo.cpp
DnA-IntRicate added a commit to DnA-IntRicate/imgui that referenced this issue Oct 7, 2022
* Docking: added comments. added experimental TabItemFlagsOverrideSet to ImGuiWindowClass.

(Could probably do something similar with TabBarFlagsOverrideSet+Clear for ocornut#2700 later.)

* Docking: docked window honor tab and text colors by storing them. (ocornut#2771)

Later to lead into ocornut#2700 and ocornut#2539
Move tab submission block above in DockNodeUpdateTabBar(), not strictly necessary for this change as is, but useful if needing to apply override for TitleBg* as we'd need a value for node->VisibleWindow earlier than currently set.

* Fixed some compile warnings with Clang on Windows (ocornut#3754)

* Viewports, Backends: Vulkan: handle VK_ERROR_OUT_OF_DATE_KHR when resizing secondary viewport (ocornut#3766, ocornut#3758)

Cannot repro here but appears to a user on Linux. Fix may be not super solid.

* Docking: on node split, update memorized DockId for currently closed windows (ocornut#3716)

Amended by @ocornut with same fix in DockBuilderRemoveNodeChildNodes().

* Docking: fix gap in hit test hold when using ImGuiDockNodeFlags_PassthruCentralNode touching the edge of a viewport. (ocornut#3733)

* Viewports: (breaking) removed ImGuiPlatformIO::MainViewport which is now pretty much unused and duplicate (and misleading as we will evolve the concept)

Use GetMainViewport() if stuck.

* Viewports: Moved in own section of imgui.h ahead of merging a small part of viewport interface to master.

* Viewports: trying to treat GetMainViewport() as const. Reducing unnecessary casts of ImGuiViewportP*

Metrics: readded root Drawlists node in metrics to match master.
The (void*) casts are implying const-casst but currently left GetMainViewport() as returning non-const.

* Viewports: (Breaking) turned GetWorkPos(), GetWorkSize() into straight fields -> WorkPos, WorkSize before exposing in master branch.

* Fix for compiling imgui_internal.h without operators + made GetWorkRect() consistent with clamped WorkSize.

* Misc tweaks - mostly toward minimizing diff in upcoming backport merge of a few viewport structures in master

* Viewports: Fix issue inferring viewport z-order when new popups gets created. (ocornut#3734) + Metrics updates.

Revert 6bc5266
Showing inferred order and missing flags in metrics.

* Viewports: Setting the new (currently dummy) flags on viewports. (ocornut#3789, ocornut#1542, ocornut#3680, ocornut#3350, ocornut#3012, ocornut#2471)

Amend the merging of f14042c (merge ee59d7a)

* Remove redundant GetMainViewport decl in imgui.h (ocornut#3801, ocornut#3800)

* Docking: Made close button enable logic consistent on dockspace. When no docked window have a close button or it is disabled on the node, the space is given to tabs.

Clarified close_button_is_visible vs close_button_is_enabled behavior in DockNodeUpdateTabBar().. (ocornut#3633, ocornut#3521)
Reduced alpha of disabled close button a little bit further.
Removed 'EnableCloseButton' which was actually unused (can't be infered early, need ->VisibleWindow anyway, which is not == ->ActiveWindow)

* Examples: DX9-DX11: Removed half-assed DPI awareness enable. Updated Docking/Viewports part of Changelog (e.g. removed bits that are now already in master, clarified some added bits)

* Viewports: Fix setting of ImGuiViewportFlags_NoRendererClear. (ocornut#3213)

* Internals: Add a way to request window to not process any interactions for specified number of frames.

* Added missing IMGUI_API to internal docking-related structs. (ocornut#3850)

* Internals: Docking: some renaming.

* Internals: rename RootWindow->RootWindowDockTree, RootWindowDockStop->RootWindow.

Why?  So by default RootWindow matches user expectation on both branches, and RootWindowDockTree is more intentful.
(Actually should reduce diff between master<>docking)

* Viewports, Backend: SDL: Fix missing ImGuiBackendFlags_HasSetMousePos flag in docking branch (ok in master), GLFW: Fix application of WantSetMousePos. (ocornut#1542, ocornut#787)

Shows how little this feature is used with nav (was designed for small devices and frankly may be dropped) - but the backend support itself we will make use of for other features.

* Viewports, Internals: added GetViewportPlatformMonitor() will a safety net to keep code portable + simplified handling of disconnected monitor in Begin().

* ImDrawFlags: rework/revert c2d6d26 + 39432bf in a way that is closer to old version and back to opt-in but with default 0 = all corners.

* Removed deprecated flag stopping compilation (ocornut#3902)

* Docking: Dockspace() never draws a background. (ocornut#3924)

* Docking: undocking nodes/windows covering most of the monitor max their size down to 90% to ease further manipulations.

Kind of a welcome hack.

* Docking: Add support for split_outer in DockContextCalcDropPosForDocking().
Misc: Add FIXME regarding behavior of some window fields.

* Viewports, Backends: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (ocornut#3881)

* BeginMainMenuBar(): remove expectation that we don't know menu bar height ahead, allowing up to generalize placement in any direction (will be done in master)

Amend 75de34e

* Viewports: Hotfix for crash in monitor array access, caused by 4b9bc49. (ocornut#3967)

* TabBar: Use mouse position instead of hardcoded +1/-1 offset when reordering tabs.

Fixes tab reordering in test engine when using fast mode.

# Conflicts:
#	imgui_widgets.cpp

* TabBar: Amend previous commit. Fix tab reordering when tab bar has scrolling.

Some tidying up with helpers + honor 16-bit offsets as with other tab bar features (unlikely single reorder can reach that but consistent)

* Backends, Viewports: GLFW: Add a workaround for stuck keys after closing a GLFW window (ocornut#3837).

* Docking: DockSpace() returns its node ID + adding branch changelog.

* Docking: fix undocking from tab-bar by moving mouse horizontally, broken by d705192.

* Docking: removed io.ConfigDockingWithShift option. (ocornut#2109)

* Docking: fix undocking from tab-bar by moving mouse horizontally, amend 3ed07a8 + d705192.

Automation system may drag e.g. right-most tab far left (and vice-versa) and one frame and our current logic would fail at it.

* Fix popup positioning, broken by 84e6fe4. (ocornut#3991, ocornut#3982)

* Docking: Fixed restoring of tab order within a dockspace or a split node.

(tests in "docking_tab_order")

* Docking: Fixed multiple simultaneously reappearing window from appearing undocked in their initial frame.

* Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame.

* Docking: move NavWindow to SelectedTabId application lower to leave a chance for in-between code to alter focus. + store per-node window menu button id to simplify usage.

* Docking: Fix window menu button. Broken by 3f16a52 (ocornut#4043)

Worked on single-frame click.

* Changelog: added docking+entries from 1.72 to 1.82 to increase their visibility.

* Backends: Vulkan: Fix for using IMGUI_IMPL_VULKAN_NO_PROTOTYPES (ocornut#4151, ocornut#3759, ocornut#3227)

* Docking: Docking node tab bar honors ItemInnerSpacing.x before first tab. Tweak rendering and alignment of dock node menu marker. (ocornut#4130)

+ Fix ~0 in EndFrameDrawDimmedBackgrounds() which is obsolete way of signifying "all round corners".

* Docking: Fix IsWindowAppearing() and ImGuiCond_Appearing on docked windows. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061)

* Docking: Amend 91704b7, window->DockXXX booleans not properly cleared when window not docked. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061)

Fix issue with freshly split windows/nodes incorrectly returning true to IsWindowAppearing().

* Docking: Fix IsWindowAppearing() unnecessarily returning true twice in a row. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061) + added a zealous assert.

* Docking: Clicking on the right-most close button of a docking node closes all windows. (ocornut#4186)

* Docking: comments (ocornut#4189)

* Added PushDisabled(), PopDisabled() currently only exposed in imgui_internal.h (ocornut#211)

* ImVector: added clear_delete(), clear_destruct() helpers.

# Conflicts:
#	imgui.cpp

* Nav, Drag and Drop, Docking: fixed two issues leading nav result to conflict with moving a window. (ocornut#4211, ocornut#3025)

* Backends, Viewports: Vulkan: Fix the use of the incorrect fence in wait for fence. (ocornut#4208)

The fence being waited upon was not the one associated with the current frame.
This results in validation error detecting a reset of command buffers still in use and resetting fences while still in use.
Read more details in ocornut#4208

* Metrics: Tentative fix for bad printf format.

Ref b53b8f5, a7a1b3b

* Viewport: extracted code out of Begin() into WindowSyncOwnedViewport() - no other change

* Viewports: Fix popup/tooltip created without a parent window from being given a ParentViewportId value of the implicit/fallback window. (ocornut#4236, ocornut#2409)

Amend 3ead982

* Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys().

No need to clear fields before deletion. DX12: renamed to match docking branch.

* Backends: Viewports: renamed viewport storage structures ImGuiViewportDataXXXX -> ImGui_ImplXXXX_ViewportData and locals (matching naming convention in 70c6038)

* Docking: removed DockNodeFlagsOverrideClear flags from ImGuiWindowClass. (ocornut#2999, ocornut#3521, ocornut#3633)

+ extraded bits of metrics into DebugNodeDockNodeFlags()

* Docking: Reworked node flags saving/inheritance... (ocornut#4292, ocornut#3834, ocornut#3633, ocornut#3521, ocornut#3492, ocornut#3335, ocornut#2999, ocornut#2648)

..so that flags enforced by docked windows via the DockNodeFlagsOverrideSet mechanism are are not left in empty dockspace nodes once the windows gets undocked.

* Docking: Added ImGuiDockNodeFlags_NoDockingOverEmpty. Breaking definition of ImGuiDockNodeFlags_NoDockingOverOther which now means "non empty node". (ocornut#3492, ocornut#2648, ocornut#4292)

* Docking: Fixed crash issues using DockBuilderRemoveNode() in some situations. (ocornut#3111, ocornut#3179, ocornut#3203, ocornut#4295)

If the deleted root node isn't part of a dockspace with a central node, it won't be "protected" but removed when last window gets removed.

* Docking: Fix crash when a dock node gets re-qualified as dockspace>floating>dockspace.. (ocornut#3203, ocornut#4295)

Which tends to happen when incorrectly calling DockBuilderAddNode() without ImGuiDockNodeFlags_Dockspace and using it as a Dockspace on the next frame after the floating window hosting the node has been automatically created.

* Added missing IMGUI_API to GetViewportPlatformMonitor. (ocornut#4309)

* Backends: Win32, SDL, GLFW: only honor io.WantSetMousePos when focused + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (ocornut#787, ocornut#2445, ocornut#2696, ocornut#3751, ocornut#4377)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp

* IO: modify io.AddFocusEvent() to tolerate in/out for multi-viewports. Amend 2f40be6. (ocornut#3532)

* Fix BeginDisabled(false), (ocornut#211, ocornut#4452)

* Fix BeginDisabled(false), again, (ocornut#211, ocornut#4452, ocornut#4453) Version 1.84.1

(forced pushed since our earlier versioning didn't sort correctly in github web)

# Conflicts:
#	docs/CHANGELOG.txt

* Backends: GLFW: Fixed unused variable warning for empty assert macro. (ocornut#4459)

* Docking: fixed settings load issue when mouse wheeling. (ocornut#4310)

* Docking: fix 58f5092 (ocornut#4310)

If we clear _ChildWindow flag we must remove it from here otherwise render loop will fail.

* Docking: warning fix for when IM_ASSERT() is empty

* Fixed bad merge of Changelog in docking branch

* Internals: refactored IsWindowHovered()/IsWindowFocused() to make their logic more similar + change underlying value of ImGuiHoveredFlags_AllowWhenBlockedByPopup + comment out docking only flags.

* Fixed _ChildWindows from leaking docking hierarchy. Added ImGuiFocusedFlags_DockHierarchy and ImGuiHoveredFlags_DockHierarchy.

* Viewports: fixed unnecessary creation of temporary viewports when multiple docked windows got reassigned to a new node (created mid-frame) which already has a HostWindow

* Viewports: Fixed a crash while a window owning its viewport disappear while being dragged.

t would manifest when e.g. reconfiguring dock nodes while dragging.

* Viewports: fix window with viewport ini data immediately merged into a host viewport from leaving a temporary viewport alive for a frame (would leak into backend).

* Fixed IsWindowFocused/IsWindowHovered with _ChildWindows for not following through popup parents (amend 6b1e094, fix ocornut#4527)

* Viewports: extracted DestroyViewport() out of UpdateViewportsNewFrame() function.

* Docking: bits.

* Docking: floating node with a central node hides properly when nothing is docked + rename.

* Docking: Improved resizing system so that non-central zone are better at keeping their fixed size.

* Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation is disabled. (ocornut#4547, ocornut#4439)

* Docking: Fixed IsItemHovered() and functions depending on it (e.g. BeginPopupContextItem()) when called after Begin() on a docked window (ocornut#3851)

Fix ee643b2

* Added ImGuiFocusedFlags_NoPopupHierarchy and ImGuiHoveredFlags_NoPopupHierarchy (followup ocornut#4527)

IsWindowFocused: fix flag usage (amend 6b1e094) was technically harmless because of light typing.

* Docking: reinstate io.ConfigDockingWithShift option. (ocornut#4643)

This more or less reverts commit 3ed07a8.

* Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (ocornut#4655, ocornut#4452, ocornut#4453, ocornut#4462)

* Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (ocornut#4656)

* Viewports: Made it possible to explicitly assign ImGuiWindowClass::ParentViewportId to 0. (ocornut#3152, ocornut#2871)

* Fixed tooltip in own viewport over modal from being incorrectly dimmed. (ocornut#4729)

Normally we would aim to ensure that g.Windows[] gets maintained to reflect display layer but it is presently non trivial.

* Fixed crash on right-click without modal, introduced by previous commit a3667f4,  (ocornut#4729)

* Viewports: fix missing default per-window value for ParentViewportId due to zero-cleared in-window instance (ocornut#4756)

Broken by 2080d12

* Docking: Fixed a bug undocking windows docked into a non-visible or _KeepAliveOnly dockspace. (ocornut#4757)

* Docking: Fix typo (had no side effect) (ocornut#4778)

Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com>

* Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport + moved EndFrameDrawDimmedBackgrounds() call + removed duplicate code in Begin() already in EndFrameDrawDimmedBackgrounds()

* Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree.

* Docking: Fixed single-frame node pos/size inconsistencies when window stop or start being submitted.

Fix 718e15c while preserving its intended property. Tested by "docking_window_appearing_layout". (ocornut#2109)

* Docking: internals: extracted rounding corner calculation into reusable CalcRoundingFlagsForRectInRect() function.

* Docking: docked windows honor ImGuiCol_WindowBg. Host window in charge of rendering seams. (ocornut#2700, ocornut#2539 + Docked windows honor display their border properly. (ocornut#2522)

Plus: better support for transparent one in nodes
Side effects: DockContextBindNodeToWindow doesn't alter node->IsVisible.
Side effects: ImDrawList:: _ResetForNewFrame() needs to merge, sane (in case of
(Amended, force-pushed)

* Docking: Amend b16f738 fixed dimming of docked window + removed thin highlight around windows (never worked on docked window, not viewports friendly, hard to move to EndFrame) (ocornut#2700, ocornut#2539, ocornut#2522)

* Nav, Docking: reworked modal/ctrl+tab dimming system to be entirely processed at end of the frame, which will simplify things for an upcoming commit.

(Will backport some of this back to master now.)

* Nav, Docking: Fix dimming on docked windows.

* Nav, Docking: Fix crash on dimming docked window and DockSpaceOverViewport() with PassthruCentralNode.

(amend 1dc3af3, 23ef6c1, 657073a)

* Added an assertion for the common user mistake of using "" as an identifier at the root level of a window. (ocornut#1414, ocornut#2562, ocornut#2807, ocornut#4008, ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796)

  ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796)

* Docking: prevent docking any window created above a popup/modal. (ocornut#4317)

* Internals: UpdateWindowInFocusOrderList: amend a528398 to fix docking. (ocornut#3496, ocornut#4797)

* Internals: reduced side-effects of setting window->HiddenFramesForRenderOnly > 0

* Viewports: Fixed a CTRL+TAB crash with viewports enabled (ocornut#4023, ocornut#787) (amend 1dc3af3, 23ef6c1, 657073a)

+ Expose FindHoveredViewportFromPlatformWindowStack() in imgui_internal.h

* Update .gitignore

* Backends: OSX: Fixed typo.

* Rename io.AddKeyModEvent() -> io.AddKeyModsEvent() and updated backends accordingly. (ocornut#2625, ocornut#4858)

Amend 790132a (breaking)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp

* IO: fix SetKeyEventNativeData() not handling ImGuiKey_None the same way as AddKeyEvent(). (ocornut#4905, ocornut#4858)

* Merge "Backends: SDL: Fix for Emscriptem. Amend 98ce013." + Fix bad merge from master of "is_app_focused" property (Amend 0647ba3)

* Viewports: Fixed active InputText() from preventing viewports to merge. (ocornut#4212)

* Viewports: Relaxed specs for backend supporting ImGuiBackendFlags_HasMouseHoveredViewport. Backends: SDL: Added support for simplified HasMouseHoveredViewport. (ocornut#1542, ocornut#4665)

* IO: added AddMouseViewportEvent() + used in backends.

* Docking: Fixed a CTRL+TAB crash when aiming at an empty docked window. (ocornut#4792)

* Revert moving ImGuiKeyModFlags to internal.h (amendc906c65)

# Conflicts:
#	imgui.cpp

* Backends: SDL: no support for ImGuiBackendFlags_HasMouseHoveredViewport under OSX/LInux (ocornut#4960)

* Docking: Fixed size constraints not working on single window holding on a dock id (still doesn't work on docked windows).

* Docking: Tabs use their own identifier (in order to make window->ID refer to whole window in test engine).  Also prevents Tab ID from clashing with "" which was common.

* Docking: Fixed CTRL+TAB back into a docked window not selecting menu layer when no item are on main layer.

Could merge on master.

* Backends: SDL: Amend 08350e5, multi-viewports mouse tracking works under Linux. (ocornut#4960) + Reword tests to help static analysis.

* Docking: fixed potential crash if a passthrough dock node is submitted without a child intermediate (currently not possible via API)

* Internals: rework RenderMouseCursor() signature so we can use it in docking branch more naturally. (Merged from master+ rework for docking)

# Conflicts:
#	imgui.cpp
#	imgui_draw.cpp

* Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (ocornut#4900)

* Docking: Fixed floating docked nodes not being clamped into viewport workrect to stay reachable when g.ConfigWindowsMoveFromTitleBarOnly is set and multi-viewports are disabled. (ocornut#5044)

* Viewports: Fixed translating a host viewport from briefly altering the size of AlwaysAutoResize windows. (ocornut#5057)

* Backends: SDL: Fix multi-viewport dragging issue with SDL on some systems. (ocornut#5012)

* Backends: SDL: Fix more dragging issues. SDL_CaptureMouse() is essentially broken. (ocornut#5012, ocornut#5082)

master got c5f6721 which is combining f337378 and this commit.

* Windows: Fixed first-time windows appearing in negative coordinates. (ocornut#5215, ocornut#3414)

Regression added in 6af92b0

* Backends: OSX, Metal: Added multi-viewports support. (ocornut#4821, ocornut#2778)

* Backends: OSX, Metal: Amend d111133, tidying up, remove unused, misc tweaks. . (ocornut#4821, ocornut#2778)

* Backends: OSX: Implement ImGui_ImplOSX_ShowWindow(). (ocornut#5299)

* Examples: Apple+OpenGL: Fix build.

* Docking: Fixed moving window being interrupted when undocing a window with "io.ConfigDockingAlwaysTabBar = true". (ocornut#5324)

Regression introduced in 6b77668

* Docking: Fix unhiding tab bar regression. (ocornut#5325, ocornut#5181)

Broken by 9038678

* Misc: Fix custom assertion macro failing to compile imgui.cpp (ocornut#5378)

* Docking: Fixed incorrect focus highlight on docking node when focusing empty central node or a child window which was manually injected into a dockspace window.

* Backends: SDL+GLFW, Examples: SDL+Metal, GLFW+Metal: Fix viewport support with Metal backend.

Fixes ocornut#5392 + alignment fixes and removed static_cast<> + Amended with fix.

* Docking, Modal: Fixed a crash when opening popup from a parent which is being docked on the same frame. (ocornut#5401)

Ideally we should untangle the purpose of parent_window_in_stack / ParentWindowInBeginStack better.

* Docking: Amend 24dfebf. Fixed incorrect focus highlight on docking node with nested hierarchies.

* Backends: GLFW: Fixed leftover static variable preventing from changing or reinitializing backend while application is running. (ocornut#4616, ocornut#5434)

* Backends, Viewport: Metal: Pull format from shared context. (ocornut#5403, ocornut#5437)

* Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer  (ocornut#5463, ocornut#4792)

Fix 37958ca

* Docking: Fix docked window contents not rendering when switching with CTRL+Tab.

(regression from 8eb8689).

* Internals: Docking: make DockContextFindNodeByID() more visible (instead of DockBuilderGetNode)

+ using defines for channel changes.

* Docking: Fixed splitting/docking into a node that has buttons amended into tab bar. Windows were not moved correctly. (ocornut#5515)

* Docking: Fixed amending into an existing tab bar from rendering invisible items. (ocornut#5515, amend b16f738 ocornut#2700, ocornut#2539)

Commit b16f738 left us with a "current" channel 0 which seems inadequate. Undoing that, assuming default is always 1, code filling bg color does a switch. Only DockContextEndFrame() leave it at 0 and it's not particularly necessary.

* Docking+Viewports: Fix undocking window node causing parent viewport to become unresponsive. (ocornut#5503)

Amend 67be485, Somehow ties to 58f5092 + 0eb45a0 (ocornut#4310)
Unsure of exact chain of event but this caused a parent link msimatch between the time of the MouseMoving test in AddUpdateViewport() setting _NoInputs on the wrong parent., and the release clearing _NoInputs on the rght one.

* Docking: Simplify logic of moving tabs between nodes. Amends 0abe7d. (ocornut#5515)

The idea is that in the absence of a tab bar, as new one gets created new tabs will be sorted based on window->DockOrder so this may work but we're not 100% sure.

* Docking: Add source dock node parameter DockContextCalcDropPosForDocking() to facilitate test engine (un)docking nodes before they are split out to their own window.
Metrics: Display dock_node->Windows in node metrics.

* Internals: Docking: rename HoveredDockNode to DebugHoveredDockNode to clarify that it isn't usable for much other than debugging.

* Nav: Fixed regression in e99c4fc preventing CTR+Tab to work without NavEnableKeyboard (ocornut#5504, ocornut#4023);

* Obsoleted using SetCursorPos()/SetCursorScreenPos() to extend parent window/cell boundaries. (ocornut#5548)

This incorrect pattern has been mentioned or suggested in: ocornut#4510, ocornut#3355, ocornut#1760, ocornut#1490, ocornut#4152, ocornut#150

# Conflicts:
#	imgui.cpp

* Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (ocornut#5665)

* Docking: Fixed incorrect focus highlight on docking node when focusing a menu. (ocornut#5702)

* Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709)

# Conflicts:
#	backends/imgui_impl_opengl3.cpp

* Update imgui_impl_vulkan.h to match martty/imgui

https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.h

* Update imgui_impl_vulkan.cpp to match martty/imgui

https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.cpp

* Viewports: Fix AddMouseViewportEvent() to honor AppAcceptingEvents, filter duplicate, add to debug log.

* Docking: Fixed missing highlight when using dock node host window borders. (ocornut#5702)

Amend 8f43487, 9764adc, 24dfebf

* Fixed ImGuiWindowFlags_UnsavedDocument clipping label in docked windows with no close button. [changes for docking] (ocornut#5745)

+ TabBar: starts displaying the unsaved document marker with a frame delay to match how close button is processed, otherwise the transition would be noticeable.

* Fix for Vulkan validation layer warnings

Fix from: TheCherno@add065f
ocornut#3957

Co-authored-by: ocornut <omarcornut@gmail.com>
Co-authored-by: Sammy Fatnassi <sammyfreg@gmail.com>
Co-authored-by: GamingMinds-DanielC <daniel.cremers@gamingmindsstudios.com>
Co-authored-by: Adam Kewley <contact@adamkewley.com>
Co-authored-by: Rokas Kupstys <rokups@zoho.com>
Co-authored-by: David Maas <contact@pathogenstudios.com>
Co-authored-by: CheckmateAt7 <66566308+CheckmateAt7@users.noreply.github.com>
Co-authored-by: warriormaster12 <streng.alexander@gmail.com>
Co-authored-by: Michel Lesoinne <michel.lesoinne@androdevllc.com>
Co-authored-by: Mikko Sivulainen <mikko.sivulainen@gmail.com>
Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com>
Co-authored-by: Dima Koltun <koltundimachamp@gmail.com>
Co-authored-by: stuartcarnie <stuart.carnie@gmail.com>
Co-authored-by: omar <ocornut@users.noreply.github.com>
Co-authored-by: Andrej Redeky <41929176+WSSDude420@users.noreply.github.com>
Co-authored-by: Runik <rtoumazet@free.fr>
Co-authored-by: Stephen H. Gerstacker <stephen@gerstacker.us>
@parbo
Copy link
Author

parbo commented Oct 14, 2022

The state for me is that I can no longer reproduce the memory leak, even with the code as it was when I originally reported this. I guess the Intel driver has been updated to fix the problem.

The tearing issue is still there if UseBufferSubData is true, and not there if set to false.

GL_DYNAMIC_DRAW vs GL_STREAM_DRAW seems to make no difference.

Output from debug printouts:

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

@ocornut
Copy link
Owner

ocornut commented Nov 9, 2022

The state for me is that I can no longer reproduce the memory leak, even with the code as it was when I originally reported this. I guess the Intel driver has been updated to fix the problem.

Alright, I'll disable that stuff now.

The tearing issue is still there if UseBufferSubData is true, and not there if set to false.

Which tearing issue are you talking about? Anyhow we will disable UseBufferSubData now.

Thank you.

@ocornut
Copy link
Owner

ocornut commented Nov 9, 2022

Reverted with b8b0f9d. PLEASE REPORT IF YOU STILL HAVE ISSUES AFTER TODAY.
I temporarily kept the alternative code path even though bd->UseBufferSubData is always false, allowing potential experiment shall new issues arises. Finger crossed this doesn't bite us back.

@jsham0414
Copy link

It doesn't just happen in the opengl. I'm using directx11 and the same thing happens.

@flarive
Copy link

flarive commented May 9, 2024

Hello @ocornut,

I'm also facing the memory leak bug with latest docking branch.
I have an NVIDIA GeForce MX 250 on my Windows 11 Dell laptop.
I have the latest NVIDIA drivers.

I have made a very simple repro to reproduce the memory issue :
https://github.com/flarive/imGuiViewport_MemoryLeak

Image taken from the simple repro :
memory_leak

When one of the dialog is outside the main window, the memory starts to increase and never stops increasing.
If i just move the 2 dialogs into the main window, the memory stops increasing and falls back to something like 15Mo.

I have tried to use your fix from your opengl_buffer_update branch (009c1e0)

When using the 2 files from your fix, the memory leak seems to be fixed but i have strange glitches on my dialogs :(

Image taken from my project showing the glitches :
glitch

I have time to help you if you need help on that issue.
Sorry, i know you thought it was fixed... but in fact not really :)

Eviral

@SorpoBlock
Copy link

Hello, a friend of mine was trying to run my game, he has a GTX 1070 and Windows, not sure what his drivers are, but he kept getting the following error:

"ERROR - OpenGL error, type: 33361 severity: 33387 message: Buffer detailed info: Buffer object 9 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_STREAM_DRAW) will use VIDEO memory as the source for buffer object operations."

I personally don't use stream draw, only static or dynamic, so I was able to trace the issue to imgui_impl_opengl3.cpp line 579:

GL_CALL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW));

I do not get the issue on my RX 5700 XT with Windows and updated drivers nor do I get it on intel integrated graphics on a Linux laptop.

@flarive
Copy link

flarive commented Sep 7, 2024

Hello,
The solution for me was to force NVIDIA video card usage (GeForce MX250 on my laptop) instead of intel embedded chipset.
It solved the issue without any hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants