function createTexture(textureManager, loadedImage, context) {
  const { id, textureUniform, image } = loadedImage;

  // If the context is WebGL1, and the sampler needs mipmaps or repeating
  // boundary conditions, the image may need to be resized first
  const texture = context.webgl2
    ? getTextureAndMips(textureUniform, image, context)
    : getWebGL1Texture(textureUniform, image, context);

  // Destroy the old texture once the new one is loaded for more seamless
  // transitions between values
  const oldTexture = textureManager._textures[id];
  if (defined(oldTexture) && oldTexture !== context.defaultTexture) {
    oldTexture.destroy();
  }
  textureManager._textures[id] = texture;
}
Load a texture 2D asynchronously. Note that {@link TextureManager#update}
must be called in the render loop to finish processing the textures.

@param {string} textureId A unique ID to identify this texture.
@param {TextureUniform} textureUniform A description of the texture

@private