From 5c3a6745a2ebc6e5fffbcd3e9a1bc6eae6d80351 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Thu, 16 Oct 2025 11:50:28 +0200 Subject: [PATCH] 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 --- intern/cycles/device/metal/bvh.mm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/intern/cycles/device/metal/bvh.mm b/intern/cycles/device/metal/bvh.mm index d9c96740898..cea9ff68460 100644 --- a/intern/cycles/device/metal/bvh.mm +++ b/intern/cycles/device/metal/bvh.mm @@ -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];