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
This commit is contained in:
parent
e2a36a6e45
commit
97a023a0d5
|
@ -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
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue