Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

rtcNewScene, rtcNewGeometry thread safety

Burr__Adam
Beginner
1,223 Views

Are the rtcNewScene and rtcNewGeometry functions thread safe when called concurrently with a shared RTCDevice? I assume not but I don't want to put in redundant locking if it's handled internally.

0 Kudos
1 Solution
SvenW_Intel
Moderator
1,223 Views

All operations that take the device are thread safe, e.g. you can create scenes for a single device from multiple scenes. Other objects are typically not thread safe, thus you cannot attach geometries from multiple threads to the same scene. However, for different objects that works. thus each thread can work on a different scene. Similar each thread can work on separate geometries, but not on the same.

An exception are functions that only read state and are intended for rendering. E.g. the rtcIntersectXX and rtcInterpolateXX functions can get called from multiple threads (as long as no thread is modifying the underlying objects with some API calls).

 

View solution in original post

0 Kudos
3 Replies
Burr__Adam
Beginner
1,223 Views

Also, if I have multiple RTCScene objects sharing a single RTCDevice, is it safe to modify the scenes (eg rtcAttachGeometry, rtcSetNewGeometryBuffer, rtcCommitGeometry, rtcCommitScene, etc) concurrently from multiple threads? Or should I be using multiple RTCDevice objects? Or a single RTCDevice with mutex locking?

0 Kudos
SvenW_Intel
Moderator
1,224 Views

All operations that take the device are thread safe, e.g. you can create scenes for a single device from multiple scenes. Other objects are typically not thread safe, thus you cannot attach geometries from multiple threads to the same scene. However, for different objects that works. thus each thread can work on a different scene. Similar each thread can work on separate geometries, but not on the same.

An exception are functions that only read state and are intended for rendering. E.g. the rtcIntersectXX and rtcInterpolateXX functions can get called from multiple threads (as long as no thread is modifying the underlying objects with some API calls).

 

0 Kudos
Burr__Adam
Beginner
1,223 Views

In my case different threads will always be working with different scenes and geometry, the only thing shared between threads is the device. I won't be modifying the same scene or geometry concurrently so it sounds like I will be safe. Thanks!

0 Kudos
Reply