Arbitrary depth write (SV_Depth) might be fine in any case as long as you're aware of the potential performance impact
Arbitrary depth write (SV_Depth) might be fine in any case as long as you're aware of the potential performance impact
Yes, as long as you can ensure fragments are writing depth as being further away from the camera and never closer. It should be a viable approach.
You can mitigate some of the impact by using SV_DepthGreaterEqual (hlsl system semantic) where the fragment shader will write a depth value greater or equal, which allows the early depth testing to still occur, but restricts the the valid depth values you can write
You can, but you should be careful about doing so, as it will disable some hardware optimizations like early z testing (testing that gets run before the fragment shader is dispatched). So it will have a performance impact.
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