@HeelX: As far as I know you have no access to the depth buffer under DX9. How do you intend to use your custom depth for early-z culling?