diff options
Diffstat (limited to 'intern/cycles/blender/addon/properties.py')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 93f8f76cd6a..8623b38a271 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -137,6 +137,7 @@ enum_world_mis = ( enum_device_type = ( ('CPU', "CPU", "CPU", 0), ('CUDA', "CUDA", "CUDA", 1), + ('OPTIX', "OptiX", "OptiX", 3), ('OPENCL', "OpenCL", "OpenCL", 2) ) @@ -740,6 +741,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): debug_use_cuda_adaptive_compile: BoolProperty(name="Adaptive Compile", default=False) debug_use_cuda_split_kernel: BoolProperty(name="Split Kernel", default=False) + debug_optix_cuda_streams: IntProperty(name="CUDA Streams", default=1, min=1) + debug_opencl_kernel_type: EnumProperty( name="OpenCL Kernel Type", default='DEFAULT', @@ -1400,10 +1403,12 @@ class CyclesPreferences(bpy.types.AddonPreferences): def get_device_types(self, context): import _cycles - has_cuda, has_opencl = _cycles.get_device_types() + has_cuda, has_optix, has_opencl = _cycles.get_device_types() list = [('NONE', "None", "Don't use compute device", 0)] if has_cuda: list.append(('CUDA', "CUDA", "Use CUDA for GPU acceleration", 1)) + if has_optix: + list.append(('OPTIX', "OptiX", "Use OptiX for GPU acceleration", 3)) if has_opencl: list.append(('OPENCL', "OpenCL", "Use OpenCL for GPU acceleration", 2)) return list @@ -1424,7 +1429,7 @@ class CyclesPreferences(bpy.types.AddonPreferences): def update_device_entries(self, device_list): for device in device_list: - if not device[1] in {'CUDA', 'OPENCL', 'CPU'}: + if not device[1] in {'CUDA', 'OPTIX', 'OPENCL', 'CPU'}: continue # Try to find existing Device entry entry = self.find_existing_device_entry(device) @@ -1439,8 +1444,8 @@ class CyclesPreferences(bpy.types.AddonPreferences): # Update name in case it changed entry.name = device[0] - # Gets all devices types by default. - def get_devices(self, compute_device_type=''): + # Gets all devices types for a compute device type. + def get_devices_for_type(self, compute_device_type): import _cycles # Layout of the device tuples: (Name, Type, Persistent ID) device_list = _cycles.available_devices(compute_device_type) @@ -1449,20 +1454,23 @@ class CyclesPreferences(bpy.types.AddonPreferences): # hold pointers to a resized array. self.update_device_entries(device_list) # Sort entries into lists - cuda_devices = [] - opencl_devices = [] + devices = [] cpu_devices = [] for device in device_list: entry = self.find_existing_device_entry(device) - if entry.type == 'CUDA': - cuda_devices.append(entry) - elif entry.type == 'OPENCL': - opencl_devices.append(entry) + if entry.type == compute_device_type: + devices.append(entry) elif entry.type == 'CPU': cpu_devices.append(entry) # Extend all GPU devices with CPU. - cuda_devices.extend(cpu_devices) - opencl_devices.extend(cpu_devices) + if compute_device_type in ('CUDA', 'OPENCL'): + devices.extend(cpu_devices) + return devices + + # For backwards compatibility, only has CUDA and OpenCL. + def get_devices(self, compute_device_type=''): + cuda_devices = self.get_devices_for_type('CUDA') + opencl_devices = self.get_devices_for_type('OPENCL') return cuda_devices, opencl_devices def get_num_gpu_devices(self): @@ -1498,16 +1506,24 @@ class CyclesPreferences(bpy.types.AddonPreferences): for device in devices: box.prop(device, "use", text=device.name) + if device_type == 'OPTIX': + col = box.column(align=True) + col.label(text="OptiX support is experimental", icon='INFO') + col.label(text="Not all Cycles features are supported yet", icon='BLANK1') + + def draw_impl(self, layout, context): row = layout.row() row.prop(self, "compute_device_type", expand=True) - cuda_devices, opencl_devices = self.get_devices(self.compute_device_type) + devices = self.get_devices_for_type(self.compute_device_type) row = layout.row() if self.compute_device_type == 'CUDA': - self._draw_devices(row, 'CUDA', cuda_devices) + self._draw_devices(row, 'CUDA', devices) + elif self.compute_device_type == 'OPTIX': + self._draw_devices(row, 'OPTIX', devices) elif self.compute_device_type == 'OPENCL': - self._draw_devices(row, 'OPENCL', opencl_devices) + self._draw_devices(row, 'OPENCL', devices) def draw(self, context): self.draw_impl(self.layout, context) |