From 9c566da8813d9f11d4b8960eb14d1399b988e83a Mon Sep 17 00:00:00 2001 From: Alaska Date: Sat, 30 Sep 2023 20:16:48 +1300 Subject: [PATCH 1/8] Cycles: Update BVH options --- intern/cycles/blender/addon/ui.py | 43 ++++++++++++++++++------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index e7e5302bd91..ed4515f48b7 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -102,6 +102,10 @@ def use_metal(context): return (get_device_type(context) == 'METAL' and cscene.device == 'GPU') +def use_metalrt(context): + return (context.preferences.addons[__package__].preferences.use_metalrt and use_metal(context)) + + def use_cuda(context): cscene = context.scene.cycles @@ -114,6 +118,10 @@ def use_hip(context): return (get_device_type(context) == 'HIP' and cscene.device == 'GPU') +def use_hiprt(context): + return (context.preferences.addons[__package__].preferences.use_hiprt and use_hip(context)) + + def use_optix(context): cscene = context.scene.cycles @@ -126,6 +134,10 @@ def use_oneapi(context): return (get_device_type(context) == 'ONEAPI' and cscene.device == 'GPU') +def use_oneapirt(context): + return (context.preferences.addons[__package__].preferences.use_oneapirt and use_oneapi(context)) + + def use_multi_device(context): cscene = context.scene.cycles if cscene.device != 'GPU': @@ -790,7 +802,7 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa @classmethod def poll(cls, context): - return not use_optix(context) or use_multi_device(context) + return use_multi_device(context) or not (use_optix(context) or use_hiprt(context) or use_metalrt(context)) def draw(self, context): import _cycles @@ -804,32 +816,27 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col = layout.column() - use_embree = _cycles.with_embree + built_with_embree = _cycles.with_embree + use_embree = built_with_embree and (use_oneapirt(context) or (use_cpu(context) and ( + context.scene.cycles.debug_bvh_layout == "EMBREE" or not CyclesDebugButtonsPanel.poll(context)))) - if use_cpu(context): - 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") + col.prop(cscene, "debug_use_spatial_splits") + if use_embree: + col.prop(cscene, "debug_use_compact_bvh") 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_hair_bvh") + if use_cpu(context) or (use_multi_device(context) and not built_with_embree): + sub = col.column(align=True) + sub.label(text="Cycles is not using, or was built without Embree") + sub.label(text="CPU raytracing performance will be reduced") + # CPU is used in addition to a GPU - if use_multi_device(context) and use_embree: + if use_multi_device(context) and built_with_embree: col.prop(cscene, "debug_use_compact_bvh") -- 2.30.2 From 90d5fea586de6a32241fb03b28811dded8ec0d36 Mon Sep 17 00:00:00 2001 From: Alaska Date: Sat, 30 Sep 2023 21:22:11 +1300 Subject: [PATCH 2/8] Cover edge cases and add comments --- intern/cycles/blender/addon/ui.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index ed4515f48b7..00674573ba4 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -802,7 +802,8 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa @classmethod def poll(cls, context): - return use_multi_device(context) or not (use_optix(context) or use_hiprt(context) or use_metalrt(context)) + gpu_uses_custom_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) + return use_multi_device(context) or not (gpu_uses_custom_bvh) def draw(self, context): import _cycles @@ -820,15 +821,25 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa use_embree = built_with_embree and (use_oneapirt(context) or (use_cpu(context) and ( context.scene.cycles.debug_bvh_layout == "EMBREE" or not CyclesDebugButtonsPanel.poll(context)))) + # The GPU backend isn't using BVH2 or Embree + gpu_uses_custom_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) + + # Common Setting col.prop(cscene, "debug_use_spatial_splits") if use_embree: + # Embree Setting 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") + # When using CPU + GPU and using a custom BVH on the GPU, + # don't expose BVH2 settings unless Cycles is built without Embree, + # since the CPU will use BVH2 in that case. + if (use_multi_device(context) and not built_with_embree) or not (gpu_uses_custom_bvh): + # BVH2 Settings + 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") + col.prop(cscene, "debug_use_hair_bvh") if use_cpu(context) or (use_multi_device(context) and not built_with_embree): sub = col.column(align=True) @@ -837,6 +848,7 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa # CPU is used in addition to a GPU if use_multi_device(context) and built_with_embree: + # Embree Setting col.prop(cscene, "debug_use_compact_bvh") -- 2.30.2 From a34cdb027ce478a532322144121296d11747d92a Mon Sep 17 00:00:00 2001 From: Alaska Date: Sat, 30 Sep 2023 22:22:31 +1300 Subject: [PATCH 3/8] Cover CPU only device when using a GPU backend showing wrong settings --- intern/cycles/blender/addon/ui.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 00674573ba4..4d908d3c54d 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -821,19 +821,20 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa use_embree = built_with_embree and (use_oneapirt(context) or (use_cpu(context) and ( context.scene.cycles.debug_bvh_layout == "EMBREE" or not CyclesDebugButtonsPanel.poll(context)))) - # The GPU backend isn't using BVH2 or Embree - gpu_uses_custom_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) - # Common Setting col.prop(cscene, "debug_use_spatial_splits") if use_embree: # Embree Setting col.prop(cscene, "debug_use_compact_bvh") else: + # The GPU backend isn't using BVH2 or Embree + gpu_uses_custom_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) + # When using CPU + GPU and using a custom BVH on the GPU, # don't expose BVH2 settings unless Cycles is built without Embree, # since the CPU will use BVH2 in that case. - if (use_multi_device(context) and not built_with_embree) or not (gpu_uses_custom_bvh): + if (use_multi_device(context) and not built_with_embree) or + (show_device_active(context) and not gpu_uses_custom_bvh): # BVH2 Settings sub = col.column() sub.active = not cscene.debug_use_spatial_splits -- 2.30.2 From d8e7c048ba78b6701dbe50f08dd87074013131ca Mon Sep 17 00:00:00 2001 From: Alaska Date: Sun, 1 Oct 2023 00:03:09 +1300 Subject: [PATCH 4/8] Fix python error due to formatting --- intern/cycles/blender/addon/ui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 4d908d3c54d..d097a3d1e24 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -833,8 +833,8 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa # When using CPU + GPU and using a custom BVH on the GPU, # don't expose BVH2 settings unless Cycles is built without Embree, # since the CPU will use BVH2 in that case. - if (use_multi_device(context) and not built_with_embree) or - (show_device_active(context) and not gpu_uses_custom_bvh): + if (use_multi_device(context) and not built_with_embree) or ( + show_device_active(context) and not gpu_uses_custom_bvh): # BVH2 Settings sub = col.column() sub.active = not cscene.debug_use_spatial_splits -- 2.30.2 From fd2a73ed8eee9249336effd8cbea11f442524397 Mon Sep 17 00:00:00 2001 From: Alaska Date: Sun, 1 Oct 2023 03:09:16 +1300 Subject: [PATCH 5/8] Cleanup, refactor, and cover an extra edge case --- intern/cycles/blender/addon/ui.py | 42 ++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index d097a3d1e24..c1173147a8d 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -145,11 +145,15 @@ def use_multi_device(context): return context.preferences.addons[__package__].preferences.has_multi_device() +def backend_has_active_gpu(context): + return context.preferences.addons[__package__].preferences.has_active_device() + + def show_device_active(context): cscene = context.scene.cycles if cscene.device != 'GPU': return True - return context.preferences.addons[__package__].preferences.has_active_device() + return backend_has_active_gpu(context) def get_effective_preview_denoiser(context): @@ -802,8 +806,8 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa @classmethod def poll(cls, context): - gpu_uses_custom_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) - return use_multi_device(context) or not (gpu_uses_custom_bvh) + custom_gpu_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) + return use_multi_device(context) or not (custom_gpu_bvh) or not backend_has_active_gpu(context) def draw(self, context): import _cycles @@ -817,9 +821,13 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col = layout.column() + no_active_gpu = not backend_has_active_gpu(context) + using_cpu = use_cpu(context) or no_active_gpu + cpu_bvh_is_embree = not CyclesDebugButtonsPanel.poll(context) or cscene.debug_bvh_layout == "EMBREE" + use_embree_gpu = use_oneapirt(context) and backend_has_active_gpu(context) built_with_embree = _cycles.with_embree - use_embree = built_with_embree and (use_oneapirt(context) or (use_cpu(context) and ( - context.scene.cycles.debug_bvh_layout == "EMBREE" or not CyclesDebugButtonsPanel.poll(context)))) + + use_embree = built_with_embree and ((using_cpu and cpu_bvh_is_embree) or use_embree_gpu) # Common Setting col.prop(cscene, "debug_use_spatial_splits") @@ -827,14 +835,13 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa # Embree Setting col.prop(cscene, "debug_use_compact_bvh") else: - # The GPU backend isn't using BVH2 or Embree - gpu_uses_custom_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) + # GPU backend isn't using BVH2 or Embree + custom_gpu_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) - # When using CPU + GPU and using a custom BVH on the GPU, - # don't expose BVH2 settings unless Cycles is built without Embree, - # since the CPU will use BVH2 in that case. - if (use_multi_device(context) and not built_with_embree) or ( - show_device_active(context) and not gpu_uses_custom_bvh): + cpu_bvh2_is_used = no_active_gpu # and using_cpu and not cpu_bvh_is_embree + gpu_is_custom_and_cpu_is_bvh2 = not built_with_embree and custom_gpu_bvh and backend_has_active_gpu(context) + + if cpu_bvh2_is_used or not custom_gpu_bvh or gpu_is_custom_and_cpu_is_bvh2: # BVH2 Settings sub = col.column() sub.active = not cscene.debug_use_spatial_splits @@ -842,13 +849,18 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col.prop(cscene, "debug_use_hair_bvh") - if use_cpu(context) or (use_multi_device(context) and not built_with_embree): + multi_custom_gpu = use_multi_device(context) and custom_gpu_bvh + + # CPU is using BVH2 when it could be using Embree + if using_cpu or ( + multi_custom_gpu and not built_with_embree) or ( + custom_gpu_bvh and not use_multi_device(context)): sub = col.column(align=True) sub.label(text="Cycles is not using, or was built without Embree") sub.label(text="CPU raytracing performance will be reduced") - # CPU is used in addition to a GPU - if use_multi_device(context) and built_with_embree: + # CPU is used in addition to a GPU, and the GPU is not using BVH2 + if built_with_embree and multi_custom_gpu and not using_cpu: # Embree Setting col.prop(cscene, "debug_use_compact_bvh") -- 2.30.2 From d6b41b08759b0a98da95b750fb623fe960cf44f1 Mon Sep 17 00:00:00 2001 From: Alaska Date: Sun, 1 Oct 2023 03:49:16 +1300 Subject: [PATCH 6/8] Cleanup and simplify --- intern/cycles/blender/addon/ui.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c1173147a8d..e325c280624 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -822,12 +822,12 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col = layout.column() no_active_gpu = not backend_has_active_gpu(context) - using_cpu = use_cpu(context) or no_active_gpu + cpu_only = use_cpu(context) or no_active_gpu cpu_bvh_is_embree = not CyclesDebugButtonsPanel.poll(context) or cscene.debug_bvh_layout == "EMBREE" use_embree_gpu = use_oneapirt(context) and backend_has_active_gpu(context) built_with_embree = _cycles.with_embree - use_embree = built_with_embree and ((using_cpu and cpu_bvh_is_embree) or use_embree_gpu) + use_embree = built_with_embree and ((cpu_only and cpu_bvh_is_embree) or use_embree_gpu) # Common Setting col.prop(cscene, "debug_use_spatial_splits") @@ -838,8 +838,9 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa # GPU backend isn't using BVH2 or Embree custom_gpu_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) - cpu_bvh2_is_used = no_active_gpu # and using_cpu and not cpu_bvh_is_embree + cpu_bvh2_is_used = no_active_gpu # `and cpu_only and not cpu_bvh_is_embree` from earlier gpu_is_custom_and_cpu_is_bvh2 = not built_with_embree and custom_gpu_bvh and backend_has_active_gpu(context) + # `and use_multi_device(context)` from earlier if cpu_bvh2_is_used or not custom_gpu_bvh or gpu_is_custom_and_cpu_is_bvh2: # BVH2 Settings @@ -849,18 +850,16 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col.prop(cscene, "debug_use_hair_bvh") - multi_custom_gpu = use_multi_device(context) and custom_gpu_bvh + cpu_and_custom_gpu = use_multi_device(context) and custom_gpu_bvh and not cpu_only # CPU is using BVH2 when it could be using Embree - if using_cpu or ( - multi_custom_gpu and not built_with_embree) or ( - custom_gpu_bvh and not use_multi_device(context)): + if cpu_only or (not built_with_embree and cpu_and_custom_gpu): sub = col.column(align=True) - sub.label(text="Cycles is not using, or was built without Embree") + sub.label(text="Cycles is configure to not use, or was built without Embree") sub.label(text="CPU raytracing performance will be reduced") - # CPU is used in addition to a GPU, and the GPU is not using BVH2 - if built_with_embree and multi_custom_gpu and not using_cpu: + # CPU is used in addition to a GPU + if built_with_embree and cpu_and_custom_gpu: # Embree Setting col.prop(cscene, "debug_use_compact_bvh") -- 2.30.2 From b32e429879b9a1e5aca0caea5e5d268ad2452c55 Mon Sep 17 00:00:00 2001 From: Alaska Date: Mon, 2 Oct 2023 01:26:25 +1300 Subject: [PATCH 7/8] Refactor, cleanup, add code comments, and simplify Too many things changed to properly describe what happened here. --- intern/cycles/blender/addon/ui.py | 80 ++++++++++++++++--------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index e325c280624..78fbb897db5 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -90,16 +90,27 @@ def get_device_type(context): return context.preferences.addons[__package__].preferences.compute_device_type +def backend_has_active_gpu(context): + return context.preferences.addons[__package__].preferences.has_active_device() + + +def show_device_active(context): + cscene = context.scene.cycles + if cscene.device != 'GPU': + return True + return backend_has_active_gpu(context) + + def use_cpu(context): cscene = context.scene.cycles - return (get_device_type(context) == 'NONE' or cscene.device == 'CPU') + return (get_device_type(context) == 'NONE' or cscene.device == 'CPU' or not backend_has_active_gpu(context)) def use_metal(context): cscene = context.scene.cycles - return (get_device_type(context) == 'METAL' and cscene.device == 'GPU') + return (get_device_type(context) == 'METAL' and cscene.device == 'GPU' and backend_has_active_gpu(context)) def use_metalrt(context): @@ -109,13 +120,13 @@ def use_metalrt(context): def use_cuda(context): cscene = context.scene.cycles - return (get_device_type(context) == 'CUDA' and cscene.device == 'GPU') + return (get_device_type(context) == 'CUDA' and cscene.device == 'GPU' and backend_has_active_gpu(context)) def use_hip(context): cscene = context.scene.cycles - return (get_device_type(context) == 'HIP' and cscene.device == 'GPU') + return (get_device_type(context) == 'HIP' and cscene.device == 'GPU' and backend_has_active_gpu(context)) def use_hiprt(context): @@ -125,13 +136,13 @@ def use_hiprt(context): def use_optix(context): cscene = context.scene.cycles - return (get_device_type(context) == 'OPTIX' and cscene.device == 'GPU') + return (get_device_type(context) == 'OPTIX' and cscene.device == 'GPU' and backend_has_active_gpu(context)) def use_oneapi(context): cscene = context.scene.cycles - return (get_device_type(context) == 'ONEAPI' and cscene.device == 'GPU') + return (get_device_type(context) == 'ONEAPI' and cscene.device == 'GPU' and backend_has_active_gpu(context)) def use_oneapirt(context): @@ -145,17 +156,6 @@ def use_multi_device(context): return context.preferences.addons[__package__].preferences.has_multi_device() -def backend_has_active_gpu(context): - return context.preferences.addons[__package__].preferences.has_active_device() - - -def show_device_active(context): - cscene = context.scene.cycles - if cscene.device != 'GPU': - return True - return backend_has_active_gpu(context) - - def get_effective_preview_denoiser(context): scene = context.scene cscene = scene.cycles @@ -806,8 +806,9 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa @classmethod def poll(cls, context): - custom_gpu_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) - return use_multi_device(context) or not (custom_gpu_bvh) or not backend_has_active_gpu(context) + # GPU backend isn't using BVH2 or Embree + gpu_uses_custom = use_optix(context) or use_hiprt(context) or use_metalrt(context) + return use_multi_device(context) or not gpu_uses_custom def draw(self, context): import _cycles @@ -821,28 +822,35 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col = layout.column() - no_active_gpu = not backend_has_active_gpu(context) - cpu_only = use_cpu(context) or no_active_gpu - cpu_bvh_is_embree = not CyclesDebugButtonsPanel.poll(context) or cscene.debug_bvh_layout == "EMBREE" - use_embree_gpu = use_oneapirt(context) and backend_has_active_gpu(context) + # GPU backend isn't using BVH2 or Embree + gpu_uses_custom = use_optix(context) or use_hiprt(context) or use_metalrt(context) + cpu_and_custom_gpu = use_multi_device(context) and gpu_uses_custom + + cpu_only = use_cpu(context) + cpu_uses_embree = not CyclesDebugButtonsPanel.poll(context) or cscene.debug_bvh_layout == 'EMBREE' + gpu_uses_embree = use_oneapirt(context) built_with_embree = _cycles.with_embree - use_embree = built_with_embree and ((cpu_only and cpu_bvh_is_embree) or use_embree_gpu) + use_embree = built_with_embree and ((cpu_only and cpu_uses_embree) or gpu_uses_embree or cpu_and_custom_gpu) # Common Setting col.prop(cscene, "debug_use_spatial_splits") if use_embree: - # Embree Setting col.prop(cscene, "debug_use_compact_bvh") else: - # GPU backend isn't using BVH2 or Embree - custom_gpu_bvh = use_optix(context) or use_hiprt(context) or use_metalrt(context) + # `cpu_uses_bvh2 = cpu_only` because `cpu_only` is only True here if + # `cpu_only and not (cpu_uses_embree and built_with_embree)` + cpu_uses_bvh2 = cpu_only - cpu_bvh2_is_used = no_active_gpu # `and cpu_only and not cpu_bvh_is_embree` from earlier - gpu_is_custom_and_cpu_is_bvh2 = not built_with_embree and custom_gpu_bvh and backend_has_active_gpu(context) - # `and use_multi_device(context)` from earlier + # `gpu_uses_bvh2` works under the assumption that the CPU will use BVH2 + # when the GPU is using BVH2 when `use_multi_device(context)` is True + gpu_uses_bvh2 = not gpu_uses_custom # `and not cpu_only` where `not cpu_only = using_gpu` - if cpu_bvh2_is_used or not custom_gpu_bvh or gpu_is_custom_and_cpu_is_bvh2: + # `gpu_uses_custom` is only True and relevant here if `use_multi_device(context)` is True, + # meaning a CPU will be used along side the GPU. + gpu_uses_custom_and_cpu_uses_bvh2 = not built_with_embree and gpu_uses_custom + + if cpu_uses_bvh2 or gpu_uses_bvh2 or gpu_uses_custom_and_cpu_uses_bvh2: # BVH2 Settings sub = col.column() sub.active = not cscene.debug_use_spatial_splits @@ -850,19 +858,13 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa col.prop(cscene, "debug_use_hair_bvh") - cpu_and_custom_gpu = use_multi_device(context) and custom_gpu_bvh and not cpu_only - # CPU is using BVH2 when it could be using Embree - if cpu_only or (not built_with_embree and cpu_and_custom_gpu): + # `cpu_and_custom_gpu` is only True here if `not built_with_embree` meaning the CPU is using BVH2 + if cpu_uses_bvh2 or cpu_and_custom_gpu: sub = col.column(align=True) sub.label(text="Cycles is configure to not use, or was built without Embree") sub.label(text="CPU raytracing performance will be reduced") - # CPU is used in addition to a GPU - if built_with_embree and cpu_and_custom_gpu: - # Embree Setting - col.prop(cscene, "debug_use_compact_bvh") - class CYCLES_RENDER_PT_performance_final_render(CyclesButtonsPanel, Panel): bl_label = "Final Render" -- 2.30.2 From 1588c3b52edeae3ddb6d6cdf45e27bffaf500e5f Mon Sep 17 00:00:00 2001 From: Alaska Date: Mon, 2 Oct 2023 23:26:57 +1300 Subject: [PATCH 8/8] Remove waste of sace code comment. The code comment was about how we didn't need to do a simple AND test. But it's clearer to do the AND test, and performance shouldn't be a concern --- intern/cycles/blender/addon/ui.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 78fbb897db5..3e0db9397e5 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -842,9 +842,7 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa # `cpu_only and not (cpu_uses_embree and built_with_embree)` cpu_uses_bvh2 = cpu_only - # `gpu_uses_bvh2` works under the assumption that the CPU will use BVH2 - # when the GPU is using BVH2 when `use_multi_device(context)` is True - gpu_uses_bvh2 = not gpu_uses_custom # `and not cpu_only` where `not cpu_only = using_gpu` + gpu_uses_bvh2 = not gpu_uses_custom and not cpu_only # `gpu_uses_custom` is only True and relevant here if `use_multi_device(context)` is True, # meaning a CPU will be used along side the GPU. -- 2.30.2