You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
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.
This commit is contained in:
@@ -1781,7 +1781,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
|
|||||||
|
|
||||||
//print_line("bake line " + itos(i) + " / " + itos(height));
|
//print_line("bake line " + itos(i) + " / " + itos(height));
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel for
|
#pragma omp parallel for schedule(dynamic, 1)
|
||||||
#endif
|
#endif
|
||||||
for (int j = 0; j < width; j++) {
|
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();
|
LightMap *lightmap_ptr = lightmap.ptrw();
|
||||||
const Cell *cells = bake_cells.ptr();
|
const Cell *cells = bake_cells.ptr();
|
||||||
const Light *light = bake_light.ptr();
|
const Light *light = bake_light.ptr();
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel
|
||||||
|
#endif
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
|
|
||||||
//print_line("bake line " + itos(i) + " / " + itos(height));
|
//print_line("bake line " + itos(i) + " / " + itos(height));
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel for
|
#pragma omp parallel for schedule(dynamic, 1)
|
||||||
#endif
|
#endif
|
||||||
for (int j = 0; j < width; j++) {
|
for (int j = 0; j < width; j++) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user