12#include "device/cpu/kernel.h"
27 const int max_num_inputs,
28 const int num_channels,
32 bool first_device =
true;
37 LOG_DEBUG <<
"Multi-devices are not yet fully implemented, will evaluate shader on a "
51 input.
alloc(max_num_inputs);
52 int const num_points = fill_input(input);
53 if (num_points == 0) {
58 output.alloc(num_points * num_channels);
94 float *output_data =
output.data();
98 local_arena.execute([&]() {
106 const int thread_index = tbb::this_task_arena::current_thread_index();
153 queue->init_execution();
157 cache_miss[0] =
false;
161 const int32_t chunk_size = 1 << 21;
178 cache_miss[0] =
false;
186 queue->copy_to_device(cache_miss);
188 &d_input, &d_output, &cache_miss.
device_pointer, &d_offset, &d_work_size);
189 queue->enqueue(kernel, d_work_size, args);
190 queue->copy_from_device(cache_miss);
192 if (!queue->synchronize()) {
200 }
while (cache_miss[0]);
ShaderEvalFunction shader_eval_background
ShaderEvalFunction shader_eval_volume_density
ShaderEvalFunction shader_eval_displace
ShaderEvalFunction shader_eval_curve_shadow_transparency
static const CPUKernels & get_cpu_kernels()
void image_load_requested_gpu(DeviceQueue &queue)
virtual unique_ptr< DeviceQueue > gpu_queue_create()
virtual vector< ThreadKernelGlobalsCPU > * acquire_cpu_kernel_thread_globals()
virtual void foreach_device(const std::function< void(Device *)> &callback)
virtual void release_cpu_kernel_thread_globals()
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(const ShaderEvalType type, const int max_num_inputs, const int num_channels, const std::function< int(device_vector< KernelShaderEvalInput > &)> &fill_input, const std::function< void(device_vector< float > &)> &read_output)
bool eval_gpu(Device *device, const ShaderEvalType type, device_vector< KernelShaderEvalInput > &input, device_vector< float > &output, const int64_t work_size)
device_ptr device_pointer
T * alloc(const size_t width, const size_t height=0)
#define CCL_NAMESPACE_END
#define assert(assertion)
ccl_gpu_kernel_postfix const ccl_global int ccl_global float const int work_size
@ DEVICE_KERNEL_SHADER_EVAL_DISPLACE
@ DEVICE_KERNEL_SHADER_EVAL_VOLUME_DENSITY
@ DEVICE_KERNEL_SHADER_EVAL_BACKGROUND
@ DEVICE_KERNEL_SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY
#define SCOPED_DEFER(code)
@ SHADER_EVAL_VOLUME_DENSITY
@ SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY