Not sure on the specifics, but I think if the school does not have a team for that gender, the school may have to open up the other team for both sexes. I know several years ago in a TAPPS district, there was a girl playing on the boys team (school did not have a girls buckets team) and I think she was good enough to get district honors (again, it was a 1A district --- schools with enrollments about 40 and less and a pretty weak district even among those).
And somewhere last year, I remember reading about a young man who forfeited his state high school wrestling tournament match (late in the tournament) because his opponent was a girl and he did not want to (for religious reasons) to compete against a girl ... although I know a couple girls from my youth that were excellent at getting out of wrestling holds ... in the back seat of my ... well, let's save that discussion for another day.
But I think since, TAPPS has made it clear boys sports are for boys, girls sports are for girls. UIL and public schools with federal funds and Title IX in the mix are a whole other thing.