diff options
Diffstat (limited to 'intern/cycles/device/metal/kernel.mm')
-rw-r--r-- | intern/cycles/device/metal/kernel.mm | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm index 385cb412b06..55938d1a03a 100644 --- a/intern/cycles/device/metal/kernel.mm +++ b/intern/cycles/device/metal/kernel.mm @@ -162,6 +162,13 @@ bool ShaderCache::should_load_kernel(DeviceKernel device_kernel, } } + if (device_kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE) { + if ((device->kernel_features & KERNEL_FEATURE_MNEE) == 0) { + /* Skip shade_surface_mnee kernel if the scene doesn't require it. */ + return false; + } + } + if (pso_type != PSO_GENERIC) { /* Only specialize kernels where it can make an impact. */ if (device_kernel < DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST || @@ -308,26 +315,35 @@ 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. */ + /* 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; + } + } + + /* Workaround for Intel GPU having issue using Binary Archives */ + MetalGPUVendor gpu_vendor = MetalInfo::get_device_vendor(mtlDevice); + if (gpu_vendor == METAL_GPU_INTEL) { 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, - * but will be quick to regenerate if not. */ + /* The remaining kernels are all fast to compile. They may get cached by the system shader + * cache, but will be quick to regenerate if not. */ + } return false; } |