@luma.gl/webgl 9.1.0-alpha.10 → 9.1.0-alpha.13

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.
Files changed (63) hide show
  1. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
  2. package/dist/adapter/device-helpers/webgl-device-features.js +1 -2
  3. package/dist/adapter/helpers/format-utils.d.ts.map +1 -0
  4. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  5. package/dist/adapter/helpers/get-shader-layout.js +1 -3
  6. package/dist/adapter/helpers/typed-array-utils.d.ts.map +1 -0
  7. package/dist/adapter/helpers/webgl-texture-utils.d.ts +85 -18
  8. package/dist/adapter/helpers/webgl-texture-utils.d.ts.map +1 -1
  9. package/dist/adapter/helpers/webgl-texture-utils.js +210 -18
  10. package/dist/adapter/resources/webgl-framebuffer.d.ts +1 -2
  11. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  12. package/dist/adapter/resources/webgl-framebuffer.js +27 -31
  13. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  14. package/dist/adapter/resources/webgl-render-pipeline.d.ts +1 -3
  15. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  16. package/dist/adapter/resources/webgl-texture.d.ts +1 -1
  17. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  18. package/dist/adapter/resources/webgl-texture.js +33 -8
  19. package/dist/adapter/webgl-device.d.ts +1 -2
  20. package/dist/adapter/webgl-device.d.ts.map +1 -1
  21. package/dist/adapter/webgl-device.js +2 -2
  22. package/dist/deprecated/accessor.d.ts.map +1 -0
  23. package/dist/{classic → deprecated}/accessor.js +36 -1
  24. package/dist/deprecated/clear.d.ts.map +1 -0
  25. package/dist/{classic → deprecated}/clear.js +2 -0
  26. package/dist/dist.dev.js +514 -457
  27. package/dist/dist.min.js +2 -2
  28. package/dist/index.cjs +509 -459
  29. package/dist/index.cjs.map +4 -4
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -1
  33. package/dist/utils/fill-array.d.ts +4 -4
  34. package/dist/utils/fill-array.d.ts.map +1 -1
  35. package/package.json +5 -5
  36. package/src/adapter/device-helpers/webgl-device-features.ts +5 -2
  37. package/src/adapter/helpers/get-shader-layout.ts +1 -3
  38. package/src/adapter/helpers/webgl-texture-utils.ts +356 -37
  39. package/src/adapter/resources/webgl-framebuffer.ts +37 -42
  40. package/src/adapter/resources/webgl-render-pass.ts +3 -3
  41. package/src/adapter/resources/webgl-render-pipeline.ts +10 -3
  42. package/src/adapter/resources/webgl-texture.ts +41 -8
  43. package/src/adapter/webgl-device.ts +13 -4
  44. package/src/{classic → deprecated}/accessor.ts +44 -3
  45. package/src/{classic → deprecated}/clear.ts +3 -1
  46. package/src/index.ts +1 -1
  47. package/src/utils/fill-array.ts +4 -4
  48. package/dist/classic/accessor.d.ts.map +0 -1
  49. package/dist/classic/clear.d.ts.map +0 -1
  50. package/dist/classic/copy-and-blit.d.ts +0 -64
  51. package/dist/classic/copy-and-blit.d.ts.map +0 -1
  52. package/dist/classic/copy-and-blit.js +0 -194
  53. package/dist/classic/format-utils.d.ts.map +0 -1
  54. package/dist/classic/typed-array-utils.d.ts.map +0 -1
  55. package/src/classic/copy-and-blit.ts +0 -323
  56. /package/dist/{classic → adapter/helpers}/format-utils.d.ts +0 -0
  57. /package/dist/{classic → adapter/helpers}/format-utils.js +0 -0
  58. /package/dist/{classic → adapter/helpers}/typed-array-utils.d.ts +0 -0
  59. /package/dist/{classic → adapter/helpers}/typed-array-utils.js +0 -0
  60. /package/dist/{classic → deprecated}/accessor.d.ts +0 -0
  61. /package/dist/{classic → deprecated}/clear.d.ts +0 -0
  62. /package/src/{classic → adapter/helpers}/format-utils.ts +0 -0
  63. /package/src/{classic → adapter/helpers}/typed-array-utils.ts +0 -0
package/dist/index.cjs CHANGED
@@ -46,10 +46,10 @@ __export(dist_exports, {
46
46
  module.exports = __toCommonJS(dist_exports);
47
47
 
48
48
  // dist/adapter/webgl-adapter.js
49
- var import_core23 = require("@luma.gl/core");
49
+ var import_core24 = require("@luma.gl/core");
50
50
 
51
51
  // dist/adapter/webgl-device.js
52
- var import_core22 = require("@luma.gl/core");
52
+ var import_core23 = require("@luma.gl/core");
53
53
 
54
54
  // dist/context/parameters/webgl-parameter-tables.js
55
55
  var import_constants = require("@luma.gl/constants");
@@ -1406,15 +1406,15 @@ var WebGLDeviceLimits = class extends import_core3.DeviceLimits {
1406
1406
  };
1407
1407
 
1408
1408
  // dist/adapter/webgl-canvas-context.js
1409
- var import_core9 = require("@luma.gl/core");
1409
+ var import_core10 = require("@luma.gl/core");
1410
1410
 
1411
1411
  // dist/adapter/resources/webgl-framebuffer.js
1412
- var import_core8 = require("@luma.gl/core");
1413
- var import_constants11 = require("@luma.gl/constants");
1412
+ var import_core9 = require("@luma.gl/core");
1413
+ var import_constants13 = require("@luma.gl/constants");
1414
1414
 
1415
1415
  // dist/adapter/resources/webgl-texture.js
1416
- var import_core7 = require("@luma.gl/core");
1417
- var import_constants10 = require("@luma.gl/constants");
1416
+ var import_core8 = require("@luma.gl/core");
1417
+ var import_constants12 = require("@luma.gl/constants");
1418
1418
 
1419
1419
  // dist/context/state-tracker/with-parameters.js
1420
1420
  function withGLParameters(gl, parameters, func) {
@@ -1810,7 +1810,97 @@ var WEBGLTextureView = class extends import_core6.TextureView {
1810
1810
  };
1811
1811
 
1812
1812
  // dist/adapter/helpers/webgl-texture-utils.js
1813
+ var import_core7 = require("@luma.gl/core");
1814
+ var import_constants11 = require("@luma.gl/constants");
1815
+
1816
+ // dist/adapter/helpers/typed-array-utils.js
1813
1817
  var import_constants9 = require("@luma.gl/constants");
1818
+ var ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
1819
+ function getGLTypeFromTypedArray(arrayOrType) {
1820
+ const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
1821
+ switch (type) {
1822
+ case Float32Array:
1823
+ return 5126;
1824
+ case Uint16Array:
1825
+ return 5123;
1826
+ case Uint32Array:
1827
+ return 5125;
1828
+ case Uint8Array:
1829
+ return 5121;
1830
+ case Uint8ClampedArray:
1831
+ return 5121;
1832
+ case Int8Array:
1833
+ return 5120;
1834
+ case Int16Array:
1835
+ return 5122;
1836
+ case Int32Array:
1837
+ return 5124;
1838
+ default:
1839
+ throw new Error(ERR_TYPE_DEDUCTION);
1840
+ }
1841
+ }
1842
+ function getTypedArrayFromGLType(glType, options) {
1843
+ const { clamped = true } = options || {};
1844
+ switch (glType) {
1845
+ case 5126:
1846
+ return Float32Array;
1847
+ case 5123:
1848
+ case 33635:
1849
+ case 32819:
1850
+ case 32820:
1851
+ return Uint16Array;
1852
+ case 5125:
1853
+ return Uint32Array;
1854
+ case 5121:
1855
+ return clamped ? Uint8ClampedArray : Uint8Array;
1856
+ case 5120:
1857
+ return Int8Array;
1858
+ case 5122:
1859
+ return Int16Array;
1860
+ case 5124:
1861
+ return Int32Array;
1862
+ default:
1863
+ throw new Error("Failed to deduce typed array type from GL constant");
1864
+ }
1865
+ }
1866
+
1867
+ // dist/adapter/helpers/format-utils.js
1868
+ var import_constants10 = require("@luma.gl/constants");
1869
+ function glFormatToComponents(format) {
1870
+ switch (format) {
1871
+ case 6406:
1872
+ case 33326:
1873
+ case 6403:
1874
+ return 1;
1875
+ case 33328:
1876
+ case 33319:
1877
+ return 2;
1878
+ case 6407:
1879
+ case 34837:
1880
+ return 3;
1881
+ case 6408:
1882
+ case 34836:
1883
+ return 4;
1884
+ default:
1885
+ return 0;
1886
+ }
1887
+ }
1888
+ function glTypeToBytes(type) {
1889
+ switch (type) {
1890
+ case 5121:
1891
+ return 1;
1892
+ case 33635:
1893
+ case 32819:
1894
+ case 32820:
1895
+ return 2;
1896
+ case 5126:
1897
+ return 4;
1898
+ default:
1899
+ return 0;
1900
+ }
1901
+ }
1902
+
1903
+ // dist/adapter/helpers/webgl-texture-utils.js
1814
1904
  function initializeTextureStorage(gl, levels, options) {
1815
1905
  const { dimension, width, height, depth = 0 } = options;
1816
1906
  const { glInternalFormat } = options;
@@ -1824,26 +1914,31 @@ function initializeTextureStorage(gl, levels, options) {
1824
1914
  gl.texStorage2D(glTarget, levels, glInternalFormat, width, height);
1825
1915
  }
1826
1916
  }
1827
- function copyCPUImageToMipLevel(gl, image, options) {
1828
- const { dimension, width, height, depth = 0, level = 0 } = options;
1917
+ function copyExternalImageToMipLevel(gl, handle, image, options) {
1918
+ const { width, height } = options;
1919
+ const { dimension, depth = 0, mipLevel = 0 } = options;
1829
1920
  const { x = 0, y = 0, z = 0 } = options;
1830
1921
  const { glFormat, glType } = options;
1831
1922
  const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
1832
1923
  switch (dimension) {
1833
1924
  case "2d-array":
1834
1925
  case "3d":
1835
- gl.texSubImage3D(glTarget, level, x, y, z, width, height, depth, glFormat, glType, image);
1926
+ gl.bindTexture(glTarget, handle);
1927
+ gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, glType, image);
1928
+ gl.bindTexture(glTarget, null);
1836
1929
  break;
1837
1930
  case "2d":
1838
1931
  case "cube":
1839
- gl.texSubImage2D(glTarget, level, x, y, width, height, glFormat, glType, image);
1932
+ gl.bindTexture(glTarget, handle);
1933
+ gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, glType, image);
1934
+ gl.bindTexture(glTarget, null);
1840
1935
  break;
1841
1936
  default:
1842
1937
  throw new Error(dimension);
1843
1938
  }
1844
1939
  }
1845
1940
  function copyCPUDataToMipLevel(gl, typedArray, options) {
1846
- const { dimension, width, height, depth = 0, level = 0, byteOffset = 0 } = options;
1941
+ const { dimension, width, height, depth = 0, mipLevel = 0, byteOffset = 0 } = options;
1847
1942
  const { x = 0, y = 0, z = 0 } = options;
1848
1943
  const { glFormat, glType, compressed } = options;
1849
1944
  const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
@@ -1851,17 +1946,17 @@ function copyCPUDataToMipLevel(gl, typedArray, options) {
1851
1946
  case "2d-array":
1852
1947
  case "3d":
1853
1948
  if (compressed) {
1854
- gl.compressedTexSubImage3D(glTarget, level, x, y, z, width, height, depth, glFormat, typedArray, byteOffset);
1949
+ gl.compressedTexSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, typedArray, byteOffset);
1855
1950
  } else {
1856
- gl.texSubImage3D(glTarget, level, x, y, z, width, height, depth, glFormat, glType, typedArray, byteOffset);
1951
+ gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, glType, typedArray, byteOffset);
1857
1952
  }
1858
1953
  break;
1859
1954
  case "2d":
1860
1955
  case "cube":
1861
1956
  if (compressed) {
1862
- gl.compressedTexSubImage2D(glTarget, level, x, y, width, height, glFormat, typedArray, byteOffset);
1957
+ gl.compressedTexSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, typedArray, byteOffset);
1863
1958
  } else {
1864
- gl.texSubImage2D(glTarget, level, x, y, width, height, glFormat, glType, typedArray, byteOffset);
1959
+ gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, glType, typedArray, byteOffset);
1865
1960
  }
1866
1961
  break;
1867
1962
  default:
@@ -1888,6 +1983,97 @@ function getWebGLTextureTarget(dimension) {
1888
1983
  function getWebGLCubeFaceTarget(glTarget, dimension, level) {
1889
1984
  return dimension === "cube" ? 34069 + level : glTarget;
1890
1985
  }
1986
+ function readPixelsToArray(source, options) {
1987
+ var _a, _b, _c, _d, _e, _f;
1988
+ const {
1989
+ sourceX = 0,
1990
+ sourceY = 0,
1991
+ sourceAttachment = 36064
1992
+ // TODO - support gl.readBuffer
1993
+ } = options || {};
1994
+ let {
1995
+ target = null,
1996
+ // following parameters are auto deduced if not provided
1997
+ sourceWidth,
1998
+ sourceHeight,
1999
+ sourceDepth,
2000
+ sourceFormat,
2001
+ sourceType
2002
+ } = options || {};
2003
+ const { framebuffer, deleteFramebuffer } = getFramebuffer(source);
2004
+ const { gl, handle } = framebuffer;
2005
+ const attachment = sourceAttachment - 36064;
2006
+ sourceWidth ||= framebuffer.width;
2007
+ sourceHeight ||= framebuffer.height;
2008
+ sourceDepth = ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.depth) || 1;
2009
+ sourceFormat ||= ((_d = (_c = framebuffer.colorAttachments[attachment]) == null ? void 0 : _c.texture) == null ? void 0 : _d.glFormat) || 6408;
2010
+ sourceType ||= ((_f = (_e = framebuffer.colorAttachments[attachment]) == null ? void 0 : _e.texture) == null ? void 0 : _f.glType) || 5121;
2011
+ target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight, sourceDepth);
2012
+ sourceType = sourceType || getGLTypeFromTypedArray(target);
2013
+ const prevHandle = gl.bindFramebuffer(36160, handle);
2014
+ gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
2015
+ gl.bindFramebuffer(36160, prevHandle || null);
2016
+ if (deleteFramebuffer) {
2017
+ framebuffer.destroy();
2018
+ }
2019
+ return target;
2020
+ }
2021
+ function readPixelsToBuffer(source, options) {
2022
+ const { target, sourceX = 0, sourceY = 0, sourceFormat = 6408, targetByteOffset = 0 } = options || {};
2023
+ let { sourceWidth, sourceHeight, sourceType } = options || {};
2024
+ const { framebuffer, deleteFramebuffer } = getFramebuffer(source);
2025
+ sourceWidth = sourceWidth || framebuffer.width;
2026
+ sourceHeight = sourceHeight || framebuffer.height;
2027
+ const webglFramebuffer = framebuffer;
2028
+ sourceType = sourceType || 5121;
2029
+ let webglBufferTarget = target;
2030
+ if (!webglBufferTarget) {
2031
+ const components = glFormatToComponents(sourceFormat);
2032
+ const byteCount = glTypeToBytes(sourceType);
2033
+ const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;
2034
+ webglBufferTarget = webglFramebuffer.device.createBuffer({ byteLength });
2035
+ }
2036
+ const commandEncoder = source.device.createCommandEncoder();
2037
+ commandEncoder.copyTextureToBuffer({
2038
+ source,
2039
+ width: sourceWidth,
2040
+ height: sourceHeight,
2041
+ origin: [sourceX, sourceY],
2042
+ destination: webglBufferTarget,
2043
+ byteOffset: targetByteOffset
2044
+ });
2045
+ commandEncoder.destroy();
2046
+ if (deleteFramebuffer) {
2047
+ framebuffer.destroy();
2048
+ }
2049
+ return webglBufferTarget;
2050
+ }
2051
+ function getFramebuffer(source) {
2052
+ if (!(source instanceof import_core7.Framebuffer)) {
2053
+ return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
2054
+ }
2055
+ return { framebuffer: source, deleteFramebuffer: false };
2056
+ }
2057
+ function toFramebuffer(texture, props) {
2058
+ const { device, width, height, id } = texture;
2059
+ const framebuffer = device.createFramebuffer({
2060
+ ...props,
2061
+ id: `framebuffer-for-${id}`,
2062
+ width,
2063
+ height,
2064
+ colorAttachments: [texture]
2065
+ });
2066
+ return framebuffer;
2067
+ }
2068
+ function getPixelArray(pixelArray, type, format, width, height, depth) {
2069
+ if (pixelArray) {
2070
+ return pixelArray;
2071
+ }
2072
+ type = type || 5121;
2073
+ const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
2074
+ const components = glFormatToComponents(format);
2075
+ return new ArrayType(width * height * components);
2076
+ }
1891
2077
 
1892
2078
  // dist/adapter/resources/webgl-texture.js
1893
2079
  function normalizeTextureData(data, options) {
@@ -1909,7 +2095,7 @@ function normalizeTextureData(data, options) {
1909
2095
  }
1910
2096
  return lodArray;
1911
2097
  }
1912
- var WEBGLTexture = class extends import_core7.Texture {
2098
+ var WEBGLTexture = class extends import_core8.Texture {
1913
2099
  MAX_ATTRIBUTES;
1914
2100
  device;
1915
2101
  gl;
@@ -1950,7 +2136,7 @@ var WEBGLTexture = class extends import_core7.Texture {
1950
2136
  /** For automatically updating video */
1951
2137
  _video = null;
1952
2138
  constructor(device, props) {
1953
- super(device, { ...import_core7.Texture.defaultProps, ...props, data: void 0 });
2139
+ super(device, { ...import_core8.Texture.defaultProps, ...props, data: void 0 });
1954
2140
  this.device = device;
1955
2141
  this.gl = this.device.gl;
1956
2142
  this.glTarget = getWebGLTextureTarget(this.props.dimension);
@@ -1978,7 +2164,7 @@ var WEBGLTexture = class extends import_core7.Texture {
1978
2164
  const data = props.data;
1979
2165
  let { width, height } = props;
1980
2166
  if (!width || !height) {
1981
- const textureSize = import_core7.Texture.getTextureDataSize(data);
2167
+ const textureSize = import_core8.Texture.getTextureDataSize(data);
1982
2168
  width = (textureSize == null ? void 0 : textureSize.width) || 1;
1983
2169
  height = (textureSize == null ? void 0 : textureSize.height) || 1;
1984
2170
  }
@@ -2071,7 +2257,7 @@ var WEBGLTexture = class extends import_core7.Texture {
2071
2257
  }
2072
2258
  /** Update external texture (video frame or canvas) */
2073
2259
  update() {
2074
- import_core7.log.warn("Texture.update() not implemented");
2260
+ import_core8.log.warn("Texture.update() not implemented");
2075
2261
  }
2076
2262
  // Call to regenerate mipmaps after modifying texture(s)
2077
2263
  generateMipmap(params = {}) {
@@ -2087,12 +2273,30 @@ var WEBGLTexture = class extends import_core7.Texture {
2087
2273
  }
2088
2274
  // Image Data Setters
2089
2275
  copyExternalImage(options) {
2090
- const size = import_core7.Texture.getExternalImageSize(options.image);
2091
- const opts = { ...import_core7.Texture.defaultCopyExternalImageOptions, ...size, ...options };
2092
- const { depth, mipLevel: lodLevel, image } = opts;
2093
- this.bind();
2094
- this._setMipLevel(depth, lodLevel, image);
2095
- this.unbind();
2276
+ const size = import_core8.Texture.getExternalImageSize(options.image);
2277
+ const opts = { ...import_core8.Texture.defaultCopyExternalImageOptions, ...size, ...options };
2278
+ const { image, depth, mipLevel, x, y, z } = opts;
2279
+ let { width, height } = opts;
2280
+ const { dimension, glTarget, glFormat, glInternalFormat, glType } = this;
2281
+ width = Math.min(width, size.width - x);
2282
+ height = Math.min(height, size.height - y);
2283
+ if (options.sourceX || options.sourceY) {
2284
+ throw new Error("WebGL does not yet support sourceX/sourceY in copyExternalImage; requires copyTexSubImage2D from a framebuffer");
2285
+ }
2286
+ copyExternalImageToMipLevel(this.device.gl, this.handle, image, {
2287
+ dimension,
2288
+ mipLevel,
2289
+ x,
2290
+ y,
2291
+ z,
2292
+ width,
2293
+ height,
2294
+ depth,
2295
+ glFormat,
2296
+ glInternalFormat,
2297
+ glType,
2298
+ glTarget
2299
+ });
2096
2300
  return { width: opts.width, height: opts.height };
2097
2301
  }
2098
2302
  setTexture1DData(data) {
@@ -2103,7 +2307,7 @@ var WEBGLTexture = class extends import_core7.Texture {
2103
2307
  this.bind();
2104
2308
  const lodArray = normalizeTextureData(lodData, this);
2105
2309
  if (lodArray.length > 1 && this.props.mipmaps !== false) {
2106
- import_core7.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
2310
+ import_core8.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
2107
2311
  }
2108
2312
  for (let lodLevel = 0; lodLevel < lodArray.length; lodLevel++) {
2109
2313
  const imageData = lodArray[lodLevel];
@@ -2135,7 +2339,7 @@ var WEBGLTexture = class extends import_core7.Texture {
2135
2339
  if (this.props.dimension !== "cube") {
2136
2340
  throw new Error(this.id);
2137
2341
  }
2138
- for (const face of import_core7.Texture.CubeFaces) {
2342
+ for (const face of import_core8.Texture.CubeFaces) {
2139
2343
  this.setTextureCubeFaceData(data[face], face);
2140
2344
  }
2141
2345
  }
@@ -2158,9 +2362,9 @@ var WEBGLTexture = class extends import_core7.Texture {
2158
2362
  }
2159
2363
  setTextureCubeFaceData(lodData, face, depth = 0) {
2160
2364
  if (Array.isArray(lodData) && lodData.length > 1 && this.props.mipmaps !== false) {
2161
- import_core7.log.warn(`${this.id} has mipmap and multiple LODs.`)();
2365
+ import_core8.log.warn(`${this.id} has mipmap and multiple LODs.`)();
2162
2366
  }
2163
- const faceDepth = import_core7.Texture.CubeFaces.indexOf(face);
2367
+ const faceDepth = import_core8.Texture.CubeFaces.indexOf(face);
2164
2368
  this.setTexture2DData(lodData, faceDepth);
2165
2369
  }
2166
2370
  // INTERNAL METHODS
@@ -2192,8 +2396,8 @@ var WEBGLTexture = class extends import_core7.Texture {
2192
2396
  }
2193
2397
  }
2194
2398
  _getImageDataMap(faceData) {
2195
- for (let i = 0; i < import_core7.Texture.CubeFaces.length; ++i) {
2196
- const faceName = import_core7.Texture.CubeFaces[i];
2399
+ for (let i = 0; i < import_core8.Texture.CubeFaces.length; ++i) {
2400
+ const faceName = import_core8.Texture.CubeFaces[i];
2197
2401
  if (faceData[faceName]) {
2198
2402
  faceData[34069 + i] = faceData[faceName];
2199
2403
  delete faceData[faceName];
@@ -2206,7 +2410,7 @@ var WEBGLTexture = class extends import_core7.Texture {
2206
2410
  * Sets sampler parameters on texture
2207
2411
  */
2208
2412
  _setSamplerParameters(parameters) {
2209
- import_core7.log.log(1, "texture sampler parameters", parameters)();
2413
+ import_core8.log.log(1, "texture sampler parameters", parameters)();
2210
2414
  this.gl.bindTexture(this.glTarget, this.handle);
2211
2415
  for (const [pname, pvalue] of Object.entries(parameters)) {
2212
2416
  const param = Number(pname);
@@ -2295,16 +2499,21 @@ var WEBGLTexture = class extends import_core7.Texture {
2295
2499
  * Copy a region of data from a CPU memory buffer into this texture.
2296
2500
  * @todo - GLUnpackParameters parameters
2297
2501
  */
2298
- _setMipLevel(depth, level, textureData, glTarget = this.glTarget) {
2299
- if (import_core7.Texture.isExternalImage(textureData)) {
2300
- copyCPUImageToMipLevel(this.device.gl, textureData, { ...this, depth, level, glTarget });
2502
+ _setMipLevel(depth, mipLevel, textureData, glTarget = this.glTarget) {
2503
+ if (import_core8.Texture.isExternalImage(textureData)) {
2504
+ copyExternalImageToMipLevel(this.device.gl, this.handle, textureData, {
2505
+ ...this,
2506
+ depth,
2507
+ mipLevel,
2508
+ glTarget
2509
+ });
2301
2510
  return;
2302
2511
  }
2303
- if (import_core7.Texture.isTextureLevelData(textureData)) {
2512
+ if (import_core8.Texture.isTextureLevelData(textureData)) {
2304
2513
  copyCPUDataToMipLevel(this.device.gl, textureData.data, {
2305
2514
  ...this,
2306
2515
  depth,
2307
- level,
2516
+ mipLevel,
2308
2517
  glTarget
2309
2518
  });
2310
2519
  return;
@@ -2336,7 +2545,7 @@ var WEBGLTexture = class extends import_core7.Texture {
2336
2545
  };
2337
2546
 
2338
2547
  // dist/adapter/resources/webgl-framebuffer.js
2339
- var WEBGLFramebuffer = class extends import_core8.Framebuffer {
2548
+ var WEBGLFramebuffer = class extends import_core9.Framebuffer {
2340
2549
  device;
2341
2550
  gl;
2342
2551
  handle;
@@ -2351,24 +2560,7 @@ var WEBGLFramebuffer = class extends import_core8.Framebuffer {
2351
2560
  if (!isDefaultFramebuffer) {
2352
2561
  device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
2353
2562
  this.autoCreateAttachmentTextures();
2354
- const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
2355
- for (let i = 0; i < this.colorAttachments.length; ++i) {
2356
- const attachment = this.colorAttachments[i];
2357
- const attachmentPoint = 36064 + i;
2358
- if (attachment) {
2359
- this._attachTexture(attachmentPoint, attachment);
2360
- }
2361
- }
2362
- if (this.depthStencilAttachment) {
2363
- this._attachTexture(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
2364
- }
2365
- if (props.check !== false) {
2366
- const status = this.gl.checkFramebufferStatus(36160);
2367
- if (status !== 36053) {
2368
- throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
2369
- }
2370
- }
2371
- this.gl.bindFramebuffer(36160, prevHandle);
2563
+ this.updateAttachments();
2372
2564
  }
2373
2565
  }
2374
2566
  /** destroys any auto created resources etc. */
@@ -2378,6 +2570,27 @@ var WEBGLFramebuffer = class extends import_core8.Framebuffer {
2378
2570
  this.gl.deleteFramebuffer(this.handle);
2379
2571
  }
2380
2572
  }
2573
+ updateAttachments() {
2574
+ const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
2575
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
2576
+ const attachment = this.colorAttachments[i];
2577
+ if (attachment) {
2578
+ const attachmentPoint = 36064 + i;
2579
+ this._attachTextureView(attachmentPoint, attachment);
2580
+ }
2581
+ }
2582
+ if (this.depthStencilAttachment) {
2583
+ const attachmentPoint = getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format);
2584
+ this._attachTextureView(attachmentPoint, this.depthStencilAttachment);
2585
+ }
2586
+ if (this.props.check !== false) {
2587
+ const status = this.gl.checkFramebufferStatus(36160);
2588
+ if (status !== 36053) {
2589
+ throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
2590
+ }
2591
+ }
2592
+ this.gl.bindFramebuffer(36160, prevHandle);
2593
+ }
2381
2594
  // PRIVATE
2382
2595
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
2383
2596
  createDepthStencilTexture(format) {
@@ -2419,10 +2632,6 @@ var WEBGLFramebuffer = class extends import_core8.Framebuffer {
2419
2632
  return this;
2420
2633
  }
2421
2634
  */
2422
- /** Attach one attachment */
2423
- _attachTexture(attachmentPoint, textureView) {
2424
- this._attachTextureView(attachmentPoint, textureView);
2425
- }
2426
2635
  /**
2427
2636
  * @param attachment
2428
2637
  * @param texture
@@ -2476,7 +2685,7 @@ function _getFrameBufferStatus(status) {
2476
2685
  }
2477
2686
 
2478
2687
  // dist/adapter/webgl-canvas-context.js
2479
- var WebGLCanvasContext = class extends import_core9.CanvasContext {
2688
+ var WebGLCanvasContext = class extends import_core10.CanvasContext {
2480
2689
  device;
2481
2690
  format = "rgba8unorm";
2482
2691
  depthStencilFormat = "depth24plus";
@@ -2529,7 +2738,7 @@ var WebGLCanvasContext = class extends import_core9.CanvasContext {
2529
2738
  };
2530
2739
 
2531
2740
  // dist/context/debug/spector.js
2532
- var import_core10 = require("@luma.gl/core");
2741
+ var import_core11 = require("@luma.gl/core");
2533
2742
 
2534
2743
  // dist/utils/load-script.js
2535
2744
  async function loadScript(scriptUrl, scriptId) {
@@ -2555,7 +2764,7 @@ var LOG_LEVEL = 1;
2555
2764
  var spector = null;
2556
2765
  var initialized = false;
2557
2766
  var DEFAULT_SPECTOR_PROPS = {
2558
- debugWithSpectorJS: import_core10.log.get("spector") || import_core10.log.get("spectorjs"),
2767
+ debugWithSpectorJS: import_core11.log.get("spector") || import_core11.log.get("spectorjs"),
2559
2768
  // https://github.com/BabylonJS/Spector.js#basic-usage
2560
2769
  // https://forum.babylonjs.com/t/spectorcdn-is-temporarily-off/48241
2561
2770
  // spectorUrl: 'https://spectorcdn.babylonjs.com/spector.bundle.js';
@@ -2567,7 +2776,7 @@ async function loadSpectorJS(props) {
2567
2776
  try {
2568
2777
  await loadScript(props.spectorUrl || DEFAULT_SPECTOR_PROPS.spectorUrl);
2569
2778
  } catch (error) {
2570
- import_core10.log.warn(String(error));
2779
+ import_core11.log.warn(String(error));
2571
2780
  }
2572
2781
  }
2573
2782
  }
@@ -2578,7 +2787,7 @@ function initializeSpectorJS(props) {
2578
2787
  return null;
2579
2788
  }
2580
2789
  if (!spector && globalThis.SPECTOR && !((_a = globalThis.luma) == null ? void 0 : _a.spector)) {
2581
- import_core10.log.probe(LOG_LEVEL, "SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();
2790
+ import_core11.log.probe(LOG_LEVEL, "SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();
2582
2791
  const { Spector } = globalThis.SPECTOR;
2583
2792
  spector = new Spector();
2584
2793
  if (globalThis.luma) {
@@ -2591,9 +2800,9 @@ function initializeSpectorJS(props) {
2591
2800
  if (!initialized) {
2592
2801
  initialized = true;
2593
2802
  spector.spyCanvases();
2594
- spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core10.log.info("Spector capture started:", capture)());
2803
+ spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core11.log.info("Spector capture started:", capture)());
2595
2804
  spector == null ? void 0 : spector.onCapture.add((capture) => {
2596
- import_core10.log.info("Spector capture complete:", capture)();
2805
+ import_core11.log.info("Spector capture complete:", capture)();
2597
2806
  spector == null ? void 0 : spector.getResultUI();
2598
2807
  spector == null ? void 0 : spector.resultView.display();
2599
2808
  spector == null ? void 0 : spector.resultView.addCapture(capture);
@@ -2605,7 +2814,7 @@ function initializeSpectorJS(props) {
2605
2814
  spector == null ? void 0 : spector.startCapture(props.gl, 500);
2606
2815
  gl.device = device;
2607
2816
  new Promise((resolve) => setTimeout(resolve, 2e3)).then((_) => {
2608
- import_core10.log.info("Spector capture stopped after 2 seconds")();
2817
+ import_core11.log.info("Spector capture stopped after 2 seconds")();
2609
2818
  spector == null ? void 0 : spector.stopCapture();
2610
2819
  });
2611
2820
  }
@@ -2613,8 +2822,8 @@ function initializeSpectorJS(props) {
2613
2822
  }
2614
2823
 
2615
2824
  // dist/context/debug/webgl-developer-tools.js
2616
- var import_core11 = require("@luma.gl/core");
2617
- var import_constants12 = require("@luma.gl/constants");
2825
+ var import_core12 = require("@luma.gl/core");
2826
+ var import_constants14 = require("@luma.gl/constants");
2618
2827
  var import_env = require("@probe.gl/env");
2619
2828
  var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
2620
2829
  function getWebGLContextData(gl) {
@@ -2637,18 +2846,18 @@ function getRealContext(gl) {
2637
2846
  }
2638
2847
  function getDebugContext(gl, props) {
2639
2848
  if (!globalThis.WebGLDebugUtils) {
2640
- import_core11.log.warn("webgl-debug not loaded")();
2849
+ import_core12.log.warn("webgl-debug not loaded")();
2641
2850
  return gl;
2642
2851
  }
2643
2852
  const data = getWebGLContextData(gl);
2644
2853
  if (data.debugContext) {
2645
2854
  return data.debugContext;
2646
2855
  }
2647
- globalThis.WebGLDebugUtils.init({ ...import_constants12.GL, ...gl });
2856
+ globalThis.WebGLDebugUtils.init({ ...import_constants14.GL, ...gl });
2648
2857
  const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(gl, onGLError.bind(null, props), onValidateGLFunc.bind(null, props));
2649
- for (const key in import_constants12.GL) {
2650
- if (!(key in glDebug) && typeof import_constants12.GL[key] === "number") {
2651
- glDebug[key] = import_constants12.GL[key];
2858
+ for (const key in import_constants14.GL) {
2859
+ if (!(key in glDebug) && typeof import_constants14.GL[key] === "number") {
2860
+ glDebug[key] = import_constants14.GL[key];
2652
2861
  }
2653
2862
  }
2654
2863
  class WebGLDebugContext {
@@ -2672,7 +2881,7 @@ function onGLError(props, err, functionName, args) {
2672
2881
  const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);
2673
2882
  const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);
2674
2883
  const message2 = `${errorMessage} in gl.${functionName}(${functionArgs})`;
2675
- import_core11.log.error(message2)();
2884
+ import_core12.log.error(message2)();
2676
2885
  debugger;
2677
2886
  if (props.throwOnError) {
2678
2887
  throw new Error(message2);
@@ -2680,9 +2889,9 @@ function onGLError(props, err, functionName, args) {
2680
2889
  }
2681
2890
  function onValidateGLFunc(props, functionName, functionArgs) {
2682
2891
  let functionString = "";
2683
- if (import_core11.log.level >= 1) {
2892
+ if (import_core12.log.level >= 1) {
2684
2893
  functionString = getFunctionString(functionName, functionArgs);
2685
- import_core11.log.log(1, functionString)();
2894
+ import_core12.log.log(1, functionString)();
2686
2895
  }
2687
2896
  if (props.break && props.break.length > 0) {
2688
2897
  functionString = functionString || getFunctionString(functionName, functionArgs);
@@ -2697,7 +2906,7 @@ function onValidateGLFunc(props, functionName, functionArgs) {
2697
2906
  if (props.throwOnError) {
2698
2907
  throw new Error(`Undefined argument: ${functionString}`);
2699
2908
  } else {
2700
- import_core11.log.error(`Undefined argument: ${functionString}`)();
2909
+ import_core12.log.error(`Undefined argument: ${functionString}`)();
2701
2910
  debugger;
2702
2911
  }
2703
2912
  }
@@ -2713,9 +2922,9 @@ function uid(id = "id") {
2713
2922
  }
2714
2923
 
2715
2924
  // dist/adapter/resources/webgl-buffer.js
2716
- var import_core12 = require("@luma.gl/core");
2717
- var import_constants13 = require("@luma.gl/constants");
2718
- var WEBGLBuffer = class extends import_core12.Buffer {
2925
+ var import_core13 = require("@luma.gl/core");
2926
+ var import_constants15 = require("@luma.gl/constants");
2927
+ var WEBGLBuffer = class extends import_core13.Buffer {
2719
2928
  device;
2720
2929
  gl;
2721
2930
  handle;
@@ -2813,33 +3022,33 @@ var WEBGLBuffer = class extends import_core12.Buffer {
2813
3022
  }
2814
3023
  };
2815
3024
  function getWebGLTarget(usage) {
2816
- if (usage & import_core12.Buffer.INDEX) {
3025
+ if (usage & import_core13.Buffer.INDEX) {
2817
3026
  return 34963;
2818
3027
  }
2819
- if (usage & import_core12.Buffer.VERTEX) {
3028
+ if (usage & import_core13.Buffer.VERTEX) {
2820
3029
  return 34962;
2821
3030
  }
2822
- if (usage & import_core12.Buffer.UNIFORM) {
3031
+ if (usage & import_core13.Buffer.UNIFORM) {
2823
3032
  return 35345;
2824
3033
  }
2825
3034
  return 34962;
2826
3035
  }
2827
3036
  function getWebGLUsage(usage) {
2828
- if (usage & import_core12.Buffer.INDEX) {
3037
+ if (usage & import_core13.Buffer.INDEX) {
2829
3038
  return 35044;
2830
3039
  }
2831
- if (usage & import_core12.Buffer.VERTEX) {
3040
+ if (usage & import_core13.Buffer.VERTEX) {
2832
3041
  return 35044;
2833
3042
  }
2834
- if (usage & import_core12.Buffer.UNIFORM) {
3043
+ if (usage & import_core13.Buffer.UNIFORM) {
2835
3044
  return 35048;
2836
3045
  }
2837
3046
  return 35044;
2838
3047
  }
2839
3048
 
2840
3049
  // dist/adapter/resources/webgl-shader.js
2841
- var import_core13 = require("@luma.gl/core");
2842
- var import_constants14 = require("@luma.gl/constants");
3050
+ var import_core14 = require("@luma.gl/core");
3051
+ var import_constants16 = require("@luma.gl/constants");
2843
3052
 
2844
3053
  // dist/adapter/helpers/parse-shader-compiler-log.js
2845
3054
  function parseShaderCompilerLog(errLog) {
@@ -2886,7 +3095,7 @@ function getMessageType(messageType) {
2886
3095
  }
2887
3096
 
2888
3097
  // dist/adapter/resources/webgl-shader.js
2889
- var WEBGLShader = class extends import_core13.Shader {
3098
+ var WEBGLShader = class extends import_core14.Shader {
2890
3099
  device;
2891
3100
  handle;
2892
3101
  constructor(device, props) {
@@ -2916,8 +3125,8 @@ var WEBGLShader = class extends import_core13.Shader {
2916
3125
  return this.getCompilationInfoSync();
2917
3126
  }
2918
3127
  getCompilationInfoSync() {
2919
- const log10 = this.device.gl.getShaderInfoLog(this.handle);
2920
- return log10 ? parseShaderCompilerLog(log10) : [];
3128
+ const log12 = this.device.gl.getShaderInfoLog(this.handle);
3129
+ return log12 ? parseShaderCompilerLog(log12) : [];
2921
3130
  }
2922
3131
  getTranslatedSource() {
2923
3132
  const extensions = this.device.getExtension("WEBGL_debug_shaders");
@@ -2933,7 +3142,7 @@ ${source2}`;
2933
3142
  const { gl } = this.device;
2934
3143
  gl.shaderSource(this.handle, source);
2935
3144
  gl.compileShader(this.handle);
2936
- if (import_core13.log.level === 0) {
3145
+ if (import_core14.log.level === 0) {
2937
3146
  this.compilationStatus = "pending";
2938
3147
  return;
2939
3148
  }
@@ -2945,9 +3154,9 @@ ${source2}`;
2945
3154
  }
2946
3155
  return;
2947
3156
  }
2948
- import_core13.log.once(1, "Shader compilation is asynchronous")();
3157
+ import_core14.log.once(1, "Shader compilation is asynchronous")();
2949
3158
  await this._waitForCompilationComplete();
2950
- import_core13.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
3159
+ import_core14.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
2951
3160
  this._getCompilationStatus();
2952
3161
  this.debugShader();
2953
3162
  }
@@ -2979,14 +3188,14 @@ ${source2}`;
2979
3188
  };
2980
3189
 
2981
3190
  // dist/adapter/resources/webgl-render-pass.js
2982
- var import_core14 = require("@luma.gl/core");
2983
- var import_constants15 = require("@luma.gl/constants");
3191
+ var import_core15 = require("@luma.gl/core");
3192
+ var import_constants17 = require("@luma.gl/constants");
2984
3193
  var GL_DEPTH_BUFFER_BIT = 256;
2985
3194
  var GL_STENCIL_BUFFER_BIT = 1024;
2986
3195
  var GL_COLOR_BUFFER_BIT = 16384;
2987
3196
  var GL_COLOR = 6144;
2988
3197
  var COLOR_CHANNELS = [1, 2, 4, 8];
2989
- var WEBGLRenderPass = class extends import_core14.RenderPass {
3198
+ var WEBGLRenderPass = class extends import_core15.RenderPass {
2990
3199
  device;
2991
3200
  /** Parameters that should be applied before each draw call */
2992
3201
  glParameters;
@@ -3111,184 +3320,12 @@ var WEBGLRenderPass = class extends import_core14.RenderPass {
3111
3320
  };
3112
3321
 
3113
3322
  // dist/adapter/resources/webgl-render-pipeline.js
3114
- var import_core15 = require("@luma.gl/core");
3323
+ var import_core16 = require("@luma.gl/core");
3115
3324
  var import_constants22 = require("@luma.gl/constants");
3116
3325
 
3117
3326
  // dist/adapter/helpers/get-shader-layout.js
3118
3327
  var import_constants19 = require("@luma.gl/constants");
3119
3328
 
3120
- // dist/classic/accessor.js
3121
- var import_constants17 = require("@luma.gl/constants");
3122
-
3123
- // dist/classic/typed-array-utils.js
3124
- var import_constants16 = require("@luma.gl/constants");
3125
- var ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
3126
- function getGLTypeFromTypedArray(arrayOrType) {
3127
- const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
3128
- switch (type) {
3129
- case Float32Array:
3130
- return 5126;
3131
- case Uint16Array:
3132
- return 5123;
3133
- case Uint32Array:
3134
- return 5125;
3135
- case Uint8Array:
3136
- return 5121;
3137
- case Uint8ClampedArray:
3138
- return 5121;
3139
- case Int8Array:
3140
- return 5120;
3141
- case Int16Array:
3142
- return 5122;
3143
- case Int32Array:
3144
- return 5124;
3145
- default:
3146
- throw new Error(ERR_TYPE_DEDUCTION);
3147
- }
3148
- }
3149
- function getTypedArrayFromGLType(glType, options) {
3150
- const { clamped = true } = options || {};
3151
- switch (glType) {
3152
- case 5126:
3153
- return Float32Array;
3154
- case 5123:
3155
- case 33635:
3156
- case 32819:
3157
- case 32820:
3158
- return Uint16Array;
3159
- case 5125:
3160
- return Uint32Array;
3161
- case 5121:
3162
- return clamped ? Uint8ClampedArray : Uint8Array;
3163
- case 5120:
3164
- return Int8Array;
3165
- case 5122:
3166
- return Int16Array;
3167
- case 5124:
3168
- return Int32Array;
3169
- default:
3170
- throw new Error("Failed to deduce typed array type from GL constant");
3171
- }
3172
- }
3173
-
3174
- // dist/classic/accessor.js
3175
- var DEFAULT_ACCESSOR_VALUES = {
3176
- offset: 0,
3177
- stride: 0,
3178
- type: 5126,
3179
- size: 1,
3180
- divisor: 0,
3181
- normalized: false,
3182
- integer: false
3183
- };
3184
- var Accessor = class {
3185
- offset;
3186
- stride;
3187
- type;
3188
- size;
3189
- divisor;
3190
- normalized;
3191
- integer;
3192
- buffer;
3193
- index;
3194
- static getBytesPerElement(accessor) {
3195
- const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
3196
- return ArrayType.BYTES_PER_ELEMENT;
3197
- }
3198
- static getBytesPerVertex(accessor) {
3199
- const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
3200
- return ArrayType.BYTES_PER_ELEMENT * accessor.size;
3201
- }
3202
- // Combines (merges) a list of accessors. On top of default values
3203
- // Usually [programAccessor, bufferAccessor, appAccessor]
3204
- // All props will be set in the returned object.
3205
- // TODO check for conflicts between values in the supplied accessors
3206
- static resolve(...accessors) {
3207
- return new Accessor(...[DEFAULT_ACCESSOR_VALUES, ...accessors]);
3208
- }
3209
- constructor(...accessors) {
3210
- accessors.forEach((accessor) => this._assign(accessor));
3211
- Object.freeze(this);
3212
- }
3213
- toString() {
3214
- return JSON.stringify(this);
3215
- }
3216
- // ACCESSORS
3217
- // TODO - remove>
3218
- get BYTES_PER_ELEMENT() {
3219
- return Accessor.getBytesPerElement(this);
3220
- }
3221
- get BYTES_PER_VERTEX() {
3222
- return Accessor.getBytesPerVertex(this);
3223
- }
3224
- // PRIVATE
3225
- // eslint-disable-next-line complexity, max-statements
3226
- _assign(props = {}) {
3227
- if (props.type !== void 0) {
3228
- this.type = props.type;
3229
- if (props.type === 5124 || props.type === 5125) {
3230
- this.integer = true;
3231
- }
3232
- }
3233
- if (props.size !== void 0) {
3234
- this.size = props.size;
3235
- }
3236
- if (props.offset !== void 0) {
3237
- this.offset = props.offset;
3238
- }
3239
- if (props.stride !== void 0) {
3240
- this.stride = props.stride;
3241
- }
3242
- if (props.normalize !== void 0) {
3243
- this.normalized = props.normalize;
3244
- }
3245
- if (props.normalized !== void 0) {
3246
- this.normalized = props.normalized;
3247
- }
3248
- if (props.integer !== void 0) {
3249
- this.integer = props.integer;
3250
- }
3251
- if (props.divisor !== void 0) {
3252
- this.divisor = props.divisor;
3253
- }
3254
- if (props.buffer !== void 0) {
3255
- this.buffer = props.buffer;
3256
- }
3257
- if (props.index !== void 0) {
3258
- if (typeof props.index === "boolean") {
3259
- this.index = props.index ? 1 : 0;
3260
- } else {
3261
- this.index = props.index;
3262
- }
3263
- }
3264
- if (props.instanced !== void 0) {
3265
- this.divisor = props.instanced ? 1 : 0;
3266
- }
3267
- if (props.isInstanced !== void 0) {
3268
- this.divisor = props.isInstanced ? 1 : 0;
3269
- }
3270
- if (this.offset === void 0)
3271
- delete this.offset;
3272
- if (this.stride === void 0)
3273
- delete this.stride;
3274
- if (this.type === void 0)
3275
- delete this.type;
3276
- if (this.size === void 0)
3277
- delete this.size;
3278
- if (this.divisor === void 0)
3279
- delete this.divisor;
3280
- if (this.normalized === void 0)
3281
- delete this.normalized;
3282
- if (this.integer === void 0)
3283
- delete this.integer;
3284
- if (this.buffer === void 0)
3285
- delete this.buffer;
3286
- if (this.index === void 0)
3287
- delete this.index;
3288
- return this;
3289
- }
3290
- };
3291
-
3292
3329
  // dist/adapter/helpers/decode-webgl-types.js
3293
3330
  var import_constants18 = require("@luma.gl/constants");
3294
3331
  function isSamplerUniform(type) {
@@ -3455,8 +3492,7 @@ function readVaryings(gl, program) {
3455
3492
  }
3456
3493
  const { name, type: compositeType, size } = activeInfo;
3457
3494
  const { glType, components } = decodeGLUniformType(compositeType);
3458
- const accessor = new Accessor({ type: glType, size: size * components });
3459
- const varying = { location, name, accessor };
3495
+ const varying = { location, name, type: glType, size: size * components };
3460
3496
  varyings.push(varying);
3461
3497
  }
3462
3498
  varyings.sort((a, b) => a.location - b.location);
@@ -3723,7 +3759,7 @@ function getGLPrimitive(topology) {
3723
3759
 
3724
3760
  // dist/adapter/resources/webgl-render-pipeline.js
3725
3761
  var LOG_PROGRAM_PERF_PRIORITY = 4;
3726
- var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3762
+ var WEBGLRenderPipeline = class extends import_core16.RenderPipeline {
3727
3763
  /** The WebGL device that created this render pipeline */
3728
3764
  device;
3729
3765
  /** Handle to underlying WebGL program */
@@ -3756,9 +3792,9 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3756
3792
  this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
3757
3793
  }
3758
3794
  this._linkShaders();
3759
- import_core15.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3795
+ import_core16.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3760
3796
  this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
3761
- import_core15.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3797
+ import_core16.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3762
3798
  this.shaderLayout = mergeShaderLayout(this.introspectedLayout, props.shaderLayout);
3763
3799
  }
3764
3800
  destroy() {
@@ -3777,12 +3813,12 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3777
3813
  if (!binding) {
3778
3814
  const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
3779
3815
  if (!(options == null ? void 0 : options.disableWarnings)) {
3780
- import_core15.log.warn(`No binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`, value)();
3816
+ import_core16.log.warn(`No binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`, value)();
3781
3817
  }
3782
3818
  continue;
3783
3819
  }
3784
3820
  if (!value) {
3785
- import_core15.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
3821
+ import_core16.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
3786
3822
  }
3787
3823
  switch (binding.type) {
3788
3824
  case "uniform":
@@ -3796,7 +3832,7 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3796
3832
  }
3797
3833
  break;
3798
3834
  case "sampler":
3799
- import_core15.log.warn(`Ignoring sampler ${name}`)();
3835
+ import_core16.log.warn(`Ignoring sampler ${name}`)();
3800
3836
  break;
3801
3837
  default:
3802
3838
  throw new Error(binding.type);
@@ -3829,11 +3865,11 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3829
3865
  const isIndexed = Boolean(vertexArray.indexBuffer);
3830
3866
  const glIndexType = (_a = vertexArray.indexBuffer) == null ? void 0 : _a.glIndexType;
3831
3867
  if (this.linkStatus !== "success") {
3832
- import_core15.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
3868
+ import_core16.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
3833
3869
  return false;
3834
3870
  }
3835
3871
  if (!this._areTexturesRenderable()) {
3836
- import_core15.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
3872
+ import_core16.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
3837
3873
  return false;
3838
3874
  }
3839
3875
  this.device.gl.useProgram(this.handle);
@@ -3872,7 +3908,7 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3872
3908
  setUniformsWebGL(uniforms) {
3873
3909
  const { bindings } = splitUniformsAndBindings(uniforms);
3874
3910
  Object.keys(bindings).forEach((name) => {
3875
- import_core15.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
3911
+ import_core16.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
3876
3912
  });
3877
3913
  Object.assign(this.uniforms, uniforms);
3878
3914
  }
@@ -3883,19 +3919,19 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3883
3919
  const { gl } = this.device;
3884
3920
  gl.attachShader(this.handle, this.vs.handle);
3885
3921
  gl.attachShader(this.handle, this.fs.handle);
3886
- import_core15.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
3922
+ import_core16.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
3887
3923
  gl.linkProgram(this.handle);
3888
- import_core15.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
3889
- if (import_core15.log.level === 0) {
3924
+ import_core16.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
3925
+ if (import_core16.log.level === 0) {
3890
3926
  }
3891
3927
  if (!this.device.features.has("compilation-status-async-webgl")) {
3892
3928
  const status2 = this._getLinkStatus();
3893
3929
  this._reportLinkStatus(status2);
3894
3930
  return;
3895
3931
  }
3896
- import_core15.log.once(1, "RenderPipeline linking is asynchronous")();
3932
+ import_core16.log.once(1, "RenderPipeline linking is asynchronous")();
3897
3933
  await this._waitForLinkComplete();
3898
- import_core15.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
3934
+ import_core16.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
3899
3935
  const status = this._getLinkStatus();
3900
3936
  this._reportLinkStatus(status);
3901
3937
  }
@@ -3964,7 +4000,7 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
3964
4000
  let texturesRenderable = true;
3965
4001
  for (const bindingInfo of this.shaderLayout.bindings) {
3966
4002
  if (!this.bindings[bindingInfo.name] && !this.bindings[bindingInfo.name.replace(/Uniforms$/, "")]) {
3967
- import_core15.log.warn(`Binding ${bindingInfo.name} not found in ${this.id}`)();
4003
+ import_core16.log.warn(`Binding ${bindingInfo.name} not found in ${this.id}`)();
3968
4004
  texturesRenderable = false;
3969
4005
  }
3970
4006
  }
@@ -4023,7 +4059,7 @@ var WEBGLRenderPipeline = class extends import_core15.RenderPipeline {
4023
4059
  } else if (value instanceof WEBGLTexture) {
4024
4060
  texture = value;
4025
4061
  } else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTextureView) {
4026
- import_core15.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4062
+ import_core16.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4027
4063
  texture = value.colorAttachments[0].texture;
4028
4064
  } else {
4029
4065
  throw new Error("No texture");
@@ -4062,7 +4098,7 @@ function mergeShaderLayout(baseLayout, overrideLayout) {
4062
4098
  for (const attribute of (overrideLayout == null ? void 0 : overrideLayout.attributes) || []) {
4063
4099
  const baseAttribute = mergedLayout.attributes.find((attr) => attr.name === attribute.name);
4064
4100
  if (!baseAttribute) {
4065
- import_core15.log.warn(`shader layout attribute ${attribute.name} not present in shader`);
4101
+ import_core16.log.warn(`shader layout attribute ${attribute.name} not present in shader`);
4066
4102
  } else {
4067
4103
  baseAttribute.type = attribute.type || baseAttribute.type;
4068
4104
  baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
@@ -4072,12 +4108,12 @@ function mergeShaderLayout(baseLayout, overrideLayout) {
4072
4108
  }
4073
4109
 
4074
4110
  // dist/adapter/resources/webgl-command-encoder.js
4075
- var import_core17 = require("@luma.gl/core");
4111
+ var import_core18 = require("@luma.gl/core");
4076
4112
 
4077
4113
  // dist/adapter/resources/webgl-command-buffer.js
4078
- var import_core16 = require("@luma.gl/core");
4114
+ var import_core17 = require("@luma.gl/core");
4079
4115
  var import_constants23 = require("@luma.gl/constants");
4080
- var WEBGLCommandBuffer = class extends import_core16.CommandBuffer {
4116
+ var WEBGLCommandBuffer = class extends import_core17.CommandBuffer {
4081
4117
  device;
4082
4118
  commands = [];
4083
4119
  constructor(device) {
@@ -4152,7 +4188,7 @@ function _copyTextureToBuffer(device, options) {
4152
4188
  if (mipLevel !== 0 || depthOrArrayLayers !== 0 || bytesPerRow || rowsPerImage) {
4153
4189
  throw new Error("not implemented");
4154
4190
  }
4155
- const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
4191
+ const { framebuffer, destroyFramebuffer } = getFramebuffer2(source);
4156
4192
  let prevHandle;
4157
4193
  try {
4158
4194
  const webglBuffer = destination;
@@ -4200,7 +4236,7 @@ function _copyTextureToTexture(device, options) {
4200
4236
  height = options.destination.height
4201
4237
  // depthOrArrayLayers = 0
4202
4238
  } = options;
4203
- const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
4239
+ const { framebuffer, destroyFramebuffer } = getFramebuffer2(source);
4204
4240
  const [sourceX, sourceY] = origin;
4205
4241
  const [destinationX, destinationY, destinationZ] = destinationOrigin;
4206
4242
  const prevHandle = device.gl.bindFramebuffer(36160, framebuffer.handle);
@@ -4234,8 +4270,8 @@ function _copyTextureToTexture(device, options) {
4234
4270
  framebuffer.destroy();
4235
4271
  }
4236
4272
  }
4237
- function getFramebuffer(source) {
4238
- if (source instanceof import_core16.Texture) {
4273
+ function getFramebuffer2(source) {
4274
+ if (source instanceof import_core17.Texture) {
4239
4275
  const { width, height, id } = source;
4240
4276
  const framebuffer = source.device.createFramebuffer({
4241
4277
  id: `framebuffer-for-${id}`,
@@ -4249,7 +4285,7 @@ function getFramebuffer(source) {
4249
4285
  }
4250
4286
 
4251
4287
  // dist/adapter/resources/webgl-command-encoder.js
4252
- var WEBGLCommandEncoder = class extends import_core17.CommandEncoder {
4288
+ var WEBGLCommandEncoder = class extends import_core18.CommandEncoder {
4253
4289
  device;
4254
4290
  commandBuffer;
4255
4291
  constructor(device, props) {
@@ -4288,7 +4324,7 @@ var WEBGLCommandEncoder = class extends import_core17.CommandEncoder {
4288
4324
  };
4289
4325
 
4290
4326
  // dist/adapter/resources/webgl-vertex-array.js
4291
- var import_core18 = require("@luma.gl/core");
4327
+ var import_core19 = require("@luma.gl/core");
4292
4328
  var import_constants24 = require("@luma.gl/constants");
4293
4329
  var import_env2 = require("@probe.gl/env");
4294
4330
 
@@ -4314,7 +4350,7 @@ function fillArray(options) {
4314
4350
  }
4315
4351
 
4316
4352
  // dist/adapter/resources/webgl-vertex-array.js
4317
- var WEBGLVertexArray = class extends import_core18.VertexArray {
4353
+ var WEBGLVertexArray = class extends import_core19.VertexArray {
4318
4354
  get [Symbol.toStringTag]() {
4319
4355
  return "VertexArray";
4320
4356
  }
@@ -4481,7 +4517,7 @@ var WEBGLVertexArray = class extends import_core18.VertexArray {
4481
4517
  this.buffer = this.buffer || this.device.createBuffer({ byteLength });
4482
4518
  updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
4483
4519
  if (updateNeeded) {
4484
- const typedArray = (0, import_core18.getScratchArray)(value.constructor, length);
4520
+ const typedArray = (0, import_core19.getScratchArray)(value.constructor, length);
4485
4521
  fillArray({ target: typedArray, source: constantValue, start: 0, count: length });
4486
4522
  this.buffer.write(typedArray);
4487
4523
  this.bufferValue = value;
@@ -4508,9 +4544,9 @@ function compareConstantArrayValues(v1, v2) {
4508
4544
  }
4509
4545
 
4510
4546
  // dist/adapter/resources/webgl-transform-feedback.js
4511
- var import_core19 = require("@luma.gl/core");
4547
+ var import_core20 = require("@luma.gl/core");
4512
4548
  var import_constants25 = require("@luma.gl/constants");
4513
- var WEBGLTransformFeedback = class extends import_core19.TransformFeedback {
4549
+ var WEBGLTransformFeedback = class extends import_core20.TransformFeedback {
4514
4550
  device;
4515
4551
  gl;
4516
4552
  handle;
@@ -4573,7 +4609,7 @@ var WEBGLTransformFeedback = class extends import_core19.TransformFeedback {
4573
4609
  const { buffer, byteLength, byteOffset } = this._getBufferRange(bufferOrRange);
4574
4610
  if (location < 0) {
4575
4611
  this.unusedBuffers[locationOrName] = buffer;
4576
- import_core19.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
4612
+ import_core20.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
4577
4613
  return;
4578
4614
  }
4579
4615
  this.buffers[location] = { buffer, byteLength, byteOffset };
@@ -4660,9 +4696,9 @@ function isIndex(value) {
4660
4696
  }
4661
4697
 
4662
4698
  // dist/adapter/resources/webgl-query-set.js
4663
- var import_core20 = require("@luma.gl/core");
4699
+ var import_core21 = require("@luma.gl/core");
4664
4700
  var import_constants26 = require("@luma.gl/constants");
4665
- var WEBGLQuerySet = class extends import_core20.QuerySet {
4701
+ var WEBGLQuerySet = class extends import_core21.QuerySet {
4666
4702
  device;
4667
4703
  handle;
4668
4704
  target = null;
@@ -4789,144 +4825,13 @@ var WEBGLQuerySet = class extends import_core20.QuerySet {
4789
4825
  }
4790
4826
  };
4791
4827
 
4792
- // dist/classic/copy-and-blit.js
4793
- var import_core21 = require("@luma.gl/core");
4794
- var import_constants28 = require("@luma.gl/constants");
4795
-
4796
- // dist/classic/format-utils.js
4797
- var import_constants27 = require("@luma.gl/constants");
4798
- function glFormatToComponents(format) {
4799
- switch (format) {
4800
- case 6406:
4801
- case 33326:
4802
- case 6403:
4803
- return 1;
4804
- case 33328:
4805
- case 33319:
4806
- return 2;
4807
- case 6407:
4808
- case 34837:
4809
- return 3;
4810
- case 6408:
4811
- case 34836:
4812
- return 4;
4813
- default:
4814
- return 0;
4815
- }
4816
- }
4817
- function glTypeToBytes(type) {
4818
- switch (type) {
4819
- case 5121:
4820
- return 1;
4821
- case 33635:
4822
- case 32819:
4823
- case 32820:
4824
- return 2;
4825
- case 5126:
4826
- return 4;
4827
- default:
4828
- return 0;
4829
- }
4830
- }
4831
-
4832
- // dist/classic/copy-and-blit.js
4833
- function readPixelsToArray(source, options) {
4834
- var _a, _b, _c, _d, _e, _f;
4835
- const {
4836
- sourceX = 0,
4837
- sourceY = 0,
4838
- sourceAttachment = 36064
4839
- // TODO - support gl.readBuffer
4840
- } = options || {};
4841
- let {
4842
- target = null,
4843
- // following parameters are auto deduced if not provided
4844
- sourceWidth,
4845
- sourceHeight,
4846
- sourceDepth,
4847
- sourceFormat,
4848
- sourceType
4849
- } = options || {};
4850
- const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
4851
- const { gl, handle } = framebuffer;
4852
- const attachment = sourceAttachment - 36064;
4853
- sourceWidth ||= framebuffer.width;
4854
- sourceHeight ||= framebuffer.height;
4855
- sourceDepth = ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.depth) || 1;
4856
- sourceFormat ||= ((_d = (_c = framebuffer.colorAttachments[attachment]) == null ? void 0 : _c.texture) == null ? void 0 : _d.glFormat) || 6408;
4857
- sourceType ||= ((_f = (_e = framebuffer.colorAttachments[attachment]) == null ? void 0 : _e.texture) == null ? void 0 : _f.glType) || 5121;
4858
- target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight, sourceDepth);
4859
- sourceType = sourceType || getGLTypeFromTypedArray(target);
4860
- const prevHandle = gl.bindFramebuffer(36160, handle);
4861
- gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
4862
- gl.bindFramebuffer(36160, prevHandle || null);
4863
- if (deleteFramebuffer) {
4864
- framebuffer.destroy();
4865
- }
4866
- return target;
4867
- }
4868
- function readPixelsToBuffer(source, options) {
4869
- const { target, sourceX = 0, sourceY = 0, sourceFormat = 6408, targetByteOffset = 0 } = options || {};
4870
- let { sourceWidth, sourceHeight, sourceType } = options || {};
4871
- const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
4872
- sourceWidth = sourceWidth || framebuffer.width;
4873
- sourceHeight = sourceHeight || framebuffer.height;
4874
- const webglFramebuffer = framebuffer;
4875
- sourceType = sourceType || 5121;
4876
- let webglBufferTarget = target;
4877
- if (!webglBufferTarget) {
4878
- const components = glFormatToComponents(sourceFormat);
4879
- const byteCount = glTypeToBytes(sourceType);
4880
- const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;
4881
- webglBufferTarget = webglFramebuffer.device.createBuffer({ byteLength });
4882
- }
4883
- const commandEncoder = source.device.createCommandEncoder();
4884
- commandEncoder.copyTextureToBuffer({
4885
- source,
4886
- width: sourceWidth,
4887
- height: sourceHeight,
4888
- origin: [sourceX, sourceY],
4889
- destination: webglBufferTarget,
4890
- byteOffset: targetByteOffset
4891
- });
4892
- commandEncoder.destroy();
4893
- if (deleteFramebuffer) {
4894
- framebuffer.destroy();
4895
- }
4896
- return webglBufferTarget;
4897
- }
4898
- function getFramebuffer2(source) {
4899
- if (!(source instanceof import_core21.Framebuffer)) {
4900
- return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
4901
- }
4902
- return { framebuffer: source, deleteFramebuffer: false };
4903
- }
4904
- function toFramebuffer(texture, props) {
4905
- const { device, width, height, id } = texture;
4906
- const framebuffer = device.createFramebuffer({
4907
- ...props,
4908
- id: `framebuffer-for-${id}`,
4909
- width,
4910
- height,
4911
- colorAttachments: [texture]
4912
- });
4913
- return framebuffer;
4914
- }
4915
- function getPixelArray(pixelArray, type, format, width, height, depth) {
4916
- if (pixelArray) {
4917
- return pixelArray;
4918
- }
4919
- type = type || 5121;
4920
- const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
4921
- const components = glFormatToComponents(format);
4922
- return new ArrayType(width * height * components);
4923
- }
4924
-
4925
- // dist/classic/clear.js
4828
+ // dist/deprecated/clear.js
4829
+ var import_core22 = require("@luma.gl/core");
4926
4830
  var GL_DEPTH_BUFFER_BIT2 = 256;
4927
4831
  var GL_STENCIL_BUFFER_BIT2 = 1024;
4928
4832
  var GL_COLOR_BUFFER_BIT2 = 16384;
4929
4833
  function clear(device, options) {
4834
+ import_core22.log.warn("clear will be removed in next minor release");
4930
4835
  const { framebuffer = null, color = null, depth = null, stencil = null } = options || {};
4931
4836
  const parameters = {};
4932
4837
  if (framebuffer) {
@@ -4958,7 +4863,7 @@ function clear(device, options) {
4958
4863
  }
4959
4864
 
4960
4865
  // dist/adapter/webgl-device.js
4961
- var WebGLDevice = class extends import_core22.Device {
4866
+ var WebGLDevice = class extends import_core23.Device {
4962
4867
  //
4963
4868
  // Public `Device` API
4964
4869
  //
@@ -5022,14 +4927,14 @@ var WebGLDevice = class extends import_core22.Device {
5022
4927
  }
5023
4928
  this.canvasContext.resize();
5024
4929
  const glState = new WebGLStateTracker(this.gl, {
5025
- log: (...args) => import_core22.log.log(1, ...args)()
4930
+ log: (...args) => import_core23.log.log(1, ...args)()
5026
4931
  });
5027
4932
  glState.trackState(this.gl, { copyState: false });
5028
4933
  if (props.debug) {
5029
4934
  this.gl = makeDebugContext(this.gl, { ...props, throwOnError: true });
5030
4935
  this.debug = true;
5031
- import_core22.log.level = Math.max(import_core22.log.level, 1);
5032
- import_core22.log.warn("WebGL debug mode activated. Performance reduced.")();
4936
+ import_core23.log.level = Math.max(import_core23.log.level, 1);
4937
+ import_core23.log.warn("WebGL debug mode activated. Performance reduced.")();
5033
4938
  }
5034
4939
  }
5035
4940
  /**
@@ -5133,7 +5038,7 @@ var WebGLDevice = class extends import_core22.Device {
5133
5038
  clear(this, options);
5134
5039
  }
5135
5040
  resetWebGL() {
5136
- import_core22.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
5041
+ import_core23.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
5137
5042
  resetGLParameters(this.gl);
5138
5043
  }
5139
5044
  //
@@ -5203,7 +5108,7 @@ var WebGLDevice = class extends import_core22.Device {
5203
5108
  this._constants = this._constants || new Array(maxVertexAttributes).fill(null);
5204
5109
  const currentConstant = this._constants[location];
5205
5110
  if (currentConstant && compareConstantArrayValues2(currentConstant, constant)) {
5206
- import_core22.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
5111
+ import_core23.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
5207
5112
  }
5208
5113
  this._constants[location] = constant;
5209
5114
  switch (constant.constructor) {
@@ -5262,7 +5167,7 @@ function compareConstantArrayValues2(v1, v2) {
5262
5167
  }
5263
5168
 
5264
5169
  // dist/context/polyfills/polyfill-webgl1-extensions.js
5265
- var import_constants29 = require("@luma.gl/constants");
5170
+ var import_constants27 = require("@luma.gl/constants");
5266
5171
  var WEBGL1_STATIC_EXTENSIONS = {
5267
5172
  WEBGL_depth_texture: {
5268
5173
  UNSIGNED_INT_24_8_WEBGL: 34042
@@ -5368,12 +5273,12 @@ function polyfillWebGL1Extensions(gl) {
5368
5273
 
5369
5274
  // dist/adapter/webgl-adapter.js
5370
5275
  var LOG_LEVEL2 = 1;
5371
- var WebGLAdapter = class extends import_core23.Adapter {
5276
+ var WebGLAdapter = class extends import_core24.Adapter {
5372
5277
  /** type of device's created by this adapter */
5373
5278
  type = "webgl";
5374
5279
  constructor() {
5375
5280
  super();
5376
- import_core23.Device.defaultProps = { ...import_core23.Device.defaultProps, ...DEFAULT_SPECTOR_PROPS };
5281
+ import_core24.Device.defaultProps = { ...import_core24.Device.defaultProps, ...DEFAULT_SPECTOR_PROPS };
5377
5282
  WebGLDevice.adapter = this;
5378
5283
  }
5379
5284
  /** Check if WebGL 2 is available */
@@ -5394,7 +5299,7 @@ var WebGLAdapter = class extends import_core23.Adapter {
5394
5299
  if (gl instanceof WebGLDevice) {
5395
5300
  return gl;
5396
5301
  }
5397
- if ((gl == null ? void 0 : gl.device) instanceof import_core23.Device) {
5302
+ if ((gl == null ? void 0 : gl.device) instanceof import_core24.Device) {
5398
5303
  return gl.device;
5399
5304
  }
5400
5305
  if (!isWebGL(gl)) {
@@ -5403,7 +5308,7 @@ var WebGLAdapter = class extends import_core23.Adapter {
5403
5308
  return new WebGLDevice({ gl });
5404
5309
  }
5405
5310
  async create(props = {}) {
5406
- import_core23.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created")();
5311
+ import_core24.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created")();
5407
5312
  const promises = [];
5408
5313
  if (props.debug) {
5409
5314
  promises.push(loadWebGLDeveloperTools());
@@ -5412,20 +5317,20 @@ var WebGLAdapter = class extends import_core23.Adapter {
5412
5317
  promises.push(loadSpectorJS(props));
5413
5318
  }
5414
5319
  if (typeof props.canvas === "string") {
5415
- promises.push(import_core23.CanvasContext.pageLoaded);
5320
+ promises.push(import_core24.CanvasContext.pageLoaded);
5416
5321
  }
5417
5322
  const results = await Promise.allSettled(promises);
5418
5323
  for (const result of results) {
5419
5324
  if (result.status === "rejected") {
5420
- import_core23.log.error(`Failed to initialize debug libraries ${result.reason}`)();
5325
+ import_core24.log.error(`Failed to initialize debug libraries ${result.reason}`)();
5421
5326
  }
5422
5327
  }
5423
- import_core23.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
5328
+ import_core24.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
5424
5329
  const device = new WebGLDevice(props);
5425
5330
  const message2 = `Created ${device.type}${device.debug ? " debug" : ""} context: ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
5426
- import_core23.log.probe(LOG_LEVEL2, message2)();
5427
- import_core23.log.table(LOG_LEVEL2, device.info)();
5428
- import_core23.log.groupEnd(LOG_LEVEL2)();
5331
+ import_core24.log.probe(LOG_LEVEL2, message2)();
5332
+ import_core24.log.table(LOG_LEVEL2, device.info)();
5333
+ import_core24.log.groupEnd(LOG_LEVEL2)();
5429
5334
  return device;
5430
5335
  }
5431
5336
  };
@@ -5436,4 +5341,149 @@ function isWebGL(gl) {
5436
5341
  return Boolean(gl && Number.isFinite(gl._version));
5437
5342
  }
5438
5343
  var webgl2Adapter = new WebGLAdapter();
5344
+
5345
+ // dist/deprecated/accessor.js
5346
+ var import_core25 = require("@luma.gl/core");
5347
+ var import_constants28 = require("@luma.gl/constants");
5348
+ var DEFAULT_ACCESSOR_VALUES = {
5349
+ offset: 0,
5350
+ stride: 0,
5351
+ type: 5126,
5352
+ size: 1,
5353
+ divisor: 0,
5354
+ normalized: false,
5355
+ integer: false
5356
+ };
5357
+ var Accessor = class {
5358
+ offset;
5359
+ stride;
5360
+ type;
5361
+ size;
5362
+ divisor;
5363
+ normalized;
5364
+ integer;
5365
+ buffer;
5366
+ index;
5367
+ static getBytesPerElement(accessor) {
5368
+ const ArrayType = getTypedArrayFromGLType2(accessor.type || 5126);
5369
+ return ArrayType.BYTES_PER_ELEMENT;
5370
+ }
5371
+ static getBytesPerVertex(accessor) {
5372
+ const ArrayType = getTypedArrayFromGLType2(accessor.type || 5126);
5373
+ return ArrayType.BYTES_PER_ELEMENT * accessor.size;
5374
+ }
5375
+ // Combines (merges) a list of accessors. On top of default values
5376
+ // Usually [programAccessor, bufferAccessor, appAccessor]
5377
+ // All props will be set in the returned object.
5378
+ // TODO check for conflicts between values in the supplied accessors
5379
+ static resolve(...accessors) {
5380
+ return new Accessor(...[DEFAULT_ACCESSOR_VALUES, ...accessors]);
5381
+ }
5382
+ constructor(...accessors) {
5383
+ import_core25.log.warn("Accessor will be removed in next minor release");
5384
+ accessors.forEach((accessor) => this._assign(accessor));
5385
+ Object.freeze(this);
5386
+ }
5387
+ toString() {
5388
+ return JSON.stringify(this);
5389
+ }
5390
+ // ACCESSORS
5391
+ // TODO - remove>
5392
+ get BYTES_PER_ELEMENT() {
5393
+ return Accessor.getBytesPerElement(this);
5394
+ }
5395
+ get BYTES_PER_VERTEX() {
5396
+ return Accessor.getBytesPerVertex(this);
5397
+ }
5398
+ // PRIVATE
5399
+ // eslint-disable-next-line complexity, max-statements
5400
+ _assign(props = {}) {
5401
+ if (props.type !== void 0) {
5402
+ this.type = props.type;
5403
+ if (props.type === 5124 || props.type === 5125) {
5404
+ this.integer = true;
5405
+ }
5406
+ }
5407
+ if (props.size !== void 0) {
5408
+ this.size = props.size;
5409
+ }
5410
+ if (props.offset !== void 0) {
5411
+ this.offset = props.offset;
5412
+ }
5413
+ if (props.stride !== void 0) {
5414
+ this.stride = props.stride;
5415
+ }
5416
+ if (props.normalize !== void 0) {
5417
+ this.normalized = props.normalize;
5418
+ }
5419
+ if (props.normalized !== void 0) {
5420
+ this.normalized = props.normalized;
5421
+ }
5422
+ if (props.integer !== void 0) {
5423
+ this.integer = props.integer;
5424
+ }
5425
+ if (props.divisor !== void 0) {
5426
+ this.divisor = props.divisor;
5427
+ }
5428
+ if (props.buffer !== void 0) {
5429
+ this.buffer = props.buffer;
5430
+ }
5431
+ if (props.index !== void 0) {
5432
+ if (typeof props.index === "boolean") {
5433
+ this.index = props.index ? 1 : 0;
5434
+ } else {
5435
+ this.index = props.index;
5436
+ }
5437
+ }
5438
+ if (props.instanced !== void 0) {
5439
+ this.divisor = props.instanced ? 1 : 0;
5440
+ }
5441
+ if (props.isInstanced !== void 0) {
5442
+ this.divisor = props.isInstanced ? 1 : 0;
5443
+ }
5444
+ if (this.offset === void 0)
5445
+ delete this.offset;
5446
+ if (this.stride === void 0)
5447
+ delete this.stride;
5448
+ if (this.type === void 0)
5449
+ delete this.type;
5450
+ if (this.size === void 0)
5451
+ delete this.size;
5452
+ if (this.divisor === void 0)
5453
+ delete this.divisor;
5454
+ if (this.normalized === void 0)
5455
+ delete this.normalized;
5456
+ if (this.integer === void 0)
5457
+ delete this.integer;
5458
+ if (this.buffer === void 0)
5459
+ delete this.buffer;
5460
+ if (this.index === void 0)
5461
+ delete this.index;
5462
+ return this;
5463
+ }
5464
+ };
5465
+ function getTypedArrayFromGLType2(glType, options) {
5466
+ const { clamped = true } = options || {};
5467
+ switch (glType) {
5468
+ case 5126:
5469
+ return Float32Array;
5470
+ case 5123:
5471
+ case 33635:
5472
+ case 32819:
5473
+ case 32820:
5474
+ return Uint16Array;
5475
+ case 5125:
5476
+ return Uint32Array;
5477
+ case 5121:
5478
+ return clamped ? Uint8ClampedArray : Uint8Array;
5479
+ case 5120:
5480
+ return Int8Array;
5481
+ case 5122:
5482
+ return Int16Array;
5483
+ case 5124:
5484
+ return Int32Array;
5485
+ default:
5486
+ throw new Error("Failed to deduce typed array type from GL constant");
5487
+ }
5488
+ }
5439
5489
  //# sourceMappingURL=index.cjs.map