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

Render thread (also the main thread for some platforms) is blocked most of the time #582

Closed
ryantrem opened this issue Jun 6, 2023 · 1 comment

Comments

@ryantrem
Copy link
Member

ryantrem commented Jun 6, 2023

Describe the bug
The Start/Finish calls are in the wrong order, and this results in the render thread to be in a blocked state rather than an idle state between frames being rendered. This severely limits how much work can be done on the render thread when a frame is not being actively rendered. In some cases (such as Android), the render thread is the same as the main UI thread. The net result is that UI can be laggy and unresponsive while an EngineView is active (since the thread spends much of its time in a blocked state).

From BabylonNative.cpp:

g_graphics->StartRenderingCurrentFrame();
g_update->Start();
g_update->Finish();
g_graphics->FinishRenderingCurrentFrame();

This ordering should be swapped. In the past, there were some problems with this, but maybe those issues have since been fixed.

To Reproduce
Profile while Babylon Native is rendering and observe that the render thread is in a blocked state for a significant amount of time during app execution.

Expected behavior
The render thread should be idle between frames and other work should be able to happen on the render thread.

Screenshots
I haven't profiled this in a while so I don't have screenshots or other evidence available.

Other

  • Platform: [Definitely Android, maybe other platforms too.]
@ryantrem
Copy link
Member Author

ryantrem commented Jun 6, 2023

Oh looks like there is an existing issue on this: #343

@ryantrem ryantrem closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant