Fix #113325: Zero-sized curve leads to OptiX error

Empty hair geometry in Cycles may still report having one curve, even when
there are no actual segments in that curve. This caused an attempt to build
an acceleration structure with zero primitives, which due to other setup
OptiX rejected with an error. Fix that by checking the number of segments
rather than the number of curves in the hair geometry, since the former will
always be zero for empty geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/115044
This commit is contained in:
Patrick Mours
2023-11-17 17:20:57 +01:00
committed by Patrick Mours
parent f27e87db7a
commit 697114c4b6
+1 -1
View File
@@ -1160,7 +1160,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
if (geom->geometry_type == Geometry::HAIR) {
/* Build BLAS for curve primitives. */
Hair *const hair = static_cast<Hair *const>(geom);
if (hair->num_curves() == 0) {
if (hair->num_segments() == 0) {
return;
}