-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[3.x] Rendering thread synchronization in Particles (GLES3) #60625
Comments
Can not confirm on Godot 3.4 release, Windows 10 latest, RTX2070S, I9-9900KF. Godot either completely locks up due to how high I need to set the loop value (gdscript incapable of using up hardware resources before the engine dies), or dies from running out of memory because of the absurd particle count I have to set to notice any kind of framerate dip. I can also observe no difference with Vsync disabled. With both versions maintaining identical frame timings at the same settings. |
Running the MRP with 3.5 beta 4 and I can't reproduce. I ran both the GPUParticles scene and the CPUParticles scene and had identical performance between both. Pop OS 22.04, Intel i7-1165G7, Mesa Intel Xe Graphics That being said, reading The difficulty with caching the state of I think a more sustainable solution is to avoid a situation where you are polling the rendering thread every single frame. Another solution is to have a signal that emits once the particles are finished (this is described in godotengine/godot-proposals#649) |
The performance of the MRP is very machine-dependent. I can definitely see the effect of reading |
I guess the reason why this has historically been difficult is probably because of the separation between the client side scene tree code and the VisualServer, and the synchronization, because the relationship is usually one way from client -> VisualServer, as reading back can potentially cause stalls. Although it seems a bit strange, a timer is probably the most simple way of doing this and keeping it all scene tree side, if a formula like that suggested here works: There is also a callback mechanism which I put in for portals which could be re-used for sending a signal from the VisualServer if anyone attempts to implement this (and such a proposal was approved). This would work for CPUParticles at least, I'm not super familiar with the GPUParticles. One snag may be that the particle systems may not currently hold an ObjectID, so it might need e.g. an extra function to set this on particle systems. But overall I would recommend a simple client side timer if at all possible, as it will be far less complex and have fewer failure points. |
I wonder if this issue can potentially affect the implementation of #54716. |
Godot version
d62166f
System information
OS: Arch Linux, CPU: Ryzen 5, GPU: RX 6600
Issue description
Reading the "is_emitting" property in Particles nodes causes synchronisation of the main thread with the rendering thread.
The property is read internally at each frame for one-shot particles, always causing synchronisation.
In projects where both threads are under heavy load (like in mine), this will cause significant performance degradation.
The solution should be to cache the "is_emitting" property in the Particles object.
Steps to reproduce
Minimal reproduction project
particles_performace_test.zip
The text was updated successfully, but these errors were encountered: