2023-06-14 16:52:36 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "device/cpu/kernel_function.h"
|
2021-11-05 21:01:23 +01:00
|
|
|
#include "util/half.h"
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
2024-12-29 23:13:45 +01:00
|
|
|
struct ThreadKernelGlobalsCPU;
|
2021-11-05 21:01:23 +01:00
|
|
|
struct KernelFilmConvert;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
struct IntegratorStateCPU;
|
|
|
|
|
struct TileInfo;
|
|
|
|
|
|
|
|
|
|
class CPUKernels {
|
|
|
|
|
public:
|
|
|
|
|
/* Integrator. */
|
|
|
|
|
|
|
|
|
|
using IntegratorFunction =
|
2024-12-29 23:13:45 +01:00
|
|
|
CPUKernelFunction<void (*)(const ThreadKernelGlobalsCPU *kg, IntegratorStateCPU *state)>;
|
|
|
|
|
using IntegratorShadeFunction = CPUKernelFunction<void (*)(const ThreadKernelGlobalsCPU *kg,
|
|
|
|
|
IntegratorStateCPU *state,
|
|
|
|
|
ccl_global float *render_buffer)>;
|
|
|
|
|
using IntegratorInitFunction = CPUKernelFunction<bool (*)(const ThreadKernelGlobalsCPU *kg,
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
IntegratorStateCPU *state,
|
|
|
|
|
KernelWorkTile *tile,
|
|
|
|
|
ccl_global float *render_buffer)>;
|
|
|
|
|
|
|
|
|
|
IntegratorInitFunction integrator_init_from_camera;
|
|
|
|
|
IntegratorInitFunction integrator_init_from_bake;
|
|
|
|
|
IntegratorShadeFunction integrator_megakernel;
|
|
|
|
|
|
|
|
|
|
/* Shader evaluation. */
|
|
|
|
|
|
|
|
|
|
using ShaderEvalFunction = CPUKernelFunction<void (*)(
|
2024-12-29 23:13:45 +01:00
|
|
|
const ThreadKernelGlobalsCPU *kg, const KernelShaderEvalInput *, float *, const int)>;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
ShaderEvalFunction shader_eval_displace;
|
|
|
|
|
ShaderEvalFunction shader_eval_background;
|
2021-09-20 16:16:11 +02:00
|
|
|
ShaderEvalFunction shader_eval_curve_shadow_transparency;
|
2024-11-29 12:20:56 +01:00
|
|
|
ShaderEvalFunction shader_eval_volume_density;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
/* Adaptive stopping. */
|
|
|
|
|
|
|
|
|
|
using AdaptiveSamplingConvergenceCheckFunction =
|
2024-12-29 23:13:45 +01:00
|
|
|
CPUKernelFunction<bool (*)(const ThreadKernelGlobalsCPU *kg,
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
ccl_global float *render_buffer,
|
2025-01-01 18:15:54 +01:00
|
|
|
const int x,
|
|
|
|
|
const int y,
|
|
|
|
|
const float threshold,
|
|
|
|
|
const int reset,
|
|
|
|
|
const int offset,
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
int stride)>;
|
|
|
|
|
|
2025-02-25 19:11:08 +01:00
|
|
|
using FilterXFunction = CPUKernelFunction<void (*)(const ThreadKernelGlobalsCPU *kg,
|
|
|
|
|
ccl_global float *render_buffer,
|
|
|
|
|
const int y,
|
|
|
|
|
const int start_x,
|
|
|
|
|
const int width,
|
|
|
|
|
const int offset,
|
|
|
|
|
int stride)>;
|
|
|
|
|
|
|
|
|
|
using FilterYFunction = CPUKernelFunction<void (*)(const ThreadKernelGlobalsCPU *kg,
|
|
|
|
|
ccl_global float *render_buffer,
|
|
|
|
|
const int x,
|
|
|
|
|
const int start_y,
|
|
|
|
|
const int height,
|
|
|
|
|
const int offset,
|
|
|
|
|
int stride)>;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
AdaptiveSamplingConvergenceCheckFunction adaptive_sampling_convergence_check;
|
|
|
|
|
|
2025-02-25 19:11:08 +01:00
|
|
|
FilterXFunction adaptive_sampling_filter_x;
|
|
|
|
|
FilterYFunction adaptive_sampling_filter_y;
|
|
|
|
|
|
|
|
|
|
/* Volume Scattering Probability Guiding. */
|
|
|
|
|
CPUKernelFunction<void (*)(const ThreadKernelGlobalsCPU *kg,
|
|
|
|
|
ccl_global float *render_buffer,
|
|
|
|
|
const int y,
|
|
|
|
|
const int center_x,
|
|
|
|
|
const int min_x,
|
|
|
|
|
const int max_x,
|
|
|
|
|
const int offset,
|
|
|
|
|
int stride)>
|
|
|
|
|
volume_guiding_filter_x;
|
|
|
|
|
FilterYFunction volume_guiding_filter_y;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
/* Cryptomatte. */
|
|
|
|
|
|
|
|
|
|
using CryptomattePostprocessFunction = CPUKernelFunction<void (*)(
|
2024-12-29 23:13:45 +01:00
|
|
|
const ThreadKernelGlobalsCPU *kg, ccl_global float *render_buffer, const int pixel_index)>;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
CryptomattePostprocessFunction cryptomatte_postprocess;
|
|
|
|
|
|
2021-11-05 21:01:23 +01:00
|
|
|
/* Film Convert. */
|
|
|
|
|
using FilmConvertFunction = CPUKernelFunction<void (*)(const KernelFilmConvert *kfilm_convert,
|
|
|
|
|
const float *buffer,
|
|
|
|
|
float *pixel,
|
|
|
|
|
const int width,
|
|
|
|
|
const int buffer_stride,
|
|
|
|
|
const int pixel_stride)>;
|
|
|
|
|
using FilmConvertHalfRGBAFunction =
|
|
|
|
|
CPUKernelFunction<void (*)(const KernelFilmConvert *kfilm_convert,
|
|
|
|
|
const float *buffer,
|
|
|
|
|
half4 *pixel,
|
|
|
|
|
const int width,
|
|
|
|
|
const int buffer_stride)>;
|
|
|
|
|
|
|
|
|
|
#define KERNEL_FILM_CONVERT_FUNCTION(name) \
|
|
|
|
|
FilmConvertFunction film_convert_##name; \
|
|
|
|
|
FilmConvertHalfRGBAFunction film_convert_half_rgba_##name;
|
|
|
|
|
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(depth)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(mist)
|
2025-02-25 19:11:08 +01:00
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(volume_majorant)
|
2021-11-05 21:01:23 +01:00
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(sample_count)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(float)
|
|
|
|
|
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(light_path)
|
2025-05-21 12:23:13 +02:00
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(rgbe)
|
2021-11-05 21:01:23 +01:00
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(float3)
|
|
|
|
|
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(motion)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(cryptomatte)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(shadow_catcher)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(shadow_catcher_matte_with_shadow)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(combined)
|
|
|
|
|
KERNEL_FILM_CONVERT_FUNCTION(float4)
|
|
|
|
|
|
|
|
|
|
#undef KERNEL_FILM_CONVERT_FUNCTION
|
|
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
CPUKernels();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|