@@ -199,14 +199,18 @@ void embree_occluded(const RTCOccludedFunctionNArguments* args) {
199199}
200200
201201MTS_VARIANT RTCGeometry Shape<Float, Spectrum>::embree_geometry(RTCDevice device) const {
202- RTCGeometry geom = rtcNewGeometry (device, RTC_GEOMETRY_TYPE_USER);
203- rtcSetGeometryUserPrimitiveCount (geom, 1 );
204- rtcSetGeometryUserData (geom, (void *) this );
205- rtcSetGeometryBoundsFunction (geom, embree_bbox<Float, Spectrum>, nullptr );
206- rtcSetGeometryIntersectFunction (geom, embree_intersect<Float, Spectrum>);
207- rtcSetGeometryOccludedFunction (geom, embree_occluded<Float, Spectrum>);
208- rtcCommitGeometry (geom);
209- return geom;
202+ if constexpr (!is_cuda_array_v<Float>) {
203+ RTCGeometry geom = rtcNewGeometry (device, RTC_GEOMETRY_TYPE_USER);
204+ rtcSetGeometryUserPrimitiveCount (geom, 1 );
205+ rtcSetGeometryUserData (geom, (void *) this );
206+ rtcSetGeometryBoundsFunction (geom, embree_bbox<Float, Spectrum>, nullptr );
207+ rtcSetGeometryIntersectFunction (geom, embree_intersect<Float, Spectrum>);
208+ rtcSetGeometryOccludedFunction (geom, embree_occluded<Float, Spectrum>);
209+ rtcCommitGeometry (geom);
210+ return geom;
211+ } else {
212+ Throw (" embree_geometry() should only be called in CPU mode." );
213+ }
210214}
211215#endif
212216
0 commit comments