Cycles: Forward compatibility for Metal "FastIntersection" flag

Follow on from PR #141891. The `MTLAccelerationStructureUsagePreferFastIntersection` flag didn't exist until Xcode 26.0, so we ensure that it is defined for forward-compatibility. The runtime `if (@available(macos 26.0, *))` checks still remain.

Pull Request: https://projects.blender.org/blender/blender/pulls/147561
This commit is contained in:
Michael Jones
2025-10-16 11:50:28 +02:00
committed by Michael Jones (Apple)
parent f4fd52796f
commit 5c3a6745a2

View File

@@ -35,6 +35,14 @@ CCL_NAMESPACE_BEGIN
# define bvh_throttle_printf(...)
# endif
/* This flag didn't exist until Xcode 26.0, so we ensure that it is defined for
* forward-compatibility.
*/
# ifndef MAC_OS_VERSION_26_0
# define MTLAccelerationStructureUsagePreferFastIntersection \
MTLAccelerationStructureUsage(1 << 4)
# endif
/* Limit the number of concurrent BVH builds so that we don't approach unsafe GPU working set
* sizes. */
struct BVHMetalBuildThrottler {
@@ -292,11 +300,9 @@ bool BVHMetal::build_BLAS_mesh(Progress &progress,
accelDesc.usage |= (MTLAccelerationStructureUsageRefit |
MTLAccelerationStructureUsagePreferFastBuild);
}
# if defined(MAC_OS_VERSION_26_0)
else if (@available(macos 26.0, *)) {
accelDesc.usage |= MTLAccelerationStructureUsagePreferFastIntersection;
}
# endif
MTLAccelerationStructureSizes accelSizes = [mtl_device
accelerationStructureSizesWithDescriptor:accelDesc];
@@ -638,11 +644,9 @@ bool BVHMetal::build_BLAS_hair(Progress &progress,
accelDesc.usage |= (MTLAccelerationStructureUsageRefit |
MTLAccelerationStructureUsagePreferFastBuild);
}
# if defined(MAC_OS_VERSION_26_0)
else if (@available(macos 26.0, *)) {
accelDesc.usage |= MTLAccelerationStructureUsagePreferFastIntersection;
}
# endif
MTLAccelerationStructureSizes accelSizes = [mtl_device
accelerationStructureSizesWithDescriptor:accelDesc];
@@ -874,11 +878,9 @@ bool BVHMetal::build_BLAS_pointcloud(Progress &progress,
accelDesc.usage |= (MTLAccelerationStructureUsageRefit |
MTLAccelerationStructureUsagePreferFastBuild);
}
# if defined(MAC_OS_VERSION_26_0)
else if (@available(macos 26.0, *)) {
accelDesc.usage |= MTLAccelerationStructureUsagePreferFastIntersection;
}
# endif
MTLAccelerationStructureSizes accelSizes = [mtl_device
accelerationStructureSizesWithDescriptor:accelDesc];
@@ -1352,11 +1354,9 @@ bool BVHMetal::build_TLAS(Progress &progress,
accelDesc.usage |= (MTLAccelerationStructureUsageRefit |
MTLAccelerationStructureUsagePreferFastBuild);
}
# if defined(MAC_OS_VERSION_26_0)
else if (@available(macos 26.0, *)) {
accelDesc.usage |= MTLAccelerationStructureUsagePreferFastIntersection;
}
# endif
MTLAccelerationStructureSizes accelSizes = [mtl_device
accelerationStructureSizesWithDescriptor:accelDesc];