Prevent false sharing in lightbaker RNG state
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.

okamstudio/godot,okamstudio/godot,Zylann/godot,MarianoGnu/godot,sanikoyes/godot,ZuBsPaCe/godot,guilhermefelipecgs/godot,Shockblast/godot,mcanders/godot,ex/godot,firefly2442/godot,NateWardawg/godot,Valentactive/godot,NateWardawg/godot,godotengine/godot,okamstudio/godot,Valentactive/godot,guilhermefelipecgs/godot,godotengine/godot,Valentactive/godot,guilhermefelipecgs/godot,ex/godot,Shockblast/godot,godotengine/godot,okamstudio/godot,okamstudio/godot,Zylann/godot,Faless/godot,firefly2442/godot,groud/godot,BastiaanOlij/godot,ZuBsPaCe/godot,BastiaanOlij/godot,mcanders/godot,Shockblast/godot,godotengine/godot,ex/godot,Zylann/godot,Shockblast/godot,Paulloz/godot,firefly2442/godot,firefly2442/godot,MarianoGnu/godot,MarianoGnu/godot,akien-mga/godot,godotengine/godot,Faless/godot,okamstudio/godot,vnen/godot,Shockblast/godot,Paulloz/godot,sanikoyes/godot,akien-mga/godot,pkowal1982/godot,ex/godot,groud/godot,firefly2442/godot,BastiaanOlij/godot,vkbsb/godot,Shockblast/godot,josempans/godot,josempans/godot,BastiaanOlij/godot,RandomShaper/godot,mcanders/godot,akien-mga/godot,Faless/godot,Zylann/godot,pkowal1982/godot,Shockblast/godot,ZuBsPaCe/godot,NateWardawg/godot,josempans/godot,DmitriySalnikov/godot,NateWardawg/godot,Shockblast/godot,akien-mga/godot,MarianoGnu/godot,pkowal1982/godot,Faless/godot,vnen/godot,vnen/godot,godotengine/godot,Valentactive/godot,BastiaanOlij/godot,firefly2442/godot,sanikoyes/godot,vnen/godot,NateWardawg/godot,vkbsb/godot,Valentactive/godot,guilhermefelipecgs/godot,Paulloz/godot,Valentactive/godot,vnen/godot,Valentactive/godot,mcanders/godot,Paulloz/godot,okamstudio/godot,vkbsb/godot,guilhermefelipecgs/godot,josempans/godot,pkowal1982/godot,akien-mga/godot,NateWardawg/godot,josempans/godot,akien-mga/godot,RandomShaper/godot,MarianoGnu/godot,groud/godot,sanikoyes/godot,DmitriySalnikov/godot,RandomShaper/godot,okamstudio/godot,DmitriySalnikov/godot,vkbsb/godot,DmitriySalnikov/godot,vkbsb/godot,akien-mga/godot,groud/godot,okamstudio/godot,MarianoGnu/godot,honix/godot,vkbsb/godot,Valentactive/godot,MarianoGnu/godot,Faless/godot,ZuBsPaCe/godot,groud/godot,Faless/godot,guilhermefelipecgs/godot,vnen/godot,RandomShaper/godot,ZuBsPaCe/godot,firefly2442/godot,sanikoyes/godot,DmitriySalnikov/godot,DmitriySalnikov/godot,pkowal1982/godot,josempans/godot,Zylann/godot,Paulloz/godot,ZuBsPaCe/godot,ZuBsPaCe/godot,vnen/godot,vnen/godot,josempans/godot,ex/godot,vkbsb/godot,guilhermefelipecgs/godot,RandomShaper/godot,sanikoyes/godot,okamstudio/godot,vkbsb/godot,ex/godot,pkowal1982/godot,Zylann/godot,mcanders/godot,RandomShaper/godot,BastiaanOlij/godot,pkowal1982/godot,honix/godot,groud/godot,honix/godot,sanikoyes/godot,NateWardawg/godot,NateWardawg/godot,BastiaanOlij/godot,pkowal1982/godot,DmitriySalnikov/godot,Paulloz/godot,mcanders/godot,godotengine/godot,ex/godot,honix/godot,akien-mga/godot,ZuBsPaCe/godot,NateWardawg/godot,Faless/godot,godotengine/godot,honix/godot,honix/godot,firefly2442/godot,ex/godot,Zylann/godot,sanikoyes/godot,BastiaanOlij/godot,Paulloz/godot,Faless/godot,Zylann/godot,josempans/godot,RandomShaper/godot,MarianoGnu/godot,guilhermefelipecgs/godot