@luma.gl/webgl 9.0.0-beta.3 → 9.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/adapter/converters/device-parameters.js +240 -158
  2. package/dist/adapter/converters/sampler-parameters.d.ts +0 -4
  3. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  4. package/dist/adapter/converters/sampler-parameters.js +73 -68
  5. package/dist/adapter/converters/shader-formats.js +33 -46
  6. package/dist/adapter/converters/texture-formats.d.ts +9 -18
  7. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  8. package/dist/adapter/converters/texture-formats.js +454 -871
  9. package/dist/adapter/converters/vertex-formats.js +52 -61
  10. package/dist/adapter/device-helpers/device-features.d.ts +2 -5
  11. package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
  12. package/dist/adapter/device-helpers/device-features.js +56 -87
  13. package/dist/adapter/device-helpers/device-limits.d.ts +2 -4
  14. package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
  15. package/dist/adapter/device-helpers/device-limits.js +88 -83
  16. package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
  17. package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
  18. package/dist/adapter/device-helpers/get-device-info.js +79 -63
  19. package/dist/adapter/device-helpers/webgl-device-features.d.ts +6 -0
  20. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -0
  21. package/dist/adapter/device-helpers/webgl-device-features.js +52 -0
  22. package/dist/adapter/device-helpers/webgl-device-info.d.ts +4 -0
  23. package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -0
  24. package/dist/adapter/device-helpers/webgl-device-info.js +87 -0
  25. package/dist/adapter/device-helpers/webgl-device-limits.d.ts +50 -0
  26. package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -0
  27. package/dist/adapter/device-helpers/webgl-device-limits.js +92 -0
  28. package/dist/adapter/helpers/decode-webgl-types.js +87 -76
  29. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
  30. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  31. package/dist/adapter/helpers/get-shader-layout.js +261 -226
  32. package/dist/adapter/helpers/parse-shader-compiler-log.js +46 -37
  33. package/dist/adapter/helpers/set-uniform.d.ts +1 -1
  34. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  35. package/dist/adapter/helpers/set-uniform.js +67 -82
  36. package/dist/adapter/helpers/webgl-topology-utils.js +77 -93
  37. package/dist/adapter/objects/constants-to-keys.d.ts +1 -1
  38. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  39. package/dist/adapter/objects/constants-to-keys.js +18 -12
  40. package/dist/adapter/objects/webgl-renderbuffer.js +76 -80
  41. package/dist/adapter/objects/webgl-resource.d.ts +1 -1
  42. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  43. package/dist/adapter/objects/webgl-resource.js +204 -154
  44. package/dist/adapter/resources/webgl-buffer.d.ts +2 -3
  45. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  46. package/dist/adapter/resources/webgl-buffer.js +160 -119
  47. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  48. package/dist/adapter/resources/webgl-command-buffer.js +268 -171
  49. package/dist/adapter/resources/webgl-command-encoder.js +32 -40
  50. package/dist/adapter/resources/webgl-external-texture.js +92 -1
  51. package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
  52. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  53. package/dist/adapter/resources/webgl-framebuffer.js +167 -139
  54. package/dist/adapter/resources/webgl-render-pass.js +121 -95
  55. package/dist/adapter/resources/webgl-render-pipeline.d.ts +11 -1
  56. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  57. package/dist/adapter/resources/webgl-render-pipeline.js +378 -228
  58. package/dist/adapter/resources/webgl-sampler.d.ts +0 -2
  59. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  60. package/dist/adapter/resources/webgl-sampler.js +43 -34
  61. package/dist/adapter/resources/webgl-shader.d.ts +10 -1
  62. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  63. package/dist/adapter/resources/webgl-shader.js +106 -45
  64. package/dist/adapter/resources/webgl-texture.d.ts +2 -6
  65. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  66. package/dist/adapter/resources/webgl-texture.js +614 -699
  67. package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
  68. package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
  69. package/dist/adapter/resources/webgl-transform-feedback.js +143 -145
  70. package/dist/adapter/resources/webgl-vertex-array.d.ts +1 -1
  71. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
  72. package/dist/adapter/resources/webgl-vertex-array.js +229 -158
  73. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  74. package/dist/adapter/webgl-canvas-context.js +58 -37
  75. package/dist/adapter/webgl-device.d.ts +7 -15
  76. package/dist/adapter/webgl-device.d.ts.map +1 -1
  77. package/dist/adapter/webgl-device.js +440 -381
  78. package/dist/classic/accessor.js +132 -102
  79. package/dist/classic/clear.d.ts +2 -2
  80. package/dist/classic/clear.d.ts.map +1 -1
  81. package/dist/classic/clear.js +73 -73
  82. package/dist/classic/copy-and-blit.d.ts.map +1 -1
  83. package/dist/classic/copy-and-blit.js +176 -177
  84. package/dist/classic/format-utils.d.ts +2 -2
  85. package/dist/classic/format-utils.js +38 -32
  86. package/dist/classic/typed-array-utils.js +95 -81
  87. package/dist/context/{polyfill → context}/context-data.d.ts +2 -1
  88. package/dist/context/context/context-data.d.ts.map +1 -0
  89. package/dist/context/context/context-data.js +33 -0
  90. package/dist/context/context/create-browser-context.d.ts +1 -6
  91. package/dist/context/context/create-browser-context.d.ts.map +1 -1
  92. package/dist/context/context/create-browser-context.js +62 -49
  93. package/dist/context/debug/spector.js +54 -50
  94. package/dist/context/debug/webgl-developer-tools.d.ts +1 -2
  95. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  96. package/dist/context/debug/webgl-developer-tools.js +102 -76
  97. package/dist/context/parameters/unified-parameter-api.d.ts +3 -3
  98. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  99. package/dist/context/parameters/unified-parameter-api.js +95 -46
  100. package/dist/context/parameters/webgl-parameter-tables.d.ts +110 -99
  101. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  102. package/dist/context/parameters/webgl-parameter-tables.js +456 -404
  103. package/dist/context/state-tracker/deep-array-equal.js +18 -14
  104. package/dist/context/state-tracker/track-context-state.d.ts +4 -4
  105. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  106. package/dist/context/state-tracker/track-context-state.js +190 -126
  107. package/dist/context/state-tracker/with-parameters.d.ts +1 -1
  108. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  109. package/dist/context/state-tracker/with-parameters.js +45 -29
  110. package/dist/dist.dev.js +2568 -3786
  111. package/dist/index.cjs +1346 -2464
  112. package/dist/index.cjs.map +7 -0
  113. package/dist/index.d.ts +2 -5
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +36 -26
  116. package/dist/types.js +2 -1
  117. package/dist.min.js +9 -42
  118. package/package.json +11 -15
  119. package/src/adapter/converters/device-parameters.ts +0 -1
  120. package/src/adapter/converters/sampler-parameters.ts +0 -17
  121. package/src/adapter/converters/texture-formats.ts +86 -154
  122. package/src/adapter/device-helpers/webgl-device-features.ts +69 -0
  123. package/src/adapter/device-helpers/{get-device-info.ts → webgl-device-info.ts} +3 -4
  124. package/src/adapter/device-helpers/{device-limits.ts → webgl-device-limits.ts} +25 -23
  125. package/src/adapter/helpers/get-shader-layout.ts +17 -28
  126. package/src/adapter/helpers/set-uniform.ts +1 -3
  127. package/src/adapter/objects/constants-to-keys.ts +1 -1
  128. package/src/adapter/objects/webgl-renderbuffer.ts +4 -4
  129. package/src/adapter/objects/webgl-resource.ts +3 -18
  130. package/src/adapter/resources/webgl-buffer.ts +6 -11
  131. package/src/adapter/resources/webgl-command-buffer.ts +20 -30
  132. package/src/adapter/resources/webgl-external-texture.ts +2 -3
  133. package/src/adapter/resources/webgl-framebuffer.ts +4 -5
  134. package/src/adapter/resources/webgl-render-pass.ts +7 -7
  135. package/src/adapter/resources/webgl-render-pipeline.ts +106 -31
  136. package/src/adapter/resources/webgl-sampler.ts +5 -9
  137. package/src/adapter/resources/webgl-shader.ts +57 -10
  138. package/src/adapter/resources/webgl-texture.ts +29 -103
  139. package/src/adapter/resources/webgl-transform-feedback.ts +14 -15
  140. package/src/adapter/resources/webgl-vertex-array.ts +16 -18
  141. package/src/adapter/webgl-canvas-context.ts +1 -7
  142. package/src/adapter/webgl-device.ts +18 -67
  143. package/src/classic/clear.ts +13 -14
  144. package/src/classic/copy-and-blit.ts +1 -2
  145. package/src/context/context/context-data.ts +44 -0
  146. package/src/context/context/create-browser-context.ts +7 -32
  147. package/src/context/debug/webgl-developer-tools.ts +6 -8
  148. package/src/context/parameters/unified-parameter-api.ts +3 -3
  149. package/src/context/parameters/webgl-parameter-tables.ts +66 -75
  150. package/src/context/state-tracker/track-context-state.ts +18 -17
  151. package/src/context/state-tracker/with-parameters.ts +1 -1
  152. package/src/index.ts +2 -17
  153. package/dist/adapter/converters/device-parameters.js.map +0 -1
  154. package/dist/adapter/converters/sampler-parameters.js.map +0 -1
  155. package/dist/adapter/converters/shader-formats.js.map +0 -1
  156. package/dist/adapter/converters/texture-formats.js.map +0 -1
  157. package/dist/adapter/converters/vertex-formats.js.map +0 -1
  158. package/dist/adapter/device-helpers/device-features.js.map +0 -1
  159. package/dist/adapter/device-helpers/device-limits.js.map +0 -1
  160. package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
  161. package/dist/adapter/device-helpers/is-old-ie.d.ts +0 -2
  162. package/dist/adapter/device-helpers/is-old-ie.d.ts.map +0 -1
  163. package/dist/adapter/device-helpers/is-old-ie.js +0 -9
  164. package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
  165. package/dist/adapter/helpers/decode-webgl-types.js.map +0 -1
  166. package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
  167. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  168. package/dist/adapter/helpers/set-uniform.js.map +0 -1
  169. package/dist/adapter/helpers/webgl-topology-utils.js.map +0 -1
  170. package/dist/adapter/objects/constants-to-keys.js.map +0 -1
  171. package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
  172. package/dist/adapter/objects/webgl-resource.js.map +0 -1
  173. package/dist/adapter/resources/webgl-buffer.js.map +0 -1
  174. package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
  175. package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
  176. package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
  177. package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
  178. package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
  179. package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
  180. package/dist/adapter/resources/webgl-sampler.js.map +0 -1
  181. package/dist/adapter/resources/webgl-shader.js.map +0 -1
  182. package/dist/adapter/resources/webgl-texture.js.map +0 -1
  183. package/dist/adapter/resources/webgl-transform-feedback.js.map +0 -1
  184. package/dist/adapter/resources/webgl-vertex-array.js.map +0 -1
  185. package/dist/adapter/webgl-canvas-context.js.map +0 -1
  186. package/dist/adapter/webgl-device.js.map +0 -1
  187. package/dist/classic/accessor.js.map +0 -1
  188. package/dist/classic/clear.js.map +0 -1
  189. package/dist/classic/copy-and-blit.js.map +0 -1
  190. package/dist/classic/format-utils.js.map +0 -1
  191. package/dist/classic/typed-array-utils.js.map +0 -1
  192. package/dist/context/context/create-browser-context.js.map +0 -1
  193. package/dist/context/context/create-headless-context.d.ts +0 -9
  194. package/dist/context/context/create-headless-context.d.ts.map +0 -1
  195. package/dist/context/context/create-headless-context.js +0 -42
  196. package/dist/context/context/create-headless-context.js.map +0 -1
  197. package/dist/context/context/webgl-checks.d.ts +0 -13
  198. package/dist/context/context/webgl-checks.d.ts.map +0 -1
  199. package/dist/context/context/webgl-checks.js +0 -31
  200. package/dist/context/context/webgl-checks.js.map +0 -1
  201. package/dist/context/debug/spector.js.map +0 -1
  202. package/dist/context/debug/webgl-developer-tools.js.map +0 -1
  203. package/dist/context/parameters/unified-parameter-api.js.map +0 -1
  204. package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
  205. package/dist/context/polyfill/context-data.d.ts.map +0 -1
  206. package/dist/context/polyfill/context-data.js +0 -12
  207. package/dist/context/polyfill/context-data.js.map +0 -1
  208. package/dist/context/polyfill/get-parameter-polyfill.d.ts +0 -2
  209. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +0 -1
  210. package/dist/context/polyfill/get-parameter-polyfill.js +0 -85
  211. package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
  212. package/dist/context/polyfill/polyfill-context.d.ts +0 -5
  213. package/dist/context/polyfill/polyfill-context.d.ts.map +0 -1
  214. package/dist/context/polyfill/polyfill-context.js +0 -87
  215. package/dist/context/polyfill/polyfill-context.js.map +0 -1
  216. package/dist/context/polyfill/polyfill-table.d.ts +0 -48
  217. package/dist/context/polyfill/polyfill-table.d.ts.map +0 -1
  218. package/dist/context/polyfill/polyfill-table.js +0 -137
  219. package/dist/context/polyfill/polyfill-table.js.map +0 -1
  220. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +0 -2
  221. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +0 -1
  222. package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -265
  223. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  224. package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
  225. package/dist/context/state-tracker/track-context-state.js.map +0 -1
  226. package/dist/context/state-tracker/with-parameters.js.map +0 -1
  227. package/dist/index.js.map +0 -1
  228. package/dist/types.js.map +0 -1
  229. package/src/adapter/device-helpers/device-features.ts +0 -161
  230. package/src/adapter/device-helpers/is-old-ie.ts +0 -14
  231. package/src/context/context/create-headless-context.ts +0 -51
  232. package/src/context/context/webgl-checks.ts +0 -51
  233. package/src/context/polyfill/context-data.ts +0 -30
  234. package/src/context/polyfill/get-parameter-polyfill.ts +0 -122
  235. package/src/context/polyfill/polyfill-context.ts +0 -104
  236. package/src/context/polyfill/polyfill-table.ts +0 -167
  237. package/src/context/polyfill/polyfill-vertex-array-object.ts +0 -365
@@ -1,167 +1,238 @@
1
- let _Symbol$toStringTag;
1
+ // luma.gl, MIT license
2
+ // Copyright (c) vis.gl contributors
2
3
  import { VertexArray, getScratchArray, fillArray } from '@luma.gl/core';
4
+ import { GL } from '@luma.gl/constants';
3
5
  import { getBrowser } from '@probe.gl/env';
4
- import { getGLFromVertexType } from "../converters/vertex-formats.js";
5
- _Symbol$toStringTag = Symbol.toStringTag;
6
+ import { getGLFromVertexType } from '../converters/vertex-formats';
7
+ // import {AccessorObject} from '../..';
8
+ // import {getGLFromVertexType} from '../converters/vertex-formats';
9
+ /** VertexArrayObject wrapper */
6
10
  export class WEBGLVertexArray extends VertexArray {
7
- get [_Symbol$toStringTag]() {
8
- return 'VertexArray';
9
- }
10
- static isConstantAttributeZeroSupported(device) {
11
- return device.info.type === 'webgl2' || getBrowser() === 'Chrome';
12
- }
13
- constructor(device, props) {
14
- super(device, props);
15
- this.device = void 0;
16
- this.handle = void 0;
17
- this.buffer = null;
18
- this.bufferValue = null;
19
- this.init = false;
20
- this.device = device;
21
- this.handle = this.device.gl2.createVertexArray();
22
- }
23
- destroy() {
24
- super.destroy();
25
- if (this.buffer) {
26
- var _this$buffer;
27
- (_this$buffer = this.buffer) === null || _this$buffer === void 0 ? void 0 : _this$buffer.destroy();
28
- }
29
- if (this.handle) {
30
- this.device.gl2.deleteVertexArray(this.handle);
31
- this.handle = undefined;
32
- }
33
- }
34
- setIndexBuffer(indexBuffer) {
35
- const buffer = indexBuffer;
36
- if (buffer && buffer.glTarget !== 34963) {
37
- throw new Error('Use .setBuffer()');
38
- }
39
- this.device.gl2.bindVertexArray(this.handle);
40
- this.device.gl2.bindBuffer(34963, buffer ? buffer.handle : null);
41
- this.indexBuffer = buffer;
42
- }
43
- setBuffer(location, attributeBuffer) {
44
- const buffer = attributeBuffer;
45
- if (buffer.glTarget === 34963) {
46
- throw new Error('Use .setIndexBuffer()');
47
- }
48
- const {
49
- size,
50
- type,
51
- stride,
52
- offset,
53
- normalized,
54
- integer,
55
- divisor
56
- } = this._getAccessor(location);
57
- this.device.gl2.bindVertexArray(this.handle);
58
- this.device.gl.bindBuffer(34962, buffer.handle);
59
- if (integer) {
60
- this.device.assertWebGL2();
61
- this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);
62
- } else {
63
- this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);
64
- }
65
- this.device.gl.enableVertexAttribArray(location);
66
- this.device.gl2.vertexAttribDivisor(location, divisor || 0);
67
- this.attributes[location] = buffer;
68
- }
69
- setConstant(location, value) {
70
- this._enable(location, false);
71
- this.attributes[location] = value;
72
- }
73
- bindBeforeRender() {
74
- this.device.gl2.bindVertexArray(this.handle);
75
- if (!this.init) {
76
- const webglBuffer = this.indexBuffer;
77
- this.device.gl2.bindBuffer(34963, (webglBuffer === null || webglBuffer === void 0 ? void 0 : webglBuffer.handle) || null);
78
- this.init = true;
79
- }
80
- this._applyConstantAttributes();
81
- }
82
- unbindAfterRender() {
83
- this.device.gl2.bindVertexArray(null);
84
- }
85
- _applyConstantAttributes() {
86
- for (let location = 0; location < this.maxVertexAttributes; ++location) {
87
- const constant = this.attributes[location];
88
- if (ArrayBuffer.isView(constant)) {
89
- this.device.setConstantAttribute(location, constant);
90
- }
91
- }
92
- }
93
- _getAccessor(location) {
94
- const attributeInfo = this.attributeInfos[location];
95
- if (!attributeInfo) {
96
- throw new Error(`Unknown attribute location ${location}`);
97
- }
98
- const glType = getGLFromVertexType(attributeInfo.bufferDataType);
99
- return {
100
- size: attributeInfo.bufferComponents,
101
- type: glType,
102
- stride: attributeInfo.byteStride,
103
- offset: attributeInfo.byteOffset,
104
- normalized: attributeInfo.normalized,
105
- integer: attributeInfo.integer,
106
- divisor: attributeInfo.stepMode === 'instance' ? 1 : 0
107
- };
108
- }
109
- _enable(location) {
110
- let enable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
111
- const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);
112
- const canDisableAttribute = canDisableAttributeZero || location !== 0;
113
- if (enable || canDisableAttribute) {
114
- location = Number(location);
115
- this.device.gl2.bindVertexArray(this.handle);
116
- if (enable) {
11
+ get [Symbol.toStringTag]() {
12
+ return 'VertexArray';
13
+ }
14
+ device;
15
+ handle;
16
+ /** Attribute 0 buffer constant */
17
+ buffer = null;
18
+ bufferValue = null;
19
+ /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */
20
+ static isConstantAttributeZeroSupported(device) {
21
+ return getBrowser() === 'Chrome';
22
+ }
23
+ // Create a VertexArray
24
+ constructor(device, props) {
25
+ super(device, props);
26
+ this.device = device;
27
+ this.handle = this.device.gl.createVertexArray();
28
+ }
29
+ destroy() {
30
+ super.destroy();
31
+ if (this.buffer) {
32
+ this.buffer?.destroy();
33
+ }
34
+ if (this.handle) {
35
+ this.device.gl.deleteVertexArray(this.handle);
36
+ // @ts-expect-error read-only/undefined
37
+ this.handle = undefined;
38
+ }
39
+ // Auto-delete elements?
40
+ // return [this.elements];
41
+ }
42
+ /**
43
+ // Set (bind/unbind) an elements buffer, for indexed rendering.
44
+ // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER or null. Constants not supported
45
+ *
46
+ * @param elementBuffer
47
+ */
48
+ setIndexBuffer(indexBuffer) {
49
+ const buffer = indexBuffer;
50
+ // Explicitly allow `null` to support clearing the index buffer
51
+ if (buffer && buffer.glTarget !== GL.ELEMENT_ARRAY_BUFFER) {
52
+ throw new Error('Use .setBuffer()');
53
+ }
54
+ // In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject
55
+ this.device.gl.bindVertexArray(this.handle);
56
+ // TODO - this initial binding does not seem to take effect? see bindBeforeRender()
57
+ this.device.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, buffer ? buffer.handle : null);
58
+ // log.log(1, 'VertexArray.setIndexBuffer', indexBuffer)();
59
+ // log.log(1, `Binding vertex array ${this.id}`, buffer?.id)();
60
+ this.indexBuffer = buffer;
61
+ }
62
+ /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
63
+ setBuffer(location, attributeBuffer) {
64
+ const buffer = attributeBuffer;
65
+ // Sanity check target
66
+ if (buffer.glTarget === GL.ELEMENT_ARRAY_BUFFER) {
67
+ throw new Error('Use .setIndexBuffer()');
68
+ }
69
+ const { size, type, stride, offset, normalized, integer, divisor } = this._getAccessor(location);
70
+ this.device.gl.bindVertexArray(this.handle);
71
+ // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target
72
+ this.device.gl.bindBuffer(GL.ARRAY_BUFFER, buffer.handle);
73
+ // WebGL2 supports *integer* data formats, i.e. GPU will see integer values
74
+ if (integer) {
75
+ this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);
76
+ }
77
+ else {
78
+ // Attaches ARRAY_BUFFER with specified buffer format to location
79
+ this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);
80
+ }
81
+ // Mark as non-constant
117
82
  this.device.gl.enableVertexAttribArray(location);
118
- } else {
119
- this.device.gl.disableVertexAttribArray(location);
120
- }
121
- this.device.gl2.bindVertexArray(null);
122
- }
123
- }
124
- getConstantBuffer(elementCount, value) {
125
- const constantValue = normalizeConstantArrayValue(value);
126
- const byteLength = constantValue.byteLength * elementCount;
127
- const length = constantValue.length * elementCount;
128
- if (this.buffer && byteLength !== this.buffer.byteLength) {
129
- throw new Error(`Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`);
130
- }
131
- let updateNeeded = !this.buffer;
132
- this.buffer = this.buffer || this.device.createBuffer({
133
- byteLength
134
- });
135
- updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
136
- if (updateNeeded) {
137
- const typedArray = getScratchArray(value.constructor, length);
138
- fillArray({
139
- target: typedArray,
140
- source: constantValue,
141
- start: 0,
142
- count: length
143
- });
144
- this.buffer.write(typedArray);
145
- this.bufferValue = value;
146
- }
147
- return this.buffer;
148
- }
83
+ // Set the step mode 0=vertex, 1=instance
84
+ this.device.gl.vertexAttribDivisor(location, divisor || 0);
85
+ this.attributes[location] = buffer;
86
+ }
87
+ /** Set a location in vertex attributes array to a constant value, disables the location */
88
+ setConstant(location, value) {
89
+ this._enable(location, false);
90
+ this.attributes[location] = value;
91
+ }
92
+ init = false;
93
+ bindBeforeRender() {
94
+ this.device.gl.bindVertexArray(this.handle);
95
+ // TODO - the initial bind does not seem to take effect.
96
+ if (!this.init) {
97
+ // log.log(1, `Binding vertex array ${this.id}`, this.indexBuffer?.id)();
98
+ const webglBuffer = this.indexBuffer;
99
+ this.device.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, webglBuffer?.handle || null);
100
+ this.init = true;
101
+ }
102
+ this._applyConstantAttributes();
103
+ }
104
+ unbindAfterRender() {
105
+ // log.log(1, `Unbinding vertex array ${this.id}`)();
106
+ // TODO technically this is not necessary, but we might be interfacing
107
+ // with code that does not use vertex array objects
108
+ this.device.gl.bindVertexArray(null);
109
+ // this.device.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, null);
110
+ }
111
+ // Internal methods
112
+ /**
113
+ * Constant attributes need to be reset before every draw call
114
+ * Any attribute that is disabled in the current vertex array object
115
+ * is read from the context's global constant value for that attribute location.
116
+ * @note Constant attributes are only supported in WebGL, not in WebGPU
117
+ */
118
+ _applyConstantAttributes() {
119
+ for (let location = 0; location < this.maxVertexAttributes; ++location) {
120
+ const constant = this.attributes[location];
121
+ // A typed array means this is a constant
122
+ if (ArrayBuffer.isView(constant)) {
123
+ this.device.setConstantAttribute(location, constant);
124
+ }
125
+ }
126
+ }
127
+ /**
128
+ * Set a location in vertex attributes array to a buffer, enables the location, sets divisor
129
+ * @note requires vertex array to be bound
130
+ */
131
+ // protected _setAttributeLayout(location: number): void {
132
+ // const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);
133
+ // // WebGL2 supports *integer* data formats, i.e. GPU will see integer values
134
+ // if (integer) {
135
+ // this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);
136
+ // } else {
137
+ // // Attaches ARRAY_BUFFER with specified buffer format to location
138
+ // this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);
139
+ // }
140
+ // this.device.gl.vertexAttribDivisor(location, divisor || 0);
141
+ // }
142
+ /** Get an accessor from the */
143
+ _getAccessor(location) {
144
+ const attributeInfo = this.attributeInfos[location];
145
+ if (!attributeInfo) {
146
+ throw new Error(`Unknown attribute location ${location}`);
147
+ }
148
+ const glType = getGLFromVertexType(attributeInfo.bufferDataType);
149
+ return {
150
+ size: attributeInfo.bufferComponents,
151
+ type: glType,
152
+ stride: attributeInfo.byteStride,
153
+ offset: attributeInfo.byteOffset,
154
+ normalized: attributeInfo.normalized,
155
+ // it is the shader attribute declaration, not the vertex memory format,
156
+ // that determines if the data in the buffer will be treated as integers.
157
+ //
158
+ // Also note that WebGL supports assigning non-normalized integer data to floating point attributes,
159
+ // but as far as we can tell, WebGPU does not.
160
+ integer: attributeInfo.integer,
161
+ divisor: attributeInfo.stepMode === 'instance' ? 1 : 0
162
+ };
163
+ }
164
+ /**
165
+ * Enabling an attribute location makes it reference the currently bound buffer
166
+ * Disabling an attribute location makes it reference the global constant value
167
+ * TODO - handle single values for size 1 attributes?
168
+ * TODO - convert classic arrays based on known type?
169
+ */
170
+ _enable(location, enable = true) {
171
+ // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...
172
+ const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);
173
+ const canDisableAttribute = canDisableAttributeZero || location !== 0;
174
+ if (enable || canDisableAttribute) {
175
+ location = Number(location);
176
+ this.device.gl.bindVertexArray(this.handle);
177
+ if (enable) {
178
+ this.device.gl.enableVertexAttribArray(location);
179
+ }
180
+ else {
181
+ this.device.gl.disableVertexAttribArray(location);
182
+ }
183
+ this.device.gl.bindVertexArray(null);
184
+ }
185
+ }
186
+ /**
187
+ * Provide a means to create a buffer that is equivalent to a constant.
188
+ * NOTE: Desktop OpenGL cannot disable attribute 0.
189
+ * https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-
190
+ * this-has-significant-performance-penalty
191
+ */
192
+ getConstantBuffer(elementCount, value) {
193
+ // Create buffer only when needed, and reuse it (avoids inflating buffer creation statistics)
194
+ const constantValue = normalizeConstantArrayValue(value);
195
+ const byteLength = constantValue.byteLength * elementCount;
196
+ const length = constantValue.length * elementCount;
197
+ if (this.buffer && byteLength !== this.buffer.byteLength) {
198
+ throw new Error(`Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`);
199
+ }
200
+ let updateNeeded = !this.buffer;
201
+ this.buffer = this.buffer || this.device.createBuffer({ byteLength });
202
+ // Reallocate and update contents if needed
203
+ updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
204
+ if (updateNeeded) {
205
+ // Create a typed array that is big enough, and fill it with the required data
206
+ const typedArray = getScratchArray(value.constructor, length);
207
+ fillArray({ target: typedArray, source: constantValue, start: 0, count: length });
208
+ this.buffer.write(typedArray);
209
+ this.bufferValue = value;
210
+ }
211
+ return this.buffer;
212
+ }
149
213
  }
214
+ // HELPER FUNCTIONS
215
+ /**
216
+ * TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)
217
+ * TODO - handle single values for size 1 attributes?
218
+ */
150
219
  function normalizeConstantArrayValue(arrayValue) {
151
- if (Array.isArray(arrayValue)) {
152
- return new Float32Array(arrayValue);
153
- }
154
- return arrayValue;
220
+ if (Array.isArray(arrayValue)) {
221
+ return new Float32Array(arrayValue);
222
+ }
223
+ return arrayValue;
155
224
  }
225
+ /**
226
+ *
227
+ */
156
228
  function compareConstantArrayValues(v1, v2) {
157
- if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {
158
- return false;
159
- }
160
- for (let i = 0; i < v1.length; ++i) {
161
- if (v1[i] !== v2[i]) {
162
- return false;
163
- }
164
- }
165
- return true;
229
+ if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {
230
+ return false;
231
+ }
232
+ for (let i = 0; i < v1.length; ++i) {
233
+ if (v1[i] !== v2[i]) {
234
+ return false;
235
+ }
236
+ }
237
+ return true;
166
238
  }
167
- //# sourceMappingURL=webgl-vertex-array.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;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;IASN;;;;;;;;;;;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;IAiB7F,MAAM;CAOP"}
1
+ {"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;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;IASN;;;;;;;;;;;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,43 +1,64 @@
1
+ // luma.gl, MIT license
2
+ // Copyright (c) vis.gl contributors
1
3
  import { CanvasContext } from '@luma.gl/core';
2
- import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
4
+ import { WEBGLFramebuffer } from './resources/webgl-framebuffer';
5
+ /**
6
+ * A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc
7
+ */
3
8
  export class WebGLCanvasContext extends CanvasContext {
4
- constructor(device, props) {
5
- super(props);
6
- this.device = void 0;
7
- this.presentationSize = void 0;
8
- this._framebuffer = null;
9
- this.device = device;
10
- this.presentationSize = [-1, -1];
11
- this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
12
- this.update();
13
- }
14
- getCurrentFramebuffer() {
15
- this.update();
16
- this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, {
17
- handle: null
18
- });
19
- return this._framebuffer;
20
- }
21
- update() {
22
- const size = this.getPixelSize();
23
- const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];
24
- if (sizeChanged) {
25
- this.presentationSize = size;
26
- this.resize();
9
+ device;
10
+ presentationSize;
11
+ _framebuffer = null;
12
+ constructor(device, props) {
13
+ // Note: Base class creates / looks up the canvas (unless under Node.js)
14
+ super(props);
15
+ this.device = device;
16
+ this.presentationSize = [-1, -1];
17
+ this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
18
+ this.update();
27
19
  }
28
- }
29
- resize(options) {
30
- if (!this.device.gl) return;
31
- if (this.canvas) {
32
- const devicePixelRatio = this.getDevicePixelRatio(options === null || options === void 0 ? void 0 : options.useDevicePixels);
33
- this.setDevicePixelRatio(devicePixelRatio, options);
34
- return;
20
+ getCurrentFramebuffer() {
21
+ this.update();
22
+ // Setting handle to null returns a reference to the default framebuffer
23
+ this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, { handle: null });
24
+ return this._framebuffer;
35
25
  }
36
- const ext = this.device.gl.getExtension('STACKGL_resize_drawingbuffer');
37
- if (ext && options && 'width' in options && 'height' in options) {
38
- ext.resize(options.width, options.height);
26
+ /** Resizes and updates render targets if necessary */
27
+ update() {
28
+ const size = this.getPixelSize();
29
+ const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];
30
+ if (sizeChanged) {
31
+ this.presentationSize = size;
32
+ this.resize();
33
+ }
34
+ }
35
+ /**
36
+ * Resize the canvas' drawing buffer.
37
+ *
38
+ * Can match the canvas CSS size, and optionally also consider devicePixelRatio
39
+ * Can be called every frame
40
+ *
41
+ * Regardless of size, the drawing buffer will always be scaled to the viewport, but
42
+ * for best visual results, usually set to either:
43
+ * canvas CSS width x canvas CSS height
44
+ * canvas CSS width * devicePixelRatio x canvas CSS height * devicePixelRatio
45
+ * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html
46
+ */
47
+ resize(options) {
48
+ if (!this.device.gl)
49
+ return;
50
+ // Resize browser context .
51
+ if (this.canvas) {
52
+ const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);
53
+ this.setDevicePixelRatio(devicePixelRatio, options);
54
+ return;
55
+ }
56
+ }
57
+ commit() {
58
+ // gl.commit was ultimately removed from the WebGL standard??
59
+ // if (this.offScreen && this.gl.commit) {
60
+ // // @ts-expect-error gl.commit is not officially part of WebGL2RenderingContext
61
+ // this.gl.commit();
62
+ // }
39
63
  }
40
- }
41
- commit() {}
42
64
  }
43
- //# sourceMappingURL=webgl-canvas-context.js.map
@@ -1,6 +1,6 @@
1
1
  import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContextProps, TextureFormat, VertexArray, VertexArrayProps, Framebuffer, Buffer, Texture, TypedArray } from '@luma.gl/core';
2
2
  import { Device, CanvasContext } from '@luma.gl/core';
3
- import { WebGLLimits } from './device-helpers/device-limits';
3
+ import { WebGLLimits } from './device-helpers/webgl-device-limits';
4
4
  import { WebGLCanvasContext } from './webgl-canvas-context';
5
5
  import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps, CommandEncoderProps, TransformFeedbackProps } from '@luma.gl/core';
6
6
  import { WEBGLBuffer } from './resources/webgl-buffer';
@@ -18,7 +18,7 @@ export declare class WebGLDevice extends Device {
18
18
  static isSupported(): boolean;
19
19
  readonly info: DeviceInfo;
20
20
  readonly canvasContext: WebGLCanvasContext;
21
- readonly handle: WebGLRenderingContext;
21
+ readonly handle: WebGL2RenderingContext;
22
22
  get features(): Set<DeviceFeature>;
23
23
  get limits(): DeviceLimits;
24
24
  readonly lost: Promise<{
@@ -34,7 +34,7 @@ export declare class WebGLDevice extends Device {
34
34
  * @param gl
35
35
  * @returns
36
36
  */
37
- static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice;
37
+ static attach(gl: Device | WebGL2RenderingContext): WebGLDevice;
38
38
  static create(props?: DeviceProps): Promise<WebGLDevice>;
39
39
  constructor(props: DeviceProps);
40
40
  /**
@@ -47,8 +47,6 @@ export declare class WebGLDevice extends Device {
47
47
  isTextureFormatSupported(format: TextureFormat): boolean;
48
48
  isTextureFormatFilterable(format: TextureFormat): boolean;
49
49
  isTextureFormatRenderable(format: TextureFormat): boolean;
50
- /** Returns a WebGL2RenderingContext or throws an error */
51
- assertWebGL2(): WebGL2RenderingContext;
52
50
  createCanvasContext(props?: CanvasContextProps): CanvasContext;
53
51
  createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer;
54
52
  _createTexture(props: TextureProps): WEBGLTexture;
@@ -67,7 +65,7 @@ export declare class WebGLDevice extends Device {
67
65
  createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder;
68
66
  /**
69
67
  * Offscreen Canvas Support: Commit the frame
70
- * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
68
+ * https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/commit
71
69
  * Chrome's offscreen canvas does not require gl.commit
72
70
  */
73
71
  submit(): void;
@@ -102,15 +100,9 @@ export declare class WebGLDevice extends Device {
102
100
  depth?: any;
103
101
  stencil?: any;
104
102
  }): void;
105
- /** WebGL1 typed context. Can always be used. */
106
- readonly gl: WebGLRenderingContext;
107
- /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
108
- readonly gl2: WebGL2RenderingContext | null;
103
+ /** WebGL2 context. */
104
+ readonly gl: WebGL2RenderingContext;
109
105
  readonly debug: boolean;
110
- /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */
111
- readonly isWebGL1: boolean;
112
- /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */
113
- readonly isWebGL2: boolean;
114
106
  /** State used by luma.gl classes: TODO - move to canvasContext*/
115
107
  readonly _canvasSizeInfo: {
116
108
  clientWidth: number;
@@ -144,7 +136,7 @@ export declare class WebGLDevice extends Device {
144
136
  * Be aware that there are some duplicates especially for constants that are 0,
145
137
  * so this isn't guaranteed to return the right key in all cases.
146
138
  */
147
- getGLKey(value: unknown, gl?: WebGLRenderingContext): string;
139
+ getGLKey(value: unknown, gl?: WebGL2RenderingContext): string;
148
140
  /** Store constants */
149
141
  _constants: (TypedArray | null)[];
150
142
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,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;AAgBtE,OAAO,EAAkC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;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,EACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAA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