Cycles: Update Acceleration Structure UI Visibility #113077
|
@ -90,40 +90,63 @@ 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):
|
||||
return (context.preferences.addons[__package__].preferences.use_metalrt and use_metal(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):
|
||||
return (context.preferences.addons[__package__].preferences.use_hiprt and use_hip(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):
|
||||
return (context.preferences.addons[__package__].preferences.use_oneapirt and use_oneapi(context))
|
||||
|
||||
|
||||
def use_multi_device(context):
|
||||
|
@ -133,13 +156,6 @@ def use_multi_device(context):
|
|||
return context.preferences.addons[__package__].preferences.has_multi_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()
|
||||
|
||||
|
||||
def get_effective_preview_denoiser(context):
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
@ -790,7 +806,9 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return not use_optix(context) or use_multi_device(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
|
||||
|
@ -804,33 +822,46 @@ class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa
|
|||
|
||||
col = layout.column()
|
||||
|
||||
use_embree = _cycles.with_embree
|
||||
# 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
|
||||
|
||||
if use_cpu(context):
|
||||
col.prop(cscene, "debug_use_spatial_splits")
|
||||
if use_embree:
|
||||
col.prop(cscene, "debug_use_compact_bvh")
|
||||
else:
|
||||
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_uses_embree) or gpu_uses_embree or cpu_and_custom_gpu)
|
||||
|
||||
# Common Setting
|
||||
col.prop(cscene, "debug_use_spatial_splits")
|
||||
if use_embree:
|
||||
col.prop(cscene, "debug_use_compact_bvh")
|
||||
else:
|
||||
# `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
|
||||
|
||||
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.
|
||||
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
|
||||
sub.prop(cscene, "debug_bvh_time_steps")
|
||||
|
||||
col.prop(cscene, "debug_use_hair_bvh")
|
||||
|
||||
# CPU is using BVH2 when it could be using Embree
|
||||
# `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 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_hair_bvh")
|
||||
|
||||
# CPU is used in addition to a GPU
|
||||
if use_multi_device(context) and use_embree:
|
||||
col.prop(cscene, "debug_use_compact_bvh")
|
||||
sub.label(text="Cycles is configure to not use, or was built without Embree")
|
||||
sub.label(text="CPU raytracing performance will be reduced")
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_performance_final_render(CyclesButtonsPanel, Panel):
|
||||
|
|
Loading…
Reference in New Issue