[Bf-blender-cvs] [33a2a174e39] cycles-x: Cycles X: Multi-thread CPU pass accessor
Sergey Sharybin
noreply at git.blender.org
Thu Jun 3 16:01:57 CEST 2021
Commit: 33a2a174e3978d4425819fb77023d142cdb2573d
Author: Sergey Sharybin
Date: Wed Jun 2 15:11:07 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB33a2a174e3978d4425819fb77023d142cdb2573d
Cycles X: Multi-thread CPU pass accessor
Is not very measurable for the combined pass, but for shadow catcher
matte with approximated shadow gives about 30% speedup of the display
update.
Surely, this is only fraction of the overall render time, but is
still nice to have it. Makes it easier to re-use for the viewport
update as well.
Differential Revision: https://developer.blender.org/D11479
===================================================================
M intern/cycles/integrator/pass_accessor_cpu.cpp
===================================================================
diff --git a/intern/cycles/integrator/pass_accessor_cpu.cpp b/intern/cycles/integrator/pass_accessor_cpu.cpp
index 32e16d859c4..d1637a0fdb2 100644
--- a/intern/cycles/integrator/pass_accessor_cpu.cpp
+++ b/intern/cycles/integrator/pass_accessor_cpu.cpp
@@ -17,6 +17,7 @@
#include "integrator/pass_accessor_cpu.h"
#include "util/util_logging.h"
+#include "util/util_tbb.h"
// clang-format off
#include "kernel/device/cpu/compat.h"
@@ -81,18 +82,16 @@ inline void PassAccessorCPU::run_get_pass_kernel_processor(const RenderBuffers *
const float *buffer_data = render_buffers->buffer.data();
- const int pass_stride = params.pass_stride;
- const int64_t num_pixels = int64_t(params.width) * params.height;
+ tbb::parallel_for(0, params.height, [&](int y) {
+ int64_t pixel_index = y * params.width;
+ for (int x = 0; x < params.width; ++x, ++pixel_index) {
+ const int64_t input_pixel_offset = pixel_index * params.pass_stride;
+ const float *buffer = buffer_data + input_pixel_offset;
+ float *pixel = pixels + pixel_index * num_components_;
- /* TODO(sergey): Consider multi-threading. */
-
- for (int64_t i = 0; i < num_pixels; i++) {
- const int64_t input_pixel_offset = i * pass_stride;
- const float *buffer = buffer_data + input_pixel_offset;
- float *pixel = pixels + i * num_components_;
-
- processor(&kfilm_convert, buffer, pixel);
- }
+ processor(&kfilm_convert, buffer, pixel);
+ }
+ });
}
/* --------------------------------------------------------------------
More information about the Bf-blender-cvs
mailing list