Skip to content

Commit 4b39198

Browse files
committed
Fix build when both Embree and Optix enabled
1 parent 017dff6 commit 4b39198

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/librender/shape.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,18 @@ void embree_occluded(const RTCOccludedFunctionNArguments* args) {
199199
}
200200

201201
MTS_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

Comments
 (0)