Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-06-05 13:53:38 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-06-22 14:06:47 +0300
commitd8c2092b15de61a69bddbc082998a1dc786d73af (patch)
treeb04a183c85b986db1e0d99fbee94be75608afec7 /intern/cycles/render/image_sky.cpp
parentace3268482c6bfd9986815aaa6b027c99fa8e3f4 (diff)
Cycles: make TBB a required library dependency, and use in a few places
Now that the rest of Blender also relies on TBB, no point in maintaining custom code for paraller_for and thread local storage.
Diffstat (limited to 'intern/cycles/render/image_sky.cpp')
-rw-r--r--intern/cycles/render/image_sky.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/intern/cycles/render/image_sky.cpp b/intern/cycles/render/image_sky.cpp
index 3e7b491f609..442e1d7941f 100644
--- a/intern/cycles/render/image_sky.cpp
+++ b/intern/cycles/render/image_sky.cpp
@@ -20,6 +20,7 @@
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_sky_model.h"
+#include "util/util_task.h"
CCL_NAMESPACE_BEGIN
@@ -58,26 +59,21 @@ bool SkyLoader::load_pixels(const ImageMetaData &metadata,
float altitude_f = (float)altitude;
/* precompute sky texture */
- const int num_chunks = TaskScheduler::num_threads();
- const int chunk_size = height / num_chunks;
- TaskPool pool;
- for (int chunk = 0; chunk < num_chunks; chunk++) {
- const int chunk_start = chunk * chunk_size;
- const int chunk_end = (chunk + 1 < num_chunks) ? (chunk + 1) * chunk_size : height;
- pool.push(function_bind(&nishita_skymodel_precompute_texture,
- pixel_data,
- metadata.channels,
- chunk_start,
- chunk_end,
- width,
- height,
- sun_elevation,
- altitude_f,
- air_density,
- dust_density,
- ozone_density));
- }
- pool.wait_work();
+ const int rows_per_task = divide_up(1024, width);
+ parallel_for(blocked_range<size_t>(0, height, rows_per_task),
+ [&](const blocked_range<size_t> &r) {
+ nishita_skymodel_precompute_texture(pixel_data,
+ metadata.channels,
+ r.begin(),
+ r.end(),
+ width,
+ height,
+ sun_elevation,
+ altitude_f,
+ air_density,
+ dust_density,
+ ozone_density);
+ });
return true;
}