Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/cpu/kernel_thread_globals.cpp
| Show All 19 Lines | |||||
| #include "kernel/osl/osl_shader.h" | #include "kernel/osl/osl_shader.h" | ||||
| #include "kernel/osl/osl_globals.h" | #include "kernel/osl/osl_globals.h" | ||||
| // clang-format on | // clang-format on | ||||
| #include "util/util_profiling.h" | #include "util/util_profiling.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| CPUKernelThreadGlobals::CPUKernelThreadGlobals(const KernelGlobals &kernel_globals, | CPUKernelThreadGlobals::CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals, | ||||
| void *osl_globals_memory, | void *osl_globals_memory, | ||||
| Profiler &cpu_profiler) | Profiler &cpu_profiler) | ||||
| : KernelGlobals(kernel_globals), cpu_profiler_(cpu_profiler) | : KernelGlobalsCPU(kernel_globals), cpu_profiler_(cpu_profiler) | ||||
| { | { | ||||
| reset_runtime_memory(); | reset_runtime_memory(); | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| OSLShader::thread_init(this, reinterpret_cast<OSLGlobals *>(osl_globals_memory)); | OSLShader::thread_init(this, reinterpret_cast<OSLGlobals *>(osl_globals_memory)); | ||||
| #else | #else | ||||
| (void)osl_globals_memory; | (void)osl_globals_memory; | ||||
| #endif | #endif | ||||
| } | } | ||||
| CPUKernelThreadGlobals::CPUKernelThreadGlobals(CPUKernelThreadGlobals &&other) noexcept | CPUKernelThreadGlobals::CPUKernelThreadGlobals(CPUKernelThreadGlobals &&other) noexcept | ||||
| : KernelGlobals(std::move(other)), cpu_profiler_(other.cpu_profiler_) | : KernelGlobalsCPU(std::move(other)), cpu_profiler_(other.cpu_profiler_) | ||||
| { | { | ||||
| other.reset_runtime_memory(); | other.reset_runtime_memory(); | ||||
| } | } | ||||
| CPUKernelThreadGlobals::~CPUKernelThreadGlobals() | CPUKernelThreadGlobals::~CPUKernelThreadGlobals() | ||||
| { | { | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| OSLShader::thread_free(this); | OSLShader::thread_free(this); | ||||
| #endif | #endif | ||||
| } | } | ||||
| CPUKernelThreadGlobals &CPUKernelThreadGlobals::operator=(CPUKernelThreadGlobals &&other) | CPUKernelThreadGlobals &CPUKernelThreadGlobals::operator=(CPUKernelThreadGlobals &&other) | ||||
| { | { | ||||
| if (this == &other) { | if (this == &other) { | ||||
| return *this; | return *this; | ||||
| } | } | ||||
| *static_cast<KernelGlobals *>(this) = *static_cast<KernelGlobals *>(&other); | *static_cast<KernelGlobalsCPU *>(this) = *static_cast<KernelGlobalsCPU *>(&other); | ||||
| other.reset_runtime_memory(); | other.reset_runtime_memory(); | ||||
| return *this; | return *this; | ||||
| } | } | ||||
| void CPUKernelThreadGlobals::reset_runtime_memory() | void CPUKernelThreadGlobals::reset_runtime_memory() | ||||
| { | { | ||||
| Show All 16 Lines | |||||