It is possible to create valid projection matrices where the far plane is at infinity, in which case the ray direction will be NaN. We can avoid this by shifting the far plane closer in NDC space.
Thanks for that pointer. This, together with hardcoding gContext.mReversed = true in ComputeContext() made it work for me. I'm also using projection matrix with reverse-z and infinite far.
It is possible to create valid projection matrices where the far plane is at infinity, in which case the ray direction will be NaN. We can avoid this by shifting the far plane closer in NDC space.