Blender V5.3
path_trace_work_cpu.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
9
10#include "device/queue.h"
11
13
14#include "util/vector.h"
15
17
18struct KernelWorkTile;
21
22class CPUKernels;
23
24/* Implementation of PathTraceWork which schedules work on to queues pixel-by-pixel,
25 * for CPU devices.
26 *
27 * NOTE: For the CPU rendering there are assumptions about TBB arena size and number of concurrent
28 * queues on the render device which makes this work be only usable on CPU. */
30 public:
32 Film *film,
33 DeviceScene *device_scene,
34 const bool *cancel_requested_flag);
35
36 void init_execution() override;
37 void deinit_execution() override;
38
39 void render_samples(RenderStatistics &statistics,
40 const int start_sample,
41 const int samples_num,
42 const int sample_offset) override;
43
45 PassMode pass_mode,
46 const int num_samples) override;
47 void destroy_gpu_resources(PathTraceDisplay *display) override;
48
49 bool copy_render_buffers_from_device() override;
50 bool copy_render_buffers_to_device() override;
51 bool zero_render_buffers() override;
52
53 int adaptive_sampling_converge_filter_count_active(const float threshold, bool reset) override;
54 void cryptomatte_postproces() override;
55 void denoise_volume_guiding_buffers() override;
56
57#if defined(WITH_PATH_GUIDING)
58 /* Initializes the per-thread guiding kernel data. The function sets the pointers to the
59 * global guiding field and the sample data storage as well es initializes the per-thread
60 * guided sampling distributions (e.g., SurfaceSamplingDistribution and
61 * VolumeSamplingDistribution). */
62 void guiding_init_kernel_globals(void *guiding_field,
63 void *sample_data_storage,
64 const bool train) override;
65
66 /* Pushes the collected training data/samples of a path to the global sample storage.
67 * This function is called at the end of a random walk/path generation. */
68 void guiding_push_sample_data_to_global_storage(ThreadKernelGlobalsCPU *kg,
71#endif
72
73 protected:
74 /* Core path tracing routine. Renders given work time on the given queue. */
76 const KernelWorkTile &work_tile,
77 const int samples_num);
78
79 /* CPU kernels. */
81
82 /* Pointer to device-owned kernel globals which is suitable for concurrent access from multiple
83 * threads. This allows dynamic updates to image_info when textures are loaded on demand. */
85};
86
void reset()
Definition film.h:29
bool copy_render_buffers_to_device() override
vector< ThreadKernelGlobalsCPU > * kernel_thread_globals_
void deinit_execution() override
void render_samples(RenderStatistics &statistics, const int start_sample, const int samples_num, const int sample_offset) override
void init_execution() override
bool copy_render_buffers_from_device() override
int adaptive_sampling_converge_filter_count_active(const float threshold, bool reset) override
void copy_to_display(PathTraceDisplay *display, PassMode pass_mode, const int num_samples) override
void destroy_gpu_resources(PathTraceDisplay *display) override
void cryptomatte_postproces() override
const CPUKernels & kernels_
void render_samples_full_pipeline(ThreadKernelGlobalsCPU *kernel_globals, const KernelWorkTile &work_tile, const int samples_num)
PathTraceWorkCPU(Device *device, Film *film, DeviceScene *device_scene, const bool *cancel_requested_flag)
bool zero_render_buffers() override
void denoise_volume_guiding_buffers() override
PathTraceWork(Device *device, Film *film, DeviceScene *device_scene, const bool *cancel_requested_flag)
#define ccl_restrict
#define ccl_global
#define CCL_NAMESPACE_END
const int state
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int ccl_global float * render_buffer
PassMode
Definition pass.h:20