Atomic float+
No hardware I know of has atomic floating point operations but here's a handy little code snippet from Matt Pharr over on the PBRT mailing list which emulates the same functionality using an atomic compare and swap:
inline float AtomicAdd(volatile float *val, float delta) {
union bits { float f; int32_t i; };
bits oldVal, newVal;
do {
oldVal.f = *val;
newVal.f = oldVal.f + delta;
} while (AtomicCompareAndSwap(*((AtomicInt32 *)val),
newVal.i, oldVal.i) != oldVal.i);
return newVal.f;
}
In unrelated news, I've taken a job at LucasArts which I'll be starting soon, sad to say goodbye to Rocksteady they're a great company to work for and I'll miss the team there.
Looking forward to San Francisco though, 12 hours closer to my home town (Auckland, New Zealand) and maybe now I can finally get along to Siggraph or GDC. If anyone has some advice on where to live there please let me know!
Also a few weeks in between jobs so hopefully time to write some code and finish off all the tourist activities we never got around to in London.