@luma.gl/webgl 9.2.3 → 9.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/webgl",
3
- "version": "9.2.3",
3
+ "version": "9.2.4",
4
4
  "description": "WebGL2 adapter for the luma.gl core API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,9 +43,9 @@
43
43
  "@luma.gl/core": "~9.2.0"
44
44
  },
45
45
  "dependencies": {
46
- "@luma.gl/constants": "9.2.3",
46
+ "@luma.gl/constants": "9.2.4",
47
47
  "@math.gl/types": "^4.1.0",
48
48
  "@probe.gl/env": "^4.0.8"
49
49
  },
50
- "gitHead": "8bf227ad55baec4e01b16de6ad1093a13b04d605"
50
+ "gitHead": "b79327df108eb0febd307cc73b8f7196c383114e"
51
51
  }
@@ -145,12 +145,26 @@ export class WEBGLTexture extends Texture {
145
145
  const {width, height, depth} = this;
146
146
  const {mipLevel = 0, byteOffset = 0, x = 0, y = 0, z = 0} = options;
147
147
  const {glFormat, glType, compressed} = this;
148
- const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, depth);
149
148
 
150
- // WebGL automatically ignores these for compressed textures, but we are careful
149
+ // Target used for face updates, but not for binding
150
+ const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);
151
+
152
+ let unpackRowLength: number | undefined;
153
+ if (!this.compressed) {
154
+ const {bytesPerPixel} = this.device.getTextureFormatInfo(this.format);
155
+ if (bytesPerPixel) {
156
+ if (options.bytesPerRow % bytesPerPixel !== 0) {
157
+ throw new Error(
158
+ `bytesPerRow (${options.bytesPerRow}) must be a multiple of bytesPerPixel (${bytesPerPixel}) for ${this.format}`
159
+ );
160
+ }
161
+ unpackRowLength = options.bytesPerRow / bytesPerPixel;
162
+ }
163
+ }
164
+
151
165
  const glParameters: GLValueParameters = !this.compressed
152
166
  ? {
153
- [GL.UNPACK_ROW_LENGTH]: options.bytesPerRow,
167
+ ...(unpackRowLength !== undefined ? {[GL.UNPACK_ROW_LENGTH]: unpackRowLength} : {}),
154
168
  [GL.UNPACK_IMAGE_HEIGHT]: options.rowsPerImage
155
169
  }
156
170
  : {};