be aware, if you are targetting cross platform and not just directx/hlsl then some shader compilers may act counterintuitively with NaN/Inf. Specifically, in Metal with fastmath enabled the shader compiler can treat NaN or INF as undefined behaviour. It may delete whole chunks of code