convert2DRowFragmentedGLTextureToColStack() {
    if (!this.glTextureFragments || !this.glTextureFragmentShape) {
      throw new Error('[Tensor] no glTextureFragments available.')
    }

    const gl = webgl2.context
    const textureOptions = webgl2.getWebGLTextureOptions(this.glTextureType, this.glTextureFormat)
    const { textureTarget, textureInternalFormat, textureFormat, textureType } = textureOptions

    if (!this.glTextureFragmentsAsColStack) {
      this.glTextureFragmentsAsColStack = gl.createTexture()
      webgl2.storeRef('texture', this.glTextureFragmentsAsColStack)
      gl.bindTexture(textureTarget, this.glTextureFragmentsAsColStack)

      const numFragments = this.glTextureFragments.length
      this.glTextureFragmentsAsColStackShape = [
        this.glTextureFragmentShape[0],
        this.glTextureFragmentShape[1] * numFragments
      ]

      const shape = this.glTextureFragmentsAsColStackShape
      const data = new this.arrayType(shape.reduce((a, b) => a * b, 1))
      gl.texImage2D(textureTarget, 0, textureInternalFormat, shape[1], shape[0], 0, textureFormat, textureType, data)

      // clamp to edge
      gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
      gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
      // no interpolation
      gl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
      gl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
    } else {
      gl.bindTexture(textureTarget, this.glTextureFragmentsAsColStack)
    }

    const fbo = gl.createFramebuffer()
    gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo)
    this.glTextureFragments.forEach((texture, k) => {
      gl.framebufferTexture2D(gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0)
      gl.copyTexSubImage2D(
        textureTarget,
        0,
        k * this.glTextureFragmentShape[1],
        0,
        0,
        0,
        this.glTextureFragmentShape[1],
        this.glTextureFragmentShape[0]
      )
    })
    gl.deleteFramebuffer(fbo)
  }
Converts an array of row-fragmented glTextureFragments into a single column-stacked texture