-
-
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
Move _scene_particles_set_view_axis
to new static function to allow call to be done on render thread, preventing multi threaded error on compute shader execution.
#99299
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not super familiar with the callable syntax. This seems like the right workaround if we can't create a callable in this situation
@KoBeWi Is it correct that we won't be able to create a callable that calls RSG::particles_storage->particles_set_view_axis()
from renderer_scene_cull?
I don't see why the Callable couldn't be created. |
I tried that, results in this error:
|
_scene_particles_set_view_axis
to new static function to allow call to be done on render thread, preventing multi threaded error on compute shader execution._scene_particles_set_view_axis
to new static function to allow call to be done on render thread, preventing multi threaded error on compute shader execution.
The implementation is correct because non-static callables can only be used with an |
33f411c
to
05b79be
Compare
…o allow calling on render thread.
05b79be
to
7e3d480
Compare
I am having an absolute nightmare trying to get clang to make any sense, but I think I may have gotten it sorted, I will see when the workflow runs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
The syntax to make callables work kinda sucks, but its not your fault and this is the correct way to fix things, so oh well
Thanks! Congratulations on your first contribution! 🎉 Or, err, second contribution? Got in two back-to-back, gotdayum |
Lol Thank you! |
Resolves #99025 by calling the function
particles_set_view_axis
on the render thread.The error would occur when the number of instances in the tree went over 1k, resulting in the
thread_cull_threshold
being exceeded, this resulted in the multi-threaded culling method being called for particle effects, this then subsequently calledparticles_set_view_axis
which was now being called from a thread other than the render thread, and would immediately throw errors for trying to execute a compute shader on any thread other than the render thread (this only occurred either thedraw_order
ortransform_align
settings were changed on a GPUParticles3D).I initially was going to just call it directly using a
callable_mp
style call, but it would not allow it because it's calling it on a singleton, so what I did was create a static function withinRendererSceneCull
to call the function same as before, then called that static function usingcall_on_render_thread
and passing it acallable_mp_static
constructor.If there is a way to do it in a single line that would be preferable, but I had no small amount of issues trying to get that work, and couldn't find any examples elsewhere of that functionality to reference.