Add g_main_depth. (#136221, Cedric Gustin)