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

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 (144) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  2. package/dist/adapter/converters/device-parameters.js +30 -12
  3. package/dist/adapter/converters/texture-formats.d.ts +22 -16
  4. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  5. package/dist/adapter/converters/texture-formats.js +39 -47
  6. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
  7. package/dist/adapter/device-helpers/webgl-device-features.js +1 -2
  8. package/dist/adapter/device-helpers/webgl-device-limits.js +1 -1
  9. package/dist/adapter/helpers/webgl-texture-utils.d.ts +300 -0
  10. package/dist/adapter/helpers/webgl-texture-utils.d.ts.map +1 -0
  11. package/dist/adapter/helpers/webgl-texture-utils.js +370 -0
  12. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
  13. package/dist/adapter/helpers/webgl-topology-utils.js +0 -4
  14. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  15. package/dist/adapter/resources/webgl-buffer.js +2 -2
  16. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  17. package/dist/adapter/resources/webgl-command-buffer.js +6 -9
  18. package/dist/adapter/resources/webgl-framebuffer.d.ts +32 -5
  19. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  20. package/dist/adapter/resources/webgl-framebuffer.js +42 -60
  21. package/dist/adapter/resources/webgl-render-pass.d.ts +3 -2
  22. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  23. package/dist/adapter/resources/webgl-render-pass.js +18 -7
  24. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  25. package/dist/adapter/resources/webgl-render-pipeline.js +46 -21
  26. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  27. package/dist/adapter/resources/webgl-shader.js +3 -3
  28. package/dist/adapter/resources/webgl-texture-view.d.ts +1 -1
  29. package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -1
  30. package/dist/adapter/resources/webgl-texture-view.js +1 -1
  31. package/dist/adapter/resources/webgl-texture.d.ts +76 -172
  32. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  33. package/dist/adapter/resources/webgl-texture.js +397 -511
  34. package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -2
  35. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
  36. package/dist/adapter/resources/webgl-vertex-array.js +2 -2
  37. package/dist/adapter/webgl-adapter.d.ts +21 -0
  38. package/dist/adapter/webgl-adapter.d.ts.map +1 -0
  39. package/dist/adapter/webgl-adapter.js +91 -0
  40. package/dist/adapter/webgl-canvas-context.d.ts +3 -1
  41. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  42. package/dist/adapter/webgl-canvas-context.js +2 -0
  43. package/dist/adapter/webgl-device.d.ts +19 -30
  44. package/dist/adapter/webgl-device.d.ts.map +1 -1
  45. package/dist/adapter/webgl-device.js +35 -114
  46. package/dist/classic/accessor.d.ts +22 -1
  47. package/dist/classic/accessor.d.ts.map +1 -1
  48. package/dist/classic/accessor.js +1 -9
  49. package/dist/classic/clear.d.ts.map +1 -1
  50. package/dist/classic/clear.js +2 -5
  51. package/dist/classic/copy-and-blit.d.ts +3 -1
  52. package/dist/classic/copy-and-blit.d.ts.map +1 -1
  53. package/dist/classic/copy-and-blit.js +21 -18
  54. package/dist/classic/format-utils.d.ts.map +1 -1
  55. package/dist/classic/format-utils.js +0 -3
  56. package/dist/classic/typed-array-utils.d.ts +1 -1
  57. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  58. package/dist/context/debug/spector-types.d.ts +1108 -0
  59. package/dist/context/debug/spector-types.d.ts.map +1 -0
  60. package/dist/context/debug/spector-types.js +697 -0
  61. package/dist/context/debug/spector.d.ts +12 -8
  62. package/dist/context/debug/spector.d.ts.map +1 -1
  63. package/dist/context/debug/spector.js +25 -18
  64. package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
  65. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  66. package/dist/context/debug/webgl-developer-tools.js +2 -5
  67. package/dist/context/parameters/webgl-parameter-tables.js +1 -1
  68. package/dist/context/polyfills/polyfill-webgl1-extensions.d.ts +9 -0
  69. package/dist/context/polyfills/polyfill-webgl1-extensions.d.ts.map +1 -0
  70. package/dist/context/polyfills/polyfill-webgl1-extensions.js +181 -0
  71. package/dist/context/state-tracker/webgl-state-tracker.d.ts +43 -0
  72. package/dist/context/state-tracker/webgl-state-tracker.d.ts.map +1 -0
  73. package/dist/context/state-tracker/{track-context-state.js → webgl-state-tracker.js} +46 -77
  74. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  75. package/dist/context/state-tracker/with-parameters.js +5 -4
  76. package/dist/dist.dev.js +1112 -1380
  77. package/dist/dist.min.js +2 -2
  78. package/dist/index.cjs +1122 -1284
  79. package/dist/index.cjs.map +4 -4
  80. package/dist/index.d.ts +3 -5
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +3 -5
  83. package/dist/utils/fill-array.d.ts +8 -0
  84. package/dist/utils/fill-array.d.ts.map +1 -0
  85. package/dist/utils/fill-array.js +26 -0
  86. package/dist/utils/load-script.d.ts +8 -0
  87. package/dist/utils/load-script.d.ts.map +1 -0
  88. package/dist/utils/load-script.js +26 -0
  89. package/dist/utils/split-uniforms-and-bindings.d.ts +9 -0
  90. package/dist/utils/split-uniforms-and-bindings.d.ts.map +1 -0
  91. package/dist/utils/split-uniforms-and-bindings.js +20 -0
  92. package/dist/utils/uid.d.ts +7 -0
  93. package/dist/utils/uid.d.ts.map +1 -0
  94. package/dist/utils/uid.js +14 -0
  95. package/package.json +6 -5
  96. package/src/adapter/converters/device-parameters.ts +31 -13
  97. package/src/adapter/converters/texture-formats.ts +51 -56
  98. package/src/adapter/device-helpers/webgl-device-features.ts +1 -2
  99. package/src/adapter/device-helpers/webgl-device-limits.ts +1 -1
  100. package/src/adapter/helpers/webgl-texture-utils.ts +484 -0
  101. package/src/adapter/helpers/webgl-topology-utils.ts +0 -4
  102. package/src/adapter/resources/webgl-buffer.ts +2 -2
  103. package/src/adapter/resources/webgl-command-buffer.ts +8 -10
  104. package/src/adapter/resources/webgl-framebuffer.ts +22 -56
  105. package/src/adapter/resources/webgl-render-pass.ts +21 -9
  106. package/src/adapter/resources/webgl-render-pipeline.ts +50 -24
  107. package/src/adapter/resources/webgl-shader.ts +4 -4
  108. package/src/adapter/resources/webgl-texture-view.ts +1 -3
  109. package/src/adapter/resources/webgl-texture.ts +445 -784
  110. package/src/adapter/resources/webgl-vertex-array.ts +8 -7
  111. package/src/adapter/webgl-adapter.ts +113 -0
  112. package/src/adapter/webgl-canvas-context.ts +4 -1
  113. package/src/adapter/webgl-device.ts +40 -151
  114. package/src/classic/accessor.ts +31 -11
  115. package/src/classic/clear.ts +3 -6
  116. package/src/classic/copy-and-blit.ts +32 -27
  117. package/src/classic/format-utils.ts +0 -3
  118. package/src/classic/typed-array-utils.ts +1 -1
  119. package/src/context/debug/spector-types.ts +1154 -0
  120. package/src/context/debug/spector.ts +40 -30
  121. package/src/context/debug/webgl-developer-tools.ts +3 -7
  122. package/src/context/parameters/webgl-parameter-tables.ts +3 -3
  123. package/src/context/polyfills/polyfill-webgl1-extensions.ts +202 -0
  124. package/src/context/state-tracker/{track-context-state.ts → webgl-state-tracker.ts} +57 -97
  125. package/src/context/state-tracker/with-parameters.ts +5 -4
  126. package/src/index.ts +5 -13
  127. package/src/utils/fill-array.ts +35 -0
  128. package/src/utils/load-script.ts +30 -0
  129. package/src/utils/split-uniforms-and-bindings.ts +31 -0
  130. package/src/utils/uid.ts +16 -0
  131. package/dist/adapter/objects/constants-to-keys.d.ts +0 -3
  132. package/dist/adapter/objects/constants-to-keys.d.ts.map +0 -1
  133. package/dist/adapter/objects/constants-to-keys.js +0 -22
  134. package/dist/adapter/objects/webgl-renderbuffer.d.ts +0 -43
  135. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +0 -1
  136. package/dist/adapter/objects/webgl-renderbuffer.js +0 -95
  137. package/dist/adapter/objects/webgl-resource.d.ts +0 -32
  138. package/dist/adapter/objects/webgl-resource.d.ts.map +0 -1
  139. package/dist/adapter/objects/webgl-resource.js +0 -114
  140. package/dist/context/state-tracker/track-context-state.d.ts +0 -22
  141. package/dist/context/state-tracker/track-context-state.d.ts.map +0 -1
  142. package/src/adapter/objects/constants-to-keys.ts +0 -27
  143. package/src/adapter/objects/webgl-renderbuffer.ts +0 -132
  144. package/src/adapter/objects/webgl-resource.ts +0 -183
@@ -1,4 +1,5 @@
1
- import type { Device, Buffer, VertexArrayProps, TypedArray } from '@luma.gl/core';
1
+ import type { TypedArray } from '@math.gl/types';
2
+ import type { Device, Buffer, VertexArrayProps } from '@luma.gl/core';
2
3
  import { VertexArray } from '@luma.gl/core';
3
4
  import { GL } from '@luma.gl/constants';
4
5
  import { WebGLDevice } from "../webgl-device.js";
@@ -12,7 +13,7 @@ export declare class WEBGLVertexArray extends VertexArray {
12
13
  private bufferValue;
13
14
  /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */
14
15
  static isConstantAttributeZeroSupported(device: Device): boolean;
15
- constructor(device: WebGLDevice, props?: VertexArrayProps);
16
+ constructor(device: WebGLDevice, props: VertexArrayProps);
16
17
  destroy(): void;
17
18
  /**
18
19
  // Set (bind/unbind) an elements buffer, for indexed rendering.
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAA6B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAGtC,OAAO,EA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,EAAE,MAAM,UAAO,GAAG,IAAI;IAiBxD;;;;;OAKG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;CA8BnE"}
@@ -1,11 +1,11 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { VertexArray, getScratchArray, fillArray } from '@luma.gl/core';
4
+ import { VertexArray, getScratchArray } from '@luma.gl/core';
5
5
  import { GL } from '@luma.gl/constants';
6
6
  import { getBrowser } from '@probe.gl/env';
7
7
  import { getGLFromVertexType } from "../converters/vertex-formats.js";
8
- // import {getGLFromVertexType} from '../converters/vertex-formats';
8
+ import { fillArray } from "../../utils/fill-array.js";
9
9
  /** VertexArrayObject wrapper */
10
10
  export class WEBGLVertexArray extends VertexArray {
11
11
  get [Symbol.toStringTag]() {
@@ -0,0 +1,21 @@
1
+ import { Adapter, Device, DeviceProps } from '@luma.gl/core';
2
+ import { WebGLDevice } from "./webgl-device.js";
3
+ export declare class WebGLAdapter extends Adapter {
4
+ /** type of device's created by this adapter */
5
+ readonly type: Device['type'];
6
+ constructor();
7
+ /** Check if WebGL 2 is available */
8
+ isSupported(): boolean;
9
+ /** Force any created WebGL contexts to be WebGL2 contexts, polyfilled with WebGL1 extensions */
10
+ enforceWebGL2(enable: boolean): void;
11
+ /**
12
+ * Get a device instance from a GL context
13
+ * Creates and instruments the device if not already created
14
+ * @param gl
15
+ * @returns
16
+ */
17
+ attach(gl: Device | WebGL2RenderingContext): Promise<WebGLDevice>;
18
+ create(props?: DeviceProps): Promise<WebGLDevice>;
19
+ }
20
+ export declare const webgl2Adapter: WebGLAdapter;
21
+ //# sourceMappingURL=webgl-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAO3C,qBAAa,YAAa,SAAQ,OAAO;IACvC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAW;;IAYxC,oCAAoC;IACpC,WAAW,IAAI,OAAO;IAItB,gGAAgG;IAChG,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAIpC;;;;;OAKG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC;IAejE,MAAM,CAAC,KAAK,GAAE,WAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;CA4C5D;AAWD,eAAO,MAAM,aAAa,cAAqB,CAAC"}
@@ -0,0 +1,91 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { Adapter, Device, CanvasContext, log } from '@luma.gl/core';
5
+ import { WebGLDevice } from "./webgl-device.js";
6
+ import { enforceWebGL2 } from "../context/polyfills/polyfill-webgl1-extensions.js";
7
+ import { loadSpectorJS, DEFAULT_SPECTOR_PROPS } from "../context/debug/spector.js";
8
+ import { loadWebGLDeveloperTools } from "../context/debug/webgl-developer-tools.js";
9
+ const LOG_LEVEL = 1;
10
+ export class WebGLAdapter extends Adapter {
11
+ /** type of device's created by this adapter */
12
+ type = 'webgl';
13
+ constructor() {
14
+ super();
15
+ // Add spector default props to device default props, so that runtime settings are observed
16
+ Device.defaultProps = { ...Device.defaultProps, ...DEFAULT_SPECTOR_PROPS };
17
+ // @ts-ignore DEPRECATED For backwards compatibility luma.registerDevices
18
+ WebGLDevice.adapter = this;
19
+ }
20
+ /** Check if WebGL 2 is available */
21
+ isSupported() {
22
+ return typeof WebGL2RenderingContext !== 'undefined';
23
+ }
24
+ /** Force any created WebGL contexts to be WebGL2 contexts, polyfilled with WebGL1 extensions */
25
+ enforceWebGL2(enable) {
26
+ enforceWebGL2(enable);
27
+ }
28
+ /**
29
+ * Get a device instance from a GL context
30
+ * Creates and instruments the device if not already created
31
+ * @param gl
32
+ * @returns
33
+ */
34
+ async attach(gl) {
35
+ if (gl instanceof WebGLDevice) {
36
+ return gl;
37
+ }
38
+ // @ts-expect-error
39
+ if (gl?.device instanceof Device) {
40
+ // @ts-expect-error
41
+ return gl.device;
42
+ }
43
+ if (!isWebGL(gl)) {
44
+ throw new Error('Invalid WebGL2RenderingContext');
45
+ }
46
+ return new WebGLDevice({ gl: gl });
47
+ }
48
+ async create(props = {}) {
49
+ log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created')();
50
+ const promises = [];
51
+ // Load webgl and spector debug scripts from CDN if requested
52
+ if (props.debug) {
53
+ promises.push(loadWebGLDeveloperTools());
54
+ }
55
+ if (props.debugWithSpectorJS) {
56
+ promises.push(loadSpectorJS(props));
57
+ }
58
+ // Wait for page to load: if canvas is a string we need to query the DOM for the canvas element.
59
+ // We only wait when props.canvas is string to avoids setting the global page onload callback unless necessary.
60
+ if (typeof props.canvas === 'string') {
61
+ promises.push(CanvasContext.pageLoaded);
62
+ }
63
+ // Wait for all the loads to settle before creating the context.
64
+ // The Device.create() functions are async, so in contrast to the constructor, we can `await` here.
65
+ const results = await Promise.allSettled(promises);
66
+ for (const result of results) {
67
+ if (result.status === 'rejected') {
68
+ log.error(`Failed to initialize debug libraries ${result.reason}`)();
69
+ }
70
+ }
71
+ log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
72
+ const device = new WebGLDevice(props);
73
+ // Log some debug info about the newly created context
74
+ const message = `\
75
+ Created ${device.type}${device.debug ? ' debug' : ''} context: \
76
+ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
77
+ log.probe(LOG_LEVEL, message)();
78
+ log.table(LOG_LEVEL, device.info)();
79
+ log.groupEnd(LOG_LEVEL)();
80
+ return device;
81
+ }
82
+ }
83
+ /** Check if supplied parameter is a WebGL2RenderingContext */
84
+ function isWebGL(gl) {
85
+ if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
86
+ return true;
87
+ }
88
+ // Look for debug contexts, headless gl etc
89
+ return Boolean(gl && Number.isFinite(gl._version));
90
+ }
91
+ export const webgl2Adapter = new WebGLAdapter();
@@ -1,4 +1,4 @@
1
- import type { CanvasContextProps } from '@luma.gl/core';
1
+ import type { CanvasContextProps, TextureFormat } from '@luma.gl/core';
2
2
  import { CanvasContext } from '@luma.gl/core';
3
3
  import { WebGLDevice } from "./webgl-device.js";
4
4
  import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
@@ -7,6 +7,8 @@ import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
7
7
  */
8
8
  export declare class WebGLCanvasContext extends CanvasContext {
9
9
  readonly device: WebGLDevice;
10
+ readonly format: TextureFormat;
11
+ readonly depthStencilFormat: TextureFormat;
10
12
  presentationSize: [number, number];
11
13
  private _framebuffer;
12
14
  constructor(device: WebGLDevice, props: CanvasContextProps);
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,OAAO,EAAC,gBAAgB,EAAC,yCAAsC;AAE/D;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,YAAY,CAAiC;gBAEzC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB;IAS1D,qBAAqB,IAAI,gBAAgB;IAOzC,sDAAsD;IACtD,MAAM;IAUN;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAW7F,MAAM;CAOP"}
1
+ {"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACrE,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,OAAO,EAAC,gBAAgB,EAAC,yCAAsC;AAE/D;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAgB;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,aAAa,CAAiB;IAE3D,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,YAAY,CAAiC;gBAEzC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB;IAS1D,qBAAqB,IAAI,gBAAgB;IAOzC,sDAAsD;IACtD,MAAM;IAUN;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAW7F,MAAM;CAOP"}
@@ -8,6 +8,8 @@ import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
8
8
  */
9
9
  export class WebGLCanvasContext extends CanvasContext {
10
10
  device;
11
+ format = 'rgba8unorm';
12
+ depthStencilFormat = 'depth24plus';
11
13
  presentationSize;
12
14
  _framebuffer = null;
13
15
  constructor(device, props) {
@@ -1,14 +1,16 @@
1
- import type { DeviceProps, DeviceInfo, CanvasContextProps, TextureFormat, VertexArray, VertexArrayProps, Framebuffer, Buffer, Texture, TypedArray } from '@luma.gl/core';
1
+ import type { TypedArray } from '@math.gl/types';
2
+ import type { DeviceProps, DeviceInfo, CanvasContextProps, TextureFormat } from '@luma.gl/core';
3
+ import type { Buffer, Texture, Framebuffer, VertexArray, VertexArrayProps } from '@luma.gl/core';
2
4
  import { Device, CanvasContext } from '@luma.gl/core';
3
5
  import type { GLExtensions } from '@luma.gl/constants';
4
6
  import { WebGLDeviceFeatures } from "./device-helpers/webgl-device-features.js";
5
7
  import { WebGLDeviceLimits } from "./device-helpers/webgl-device-limits.js";
6
8
  import { WebGLCanvasContext } from "./webgl-canvas-context.js";
9
+ import type { Spector } from "../context/debug/spector-types.js";
7
10
  import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps, CommandEncoderProps, TransformFeedbackProps, QuerySetProps } from '@luma.gl/core';
8
11
  import { WEBGLBuffer } from "./resources/webgl-buffer.js";
9
12
  import { WEBGLShader } from "./resources/webgl-shader.js";
10
13
  import { WEBGLSampler } from "./resources/webgl-sampler.js";
11
- import { WEBGLTexture } from "./resources/webgl-texture.js";
12
14
  import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
13
15
  import { WEBGLRenderPass } from "./resources/webgl-render-pass.js";
14
16
  import { WEBGLRenderPipeline } from "./resources/webgl-render-pipeline.js";
@@ -17,8 +19,6 @@ import { WEBGLTransformFeedback } from "./resources/webgl-transform-feedback.js"
17
19
  import { WEBGLQuerySet } from "./resources/webgl-query-set.js";
18
20
  /** WebGPU style Device API for a WebGL context */
19
21
  export declare class WebGLDevice extends Device {
20
- /** type of this device */
21
- static readonly type: string;
22
22
  /** type of this device */
23
23
  readonly type = "webgl";
24
24
  /** The underlying WebGL context */
@@ -32,16 +32,20 @@ export declare class WebGLDevice extends Device {
32
32
  message: string;
33
33
  }>;
34
34
  private _resolveContextLost?;
35
- /** Check if WebGL 2 is available */
36
- static isSupported(): boolean;
37
- /**
38
- * Get a device instance from a GL context
39
- * Creates and instruments the device if not already created
40
- * @param gl
41
- * @returns
42
- */
43
- static attach(gl: Device | WebGL2RenderingContext): WebGLDevice;
44
- static create(props?: DeviceProps): Promise<WebGLDevice>;
35
+ /** WebGL2 context. */
36
+ readonly gl: WebGL2RenderingContext;
37
+ readonly debug: boolean;
38
+ /** State used by luma.gl classes: TODO - move to canvasContext*/
39
+ readonly _canvasSizeInfo: {
40
+ clientWidth: number;
41
+ clientHeight: number;
42
+ devicePixelRatio: number;
43
+ };
44
+ /** State used by luma.gl classes - TODO - not used? */
45
+ readonly _extensions: GLExtensions;
46
+ _polyfilled: boolean;
47
+ /** Instance of Spector.js (if initialized) */
48
+ spectorJS: Spector;
45
49
  constructor(props: DeviceProps);
46
50
  /**
47
51
  * Destroys the context
@@ -49,13 +53,12 @@ export declare class WebGLDevice extends Device {
49
53
  */
50
54
  destroy(): void;
51
55
  get isLost(): boolean;
52
- getSize(): [number, number];
53
56
  isTextureFormatSupported(format: TextureFormat): boolean;
54
57
  isTextureFormatFilterable(format: TextureFormat): boolean;
55
58
  isTextureFormatRenderable(format: TextureFormat): boolean;
56
59
  createCanvasContext(props?: CanvasContextProps): CanvasContext;
57
60
  createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer;
58
- _createTexture(props: TextureProps): WEBGLTexture;
61
+ _createTexture(props: TextureProps): Texture;
59
62
  createExternalTexture(props: ExternalTextureProps): ExternalTexture;
60
63
  createSampler(props: SamplerProps): WEBGLSampler;
61
64
  createShader(props: ShaderProps): WEBGLShader;
@@ -107,20 +110,6 @@ export declare class WebGLDevice extends Device {
107
110
  stencil?: any;
108
111
  }): void;
109
112
  resetWebGL(): void;
110
- /** WebGL2 context. */
111
- readonly gl: WebGL2RenderingContext;
112
- readonly debug: boolean;
113
- /** State used by luma.gl classes: TODO - move to canvasContext*/
114
- readonly _canvasSizeInfo: {
115
- clientWidth: number;
116
- clientHeight: number;
117
- devicePixelRatio: number;
118
- };
119
- /** State used by luma.gl classes - TODO - not used? */
120
- readonly _extensions: GLExtensions;
121
- _polyfilled: boolean;
122
- /** Instance of Spector.js (if initialized) */
123
- spectorJS: unknown;
124
113
  /**
125
114
  * Triggers device (or WebGL context) loss.
126
115
  * @note primarily intended for testing how application reacts to device loss
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,OAAO,EACP,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,aAAa,EAAmB,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EAAC,mBAAmB,EAAC,kDAA+C;AAC3E,OAAO,EAAC,iBAAiB,EAAC,gDAA6C;AACvE,OAAO,EAAC,kBAAkB,EAAC,kCAA+B;AAU1D,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAEhB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EAEpB,eAAe,EACf,WAAW,EACX,gBAAgB,EAEhB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,WAAW,EAAC,oCAAiC;AACrD,OAAO,EAAC,WAAW,EAAC,oCAAiC;AACrD,OAAO,EAAC,YAAY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AW,CAAC,EAAE,WAAW,CAAC;QAC1B,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,OAAO,CAAC,EAAE,GAAG,CAAC;KACf,GAAG,IAAI;IAIC,UAAU,IAAI,IAAI;IAS3B;;;OAGG;IACM,UAAU,IAAI,OAAO;IAgB9B,8DAA8D;IAC9D,SAAS,IAAI,IAAI;IAKjB,8CAA8C;IAC9C,QAAQ,IAAI,IAAI;IAKhB;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMlE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAc7D,sBAAsB;IACtB,UAAU,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;IAElC;;;;;OAKG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI;IA2BvE,gDAAgD;IAChD,YAAY,CAAC,IAAI,EAAE,MAAM,YAAY,GAAG,YAAY;CAIrD"}
@@ -1,16 +1,17 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { Device, CanvasContext, log, uid, assert } from '@luma.gl/core';
5
- import { popContextState, pushContextState, trackContextState } from "../context/state-tracker/track-context-state.js";
4
+ import { Device, log } from '@luma.gl/core';
5
+ import { WebGLStateTracker } from "../context/state-tracker/webgl-state-tracker.js";
6
6
  import { createBrowserContext } from "../context/helpers/create-browser-context.js";
7
7
  import { getDeviceInfo } from "./device-helpers/webgl-device-info.js";
8
8
  import { WebGLDeviceFeatures } from "./device-helpers/webgl-device-features.js";
9
9
  import { WebGLDeviceLimits } from "./device-helpers/webgl-device-limits.js";
10
10
  import { WebGLCanvasContext } from "./webgl-canvas-context.js";
11
- import { loadSpectorJS, initializeSpectorJS } from "../context/debug/spector.js";
12
- import { loadWebGLDeveloperTools, makeDebugContext } from "../context/debug/webgl-developer-tools.js";
11
+ import { initializeSpectorJS } from "../context/debug/spector.js";
12
+ import { makeDebugContext } from "../context/debug/webgl-developer-tools.js";
13
13
  import { isTextureFormatSupported, isTextureFormatRenderable, isTextureFormatFilterable } from "./converters/texture-formats.js";
14
+ import { uid } from "../utils/uid.js";
14
15
  import { WEBGLBuffer } from "./resources/webgl-buffer.js";
15
16
  import { WEBGLShader } from "./resources/webgl-shader.js";
16
17
  import { WEBGLSampler } from "./resources/webgl-sampler.js";
@@ -27,15 +28,12 @@ import { setGLParameters, getGLParameters, resetGLParameters } from "../context/
27
28
  import { withGLParameters } from "../context/state-tracker/with-parameters.js";
28
29
  import { clear } from "../classic/clear.js";
29
30
  import { getWebGLExtension } from "../context/helpers/webgl-extensions.js";
30
- const LOG_LEVEL = 1;
31
31
  /** WebGPU style Device API for a WebGL context */
32
32
  export class WebGLDevice extends Device {
33
33
  //
34
34
  // Public `Device` API
35
35
  //
36
36
  /** type of this device */
37
- static type = 'webgl';
38
- /** type of this device */
39
37
  type = 'webgl';
40
38
  /** The underlying WebGL context */
41
39
  handle;
@@ -45,72 +43,16 @@ export class WebGLDevice extends Device {
45
43
  canvasContext;
46
44
  lost;
47
45
  _resolveContextLost;
48
- //
49
- // Static methods, expected to be present by `luma.createDevice()`
50
- //
51
- /** Check if WebGL 2 is available */
52
- static isSupported() {
53
- return typeof WebGL2RenderingContext !== 'undefined';
54
- }
55
- /**
56
- * Get a device instance from a GL context
57
- * Creates and instruments the device if not already created
58
- * @param gl
59
- * @returns
60
- */
61
- static attach(gl) {
62
- if (gl instanceof WebGLDevice) {
63
- return gl;
64
- }
65
- // @ts-expect-error
66
- if (gl?.device instanceof Device) {
67
- // @ts-expect-error
68
- return gl.device;
69
- }
70
- if (!isWebGL(gl)) {
71
- throw new Error('Invalid WebGL2RenderingContext');
72
- }
73
- return new WebGLDevice({ gl: gl });
74
- }
75
- static async create(props = {}) {
76
- log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created')();
77
- const promises = [];
78
- // Load webgl and spector debug scripts from CDN if requested
79
- if (props.debug) {
80
- promises.push(loadWebGLDeveloperTools());
81
- }
82
- if (props.spector) {
83
- promises.push(loadSpectorJS());
84
- }
85
- // Wait for page to load: if canvas is a string we need to query the DOM for the canvas element.
86
- // We only wait when props.canvas is string to avoids setting the global page onload callback unless necessary.
87
- if (typeof props.canvas === 'string') {
88
- promises.push(CanvasContext.pageLoaded);
89
- }
90
- // Wait for all the loads to settle before creating the context.
91
- // The Device.create() functions are async, so in contrast to the constructor, we can `await` here.
92
- const results = await Promise.allSettled(promises);
93
- for (const result of results) {
94
- if (result.status === 'rejected') {
95
- log.error(`Failed to initialize debug libraries ${result.reason}`)();
96
- }
97
- }
98
- log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
99
- // @ts-expect-error
100
- if (props.gl?.device) {
101
- log.warn('reattaching existing device')();
102
- return WebGLDevice.attach(props.gl);
103
- }
104
- const device = new WebGLDevice(props);
105
- // Log some debug info about the newly created context
106
- const message = `\
107
- Created ${device.type}${device.debug ? ' debug' : ''} context: \
108
- ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
109
- log.probe(LOG_LEVEL, message)();
110
- log.table(LOG_LEVEL, device.info)();
111
- log.groupEnd(LOG_LEVEL)();
112
- return device;
113
- }
46
+ /** WebGL2 context. */
47
+ gl;
48
+ debug = false;
49
+ /** State used by luma.gl classes: TODO - move to canvasContext*/
50
+ _canvasSizeInfo = { clientWidth: 0, clientHeight: 0, devicePixelRatio: 1 };
51
+ /** State used by luma.gl classes - TODO - not used? */
52
+ _extensions = {};
53
+ _polyfilled = false;
54
+ /** Instance of Spector.js (if initialized) */
55
+ spectorJS;
114
56
  //
115
57
  // Public API
116
58
  //
@@ -128,25 +70,25 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
128
70
  this.lost = new Promise(resolve => {
129
71
  this._resolveContextLost = resolve;
130
72
  });
131
- let gl = props.gl || null;
132
- gl ||= createBrowserContext(this.canvasContext.canvas, {
73
+ this.handle = createBrowserContext(this.canvasContext.canvas, {
133
74
  ...props,
134
75
  onContextLost: (event) => this._resolveContextLost?.({
135
76
  reason: 'destroyed',
136
77
  message: 'Entered sleep mode, or too many apps or browser tabs are using the GPU.'
137
78
  })
138
79
  });
139
- if (!gl) {
80
+ this.gl = this.handle;
81
+ if (!this.handle) {
140
82
  throw new Error('WebGL context creation failed');
141
83
  }
142
- this.handle = gl;
143
- this.gl = gl;
84
+ // Add spector debug instrumentation to context
85
+ // We need to trust spector integration to decide if spector should be initialized
86
+ // We also run spector instrumentation first, otherwise spector can clobber luma instrumentation.
87
+ this.spectorJS = initializeSpectorJS({ ...this.props, gl: this.handle });
88
+ // Instrument context
144
89
  this.gl.device = this; // Update GL context: Link webgl context back to device
145
90
  this.gl._version = 2; // Update GL context: Store WebGL version field on gl context (HACK to identify debug contexts)
146
- if (props.spector) {
147
- this.spectorJS = initializeSpectorJS({ ...this.props, canvas: this.handle.canvas });
148
- }
149
- // luma Device fields
91
+ // initialize luma Device fields
150
92
  this.info = getDeviceInfo(this.gl, this._extensions);
151
93
  this.limits = new WebGLDeviceLimits(this.gl);
152
94
  this.features = new WebGLDeviceFeatures(this.gl, this._extensions, this.props.disabledFeatures);
@@ -155,14 +97,11 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
155
97
  }
156
98
  this.canvasContext.resize();
157
99
  // Install context state tracking
158
- // @ts-expect-error - hidden parameters
159
- const { enable = true, copyState = false } = props;
160
- trackContextState(this.gl, {
161
- enable,
162
- copyState,
100
+ const glState = new WebGLStateTracker(this.gl, {
163
101
  log: (...args) => log.log(1, ...args)()
164
102
  });
165
- // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1
103
+ glState.trackState(this.gl, { copyState: false });
104
+ // DEBUG contexts: Add luma debug instrumentation to the context, force log level to at least 1
166
105
  if (props.debug) {
167
106
  this.gl = makeDebugContext(this.gl, { ...props, throwOnError: true });
168
107
  this.debug = true;
@@ -178,9 +117,6 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
178
117
  get isLost() {
179
118
  return this.gl.isContextLost();
180
119
  }
181
- getSize() {
182
- return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];
183
- }
184
120
  isTextureFormatSupported(format) {
185
121
  return isTextureFormatSupported(this.gl, format, this._extensions);
186
122
  }
@@ -198,6 +134,7 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
198
134
  const newProps = this._getBufferProps(props);
199
135
  return new WEBGLBuffer(this, newProps);
200
136
  }
137
+ // _createTexture(props: TextureProps): WEBGLTexture {
201
138
  _createTexture(props) {
202
139
  return new WEBGLTexture(this, props);
203
140
  }
@@ -235,7 +172,7 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
235
172
  throw new Error('ComputePass not supported in WebGL');
236
173
  }
237
174
  renderPass = null;
238
- createCommandEncoder(props) {
175
+ createCommandEncoder(props = {}) {
239
176
  return new WEBGLCommandEncoder(this, props);
240
177
  }
241
178
  /**
@@ -278,16 +215,6 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
278
215
  //
279
216
  // WebGL-only API (not part of `Device` API)
280
217
  //
281
- /** WebGL2 context. */
282
- gl;
283
- debug = false;
284
- /** State used by luma.gl classes: TODO - move to canvasContext*/
285
- _canvasSizeInfo = { clientWidth: 0, clientHeight: 0, devicePixelRatio: 1 };
286
- /** State used by luma.gl classes - TODO - not used? */
287
- _extensions = {};
288
- _polyfilled = false;
289
- /** Instance of Spector.js (if initialized) */
290
- spectorJS;
291
218
  /**
292
219
  * Triggers device (or WebGL context) loss.
293
220
  * @note primarily intended for testing how application reacts to device loss
@@ -309,11 +236,13 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
309
236
  }
310
237
  /** Save current WebGL context state onto an internal stack */
311
238
  pushState() {
312
- pushContextState(this.gl);
239
+ const webglState = WebGLStateTracker.get(this.gl);
240
+ webglState.push();
313
241
  }
314
242
  /** Restores previously saved context state */
315
243
  popState() {
316
- popContextState(this.gl);
244
+ const webglState = WebGLStateTracker.get(this.gl);
245
+ webglState.pop();
317
246
  }
318
247
  /**
319
248
  * Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension
@@ -369,7 +298,7 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
369
298
  setConstantUintArray(this, location, constant);
370
299
  break;
371
300
  default:
372
- assert(false);
301
+ throw new Error('constant');
373
302
  }
374
303
  }
375
304
  /** Ensure extensions are only requested once */
@@ -378,14 +307,6 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
378
307
  return this._extensions;
379
308
  }
380
309
  }
381
- /** Check if supplied parameter is a WebGL2RenderingContext */
382
- function isWebGL(gl) {
383
- if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
384
- return true;
385
- }
386
- // Look for debug contexts, headless gl etc
387
- return Boolean(gl && Number.isFinite(gl._version));
388
- }
389
310
  /** Set constant float array attribute */
390
311
  function setConstantFloatArray(device, location, array) {
391
312
  switch (array.length) {
@@ -402,7 +323,7 @@ function setConstantFloatArray(device, location, array) {
402
323
  device.gl.vertexAttrib4fv(location, array);
403
324
  break;
404
325
  default:
405
- assert(false);
326
+ // assert(false);
406
327
  }
407
328
  }
408
329
  /** Set constant signed int array attribute */
@@ -1,5 +1,26 @@
1
- import { Buffer, AccessorObject } from '@luma.gl/core';
1
+ import { Buffer } from '@luma.gl/core';
2
2
  import { GL } from '@luma.gl/constants';
3
+ /**
4
+ * Attribute descriptor object
5
+ * @deprecated Use ShaderLayout
6
+ */
7
+ export interface AccessorObject {
8
+ buffer?: Buffer;
9
+ offset?: number;
10
+ stride?: number;
11
+ /** @deprecated - Use accessor.stepMode */
12
+ divisor?: number;
13
+ /** @deprecated - Infer from format */
14
+ type?: number;
15
+ /** @deprecated - Infer from format */
16
+ size?: number;
17
+ /** @deprecated - Infer from format */
18
+ normalized?: boolean;
19
+ /** @deprecated - Infer from format */
20
+ integer?: boolean;
21
+ /** @deprecated */
22
+ index?: number;
23
+ }
3
24
  declare const DEFAULT_ACCESSOR_VALUES: {
4
25
  offset: number;
5
26
  stride: number;
@@ -1 +1 @@
1
- {"version":3,"file":"accessor.d.ts","sourceRoot":"","sources":["../../src/classic/accessor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,MAAM,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAGtC,QAAA,MAAM,uBAAuB;;;;;;;;CAQ5B,CAAC;AASF,qBAAa,QAAS,YAAW,cAAc;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,GAAG,MAAM;IAOtE,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM;IAY1D,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,GAAG,QAAQ;gBAI5C,GAAG,SAAS,EAAE,cAAc,EAAE;IAK1C,QAAQ,IAAI,MAAM;IAOlB,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAKD,OAAO,CAAC,KA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,EAAE,cAAc,GAAG,MAAM;IAY1D,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,GAAG,QAAQ;gBAI5C,GAAG,SAAS,EAAE,cAAc,EAAE;IAK1C,QAAQ,IAAI,MAAM;IAOlB,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAKD,OAAO,CAAC,KAAK,GAAE,cAAmB,GAAG,IAAI;CA2E1C;AAGD,OAAO,EAAC,uBAAuB,EAAC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  // luma.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { assert, checkProps } from '@luma.gl/core';
5
4
  import { GL } from '@luma.gl/constants';
6
5
  import { getTypedArrayFromGLType } from "./typed-array-utils.js";
7
6
  const DEFAULT_ACCESSOR_VALUES = {
@@ -13,12 +12,6 @@ const DEFAULT_ACCESSOR_VALUES = {
13
12
  normalized: false,
14
13
  integer: false
15
14
  };
16
- const PROP_CHECKS = {
17
- deprecatedProps: {
18
- instanced: 'divisor',
19
- isInstanced: 'divisor'
20
- }
21
- };
22
15
  export class Accessor {
23
16
  offset;
24
17
  stride;
@@ -36,7 +29,7 @@ export class Accessor {
36
29
  return ArrayType.BYTES_PER_ELEMENT;
37
30
  }
38
31
  static getBytesPerVertex(accessor) {
39
- assert(accessor.size);
32
+ // assert(accessor.size);
40
33
  // TODO: using `FLOAT` when type is not specified,
41
34
  // ensure this assumption is valid or force API to specify type.
42
35
  const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
@@ -67,7 +60,6 @@ export class Accessor {
67
60
  // PRIVATE
68
61
  // eslint-disable-next-line complexity, max-statements
69
62
  _assign(props = {}) {
70
- props = checkProps('Accessor', props, PROP_CHECKS);
71
63
  if (props.type !== undefined) {
72
64
  this.type = props.type;
73
65
  // Auto-deduce integer type?