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

Profiler frame number stops updating when game window is minimized #37341

Closed
Tracked by #37734
SkyLucilfer opened this issue Mar 26, 2020 · 12 comments · Fixed by #37450
Closed
Tracked by #37734

Profiler frame number stops updating when game window is minimized #37341

SkyLucilfer opened this issue Mar 26, 2020 · 12 comments · Fixed by #37450

Comments

@SkyLucilfer
Copy link
Contributor

Godot version:
Master branch
a2da99f

OS/device including version:
Windows 10

Issue description:
When profiler is running and game window is minimized, the frame number at the top right of the profiler will stop updating. Meanwhile the profiler will still be running - still outputting graph, statistics.

Additional remark : During this time (when the game window is minimized), if we try to export measures as CSV, the Editor will crash. It doesn't happen as often when the game window is not minimized. Closely related to #34640

Steps to reproduce:

  1. Create an empty project.
  2. Add a 2d Node and attach a script to it.
  3. Run the scene.
  4. Start the profiler.
  5. Minimize the game window.

Minimal reproduction project:
test.zip

@SkyLucilfer SkyLucilfer changed the title Profile frame number stop updating when game window is minimized Profiler frame number stops updating when game window is minimized Mar 26, 2020
@Faless
Copy link
Collaborator

Faless commented Mar 26, 2020

@SkyLucilfer are you sure you tested at that commit?
I can't reproduce at that commit, but I can reproduce in a build after the display-server branch

@Faless
Copy link
Collaborator

Faless commented Mar 26, 2020

Seems a regression after the merge from the display-server branch.

@SkyLucilfer
Copy link
Contributor Author

@SkyLucilfer are you sure you tested at that commit?
I can't reproduce at that commit, but I can reproduce in a build after the display-server branch

Yes I confirm its the correct commit with git log - 1.
I'm interested or can help in working on this issue if you think it's accessible for me (relatively new contributor)

@Faless
Copy link
Collaborator

Faless commented Mar 26, 2020

@SkyLucilfer can you check if you are getting this at b8577ec ?

@SkyLucilfer
Copy link
Contributor Author

Yes I'm still getting it with that commit.

profilerBug2

@Faless
Copy link
Collaborator

Faless commented Mar 27, 2020

I can see you are also getting very low idle times, can you try adding this to your _process:

	print(Engine.get_idle_frames())  # number of `idle` (process) iterations called
	print(Engine.get_frames_drawn()) # number of drawn frames (number you see in the debugger)
	print(Engine.get_frames_per_second()) # should be 60 when you have vsync active (default).

@Faless
Copy link
Collaborator

Faless commented Mar 27, 2020

I think we probably want to use get_idle_frames() for the frame # instead, since when render loop is disabled get_frames_drawn() returns 0.
I guess get_frames_drawn() is not updated when the window is minimized.

@SkyLucilfer
Copy link
Contributor Author

with game window open :
idle frames = frames shown in the profiler
drawn frames = frames shown in the profiler
FPS = 60

with game window minimized :
idle frames = continue increasing like before
drawn frames = last frame shown in the profiler ( the frame that has been put on pause )
FPS = increased to around 120. Interesting, because I have vsync on

If I reopen the game window (after minimizing), drawn frames increase with frames in the profiler again and FPS returns to 60.

@Faless
Copy link
Collaborator

Faless commented Mar 27, 2020

Probably this:

diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index b9db8ab1b0..783723d1a1 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -318,7 +318,7 @@ struct RemoteDebugger::ServersProfiler {
 
        void _send_frame_data(bool p_final) {
                DebuggerMarshalls::ServersProfilerFrame frame;
-               frame.frame_number = Engine::get_singleton()->get_frames_drawn();
+               frame.frame_number = Engine::get_singleton()->get_idle_frames();
                frame.frame_time = frame_time;
                frame.idle_time = idle_time;
                frame.physics_time = physics_time;

FPS = increased to around 120. Interesting, because I have vsync on

And this might be related to #32404 . Interesting.

@SkyLucilfer
Copy link
Contributor Author

@Faless Do you want me to change get_frames_drawn() to get_idle_frames(), do some manual testing in the Editor and open a pull request? Or maybe you have some other plans for this issue?

About the vsync and FPS maybe I will take a look in the future. I think it's hard for my level now.

@Faless
Copy link
Collaborator

Faless commented Mar 27, 2020 via email

@SkyLucilfer
Copy link
Contributor Author

It seems like with the newest pull from master branch 307b1b3 the game window will crash when minimized. Think that issue #37365 needs to be solved first before I can test this one.

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

Successfully merging a pull request may close this issue.

3 participants