emit_depthbuffer refactor (partial)