@luma.gl/webgl 9.2.3 → 9.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2676,9 +2676,19 @@ var init_webgl_texture = __esm({
2676
2676
  const { width, height, depth } = this;
2677
2677
  const { mipLevel = 0, byteOffset = 0, x = 0, y = 0, z = 0 } = options;
2678
2678
  const { glFormat, glType, compressed } = this;
2679
- const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, depth);
2679
+ const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);
2680
+ let unpackRowLength;
2681
+ if (!this.compressed) {
2682
+ const { bytesPerPixel } = this.device.getTextureFormatInfo(this.format);
2683
+ if (bytesPerPixel) {
2684
+ if (options.bytesPerRow % bytesPerPixel !== 0) {
2685
+ throw new Error(`bytesPerRow (${options.bytesPerRow}) must be a multiple of bytesPerPixel (${bytesPerPixel}) for ${this.format}`);
2686
+ }
2687
+ unpackRowLength = options.bytesPerRow / bytesPerPixel;
2688
+ }
2689
+ }
2680
2690
  const glParameters = !this.compressed ? {
2681
- [3314]: options.bytesPerRow,
2691
+ ...unpackRowLength !== void 0 ? { [3314]: unpackRowLength } : {},
2682
2692
  [32878]: options.rowsPerImage
2683
2693
  } : {};
2684
2694
  this.gl.bindTexture(glTarget, this.handle);