@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.
- package/dist/adapter/converters/device-parameters.js +240 -158
- package/dist/adapter/converters/sampler-parameters.d.ts +0 -4
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +73 -68
- package/dist/adapter/converters/shader-formats.js +33 -46
- package/dist/adapter/converters/texture-formats.d.ts +9 -18
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +454 -871
- package/dist/adapter/converters/vertex-formats.js +52 -61
- package/dist/adapter/device-helpers/device-features.d.ts +2 -5
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-features.js +56 -87
- package/dist/adapter/device-helpers/device-limits.d.ts +2 -4
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +88 -83
- package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +79 -63
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +6 -0
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-features.js +52 -0
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +4 -0
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-info.js +87 -0
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +50 -0
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-limits.js +92 -0
- package/dist/adapter/helpers/decode-webgl-types.js +87 -76
- package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +261 -226
- package/dist/adapter/helpers/parse-shader-compiler-log.js +46 -37
- package/dist/adapter/helpers/set-uniform.d.ts +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +67 -82
- package/dist/adapter/helpers/webgl-topology-utils.js +77 -93
- package/dist/adapter/objects/constants-to-keys.d.ts +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +18 -12
- package/dist/adapter/objects/webgl-renderbuffer.js +76 -80
- package/dist/adapter/objects/webgl-resource.d.ts +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +204 -154
- package/dist/adapter/resources/webgl-buffer.d.ts +2 -3
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +160 -119
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +268 -171
- package/dist/adapter/resources/webgl-command-encoder.js +32 -40
- package/dist/adapter/resources/webgl-external-texture.js +92 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +167 -139
- package/dist/adapter/resources/webgl-render-pass.js +121 -95
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +11 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +378 -228
- package/dist/adapter/resources/webgl-sampler.d.ts +0 -2
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +43 -34
- package/dist/adapter/resources/webgl-shader.d.ts +10 -1
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +106 -45
- package/dist/adapter/resources/webgl-texture.d.ts +2 -6
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +614 -699
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +143 -145
- package/dist/adapter/resources/webgl-vertex-array.d.ts +1 -1
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +229 -158
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +58 -37
- package/dist/adapter/webgl-device.d.ts +7 -15
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +440 -381
- package/dist/classic/accessor.js +132 -102
- package/dist/classic/clear.d.ts +2 -2
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +73 -73
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +176 -177
- package/dist/classic/format-utils.d.ts +2 -2
- package/dist/classic/format-utils.js +38 -32
- package/dist/classic/typed-array-utils.js +95 -81
- package/dist/context/{polyfill → context}/context-data.d.ts +2 -1
- package/dist/context/context/context-data.d.ts.map +1 -0
- package/dist/context/context/context-data.js +33 -0
- package/dist/context/context/create-browser-context.d.ts +1 -6
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +62 -49
- package/dist/context/debug/spector.js +54 -50
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -2
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +102 -76
- package/dist/context/parameters/unified-parameter-api.d.ts +3 -3
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +95 -46
- package/dist/context/parameters/webgl-parameter-tables.d.ts +110 -99
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +456 -404
- package/dist/context/state-tracker/deep-array-equal.js +18 -14
- package/dist/context/state-tracker/track-context-state.d.ts +4 -4
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +190 -126
- package/dist/context/state-tracker/with-parameters.d.ts +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +45 -29
- package/dist/dist.dev.js +2568 -3786
- package/dist/index.cjs +1346 -2464
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -26
- package/dist/types.js +2 -1
- package/dist.min.js +9 -42
- package/package.json +11 -15
- package/src/adapter/converters/device-parameters.ts +0 -1
- package/src/adapter/converters/sampler-parameters.ts +0 -17
- package/src/adapter/converters/texture-formats.ts +86 -154
- package/src/adapter/device-helpers/webgl-device-features.ts +69 -0
- package/src/adapter/device-helpers/{get-device-info.ts → webgl-device-info.ts} +3 -4
- package/src/adapter/device-helpers/{device-limits.ts → webgl-device-limits.ts} +25 -23
- package/src/adapter/helpers/get-shader-layout.ts +17 -28
- package/src/adapter/helpers/set-uniform.ts +1 -3
- package/src/adapter/objects/constants-to-keys.ts +1 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +4 -4
- package/src/adapter/objects/webgl-resource.ts +3 -18
- package/src/adapter/resources/webgl-buffer.ts +6 -11
- package/src/adapter/resources/webgl-command-buffer.ts +20 -30
- package/src/adapter/resources/webgl-external-texture.ts +2 -3
- package/src/adapter/resources/webgl-framebuffer.ts +4 -5
- package/src/adapter/resources/webgl-render-pass.ts +7 -7
- package/src/adapter/resources/webgl-render-pipeline.ts +106 -31
- package/src/adapter/resources/webgl-sampler.ts +5 -9
- package/src/adapter/resources/webgl-shader.ts +57 -10
- package/src/adapter/resources/webgl-texture.ts +29 -103
- package/src/adapter/resources/webgl-transform-feedback.ts +14 -15
- package/src/adapter/resources/webgl-vertex-array.ts +16 -18
- package/src/adapter/webgl-canvas-context.ts +1 -7
- package/src/adapter/webgl-device.ts +18 -67
- package/src/classic/clear.ts +13 -14
- package/src/classic/copy-and-blit.ts +1 -2
- package/src/context/context/context-data.ts +44 -0
- package/src/context/context/create-browser-context.ts +7 -32
- package/src/context/debug/webgl-developer-tools.ts +6 -8
- package/src/context/parameters/unified-parameter-api.ts +3 -3
- package/src/context/parameters/webgl-parameter-tables.ts +66 -75
- package/src/context/state-tracker/track-context-state.ts +18 -17
- package/src/context/state-tracker/with-parameters.ts +1 -1
- package/src/index.ts +2 -17
- package/dist/adapter/converters/device-parameters.js.map +0 -1
- package/dist/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/adapter/converters/shader-formats.js.map +0 -1
- package/dist/adapter/converters/texture-formats.js.map +0 -1
- package/dist/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.d.ts +0 -2
- package/dist/adapter/device-helpers/is-old-ie.d.ts.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.js +0 -9
- package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/adapter/helpers/decode-webgl-types.js.map +0 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/adapter/helpers/webgl-topology-utils.js.map +0 -1
- package/dist/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-transform-feedback.js.map +0 -1
- package/dist/adapter/resources/webgl-vertex-array.js.map +0 -1
- package/dist/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/adapter/webgl-device.js.map +0 -1
- package/dist/classic/accessor.js.map +0 -1
- package/dist/classic/clear.js.map +0 -1
- package/dist/classic/copy-and-blit.js.map +0 -1
- package/dist/classic/format-utils.js.map +0 -1
- package/dist/classic/typed-array-utils.js.map +0 -1
- package/dist/context/context/create-browser-context.js.map +0 -1
- package/dist/context/context/create-headless-context.d.ts +0 -9
- package/dist/context/context/create-headless-context.d.ts.map +0 -1
- package/dist/context/context/create-headless-context.js +0 -42
- package/dist/context/context/create-headless-context.js.map +0 -1
- package/dist/context/context/webgl-checks.d.ts +0 -13
- package/dist/context/context/webgl-checks.d.ts.map +0 -1
- package/dist/context/context/webgl-checks.js +0 -31
- package/dist/context/context/webgl-checks.js.map +0 -1
- package/dist/context/debug/spector.js.map +0 -1
- package/dist/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/context/polyfill/context-data.d.ts.map +0 -1
- package/dist/context/polyfill/context-data.js +0 -12
- package/dist/context/polyfill/context-data.js.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.d.ts +0 -2
- package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +0 -85
- package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/context/polyfill/polyfill-context.d.ts +0 -5
- package/dist/context/polyfill/polyfill-context.d.ts.map +0 -1
- package/dist/context/polyfill/polyfill-context.js +0 -87
- package/dist/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/context/polyfill/polyfill-table.d.ts +0 -48
- package/dist/context/polyfill/polyfill-table.d.ts.map +0 -1
- package/dist/context/polyfill/polyfill-table.js +0 -137
- package/dist/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +0 -2
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -265
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/adapter/device-helpers/device-features.ts +0 -161
- package/src/adapter/device-helpers/is-old-ie.ts +0 -14
- package/src/context/context/create-headless-context.ts +0 -51
- package/src/context/context/webgl-checks.ts +0 -51
- package/src/context/polyfill/context-data.ts +0 -30
- package/src/context/polyfill/get-parameter-polyfill.ts +0 -122
- package/src/context/polyfill/polyfill-context.ts +0 -104
- package/src/context/polyfill/polyfill-table.ts +0 -167
- package/src/context/polyfill/polyfill-vertex-array-object.ts +0 -365
|
@@ -1,167 +1,238 @@
|
|
|
1
|
-
|
|
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
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
119
|
-
this.device.gl.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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,OAA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AS1D,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
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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:
|
|
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 |
|
|
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/
|
|
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
|
-
/**
|
|
106
|
-
readonly gl:
|
|
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?:
|
|
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;
|
|
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,MA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