rtcNewScene, rtcNewGeometry thread safety

rtcNewScene, rtcNewGeometry thread safety


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.

4 posts / 0 new

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?


Best Reply

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).

 


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!

Leave a Comment

Please sign in to add a comment. Not a member? Join today