diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-03-13 14:31:48 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-03-15 18:18:21 +0300 |
commit | 2f6257fd7fe305e3b226a8b505eb614bbeaf762a (patch) | |
tree | fba47f34d5bc5f10d50be92e5dd8b14fa9ecc9a9 /intern/cycles/device/device.h | |
parent | 62377431114411c50ededadf98fda284ec4061c5 (diff) |
Cycles/OpenCL: Compile Kernels During Scene Update
The main goals of this change is faster starting when using foreground
rendering.
This patch will build kernels in parallel to the update process of
the scene. When these optimized kernels are not available (yet) an AO
kernel will be used.
These AO kernels are fast to compile (3-7 seconds) and can be
reused by all scenes. When the final kernels become available we
will switch to these kernels.
In background mode the AO kernels will not be used.
Some kernels are being used during Scene update (displace, background
light). When these kernels are being used the process can halt until
these become available.
Reviewed By: brecht, #cycles
Maniphest Tasks: T61752
Differential Revision: https://developer.blender.org/D4428
Diffstat (limited to 'intern/cycles/device/device.h')
-rw-r--r-- | intern/cycles/device/device.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 3bf978600d5..6f3208e955f 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -56,6 +56,14 @@ enum DeviceTypeMask { DEVICE_MASK_ALL = ~0 }; +enum DeviceKernelStatus { + DEVICE_KERNEL_WAITING_FOR_FEATURE_KERNEL = 0, + DEVICE_KERNEL_FEATURE_KERNEL_AVAILABLE, + DEVICE_KERNEL_USING_FEATURE_KERNEL, + DEVICE_KERNEL_FEATURE_KERNEL_INVALID, + DEVICE_KERNEL_UNKNOWN, +}; + #define DEVICE_MASK(type) (DeviceTypeMask)(1 << type) class DeviceInfo { @@ -321,6 +329,20 @@ public: const DeviceRequestedFeatures& /*requested_features*/) { return true; } + /* Wait for device to become available to upload data and receive tasks + * This method is used by the OpenCL device to load the + * optimized kernels or when not (yet) available load the + * generic kernels (only during foreground rendering) */ + virtual bool wait_for_availability( + const DeviceRequestedFeatures& /*requested_features*/) + { return true; } + /* Check if there are 'better' kernels available to be used + * We can switch over to these kernels + * This method is used to determine if we can switch the preview kernels + * to regular kernels */ + virtual DeviceKernelStatus get_active_kernel_switch_state() + { return DEVICE_KERNEL_USING_FEATURE_KERNEL; } + /* tasks */ virtual int get_split_task_count(DeviceTask& task) = 0; virtual void task_add(DeviceTask& task) = 0; |