Cycles: Allow get_apple_gpu_architecture to report non Apple GPUs #120448
|
@ -77,12 +77,8 @@ void device_metal_info(vector<DeviceInfo> &devices)
|
|||
if (@available(macos 14.0, *)) {
|
||||
info.use_hardware_raytracing = device.supportsRaytracing;
|
||||
|
||||
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);
|
||||
}
|
||||
/* 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
|
||||
|
|
|
@ -27,6 +27,10 @@ enum MetalGPUVendor {
|
|||
};
|
||||
|
||||
enum AppleGPUArchitecture {
|
||||
/* NOT_APPLE_GPU represents AMD/Intel GPUs. This should remained at the start of this enum to
|
||||
* ensure that AMD/Intel GPUs don't accidentally get Apple Silicon only features enabled when
|
||||
* using comparison operators. */
|
||||
NOT_APPLE_GPU,
|
||||
APPLE_M1,
|
||||
APPLE_M2,
|
||||
APPLE_M2_BIG,
|
||||
|
|
|
@ -49,6 +49,10 @@ int MetalInfo::get_apple_gpu_core_count(id<MTLDevice> device)
|
|||
|
||||
AppleGPUArchitecture MetalInfo::get_apple_gpu_architecture(id<MTLDevice> device)
|
||||
{
|
||||
if (MetalInfo::get_device_vendor(device) != METAL_GPU_APPLE) {
|
||||
return NOT_APPLE_GPU;
|
||||
}
|
||||
|
||||
const char *device_name = [device.name UTF8String];
|
||||
if (strstr(device_name, "M1")) {
|
||||
return APPLE_M1;
|
||||
|
|
Loading…
Reference in New Issue