diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-12-20 14:30:50 +0100 |
---|---|---|
committer | Hein-Pieter van Braam <hp@tmm.cx> | 2017-12-20 14:37:00 +0100 |
commit | 0db512354807318646ac9884f3702733a56b3bb1 (patch) | |
tree | cb629fc1a4f45d73e8509f456295f8719448e078 /editor | |
parent | 0ead6b3cf5ac9d1b10ef107383d0c6e2b15ad863 (diff) |
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.
Diffstat (limited to 'editor')
0 files changed, 0 insertions, 0 deletions