diff options
author | Thomas Dinges <blender@dingto.org> | 2022-01-25 19:33:41 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2022-01-25 19:33:41 +0300 |
commit | 97a023a0d5db26eb09ada9003bb99f60fb7a3d38 (patch) | |
tree | a2d02f6cd2568f114abe176b31c3f486817c618f /intern | |
parent | e2a36a6e459fc34b62efb7a957a183b54aa51bf5 (diff) |
Cycles: Reorganize Acceleration Structure UI panel.
Only show options that are valid for the used device (CPU, GPU, Multi).
Note: The panel isn't shown for OPTIX anymore, unless Multi device is used.
Reference: https://developer.blender.org/D13592
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 13 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 42 |
2 files changed, 44 insertions, 11 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 93a0717ad5f..6e498f92854 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1452,6 +1452,19 @@ class CyclesPreferences(bpy.types.AddonPreferences): num += 1 return num + def has_multi_device(self): + import _cycles + compute_device_type = self.get_compute_device_type() + device_list = _cycles.available_devices(compute_device_type) + for device in device_list: + if device[1] == compute_device_type: + continue + for dev in self.devices: + if dev.use and dev.id == device[2]: + return True + + return False + def has_active_device(self): return self.get_num_gpu_devices() > 0 diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 06cf69f90ca..aa5f6740933 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -118,6 +118,12 @@ def use_optix(context): return (get_device_type(context) == 'OPTIX' and cscene.device == 'GPU') +def use_multi_device(context): + cscene = context.scene.cycles + if cscene.device != 'GPU': + return False + return context.preferences.addons[__package__].preferences.has_multi_device() + def show_device_active(context): cscene = context.scene.cycles @@ -661,6 +667,10 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa bl_label = "Acceleration Structure" bl_parent_id = "CYCLES_RENDER_PT_performance" + @classmethod + def poll(cls, context): + return not use_optix(context) or has_multi_device(context) + def draw(self, context): import _cycles @@ -673,23 +683,33 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col = layout.column() - use_embree = False + use_embree = _cycles.with_embree + if use_cpu(context): - use_embree = _cycles.with_embree - if not use_embree: + col.prop(cscene, "debug_use_spatial_splits") + if use_embree: + col.prop(cscene, "debug_use_compact_bvh") + else: + sub = col.column() + sub.active = not cscene.debug_use_spatial_splits + sub.prop(cscene, "debug_bvh_time_steps") + + col.prop(cscene, "debug_use_hair_bvh") + sub = col.column(align=True) sub.label(text="Cycles built without Embree support") sub.label(text="CPU raytracing performance will be poor") + else: + col.prop(cscene, "debug_use_spatial_splits") + sub = col.column() + sub.active = not cscene.debug_use_spatial_splits + sub.prop(cscene, "debug_bvh_time_steps") - col.prop(cscene, "debug_use_spatial_splits") - sub = col.column() - sub.active = not use_embree - sub.prop(cscene, "debug_use_hair_bvh") - sub = col.column() - sub.active = not cscene.debug_use_spatial_splits and not use_embree - sub.prop(cscene, "debug_bvh_time_steps") + col.prop(cscene, "debug_use_hair_bvh") - col.prop(cscene, "debug_use_compact_bvh") + # CPU is used in addition to a GPU + if use_multi_device(context) and use_embree: + col.prop(cscene, "debug_use_compact_bvh") class CYCLES_RENDER_PT_performance_final_render(CyclesButtonsPanel, Panel): |