From 01005475154a56a04bfb406b579d23aac2cb61d8 Mon Sep 17 00:00:00 2001 From: Nikita Sirgienko Date: Tue, 6 Feb 2024 20:06:13 +0100 Subject: [PATCH] Cycles: Gray out hardware raytracing checkboxes when not available HWRT checkboxes visibility in the Cycles settings wasn't uniform across devices. With this change, we unify it and gray out these in case HWRT isn't available. Pull Request: https://projects.blender.org/blender/blender/pulls/117904 --- intern/cycles/blender/addon/properties.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index f8e61fa0114..bc471dacdd4 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1711,12 +1711,13 @@ class CyclesPreferences(bpy.types.AddonPreferences): import _cycles has_peer_memory = 0 - has_rt_api_support = False + has_rt_api_support = {'METAL': False, 'HIP': False, 'ONEAPI': False} for device in _cycles.available_devices(compute_device_type): if device[3] and self.find_existing_device_entry(device).use: has_peer_memory += 1 if device[4] and self.find_existing_device_entry(device).use: - has_rt_api_support = True + device_type = device[1] + has_rt_api_support[device_type] = True if has_peer_memory > 1: row = layout.row() @@ -1734,25 +1735,25 @@ class CyclesPreferences(bpy.types.AddonPreferences): # MetalRT only works on Apple Silicon and Navi2. is_arm64 = platform.machine() == 'arm64' - if is_arm64 or (is_navi_2 and has_rt_api_support): + if is_arm64 or (is_navi_2 and has_rt_api_support['METAL']): col = layout.column() col.use_property_split = True # Kernel specialization is only supported on Apple Silicon if is_arm64: col.prop(self, "kernel_optimization_level") - if has_rt_api_support: + if has_rt_api_support['METAL']: col.prop(self, "metalrt") if compute_device_type == 'HIP': import platform if platform.system() == "Windows": # HIP-RT is currently only supported on Windows - has_cuda, has_optix, has_hip, has_metal, has_oneapi, has_hiprt = _cycles.get_device_types() row = layout.row() - row.enabled = has_hiprt + row.active = has_rt_api_support['HIP'] row.prop(self, "use_hiprt") elif compute_device_type == 'ONEAPI' and _cycles.with_embree_gpu: row = layout.row() + row.active = has_rt_api_support['ONEAPI'] row.prop(self, "use_oneapirt") def draw(self, context):