RenderKit / embree

Embree ray tracing kernels repository.
Apache License 2.0
2.37k stars 389 forks source link

Is it possible to expose a "thread ID" in RTCCollideFunc? #358

Closed ChengduLittleA closed 2 years ago

ChengduLittleA commented 2 years ago

Hi there developers, is it possible to have a "thread ID" in RTCCollideFunc? If so then we are able to record collision result per thread thus not locking access to result data, which could make make it run much smoother?

svenwoop commented 2 years ago

You can use thread local storage to assign an ID to each thread. Alternatively, if you use TBB you can use current_thread_index function to get a thread index, see embree/common/taskschedulertbb.h for an example.