How to calculate non linear depth?

If I do this:

half depth=tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD(i.projPos)).r;

I get depth from CameraDepthBuffer. How can I calculate this depth before rendering to CameraDepthBuffer?

I can do:

proj=ComputeScreenPos(o.pos)

To get linear depth (proj.z). And

LinearEyeDepth(depth);

To get linear eye depth from camera depth. So I think there is a way to get camera depth from linear depth, like reverse function to the one above.

How to get this depth?

Figured it out:

i.projPos.z/i.projPos.w