summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2017-12-17 03:07:07 +0100
committerHein-Pieter van Braam <hp@tmm.cx>2017-12-17 03:09:38 +0100
commita402efeb72fbf46f26ec4ef02ed9a5a26c26fec7 (patch)
tree11c56e9d4de452994a2c3c8d873e8a01d3f9c0cd /scene
parent83291eab3ae8940cc9da159774a1da6575196c89 (diff)
Tweak OpenMP parameters for lightbaker
On higher threadcount systems this allows for better utilization. On my 16 thread box CPU use goes from 10 - 11 threads to a steady 15 threads on the Sponza scene. Baking time goes from ~10:00 to ~07:30 for me. On lower threadcount systems I expect some improvement also but likely a little less.
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/voxel_light_baker.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 98dc1590d8..c05dfddeca 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -1781,7 +1781,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
//print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
-#pragma omp parallel for
+#pragma omp parallel for schedule(dynamic, 1)
#endif
for (int j = 0; j < width; j++) {
@@ -1878,12 +1878,14 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
LightMap *lightmap_ptr = lightmap.ptrw();
const Cell *cells = bake_cells.ptr();
const Light *light = bake_light.ptr();
-
+#ifdef _OPENMP
+#pragma omp parallel
+#endif
for (int i = 0; i < height; i++) {
//print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
-#pragma omp parallel for
+#pragma omp parallel for schedule(dynamic, 1)
#endif
for (int j = 0; j < width; j++) {