diff options
author | Morteza Mostajab <mmostajab> | 2022-10-19 19:09:23 +0300 |
---|---|---|
committer | Michael Jones <michael_p_jones@apple.com> | 2022-10-19 19:09:38 +0300 |
commit | e6902d19a0d8b034e65f28df6dba914a876b08df (patch) | |
tree | 9e1522a21aeacc8669a4ef9aba860613fbc13f4b /intern/cycles/device | |
parent | 053fc35b01593dbfa83858bf5a0debea39c5f1ef (diff) |
Cycles: Allow Intel GPUs under Metal
Known Issues:
- Command buffer failures when using binary archives (binary archives is disabled for Intel GPUs as a workaround)
- Wrong texture sampler being applied (to be addressed in the future)
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D16253
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/metal/device_impl.mm | 6 | ||||
-rw-r--r-- | intern/cycles/device/metal/kernel.mm | 6 | ||||
-rw-r--r-- | intern/cycles/device/metal/util.mm | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/intern/cycles/device/metal/device_impl.mm b/intern/cycles/device/metal/device_impl.mm index 6a16d4bb3b4..82ad5d55ecd 100644 --- a/intern/cycles/device/metal/device_impl.mm +++ b/intern/cycles/device/metal/device_impl.mm @@ -339,6 +339,12 @@ bool MetalDevice::compile_and_load(MetalPipelineType pso_type) MTLCompileOptions *options = [[MTLCompileOptions alloc] init]; + if (@available(macos 13.0, *)) { + if (device_vendor == METAL_GPU_INTEL) { + [options setOptimizationLevel:MTLLibraryOptimizationLevelSize]; + } + } + options.fastMathEnabled = YES; if (@available(macOS 12.0, *)) { options.languageVersion = MTLLanguageVersion2_4; diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm index 5e0cb6d18f4..8ccc50e57a3 100644 --- a/intern/cycles/device/metal/kernel.mm +++ b/intern/cycles/device/metal/kernel.mm @@ -317,6 +317,12 @@ bool MetalKernelPipeline::should_use_binary_archive() const } } + /* 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; diff --git a/intern/cycles/device/metal/util.mm b/intern/cycles/device/metal/util.mm index 65c67c400fe..eb77aeb6a54 100644 --- a/intern/cycles/device/metal/util.mm +++ b/intern/cycles/device/metal/util.mm @@ -110,6 +110,10 @@ vector<id<MTLDevice>> const &MetalInfo::get_usable_devices() usable |= (vendor == METAL_GPU_AMD); } + if (@available(macos 13.0, *)) { + usable |= (vendor == METAL_GPU_INTEL); + } + if (usable) { metal_printf("- %s\n", device_name.c_str()); [device retain]; |