[Bf-blender-cvs] [2653775c666] blender-v3.3-release: Cycles: Disable binary archives on macOS < 13.0

Michael Jones noreply at git.blender.org
Tue Oct 4 20:09:33 CEST 2022


Commit: 2653775c666053d4867b24f3dec88c3fbe654afd
Author: Michael Jones
Date:   Tue Oct 4 18:52:40 2022 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rB2653775c666053d4867b24f3dec88c3fbe654afd

Cycles: Disable binary archives on macOS < 13.0

(Cherry pick D16082)
An bug with binary archives was fixed in macOS 13.0 which stops some spurious kernel recompilations. In older macOS versions, falling back on the system shader cache will prevent recompilations in most instances (this is the same behaviour as in Blender 3.1.x and 3.2.x).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16141

===================================================================

M	intern/cycles/device/metal/kernel.mm

===================================================================

diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm
index 385cb412b06..f3a2fc9ec6c 100644
--- a/intern/cycles/device/metal/kernel.mm
+++ b/intern/cycles/device/metal/kernel.mm
@@ -308,22 +308,25 @@ MetalKernelPipeline *ShaderCache::get_best_pipeline(DeviceKernel kernel, const M
 
 bool MetalKernelPipeline::should_use_binary_archive() const
 {
-  if (auto str = getenv("CYCLES_METAL_DISABLE_BINARY_ARCHIVES")) {
-    if (atoi(str) != 0) {
-      /* Don't archive if we have opted out by env var. */
-      return false;
+  /* Issues with binary archives in older macOS versions. */
+  if (@available(macOS 13.0, *)) {
+    if (auto str = getenv("CYCLES_METAL_DISABLE_BINARY_ARCHIVES")) {
+      if (atoi(str) != 0) {
+        /* Don't archive if we have opted out by env var. */
+        return false;
+      }
     }
-  }
 
-  if (pso_type == PSO_GENERIC) {
-    /* Archive the generic kernels. */
-    return true;
-  }
+    if (pso_type == PSO_GENERIC) {
+      /* Archive the generic kernels. */
+      return true;
+    }
 
-  if (device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND &&
-      device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) {
-    /* Archive all shade kernels - they take a long time to compile. */
-    return true;
+    if (device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND &&
+        device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) {
+      /* Archive all shade kernels - they take a long time to compile. */
+      return true;
+    }
   }
 
   /* The remaining kernels are all fast to compile. They may get cached by the system shader cache,



More information about the Bf-blender-cvs mailing list