diff options
author | Brecht Van Lommel <brecht> | 2021-10-17 17:10:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-18 20:02:10 +0300 |
commit | 1df3b51988852fa8ee6b530a64aa23346db9acd4 (patch) | |
tree | dd79dba4c8ff8bb8474cc399e9d1b308d845e0cb /intern/cycles/device/cpu | |
parent | 44c3bb729be42d6d67eaf8918d7cbcb2ff0b315d (diff) |
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
Diffstat (limited to 'intern/cycles/device/cpu')
-rw-r--r-- | intern/cycles/device/cpu/device_impl.h | 2 | ||||
-rw-r--r-- | intern/cycles/device/cpu/kernel.h | 20 | ||||
-rw-r--r-- | intern/cycles/device/cpu/kernel_thread_globals.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/device/cpu/kernel_thread_globals.h | 8 |
4 files changed, 19 insertions, 19 deletions
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<TextureInfo> 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<void (*)(const KernelGlobals *kg, IntegratorStateCPU *state)>; + CPUKernelFunction<void (*)(const KernelGlobalsCPU *kg, IntegratorStateCPU *state)>; using IntegratorShadeFunction = CPUKernelFunction<void (*)( - const KernelGlobals *kg, IntegratorStateCPU *state, ccl_global float *render_buffer)>; - using IntegratorInitFunction = CPUKernelFunction<bool (*)(const KernelGlobals *kg, + const KernelGlobalsCPU *kg, IntegratorStateCPU *state, ccl_global float *render_buffer)>; + using IntegratorInitFunction = CPUKernelFunction<bool (*)(const KernelGlobalsCPU *kg, IntegratorStateCPU *state, KernelWorkTile *tile, ccl_global float *render_buffer)>; @@ -54,7 +54,7 @@ class CPUKernels { /* Shader evaluation. */ using ShaderEvalFunction = CPUKernelFunction<void (*)( - const KernelGlobals *kg, const KernelShaderEvalInput *, float *, const int)>; + 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<bool (*)(const KernelGlobals *kg, + CPUKernelFunction<bool (*)(const KernelGlobalsCPU *kg, ccl_global float *render_buffer, int x, int y, @@ -72,7 +72,7 @@ class CPUKernels { int stride)>; using AdaptiveSamplingFilterXFunction = - CPUKernelFunction<void (*)(const KernelGlobals *kg, + CPUKernelFunction<void (*)(const KernelGlobalsCPU *kg, ccl_global float *render_buffer, int y, int start_x, @@ -81,7 +81,7 @@ class CPUKernels { int stride)>; using AdaptiveSamplingFilterYFunction = - CPUKernelFunction<void (*)(const KernelGlobals *kg, + CPUKernelFunction<void (*)(const KernelGlobalsCPU *kg, ccl_global float *render_buffer, int x, int start_y, @@ -97,13 +97,13 @@ class CPUKernels { /* Cryptomatte. */ using CryptomattePostprocessFunction = CPUKernelFunction<void (*)( - const KernelGlobals *kg, ccl_global float *render_buffer, int pixel_index)>; + const KernelGlobalsCPU *kg, ccl_global float *render_buffer, int pixel_index)>; CryptomattePostprocessFunction cryptomatte_postprocess; /* Bake. */ - CPUKernelFunction<void (*)(const KernelGlobals *, float *, int, int, int, int, int)> bake; + CPUKernelFunction<void (*)(const KernelGlobalsCPU *, float *, int, int, int, int, int)> 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<KernelGlobals *>(this) = *static_cast<KernelGlobals *>(&other); + *static_cast<KernelGlobalsCPU *>(this) = *static_cast<KernelGlobalsCPU *>(&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); |