mesa: Refactor error checking for GL_TEXTURE_BASE_LEVEL vs texture targets