Blender  V3.3
path_trace_work_cpu.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
7 
9 #include "device/queue.h"
10 
12 
13 #include "util/vector.h"
14 
16 
17 struct KernelWorkTile;
18 struct KernelGlobalsCPU;
19 
20 class CPUKernels;
21 
22 /* Implementation of PathTraceWork which schedules work on to queues pixel-by-pixel,
23  * for CPU devices.
24  *
25  * NOTE: For the CPU rendering there are assumptions about TBB arena size and number of concurrent
26  * queues on the render device which makes this work be only usable on CPU. */
28  public:
29  PathTraceWorkCPU(Device *device,
30  Film *film,
31  DeviceScene *device_scene,
32  bool *cancel_requested_flag);
33 
34  virtual void init_execution() override;
35 
36  virtual void render_samples(RenderStatistics &statistics,
37  int start_sample,
38  int samples_num,
39  int sample_offset) override;
40 
41  virtual void copy_to_display(PathTraceDisplay *display,
42  PassMode pass_mode,
43  int num_samples) override;
44  virtual void destroy_gpu_resources(PathTraceDisplay *display) override;
45 
46  virtual bool copy_render_buffers_from_device() override;
47  virtual bool copy_render_buffers_to_device() override;
48  virtual bool zero_render_buffers() override;
49 
50  virtual int adaptive_sampling_converge_filter_count_active(float threshold, bool reset) override;
51  virtual void cryptomatte_postproces() override;
52 
53  protected:
54  /* Core path tracing routine. Renders given work time on the given queue. */
56  const KernelWorkTile &work_tile,
57  const int samples_num);
58 
59  /* CPU kernels. */
61 
62  /* Copy of kernel globals which is suitable for concurrent access from multiple threads.
63  *
64  * More specifically, the `kernel_globals_` is local to each threads and nobody else is
65  * accessing it, but some "localization" is required to decouple from kernel globals stored
66  * on the device level. */
68 };
69 
Definition: film.h:29
virtual bool copy_render_buffers_to_device() override
virtual void render_samples(RenderStatistics &statistics, int start_sample, int samples_num, int sample_offset) override
vector< CPUKernelThreadGlobals > kernel_thread_globals_
virtual void init_execution() override
virtual void copy_to_display(PathTraceDisplay *display, PassMode pass_mode, int num_samples) override
virtual bool copy_render_buffers_from_device() override
virtual void destroy_gpu_resources(PathTraceDisplay *display) override
virtual int adaptive_sampling_converge_filter_count_active(float threshold, bool reset) override
virtual void cryptomatte_postproces() override
const CPUKernels & kernels_
PathTraceWorkCPU(Device *device, Film *film, DeviceScene *device_scene, bool *cancel_requested_flag)
void render_samples_full_pipeline(KernelGlobalsCPU *kernel_globals, const KernelWorkTile &work_tile, const int samples_num)
virtual bool zero_render_buffers() override
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
SyclQueue void void size_t num_bytes SyclQueue void * kernel_globals
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int int int float bool reset
clear internal cached data and reset random seed
ccl_gpu_kernel_postfix ccl_global float int int int int ccl_global const float int int int int int int int int int int int int num_samples
PassMode
Definition: pass.h:19