You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WorkerThreadPool expose add_template_group_task and add_template_task #1368
Hi, as long as I know Callables only bind Variant arguments, plus maybe it is intended, but inside modules I havent been able of binding any PackedVector as an argument to a callable. So I started using the add_template_group_task method with pointers to arrays.
This is a method taken from my landscape system under development:
WorkerThreadPool::get_singleton()->add_template_group_task allows passing data using custom structs and there are diferences in the way each WorkerThreadPool::get_singleton()->add_XXXX_task method schedule the task. Just by looking at the source code I can see this:
So, in summary, using add_template_group_task is good for passing custom structs, and using a Callable for mimiking the behaviour will most likely not work
as a plus.... I have read a big chunk of godot source code by now and I have not find any internal use of a Callable binding a PackedVector, instead, for cases where the use of a Vector or PackedVector is necesary, the templated_task method is the one used
It's not ideal, but you can store pointers as uint64_t as a way to put them into a Variant. This strategy is used in a bunch of places in the XR APIs exposed to GDExtension.
Activity
dsnopek commentedon Apr 9, 2024
Thanks!
Now that we have
callable_mp(), you could simulateadd_template_group_task(). So, rather than doing:... you can do:
I think that code should work in a module as well!
That said, for compatibility, we could probably generate an
add_template_group_task()that would do thecallable_mp()thing for you.ozzr commentedon Apr 10, 2024
Hi, as long as I know Callables only bind Variant arguments, plus maybe it is intended, but inside modules I havent been able of binding any PackedVector as an argument to a callable. So I started using the add_template_group_task method with pointers to arrays.
This is a method taken from my landscape system under development:
Also
WorkerThreadPool::get_singleton()->add_template_group_taskallows passing data using customstructsand there are diferences in the way eachWorkerThreadPool::get_singleton()->add_XXXX_taskmethod schedule the task. Just by looking at the source code I can see this:So, in summary, using add_template_group_task is good for passing custom structs, and using a Callable for mimiking the behaviour will most likely not work
as a plus.... I have read a big chunk of godot source code by now and I have not find any internal use of a Callable binding a PackedVector, instead, for cases where the use of a Vector or PackedVector is necesary, the templated_task method is the one used
dsnopek commentedon Apr 11, 2024
It's not ideal, but you can store pointers as
uint64_tas a way to put them into aVariant. This strategy is used in a bunch of places in the XR APIs exposed to GDExtension.ozzr commentedon Apr 11, 2024
Interesting, I will take a look at it, thanks