From a402efeb72fbf46f26ec4ef02ed9a5a26c26fec7 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Sun, 17 Dec 2017 03:07:07 +0100 Subject: 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. --- scene/3d/voxel_light_baker.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scene/3d') 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 &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 &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++) { -- cgit v1.2.3