Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPUs.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
265 Discussions

rtcNewScene, rtcNewGeometry thread safety

Burr__Adam
Beginner
563 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
563 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

3 Replies
Burr__Adam
Beginner
563 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?

SvenW_Intel
Moderator
564 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).

 

Burr__Adam
Beginner
563 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!

Reply