diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2016-10-18 17:51:02 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2016-10-18 17:59:29 +0300 |
commit | 70c659b77e11ac339775fdc4f5dc30947d7f9815 (patch) | |
tree | e6637e201093a4249f577a703a599b92900de869 /intern/cycles/device/device.h | |
parent | bc8e3a3d868d19719f67ec2e5ed2d0b516a98312 (diff) |
Cycles: Add SplitKernelFunction with OpenCL implementation
SplitKernelFunction can represent a split kernel function for any device its
been implemented for. Currently this is only for OpenCL to simplify the
enqueueing of the split kernels and move another step closer to a split
kernel that can run on any device.
Diffstat (limited to 'intern/cycles/device/device.h')
-rw-r--r-- | intern/cycles/device/device.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 014e5fc010f..f79678d50e6 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -190,6 +190,28 @@ public: std::ostream& operator <<(std::ostream &os, const DeviceRequestedFeatures& requested_features); +/* Types used for split kernel */ + +class KernelDimensions { +public: + size_t global_size[2]; + size_t local_size[2]; + + KernelDimensions(size_t global_size_[2], size_t local_size_[2]) + { + memcpy(global_size, global_size_, 2*sizeof(size_t)); + memcpy(local_size, local_size_, 2*sizeof(size_t)); + } +}; + +class SplitKernelFunction { +public: + virtual ~SplitKernelFunction() {} + + /* enqueue the kernel, returns false if there is an error */ + virtual bool enqueue(const KernelDimensions& dim, device_memory& kg, device_memory& data) = 0; +}; + /* Device */ struct DeviceDrawParams { @@ -273,6 +295,18 @@ public: const DeviceRequestedFeatures& /*requested_features*/) { return true; } + /* split kernel */ + virtual bool enqueue_split_kernel_data_init() + { + assert(!"not implemented for this device"); + return false; + } + virtual SplitKernelFunction* get_split_kernel_function(string /*kernel_name*/, const DeviceRequestedFeatures&) + { + assert(!"not implemented for this device"); + return NULL; + } + /* tasks */ virtual int get_split_task_count(DeviceTask& task) = 0; virtual void task_add(DeviceTask& task) = 0; |