[Bf-blender-cvs] [d564eeb21e9] cycles-x: Cleanup: rename IntegratorState to IntegratorStateCPU

Brecht Van Lommel noreply at git.blender.org
Wed Sep 1 19:33:44 CEST 2021


Commit: d564eeb21e9f25bd82c0c9b922332a4b5e644dcb
Author: Brecht Van Lommel
Date:   Thu Aug 26 18:08:37 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBd564eeb21e9f25bd82c0c9b922332a4b5e644dcb

Cleanup: rename IntegratorState to IntegratorStateCPU

We already had a IntegratorStateGPU, this way it's more clear that this data
structure is only for the CPU.

===================================================================

M	intern/cycles/device/cpu/kernel.h
M	intern/cycles/device/optix/device_impl.cpp
M	intern/cycles/integrator/path_trace_work_cpu.cpp
M	intern/cycles/integrator/path_trace_work_gpu.cpp
M	intern/cycles/kernel/device/cpu/kernel.h
M	intern/cycles/kernel/device/cpu/kernel_arch.h
M	intern/cycles/kernel/device/cpu/kernel_arch_impl.h
M	intern/cycles/kernel/device/gpu/kernel.h
M	intern/cycles/kernel/integrator/integrator_state.h
M	intern/cycles/kernel/integrator/integrator_state_util.h
M	intern/cycles/kernel/osl/osl_shader.cpp
M	intern/cycles/kernel/osl/osl_shader.h

===================================================================

diff --git a/intern/cycles/device/cpu/kernel.h b/intern/cycles/device/cpu/kernel.h
index ee671251eb6..54b18308544 100644
--- a/intern/cycles/device/cpu/kernel.h
+++ b/intern/cycles/device/cpu/kernel.h
@@ -22,7 +22,7 @@
 CCL_NAMESPACE_BEGIN
 
 struct KernelGlobals;
-struct IntegratorState;
+struct IntegratorStateCPU;
 struct TileInfo;
 
 class CPUKernels {
@@ -30,11 +30,11 @@ class CPUKernels {
   /* Integrator. */
 
   using IntegratorFunction =
-      CPUKernelFunction<void (*)(const KernelGlobals *kg, IntegratorState *state)>;
+      CPUKernelFunction<void (*)(const KernelGlobals *kg, IntegratorStateCPU *state)>;
   using IntegratorShadeFunction = CPUKernelFunction<void (*)(
-      const KernelGlobals *kg, IntegratorState *state, ccl_global float *render_buffer)>;
+      const KernelGlobals *kg, IntegratorStateCPU *state, ccl_global float *render_buffer)>;
   using IntegratorInitFunction = CPUKernelFunction<bool (*)(const KernelGlobals *kg,
-                                                            IntegratorState *state,
+                                                            IntegratorStateCPU *state,
                                                             KernelWorkTile *tile,
                                                             ccl_global float *render_buffer)>;
 
diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp
index 7f78b458038..cd16b8c9f01 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -1556,7 +1556,7 @@ void OptiXDevice::const_copy_to(const char *name, void *host, size_t size)
       update_launch_params(offsetof(KernelParamsOptiX, tex_name), host, size); \
       return; \
     }
-  KERNEL_TEX(IntegratorState, __integrator_state)
+  KERNEL_TEX(IntegratorStateGPU, __integrator_state)
 #  include "kernel/kernel_textures.h"
 #  undef KERNEL_TEX
 }
diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp b/intern/cycles/integrator/path_trace_work_cpu.cpp
index 9e0026dec0a..dff5187da0d 100644
--- a/intern/cycles/integrator/path_trace_work_cpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_cpu.cpp
@@ -115,10 +115,10 @@ void PathTraceWorkCPU::render_samples_full_pipeline(KernelGlobals *kernel_global
   const bool has_shadow_catcher = device_scene_->data.integrator.has_shadow_catcher;
   const bool has_bake = device_scene_->data.bake.use;
 
-  IntegratorState integrator_states[2] = {};
+  IntegratorStateCPU integrator_states[2] = {};
 
-  IntegratorState *state = &integrator_states[0];
-  IntegratorState *shadow_catcher_state = &integrator_states[1];
+  IntegratorStateCPU *state = &integrator_states[0];
+  IntegratorStateCPU *shadow_catcher_state = &integrator_states[1];
 
   KernelWorkTile sample_work_tile = work_tile;
   float *render_buffer = buffers_->buffer.data();
diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp b/intern/cycles/integrator/path_trace_work_gpu.cpp
index 806a70c7953..854a2ab6dd6 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -47,7 +47,7 @@ PathTraceWorkGPU::PathTraceWorkGPU(Device *device,
       num_queued_paths_(device, "num_queued_paths", MEM_READ_WRITE),
       work_tiles_(device, "work_tiles", MEM_READ_WRITE),
       gpu_display_rgba_half_(device, "display buffer half", MEM_READ_WRITE),
-      max_num_paths_(queue_->num_concurrent_states(sizeof(IntegratorState))),
+      max_num_paths_(queue_->num_concurrent_states(sizeof(IntegratorStateCPU))),
       min_num_active_paths_(queue_->num_concurrent_busy_states()),
       max_active_path_index_(0)
 {
diff --git a/intern/cycles/kernel/device/cpu/kernel.h b/intern/cycles/kernel/device/cpu/kernel.h
index 5828b83690d..ae2a841835a 100644
--- a/intern/cycles/kernel/device/cpu/kernel.h
+++ b/intern/cycles/kernel/device/cpu/kernel.h
@@ -28,7 +28,7 @@ CCL_NAMESPACE_BEGIN
 #define KERNEL_NAME_EVAL(arch, name) KERNEL_NAME_JOIN(kernel, arch, name)
 #define KERNEL_FUNCTION_FULL_NAME(name) KERNEL_NAME_EVAL(KERNEL_ARCH, name)
 
-struct IntegratorState;
+struct IntegratorStateCPU;
 struct KernelGlobals;
 struct KernelData;
 
diff --git a/intern/cycles/kernel/device/cpu/kernel_arch.h b/intern/cycles/kernel/device/cpu/kernel_arch.h
index de367b4f29b..81f328c710b 100644
--- a/intern/cycles/kernel/device/cpu/kernel_arch.h
+++ b/intern/cycles/kernel/device/cpu/kernel_arch.h
@@ -22,16 +22,16 @@
 
 #define KERNEL_INTEGRATOR_FUNCTION(name) \
   void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *ccl_restrict kg, \
-                                                    IntegratorState *state)
+                                                    IntegratorStateCPU *state)
 
 #define KERNEL_INTEGRATOR_SHADE_FUNCTION(name) \
   void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *ccl_restrict kg, \
-                                                    IntegratorState *state, \
+                                                    IntegratorStateCPU *state, \
                                                     ccl_global float *render_buffer)
 
 #define KERNEL_INTEGRATOR_INIT_FUNCTION(name) \
   bool KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *ccl_restrict kg, \
-                                                    IntegratorState *state, \
+                                                    IntegratorStateCPU *state, \
                                                     KernelWorkTile *tile, \
                                                     ccl_global float *render_buffer)
 
diff --git a/intern/cycles/kernel/device/cpu/kernel_arch_impl.h b/intern/cycles/kernel/device/cpu/kernel_arch_impl.h
index 0f2c7635ab2..1432abfd330 100644
--- a/intern/cycles/kernel/device/cpu/kernel_arch_impl.h
+++ b/intern/cycles/kernel/device/cpu/kernel_arch_impl.h
@@ -71,14 +71,14 @@ CCL_NAMESPACE_BEGIN
 
 #define DEFINE_INTEGRATOR_KERNEL(name) \
   void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *kg, \
-                                                    IntegratorState *state) \
+                                                    IntegratorStateCPU *state) \
   { \
     KERNEL_INVOKE(name, kg, state); \
   }
 
 #define DEFINE_INTEGRATOR_SHADE_KERNEL(name) \
   void KERNEL_FUNCTION_FULL_NAME(integrator_##name)( \
-      const KernelGlobals *kg, IntegratorState *state, ccl_global float *render_buffer) \
+      const KernelGlobals *kg, IntegratorStateCPU *state, ccl_global float *render_buffer) \
   { \
     KERNEL_INVOKE(name, kg, state, render_buffer); \
   }
@@ -87,7 +87,7 @@ CCL_NAMESPACE_BEGIN
  * that it does not contain unused fields. */
 #define DEFINE_INTEGRATOR_INIT_KERNEL(name) \
   bool KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *kg, \
-                                                    IntegratorState *state, \
+                                                    IntegratorStateCPU *state, \
                                                     KernelWorkTile *tile, \
                                                     ccl_global float *render_buffer) \
   { \
diff --git a/intern/cycles/kernel/device/gpu/kernel.h b/intern/cycles/kernel/device/gpu/kernel.h
index 1a37f94358a..b2ef4ba10b5 100644
--- a/intern/cycles/kernel/device/gpu/kernel.h
+++ b/intern/cycles/kernel/device/gpu/kernel.h
@@ -48,9 +48,9 @@
 ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
     kernel_gpu_integrator_reset(int num_states)
 {
-  const int path_index = ccl_gpu_global_id_x();
+  const int state = ccl_gpu_global_id_x();
 
-  if (path_index < num_states) {
+  if (state < num_states) {
     INTEGRATOR_STATE_WRITE(path, queued_kernel) = 0;
     INTEGRATOR_STATE_WRITE(shadow_path, queued_kernel) = 0;
   }
@@ -77,12 +77,12 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
     return;
   }
 
-  const int path_index = tile->path_index_offset + tile_work_index;
+  const int state = tile->path_index_offset + tile_work_index;
 
   uint x, y, sample;
   get_work_pixel(tile, tile_work_index, &x, &y, &sample);
 
-  integrator_init_from_camera(nullptr, path_index, tile, render_buffer, x, y, sample);
+  integrator_init_from_camera(nullptr, state, tile, render_buffer, x, y, sample);
 }
 
 ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
@@ -106,12 +106,12 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
     return;
   }
 
-  const int path_index = tile->path_index_offset + tile_work_index;
+  const int state = tile->path_index_offset + tile_work_index;
 
   uint x, y, sample;
   get_work_pixel(tile, tile_work_index, &x, &y, &sample);
 
-  integrator_init_from_bake(nullptr, path_index, tile, render_buffer, x, y, sample);
+  integrator_init_from_bake(nullptr, state, tile, render_buffer, x, y, sample);
 }
 
 ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
@@ -120,8 +120,8 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
   const int global_index = ccl_gpu_global_id_x();
 
   if (global_index < work_size) {
-    const int path_index = (path_index_array) ? path_index_array[global_index] : global_index;
-    integrator_intersect_closest(NULL, path_index);
+    const int state = (path_index_array) ? path_index_array[global_index] : global_index;
+    integrator_intersect_closest(NULL, state);
   }
 }
 
@@ -131,8 +131,8 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
   const int global_index = ccl_gpu_global_id_x();
 
   if (global_index < work_size) {
-    const int path_index = (path_index_array) ? path_index_array[global_index] : global_index;
-    integrator_intersect_shadow(NULL, path_index);
+    const int state = (path_index_array) ? path_index_array[global_index] : global_index;
+    integrator_intersect_shadow(NULL, state);
   }
 }
 
@@ -142,8 +142,8 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
   const int global_index = ccl_gpu_global_id_x();
 
   if (global_index < work_size) {
-    const int path_index = (path_index_array) ? path_index_array[global_index] : global_index;
-    integrator_intersect_subsurface(NULL, path_index)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list