Commit graph

21 commits

Author SHA1 Message Date
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Juan Linietsky c1153f5041 Change the rotate function of Spatial to be local, makes more sense. Closes #14569 2017-12-26 12:45:56 -03:00
Juan Linietsky 021f3c924b -Removed OpenMP support, replaced by a custom class.
-Disabled Opus, implementation is wrong.
2017-12-24 09:32:12 -03:00
Hein-Pieter van Braam 0db5123548 Prevent false sharing in lightbaker RNG state
The previous commit corrected the RNG behavior for the lightbaker but
also made it significantly slower on high core count systems. Due to the
vector of states being physically close together in RAM we force a cache
synchronization across all cores whenever we call for the next random
number to be generated.

This will create a temporary local copy of the RNG state before entering
the loop and then saving it back to the global state when done. This
will preserve the per-thread RNG state (and random number quality) while
significantly improving performance.

On my 16 thread box it saves 3 minutes baking the Sponza scene, bringing
performance back in line to before the various RNG fixes were
introduced, being slightly faster than the first implementation.
2017-12-20 14:37:00 +01:00
Hein-Pieter van Braam ccbb5923ac Fix lightmapper rng
In our previous attempts to fix the lightmapper we may have
inadvertently introduced the same issue we were trying to fix. It
appears that rand() will on some platforms introduce a mutex making it
slower and on others may have a per-thread state that would need to be
initialized with srand() on each thread. This slows down the lightbaking
further.

This sets up a separate rng state for each OpenMP thread by calling
rand() only in the single-threaded part of the code. We then keep a
vector of states.

I believe this solves our problems.
2017-12-20 12:09:09 +01:00
Hein-Pieter van Braam 7a10d3ab78 Correct license headers in main.cpp and voxel_light_baker.cpp
Sorry for the churn
2017-12-20 01:04:30 +01:00
Hein-Pieter van Braam 9fa5a588f0 Fix lightbaker clang-format issue and add license headers 2017-12-20 01:02:03 +01:00
Hein-Pieter van Braam ff04c07912 Lightbaker: include stdlib.h to fix CI builds 2017-12-20 00:29:27 +01:00
Juan Linietsky 808a3b9c71 Fix randomness in voxel light baker, closes #14841 2017-12-19 19:51:40 -03:00
Juan Linietsky 06dd10b390 Fix raytrace lightmap bake bias 2017-12-19 17:09:05 -03:00
Juan Linietsky 5544b89750 properly plot normal when baking 2017-12-19 15:04:52 -03:00
Juan Linietsky a714e1a4c7 Fixed bug where all file dialogs requested thumbnails even if hidden. 2017-12-19 12:57:46 -03:00
Juan Linietsky e96c40f94a Added baked light support for gridmaps. 2017-12-18 00:35:20 -03:00
Rémi Verschelde 8f25a2dc11 Cleanup some #if 0'd code 2017-12-17 15:40:24 +01:00
Rémi Verschelde ad3393743c
Merge pull request #14760 from hpvb/add-several-unlikely-macros
Add several unlikely() macros
2017-12-17 14:28:15 +01:00
Rémi Verschelde 539fd14cf5
Merge pull request #14758 from hpvb/optimize-lightbaker-rng
Use a more naive RNG for the lightmapper
2017-12-17 14:27:51 +01:00
Hein-Pieter van Braam 9ba134b463 Add several unlikely() macros
Based off of perf-based prediction misses these seem to be the
lowest-hanging fruit for quick (albeit small) improvements. These are
based on:

* baking a complex lightmap
* running platformer 3d
* running goltorus
2017-12-17 13:10:30 +01:00
Hein-Pieter van Braam a402efeb72 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.
2017-12-17 03:09:38 +01:00
Hein-Pieter van Braam be4448bd1f Use a more naive RNG for the lightmapper
This speeds up the lightmapper by about 10% with no visible impact. A
comparison is up here:

https://tmm.cx/nextcloud/s/Log1eAXen1dJzBz

AMD Ryzen 7 1700 Eight-Core Processor
Sponza scene

pcg32
256/256/high   00:10:13
256/256/medium 00:02:50
256/256/low    00:01:11

xorshift
256/256/high   00:09:32
256/256/medium 00:02:34
256/256/low    00:01:05
2017-12-17 00:12:45 +01:00
Michele Valente dea5ba3991 fix for compiling the new lightmapper
also changed two calls that were ambiguous
2017-12-14 15:32:53 +01:00
Juan Linietsky f3ad14224e -Add lightmapper
-Fixes to unwrapper (remove degenerates), makes Thekla not crash
-Added optional cancel button in EditorProgress
-Added function to force processing of events (needed for cancel button)
2017-12-14 09:01:27 -03:00