FleX
FleX copied to clipboard
Atomic operations on float4
Hi,
I am writing a kernel for projecting custom constraints type. I would like to solve them in a constraint centric way. However, I am not sure how to use atomic operations such a as add on structs such as float4. From the unified particles paper I know that such approach is being used in Flex.
Some code snippet would be much appreciated.
Thanks
Hi there,
We simply emulate float4 atomics by performing it on each element, i.e.: in CUDA calling atomicAdd() 4 times. D3D11 does not have atomic floating point operations so they have to be emulated using InterlockedCompareExchange().
Hope that helps.
Cheers, Miles