Blender V4.3
kernel_thread_globals.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
11
12class Profiler;
13
14/* A special class which extends memory ownership of the `KernelGlobalsCPU` decoupling any resource
15 * which is not thread-safe for access. Every worker thread which needs to operate on
16 * `KernelGlobalsCPU` needs to initialize its own copy of this object.
17 *
18 * NOTE: Only minimal subset of objects are copied: `KernelData` is never copied. This means that
19 * there is no unnecessary data duplication happening when using this object. */
21 public:
22 /* TODO(sergey): Would be nice to have properly typed OSLGlobals even in the case when building
23 * without OSL support. Will avoid need to those unnamed pointers and casts. */
24 CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals,
25 void *osl_globals_memory,
26 Profiler &cpu_profiler,
27 const int thread_index);
28
30
33
36
37 void start_profiling();
38 void stop_profiling();
39
40 protected:
42
44};
45
CPUKernelThreadGlobals & operator=(const CPUKernelThreadGlobals &other)=delete
CPUKernelThreadGlobals(const CPUKernelThreadGlobals &other)=delete
CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals, void *osl_globals_memory, Profiler &cpu_profiler, const int thread_index)
#define CCL_NAMESPACE_END