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

Fix slow resize Embedded Game Window #102251

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

Hilderin
Copy link
Contributor

After some testing the performance issue was caused by the NOTIFICATION_PROCESS and NOTIFICATION_RESIZED which triggered a deferred call to EmbeddedProcess::_update_embedded_process each frame which was really unnecessarily. This helps the Floating Window but also the Editor Window when resizing the window or docks.

Using a timer to update the embedded window less frequently seems to work fine. At the same time, I was able to remove the NOTIFICATION_PROCESS from the EmbeddedProcess control which always bothered me.

Note: It does not affect the re-rendering of the game but rather the unresponsiveness of the window.

Note 2: There's an issue actually when resizing the game window, sometime, it stop resizing and focuses the game window. This was fixed in #102247.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Linux X11 KDE (NVIDIA), it works as expected. It's hard to spot a definitive improvement though.

I assume this will help more on Windows which has historically had more issues with window resize performance.

Forward+

Before

resize_before.mp4

After

resize_after.mp4

Compatibility

Before

resize_before_opengl.mp4

After

resize_after_opengl.mp4

@Hilderin
Copy link
Contributor Author

Hilderin commented Feb 1, 2025

I tested on my old computer and the difference is more noticeable. It's far from perfect but it's a bit better.

Godot v4.4.beta (65e14fd) - Windows 10 (build 19045) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce 940M (NVIDIA; 30.0.14.7219) - Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (4 threads)

4.4 beta 2:

dBDacN9PsF.mp4

This PR:

niQwPehAVK.mp4

No embedding:

godot.windows.editor.x86_64_YbdQCGIpfD.mp4

@Hilderin
Copy link
Contributor Author

Hilderin commented Feb 1, 2025

I found a bad regression with this PR. When hitting a breakpoint in the script editor, the focus remains on the game window. I'll look into it.
Edit: OK, wow, for this to happen both PR #102251 and #102247 must be merged together!! I pushed a fix in: #102247

@Repiteo Repiteo merged commit 2675997 into godotengine:master Feb 3, 2025
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Feb 3, 2025

Thanks!

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

Successfully merging this pull request may close these issues.

Resizing a floating game window is slow
4 participants