From 1df3b51988852fa8ee6b530a64aa23346db9acd4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 17 Oct 2021 16:10:10 +0200 Subject: Cycles: replace integrator state argument macros * Rename struct KernelGlobals to struct KernelGlobalsCPU * Add KernelGlobals, IntegratorState and ConstIntegratorState typedefs that every device can define in its own way. * Remove INTEGRATOR_STATE_ARGS and INTEGRATOR_STATE_PASS macros and replace with these new typedefs. * Add explicit state argument to INTEGRATOR_STATE and similar macros In preparation for decoupling main and shadow paths. Differential Revision: https://developer.blender.org/D12888 --- intern/cycles/device/cpu/device_impl.h | 2 +- intern/cycles/device/cpu/kernel.h | 20 ++++++++++---------- intern/cycles/device/cpu/kernel_thread_globals.cpp | 8 ++++---- intern/cycles/device/cpu/kernel_thread_globals.h | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'intern/cycles/device/cpu') diff --git a/intern/cycles/device/cpu/device_impl.h b/intern/cycles/device/cpu/device_impl.h index 371d2258104..944c61e29f7 100644 --- a/intern/cycles/device/cpu/device_impl.h +++ b/intern/cycles/device/cpu/device_impl.h @@ -44,7 +44,7 @@ CCL_NAMESPACE_BEGIN class CPUDevice : public Device { public: - KernelGlobals kernel_globals; + KernelGlobalsCPU kernel_globals; device_vector texture_info; bool need_texture_info; diff --git a/intern/cycles/device/cpu/kernel.h b/intern/cycles/device/cpu/kernel.h index b5f0d873f30..2db09057e44 100644 --- a/intern/cycles/device/cpu/kernel.h +++ b/intern/cycles/device/cpu/kernel.h @@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN -struct KernelGlobals; +struct KernelGlobalsCPU; struct IntegratorStateCPU; struct TileInfo; @@ -30,10 +30,10 @@ class CPUKernels { /* Integrator. */ using IntegratorFunction = - CPUKernelFunction; + CPUKernelFunction; using IntegratorShadeFunction = CPUKernelFunction; - using IntegratorInitFunction = CPUKernelFunction; + using IntegratorInitFunction = CPUKernelFunction; @@ -54,7 +54,7 @@ class CPUKernels { /* Shader evaluation. */ using ShaderEvalFunction = CPUKernelFunction; + const KernelGlobalsCPU *kg, const KernelShaderEvalInput *, float *, const int)>; ShaderEvalFunction shader_eval_displace; ShaderEvalFunction shader_eval_background; @@ -62,7 +62,7 @@ class CPUKernels { /* Adaptive stopping. */ using AdaptiveSamplingConvergenceCheckFunction = - CPUKernelFunction; using AdaptiveSamplingFilterXFunction = - CPUKernelFunction; using AdaptiveSamplingFilterYFunction = - CPUKernelFunction; + const KernelGlobalsCPU *kg, ccl_global float *render_buffer, int pixel_index)>; CryptomattePostprocessFunction cryptomatte_postprocess; /* Bake. */ - CPUKernelFunction bake; + CPUKernelFunction bake; CPUKernels(); }; diff --git a/intern/cycles/device/cpu/kernel_thread_globals.cpp b/intern/cycles/device/cpu/kernel_thread_globals.cpp index 988b00cd1f0..44735beb88d 100644 --- a/intern/cycles/device/cpu/kernel_thread_globals.cpp +++ b/intern/cycles/device/cpu/kernel_thread_globals.cpp @@ -25,10 +25,10 @@ CCL_NAMESPACE_BEGIN -CPUKernelThreadGlobals::CPUKernelThreadGlobals(const KernelGlobals &kernel_globals, +CPUKernelThreadGlobals::CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals, void *osl_globals_memory, Profiler &cpu_profiler) - : KernelGlobals(kernel_globals), cpu_profiler_(cpu_profiler) + : KernelGlobalsCPU(kernel_globals), cpu_profiler_(cpu_profiler) { reset_runtime_memory(); @@ -40,7 +40,7 @@ CPUKernelThreadGlobals::CPUKernelThreadGlobals(const KernelGlobals &kernel_globa } 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(); } @@ -58,7 +58,7 @@ CPUKernelThreadGlobals &CPUKernelThreadGlobals::operator=(CPUKernelThreadGlobals return *this; } - *static_cast(this) = *static_cast(&other); + *static_cast(this) = *static_cast(&other); other.reset_runtime_memory(); diff --git a/intern/cycles/device/cpu/kernel_thread_globals.h b/intern/cycles/device/cpu/kernel_thread_globals.h index d005c3bb56c..5aeeaf678d0 100644 --- a/intern/cycles/device/cpu/kernel_thread_globals.h +++ b/intern/cycles/device/cpu/kernel_thread_globals.h @@ -23,17 +23,17 @@ CCL_NAMESPACE_BEGIN class Profiler; -/* A special class which extends memory ownership of the `KernelGlobals` decoupling any resource +/* A special class which extends memory ownership of the `KernelGlobalsCPU` decoupling any resource * which is not thread-safe for access. Every worker thread which needs to operate on - * `KernelGlobals` needs to initialize its own copy of this object. + * `KernelGlobalsCPU` needs to initialize its own copy of this object. * * NOTE: Only minimal subset of objects are copied: `KernelData` is never copied. This means that * there is no unnecessary data duplication happening when using this object. */ -class CPUKernelThreadGlobals : public KernelGlobals { +class CPUKernelThreadGlobals : public KernelGlobalsCPU { public: /* TODO(sergey): Would be nice to have properly typed OSLGlobals even in the case when building * without OSL support. Will avoid need to those unnamed pointers and casts. */ - CPUKernelThreadGlobals(const KernelGlobals &kernel_globals, + CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_globals, void *osl_globals_memory, Profiler &cpu_profiler); -- cgit v1.2.3