36# define STUB_ASSERT(arch, name) \
37 assert(!(#name " kernel stub for architecture " #arch " was called!"))
48# define KERNEL_INVOKE(name, ...) (STUB_ASSERT(KERNEL_ARCH, name), 0)
50# define KERNEL_INVOKE(name, ...) integrator_##name(__VA_ARGS__)
55#define DEFINE_INTEGRATOR_INIT_KERNEL(name) \
56 bool KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const ThreadKernelGlobalsCPU *kg, \
57 IntegratorStateCPU *state, \
58 KernelWorkTile *tile, \
59 ccl_global float *render_buffer) \
61 return KERNEL_INVOKE( \
62 name, kg, state, tile, render_buffer, tile->x, tile->y, tile->start_sample); \
65#define DEFINE_INTEGRATOR_KERNEL(name) \
66 void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const ThreadKernelGlobalsCPU *kg, \
67 IntegratorStateCPU *state) \
69 KERNEL_INVOKE(name, kg, state); \
72#define DEFINE_INTEGRATOR_SHADE_KERNEL(name) \
73 void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const ThreadKernelGlobalsCPU *kg, \
74 IntegratorStateCPU *state, \
75 ccl_global float *render_buffer) \
77 KERNEL_INVOKE(name, kg, state, render_buffer); \
80#define DEFINE_INTEGRATOR_SHADOW_KERNEL(name) \
81 void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const ThreadKernelGlobalsCPU *kg, \
82 IntegratorStateCPU *state) \
84 KERNEL_INVOKE(name, kg, &state->shadow); \
87#define DEFINE_INTEGRATOR_SHADOW_SHADE_KERNEL(name) \
88 void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const ThreadKernelGlobalsCPU *kg, \
89 IntegratorStateCPU *state, \
90 ccl_global float *render_buffer) \
92 KERNEL_INVOKE(name, kg, &state->shadow, render_buffer); \
149 const float threshold,
199 const int pixel_index)
214# define KERNEL_FILM_CONVERT_FUNCTION(name, is_float) \
215 void KERNEL_FUNCTION_FULL_NAME(film_convert_##name)(const KernelFilmConvert *kfilm_convert, \
216 const float *buffer, \
219 const int buffer_stride, \
220 const int pixel_stride) \
222 STUB_ASSERT(KERNEL_ARCH, film_convert_##name); \
224 void KERNEL_FUNCTION_FULL_NAME(film_convert_half_rgba_##name)( \
225 const KernelFilmConvert *kfilm_convert, \
226 const float *buffer, \
229 const int buffer_stride) \
231 STUB_ASSERT(KERNEL_ARCH, film_convert_##name); \
236# define KERNEL_FILM_CONVERT_FUNCTION(name, is_float) \
237 void KERNEL_FUNCTION_FULL_NAME(film_convert_##name)(const KernelFilmConvert *kfilm_convert, \
238 const float *buffer, \
241 const int buffer_stride, \
242 const int pixel_stride) \
244 for (int i = 0; i < width; i++, buffer += buffer_stride, pixel += pixel_stride) { \
245 film_get_pass_pixel_##name(kfilm_convert, buffer, pixel); \
248 void KERNEL_FUNCTION_FULL_NAME(film_convert_half_rgba_##name)( \
249 const KernelFilmConvert *kfilm_convert, \
250 const float *buffer, \
253 const int buffer_stride) \
255 for (int i = 0; i < width; i++, buffer += buffer_stride, pixel++) { \
256 float pixel_rgba[4] = {0.0f, 0.0f, 0.0f, 1.0f}; \
257 film_get_pass_pixel_##name(kfilm_convert, buffer, pixel_rgba); \
259 pixel_rgba[1] = pixel_rgba[0]; \
260 pixel_rgba[2] = pixel_rgba[0]; \
262 film_apply_pass_pixel_overlays_rgba(kfilm_convert, buffer, pixel_rgba); \
263 *pixel = float4_to_half4_display( \
264 make_float4(pixel_rgba[0], pixel_rgba[1], pixel_rgba[2], pixel_rgba[3])); \
285#undef KERNEL_FILM_CONVERT_FUNCTION
288#undef DEFINE_INTEGRATOR_KERNEL
289#undef DEFINE_INTEGRATOR_SHADE_KERNEL
290#undef DEFINE_INTEGRATOR_INIT_KERNEL
void reset()
clear internal cached data and reset random seed
ccl_device_inline void film_cryptomatte_post(KernelGlobals kg, ccl_global float *render_buffer, const int pixel_index)
#define KERNEL_FILM_CONVERT_FUNCTION(name)
#define CCL_NAMESPACE_END
VecBase< float, 4 > float4
ccl_device void kernel_curve_shadow_transparency_evaluate(KernelGlobals kg, const ccl_global KernelShaderEvalInput *input, ccl_global float *output, const int offset)
CCL_NAMESPACE_BEGIN ccl_device void kernel_displace_evaluate(KernelGlobals kg, const ccl_global KernelShaderEvalInput *input, ccl_global float *output, const int offset)
ccl_device void kernel_background_evaluate(KernelGlobals kg, const ccl_global KernelShaderEvalInput *input, ccl_global float *output, const int offset)
#define KERNEL_FUNCTION_FULL_NAME(name)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int ccl_global float * render_buffer
ccl_device void film_adaptive_sampling_filter_y(KernelGlobals kg, ccl_global float *render_buffer, const int x, const int start_y, const int height, const int offset, const int stride)
ccl_device void film_adaptive_sampling_filter_x(KernelGlobals kg, ccl_global float *render_buffer, const int y, const int start_x, const int width, const int offset, const int stride)
ccl_device bool film_adaptive_sampling_convergence_check(KernelGlobals kg, ccl_global float *render_buffer, const int x, const int y, const float threshold, const int reset, const int offset, const int stride)
void KERNEL_FUNCTION_FULL_NAME shader_eval_background(const ThreadKernelGlobalsCPU *kg, const KernelShaderEvalInput *input, float *output, const int offset)
bool KERNEL_FUNCTION_FULL_NAME adaptive_sampling_convergence_check(const ThreadKernelGlobalsCPU *kg, ccl_global float *render_buffer, const int x, const int y, const float threshold, const int reset, const int offset, int stride)
void KERNEL_FUNCTION_FULL_NAME cryptomatte_postprocess(const ThreadKernelGlobalsCPU *kg, ccl_global float *render_buffer, int pixel_index)
void KERNEL_FUNCTION_FULL_NAME shader_eval_displace(const ThreadKernelGlobalsCPU *kg, const KernelShaderEvalInput *input, float *output, const int offset)
void KERNEL_FUNCTION_FULL_NAME adaptive_sampling_filter_x(const ThreadKernelGlobalsCPU *kg, ccl_global float *render_buffer, const int y, const int start_x, const int width, const int offset, int stride)
void KERNEL_FUNCTION_FULL_NAME adaptive_sampling_filter_y(const ThreadKernelGlobalsCPU *kg, ccl_global float *render_buffer, const int x, const int start_y, const int height, const int offset, int stride)
void KERNEL_FUNCTION_FULL_NAME shader_eval_curve_shadow_transparency(const ThreadKernelGlobalsCPU *kg, const KernelShaderEvalInput *input, float *output, const int offset)
#define DEFINE_INTEGRATOR_INIT_KERNEL(name)
#define KERNEL_FILM_CONVERT_FUNCTION(name, is_float)
#define DEFINE_INTEGRATOR_SHADE_KERNEL(name)