10#include "device/cpu/kernel.h"
25 const int max_num_inputs,
26 const int num_channels,
30 bool first_device =
true;
35 VLOG_WORK <<
"Multi-devices are not yet fully implemented, will evaluate shader on a "
49 input.alloc(max_num_inputs);
50 int num_points = fill_input(input);
51 if (num_points == 0) {
55 input.copy_to_device();
56 output.alloc(num_points * num_channels);
57 output.zero_to_device();
61 eval_cpu(device, type, input, output, num_points) :
62 eval_gpu(device, type, input, output, num_points);
66 output.copy_from_device(0, 1, output.size());
91 float *output_data = output.data();
95 local_arena.execute([&]() {
103 const int thread_index = tbb::this_task_arena::current_thread_index();
145 queue->init_execution();
149 const int32_t chunk_size = 65536;
160 queue->enqueue(kernel, d_work_size, args);
161 queue->synchronize();
ShaderEvalFunction shader_eval_background
ShaderEvalFunction shader_eval_displace
ShaderEvalFunction shader_eval_curve_shadow_transparency
static const CPUKernels & get_cpu_kernels()
virtual void get_cpu_kernel_thread_globals(vector< CPUKernelThreadGlobals > &)
virtual unique_ptr< DeviceQueue > gpu_queue_create()
virtual void foreach_device(const function< void(Device *)> &callback)
bool eval(const ShaderEvalType type, const int max_num_inputs, const int num_channels, const function< int(device_vector< KernelShaderEvalInput > &)> &fill_input, const function< void(device_vector< float > &)> &read_output)
ShaderEval(Device *device, Progress &progress)
bool eval_cpu(Device *device, const ShaderEvalType type, device_vector< KernelShaderEvalInput > &input, device_vector< float > &output, const int64_t work_size)
bool eval_gpu(Device *device, const ShaderEvalType type, device_vector< KernelShaderEvalInput > &input, device_vector< float > &output, const int64_t work_size)
#define CCL_NAMESPACE_END
ccl_gpu_kernel_postfix ccl_global const int ccl_global float const int work_size
@ DEVICE_KERNEL_SHADER_EVAL_DISPLACE
@ DEVICE_KERNEL_SHADER_EVAL_BACKGROUND
@ DEVICE_KERNEL_SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY
@ SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY