Most (maybe all?) species that reproduce sexually have either genders (anisogamy) or mating types (isogamy). There exist today many different type of sexual determination system. There is a whole complicated continuum from species where the gender is exclusively determined genetically (genetic determination system, GSD) to those where the gender is determined by the environment (environment determination system, ESD).
Knowing that genders (and mating types) evolved several independently, what seem to be the ancestral states of sex determination system? Where the first sexually reproducing lineages GSD or ESD? Does it differ between lineages?