diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2017-03-04 14:29:01 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2017-03-08 09:31:30 +0300 |
commit | 306034790fb75ca2c182d55132287cc0ed4b9c2f (patch) | |
tree | 272a582174d84ebcb25c0bf3a4922d29b6c0b96f /intern/cycles/device/device_cpu.cpp | |
parent | 997e345bd25bf28a8a5d67d5ffcb5b70ff52ecdd (diff) |
Cycles: Calculate size of split state buffer kernel side
By calculating the size of the state buffer in the kernel rather than the host
less code is needed and the size actually reflects the requested features.
Will also be a little faster in some cases because of larger global work size.
Diffstat (limited to 'intern/cycles/device/device_cpu.cpp')
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index b4d470747c2..1589bbe1a33 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -71,7 +71,8 @@ public: virtual SplitKernelFunction* get_split_kernel_function(string kernel_name, const DeviceRequestedFeatures&); virtual int2 split_kernel_local_size(); - virtual int2 split_kernel_global_size(DeviceTask *task); + virtual int2 split_kernel_global_size(device_memory& kg, device_memory& data, DeviceTask *task); + virtual size_t state_buffer_size(device_memory& kg, device_memory& data, size_t num_threads); }; class CPUDevice : public Device @@ -854,11 +855,17 @@ int2 CPUSplitKernel::split_kernel_local_size() return make_int2(1, 1); } -int2 CPUSplitKernel::split_kernel_global_size(DeviceTask *task) { +int2 CPUSplitKernel::split_kernel_global_size(device_memory& /*kg*/, device_memory& /*data*/, DeviceTask *task) { /* TODO(mai): this needs investigation but cpu gives incorrect render if global size doesnt match tile size */ return task->requested_tile_size; } +size_t CPUSplitKernel::state_buffer_size(device_memory& kernel_globals, device_memory& /*data*/, size_t num_threads) { + KernelGlobals *kg = (KernelGlobals*)kernel_globals.device_pointer; + + return split_data_buffer_size(kg, num_threads); +} + unordered_map<string, void*> CPUDevice::kernel_functions; Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background) |