Blender V4.3
kernel_thread_globals.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
6
8
9#include "util/profiling.h"
10
12
14 void *osl_globals_memory,
15 Profiler &cpu_profiler,
16 const int thread_index)
17 : KernelGlobalsCPU(kernel_globals), cpu_profiler_(cpu_profiler)
18{
20
21#ifdef WITH_OSL
22 OSLGlobals::thread_init(this, static_cast<OSLGlobals *>(osl_globals_memory), thread_index);
23#else
24 (void)thread_index;
25 (void)osl_globals_memory;
26#endif
27
28#ifdef WITH_PATH_GUIDING
29 opgl_path_segment_storage = new openpgl::cpp::PathSegmentStorage();
30#endif
31}
32
34 : KernelGlobalsCPU(std::move(other)), cpu_profiler_(other.cpu_profiler_)
35{
36 other.clear_runtime_pointers();
37}
38
40{
41#ifdef WITH_OSL
42 OSLGlobals::thread_free(this);
43#endif
44
45#ifdef WITH_PATH_GUIDING
46 delete opgl_path_segment_storage;
47 delete opgl_surface_sampling_distribution;
48 delete opgl_volume_sampling_distribution;
49#endif
50}
51
53{
54 if (this == &other) {
55 return *this;
56 }
57
58 *static_cast<KernelGlobalsCPU *>(this) = *static_cast<KernelGlobalsCPU *>(&other);
59
60 other.clear_runtime_pointers();
61
62 return *this;
63}
64
66{
67#ifdef WITH_OSL
68 osl = nullptr;
69#endif
70
71#ifdef WITH_PATH_GUIDING
72 opgl_sample_data_storage = nullptr;
73 opgl_guiding_field = nullptr;
74
75 opgl_path_segment_storage = nullptr;
76 opgl_surface_sampling_distribution = nullptr;
77 opgl_volume_sampling_distribution = nullptr;
78#endif
79}
80
85
90
CPUKernelThreadGlobals & operator=(const CPUKernelThreadGlobals &other)=delete
CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals, void *osl_globals_memory, Profiler &cpu_profiler, const int thread_index)
void add_state(ProfilingState *state)
Definition profiling.cpp:93
void remove_state(ProfilingState *state)
struct KernelGlobalsCPU KernelGlobalsCPU
#define CCL_NAMESPACE_END
ProfilingState profiler