WIP: Use recent implemented z_depth_visibility when optimizing layers