[g3dvl] move code around for more optimal shader generation