function loadBufferSource(texture3D, source) {
  const context = texture3D._context;
  const gl = context._gl;
  const textureTarget = texture3D._textureTarget;
  const internalFormat = texture3D._internalFormat;

  const { width, height, depth, pixelFormat, pixelDatatype, flipY } = texture3D;

  const unpackAlignment = PixelFormat.alignmentInBytes(
    pixelFormat,
    pixelDatatype,
    width,
  );
  gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);

  const { arrayBufferView } = source;
  if (flipY) {
    console.warn("texture3D.flipY is not supported.");
  }

  let levels = 1;
  if (source.mipLevels && source.mipLevels.length) {
    levels = source.mipLevels.length + 1;
  }
  gl.texStorage3D(textureTarget, levels, internalFormat, width, height, depth);

  gl.texSubImage3D(
    textureTarget,
    0,
    0,
    0,
    0,
    width,
    height,
    depth,
    pixelFormat,
    PixelDatatype.toWebGLConstant(pixelDatatype, context),
    arrayBufferView,
  );

  if (levels > 1) {
    let mipWidth = width;
    let mipHeight = height;
    let mipDepth = depth;
    for (let i = 0; i < source.mipLevels.length; ++i) {
      mipWidth = nextMipSize(mipWidth);
      mipHeight = nextMipSize(mipHeight);
      mipDepth = nextMipSize(mipDepth);
      gl.texSubImage3D(
        textureTarget,
        i + 1,
        0,
        0,
        0,
        mipWidth,
        mipHeight,
        mipDepth,
        pixelFormat,
        PixelDatatype.toWebGLConstant(pixelDatatype, context),
        source.mipLevels[i],
      );
    }
  }
}
Load texel data from a buffer into a texture3D.

@param {Texture3D} texture3D The texture3D to which texel values will be loaded.
@param {object} source The source for texel values to be loaded into the texture3D.

@private