mesa: refactor GenerateTextureMipmap handling