mesa: fix error handling for glTexEnv