Cycles: Properly default to Metal-RT off unless GPU is a M3 or newer

Ever since commit [1], `use_metalrt_by_default` will be True
if the GPU being used is not a M1 or M2 based system.
The intention of this was to enable MetalRT by default for
M3 and newer devices that have hardware for ray traversal.

However the side effect of this change was that all AMD GPUs would
have `use_metalrt_by_default` set to True. Which appears to be the
main culprit causing crashes on older AMD GPUs in #120126.
Since these GPUs don't support MetalRT.

This commit fixes this issue by only setting
`use_metalrt_by_default` to True if the GPU is not M1 or M2 based,
and the GPU is Apple Silicon based. Which equates to M3 or newer.
Which is the original intent of this code.

This resolves the issue where AMD GPUs were being told to use MetalRT
by default, when they shouldn't be.

[1] 322a2f7b12bba610a70df3af90e236d0c0ef03f6

Pull Request: https://projects.blender.org/blender/blender/pulls/120299
This commit is contained in:
Alaska 2024-04-09 16:19:24 +02:00 committed by Sergey Sharybin
parent 26f059ae55
commit eff4fe24cf

@ -77,8 +77,12 @@ void device_metal_info(vector<DeviceInfo> &devices)
if (@available(macos 14.0, *)) {
info.use_hardware_raytracing = device.supportsRaytracing;
/* Use hardware raytracing for faster rendering on architectures that support it. */
info.use_metalrt_by_default = (MetalInfo::get_apple_gpu_architecture(device) >= APPLE_M3);
info.use_metalrt_by_default = false;
if (vendor == METAL_GPU_APPLE) {
/* Use hardware raytracing for faster rendering on architectures that support it. */
info.use_metalrt_by_default = (MetalInfo::get_apple_gpu_architecture(device) >=
APPLE_M3);
}
}
}
# endif