mesa: restructure error checking in _mesa_FramebufferTexture1D/2DEXT()