-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
[4.4 dev4] compute_list render thread error #99025
Comments
Bisected to #90400, @DarioSamo |
This comes from a change to how we handle threading in the RD. The change was introduced in #90400. The solution is that our functions to update particles based on camera properties (i.e. billboarding) needs to be called from the render thread. I think it is getting called during culling which can be multi threaded if there are more than 1000 instances in the scene |
Like Clay said this is not exactly a bug introduced by the PR but rather it is exposing unsafe behavior we had before. The actionable here would be to: A) Upgrade RD to support recording compute/draw lists from secondary threads (a pretty major but not impossible refactor). or B) Just disable this functionality. The benefits of parallel recording are much further reduced now that the graph is reponsible for the API calls. Most of the API cost is elsewhere right now after reordering. Although as I understand, B) isn't merely disabling but will have to be some new system to defer the calls outside of the culling thread. That said, it makes some sense as we want to guarantee the proper order of these calls in the first place. |
Here's my current understanding of the problem. The piece of code that is causing trouble is indeed RendererSceneCull when it turns on the multithreaded processing. In particular: if (RSG::particles_storage->particles_is_inactive(idata.base_rid)) {
//but if nothing is going on, don't do it.
keep = false;
} else {
cull_data.cull->lock.lock();
RSG::particles_storage->particles_request_process(idata.base_rid);
cull_data.cull->lock.unlock();
RSG::particles_storage->particles_set_view_axis(idata.base_rid, -cull_data.cam_transform.basis.get_column(2).normalized(), cull_data.cam_transform.basis.get_column(1).normalized());
//particles visible? request redraw
RenderingServerDefault::redraw_request();
} The else branch here calls
RSG::particles_storage->particles_set_view_axis(idata.base_rid, -cull_data.cam_transform.basis.get_column(2).normalized(), cull_data.cam_transform.basis.get_column(1).normalized()); I think my proposal for solving this would be to expand particles_request_process to include an optional view/axis or to change the method to something similar. It always gets called regardless of the particle system being a billboard or not as well. |
@DarioSamo I think we can just use |
I have been interacting with the problem without realizing that there is an issue here for it. Would this work as a fix for 4.4 to move forward? I'm aware this is a little ham-handed but I chose this for it's drop in functionality not for performance/elegance, if anyone else has a better solution I'm definently open to suggestions. |
@Bonkahe The solution is way simpler. We just need to wrap the call to |
I ran into some slight issues on doing this, and had to take a slightly round-about method to get it resolved, but it's up and running, I threw together a PR for it, over at #99299 , let me know if there's a simpler method to implement this, had some issues calling |
Tested versions
System information
Godot v4.4.dev4 - Linux Mint 22 (Wilma) on X11 - X11 display driver, Single-window, 2 monitors - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (amdgpu; 6.8.5) - AMD Ryzen 5 3600 6-Core Processor (12 threads)
Issue description
A scene (3D) with enough geometry and GPU Particles (Emitting = true; transform_align = Z-Billboard) I get these errors hundreds of times per second, even in the editor:
It only happens with enough objects and only if emitting=true AND transform_align=Z-Billboard. This is as far as I could isolate the issue as I don't know much about the engine code.
Steps to reproduce
Open the Test.tscn from the MRP and go to the 3D editor.
Minimal reproduction project (MRP)
MRP.zip
The text was updated successfully, but these errors were encountered: