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

Vulkan Mobile: Video memory leakage when viewport resizes with a WorldEnvironment and glow enabled #77295

Open
Tracked by #55871
ghsoares opened this issue May 20, 2023 · 4 comments

Comments

@ghsoares
Copy link

Godot version

v4.0.3.stable.official.5222a99f5

System information

Windows 11, Vulkan API 1.2.175 - Forward Mobile - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GT 730

Issue description

There's a memory leakage when running a simple scene with a WorldEnvironment and glow enabled, when the Viewport changes it's size, when I go to the Video Memory debugger monitor, the memory usage increases rapidly every time I resize the Viewport, but only when the glow effect is enabled. The memory usage can go beyond 1 GiB easily, before slowing the whole computer down and forcing me to close the running scene.

image

Steps to reproduce

  1. Create a simple 3D scene with a Camera3D, a MeshInstance3D and a WorldEnvironment with glow enabled;
  2. In the project's settings, change the window stretch mode and aspect so that the base Viewport changes size according to the window (viewport mode aspect expand, for example);
  3. Run the scene and keep resizing the window and watch the Video Memory debugger monitor (be careful in this part, the memory usage can go crazy and can easily freeze the entire computer).

Minimal reproduction project

test.zip

@ghsoares
Copy link
Author

Just tested with Forward+, there is no memory leakage when resizing the window, it's a Forward Mobile only issue

@Calinou Calinou changed the title Video memory leakage when viewport resizes with a WorldEnvironment and glow enabled Vulkan Mobile: Video memory leakage when viewport resizes with a WorldEnvironment and glow enabled May 21, 2023
@lostminds
Copy link

lostminds commented May 22, 2023

Just tested this in Godot 4.0.3 on macOS 13.3.1 and see the same issue there.

Interestingly I only seem to get the memory leakage during viewport resizing by resizing the window. If I toggle fullscreen on/off (which on macOS animate-resizes the window up to full screen) I don't get the leaking for the viewport resize during that resize animation, and the video memory for the larger full screen viewport also seems to be correctly released when toggling back to a smaller windowed mode viewport again. If I change the viewport size in script (I have a debug testing this that toggles between landscape and portrait) I get a leak of 10-15MB for each change. So either something else is going on when manually resizing the window or it could be that when manually resizing the window it just ends up doing a lot of small viewport changes that add up quickly to GB size memory leaks.

@ghsoares
Copy link
Author

Interesting, in my case when I toggle fullscreen it seems to not free the memory, slowly rising the video memory usage:
image
Windows 11 have a resizing animation too, but it seens to keep the old resolution during the animation (while only upscaling the last drawn frame), and then setting the new resolution after the animation finishes, isn't it the same case with MacOS?

@lostminds
Copy link

Still an issue on 4.1.beta2. Regarding the fullscreen toggle it does does leak memory there as well, but only a little as you can see in the first blip in the graph it goes up two steps and then back down one when toggling to fullscreen, then up and down (to a smaller resolution) when toggling out of fullscreen. When manually resizing the window as you can see it quickly goes up one "step" per frame it seems, and then back down slightly after the resize period is done.

Screenshot 2023-06-17 at 22 03 42

It's as if it's releasing a single "old" buffer after the resize has been completed but doesn't account for a large number of additional buffers that have been created during the resize process without being released.

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

3 participants