Evolution from Mating types to different sexes
Another important reason to have mating types is to prevent self-fertilization or self-polination that produces less capable offspring. Because of this requirement, mating types may evolve also for species that produce both types of gametes, or does not differentiate them into male and female gametes. Fertilization is only possible if gametes have different mating types.

It may be more than two mating types, but if there are only two, they are probably similar to "sexes" even if gametes do not look different.