Blender  V3.3
kernel_thread_globals.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
5 
6 // clang-format off
7 #include "kernel/osl/shader.h"
8 #include "kernel/osl/globals.h"
9 // clang-format on
10 
11 #include "util/profiling.h"
12 
14 
16  void *osl_globals_memory,
17  Profiler &cpu_profiler)
18  : KernelGlobalsCPU(kernel_globals), cpu_profiler_(cpu_profiler)
19 {
21 
22 #ifdef WITH_OSL
23  OSLShader::thread_init(this, reinterpret_cast<OSLGlobals *>(osl_globals_memory));
24 #else
25  (void)osl_globals_memory;
26 #endif
27 }
28 
30  : KernelGlobalsCPU(std::move(other)), cpu_profiler_(other.cpu_profiler_)
31 {
32  other.reset_runtime_memory();
33 }
34 
36 {
37 #ifdef WITH_OSL
38  OSLShader::thread_free(this);
39 #endif
40 }
41 
43 {
44  if (this == &other) {
45  return *this;
46  }
47 
48  *static_cast<KernelGlobalsCPU *>(this) = *static_cast<KernelGlobalsCPU *>(&other);
49 
50  other.reset_runtime_memory();
51 
52  return *this;
53 }
54 
56 {
57 #ifdef WITH_OSL
58  osl = nullptr;
59 #endif
60 }
61 
63 {
65 }
66 
68 {
70 }
71 
CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals, void *osl_globals_memory, Profiler &cpu_profiler)
CPUKernelThreadGlobals & operator=(const CPUKernelThreadGlobals &other)=delete
void add_state(ProfilingState *state)
Definition: profiling.cpp:94
void remove_state(ProfilingState *state)
Definition: profiling.cpp:113
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
struct KernelGlobalsCPU KernelGlobalsCPU
SyclQueue void void size_t num_bytes void
SyclQueue void void size_t num_bytes SyclQueue void * kernel_globals
ProfilingState profiler