Blender V5.0
shader_eval.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#include <functional>
8
9#include "device/memory.h"
10
11#include "kernel/types.h"
12
14
15class Device;
16class Progress;
17
24
25/* ShaderEval class performs shader evaluation for background light and displacement. */
27 public:
28 ShaderEval(Device *device, Progress &progress);
29
30 /* Evaluate shader at points specified by KernelShaderEvalInput and write out
31 * RGBA colors to output. */
32 bool eval(const ShaderEvalType type,
33 const int max_num_inputs,
34 const int num_channels,
35 const std::function<int(device_vector<KernelShaderEvalInput> &)> &fill_input,
36 const std::function<void(device_vector<float> &)> &read_output);
37
38 protected:
39 bool eval_cpu(Device *device,
40 const ShaderEvalType type,
43 const int64_t work_size);
44 bool eval_gpu(Device *device,
45 const ShaderEvalType type,
48 const int64_t work_size);
49
52};
53
long long int int64_t
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)
Progress & progress_
Definition shader_eval.h:51
Device * device_
Definition shader_eval.h:50
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
#define input
#define output
ccl_gpu_kernel_postfix const ccl_global int ccl_global float const int work_size
ShaderEvalType
Definition shader_eval.h:18
@ SHADER_EVAL_VOLUME_DENSITY
Definition shader_eval.h:22
@ SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY
Definition shader_eval.h:21
@ SHADER_EVAL_BACKGROUND
Definition shader_eval.h:20
@ SHADER_EVAL_DISPLACE
Definition shader_eval.h:19