@luma.gl/core 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.
- package/dist/adapter/adapter.d.ts +11 -0
- package/dist/adapter/adapter.d.ts.map +1 -0
- package/dist/adapter/adapter.js +8 -0
- package/dist/adapter/canvas-context.d.ts +5 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/device.d.ts +23 -11
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +22 -20
- package/dist/adapter/luma.d.ts +70 -0
- package/dist/adapter/luma.d.ts.map +1 -0
- package/dist/adapter/luma.js +159 -0
- package/dist/adapter/resources/buffer.js +5 -5
- package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +3 -0
- package/dist/adapter/resources/external-texture.d.ts +1 -1
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +3 -3
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +2 -83
- package/dist/adapter/resources/render-pass.d.ts +2 -2
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -5
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/resource.d.ts +3 -3
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +1 -1
- package/dist/adapter/resources/shader.d.ts +5 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +15 -9
- package/dist/adapter/resources/texture-view.d.ts +1 -1
- package/dist/adapter/resources/texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/texture.d.ts +144 -47
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +120 -12
- package/dist/adapter/resources/transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +1 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +6 -2
- package/dist/adapter/types/{types.d.ts → attachments.d.ts} +7 -17
- package/dist/adapter/types/attachments.d.ts.map +1 -0
- package/dist/adapter/types/buffer-layout.d.ts +1 -1
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
- package/dist/adapter/types/compiler-message.d.ts.map +1 -0
- package/dist/adapter/types/parameters.d.ts +4 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/parameters.js +1 -0
- package/dist/adapter/types/shader-layout.d.ts +23 -3
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/uniforms.d.ts +4 -0
- package/dist/adapter/types/uniforms.d.ts.map +1 -0
- package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
- package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
- package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
- package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
- package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
- package/dist/adapter-utils/is-uniform-value.js +7 -0
- package/dist/dist.dev.js +635 -821
- package/dist/dist.min.js +6 -6
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
- package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
- package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
- package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
- package/dist/gpu-type-utils/decode-texture-format.d.ts +43 -0
- package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +67 -31
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
- package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +3 -5
- package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
- package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
- package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/index.cjs +396 -567
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -37
- package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
- package/dist/portable/uniform-block.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
- package/dist/{lib/uniforms → portable}/uniform-store.d.ts +9 -4
- package/dist/portable/uniform-store.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +6 -7
- package/dist/utils/array-utils-flat.d.ts +1 -7
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +0 -23
- package/dist/utils/is-array.d.ts +3 -3
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +2 -2
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/{utils.js → uid.js} +0 -11
- package/package.json +5 -5
- package/src/adapter/adapter.ts +16 -0
- package/src/adapter/canvas-context.ts +6 -0
- package/src/adapter/device.ts +52 -36
- package/src/adapter/luma.ts +219 -0
- package/src/adapter/resources/buffer.ts +5 -5
- package/src/adapter/resources/command-encoder.ts +1 -1
- package/src/adapter/resources/compute-pass.ts +3 -3
- package/src/adapter/resources/compute-pipeline.ts +6 -3
- package/src/adapter/resources/external-texture.ts +2 -2
- package/src/adapter/resources/framebuffer.ts +5 -92
- package/src/adapter/resources/query-set.ts +2 -2
- package/src/adapter/resources/render-pass.ts +11 -7
- package/src/adapter/resources/render-pipeline.ts +3 -6
- package/src/adapter/resources/resource.ts +7 -7
- package/src/adapter/resources/shader.ts +18 -11
- package/src/adapter/resources/texture-view.ts +5 -5
- package/src/adapter/resources/texture.ts +285 -76
- package/src/adapter/resources/transform-feedback.ts +1 -1
- package/src/adapter/resources/vertex-array.ts +7 -3
- package/src/adapter/types/{types.ts → attachments.ts} +10 -18
- package/src/adapter/types/buffer-layout.ts +1 -1
- package/src/adapter/types/parameters.ts +14 -14
- package/src/adapter/types/shader-layout.ts +31 -29
- package/src/adapter/types/uniforms.ts +10 -0
- package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
- package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
- package/src/adapter-utils/is-uniform-value.ts +10 -0
- package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +99 -39
- package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
- package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +3 -14
- package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
- package/src/index.ts +67 -83
- package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
- package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
- package/src/{lib/uniforms → portable}/uniform-store.ts +20 -12
- package/src/types.ts +0 -12
- package/src/utils/array-equal.ts +6 -7
- package/src/utils/array-utils-flat.ts +1 -31
- package/src/utils/is-array.ts +5 -5
- package/src/utils/{utils.ts → uid.ts} +0 -12
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts +0 -23
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
- package/dist/adapter/types/accessor.d.ts +0 -23
- package/dist/adapter/types/accessor.d.ts.map +0 -1
- package/dist/adapter/types/shader-types.d.ts.map +0 -1
- package/dist/adapter/types/texture-formats.d.ts.map +0 -1
- package/dist/adapter/types/types.d.ts.map +0 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
- package/dist/init.d.ts +0 -5
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -37
- package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js +0 -29
- package/dist/lib/luma.d.ts +0 -38
- package/dist/lib/luma.d.ts.map +0 -1
- package/dist/lib/luma.js +0 -141
- package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.d.ts +0 -10
- package/dist/lib/uniforms/uniform.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.js +0 -20
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -10
- package/dist/utils/cast.d.ts +0 -3
- package/dist/utils/cast.d.ts.map +0 -1
- package/dist/utils/cast.js +0 -7
- package/dist/utils/check-props.d.ts +0 -7
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -36
- package/dist/utils/deep-equal.d.ts +0 -9
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/deep-equal.js +0 -50
- package/dist/utils/format-value.d.ts +0 -7
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -39
- package/dist/utils/load-file.d.ts +0 -35
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -74
- package/dist/utils/random.d.ts +0 -5
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -18
- package/dist/utils/request-animation-frame.d.ts +0 -3
- package/dist/utils/request-animation-frame.d.ts.map +0 -1
- package/dist/utils/request-animation-frame.js +0 -16
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -19
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.d.ts.map +0 -1
- package/src/adapter/types/accessor.ts +0 -37
- package/src/init.ts +0 -53
- package/src/lib/compiler-log/get-shader-info.ts +0 -42
- package/src/lib/luma.ts +0 -190
- package/src/lib/uniforms/uniform.ts +0 -31
- package/src/utils/assert.ts +0 -11
- package/src/utils/cast.ts +0 -8
- package/src/utils/check-props.ts +0 -82
- package/src/utils/deep-equal.ts +0 -51
- package/src/utils/format-value.ts +0 -47
- package/src/utils/load-file.ts +0 -91
- package/src/utils/random.ts +0 -21
- package/src/utils/request-animation-frame.ts +0 -19
- package/src/utils/stub-methods.ts +0 -29
- /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
- /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
- /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
- /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
- /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
- /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
package/dist/dist.dev.js
CHANGED
|
@@ -32,6 +32,7 @@ var __exports__ = (() => {
|
|
|
32
32
|
// bundle.ts
|
|
33
33
|
var bundle_exports = {};
|
|
34
34
|
__export(bundle_exports, {
|
|
35
|
+
Adapter: () => Adapter,
|
|
35
36
|
Buffer: () => Buffer2,
|
|
36
37
|
CanvasContext: () => CanvasContext,
|
|
37
38
|
CommandBuffer: () => CommandBuffer,
|
|
@@ -49,54 +50,234 @@ var __exports__ = (() => {
|
|
|
49
50
|
Resource: () => Resource,
|
|
50
51
|
Sampler: () => Sampler,
|
|
51
52
|
Shader: () => Shader,
|
|
52
|
-
StatsManager: () => StatsManager,
|
|
53
53
|
Texture: () => Texture,
|
|
54
54
|
TextureView: () => TextureView,
|
|
55
55
|
TransformFeedback: () => TransformFeedback,
|
|
56
56
|
UniformBlock: () => UniformBlock,
|
|
57
57
|
UniformBufferLayout: () => UniformBufferLayout,
|
|
58
58
|
UniformStore: () => UniformStore,
|
|
59
|
-
VERSION: () => VERSION2,
|
|
60
59
|
VertexArray: () => VertexArray,
|
|
61
|
-
assert: () => assert2,
|
|
62
|
-
cancelAnimationFrame: () => cancelAnimationFrame,
|
|
63
|
-
cast: () => cast,
|
|
64
|
-
checkProps: () => checkProps,
|
|
65
60
|
decodeShaderAttributeType: () => decodeShaderAttributeType,
|
|
66
61
|
decodeShaderUniformType: () => decodeShaderUniformType,
|
|
67
62
|
decodeTextureFormat: () => decodeTextureFormat,
|
|
68
63
|
decodeVertexFormat: () => decodeVertexFormat,
|
|
69
|
-
deepEqual: () => deepEqual,
|
|
70
|
-
fillArray: () => fillArray,
|
|
71
|
-
formatCompilerLog: () => formatCompilerLog,
|
|
72
|
-
formatValue: () => formatValue,
|
|
73
64
|
getAttributeInfosFromLayouts: () => getAttributeInfosFromLayouts,
|
|
74
65
|
getDataTypeFromTypedArray: () => getDataTypeFromTypedArray,
|
|
75
66
|
getScratchArray: () => getScratchArray,
|
|
76
|
-
getScratchArrayBuffer: () => getScratchArrayBuffer,
|
|
77
67
|
getTypedArrayFromDataType: () => getTypedArrayFromDataType,
|
|
78
68
|
getVertexFormatFromAttribute: () => getVertexFormatFromAttribute,
|
|
79
|
-
glsl: () => glsl,
|
|
80
|
-
isNumberArray: () => isNumberArray,
|
|
81
|
-
isObjectEmpty: () => isObjectEmpty,
|
|
82
|
-
isTypedArray: () => isTypedArray,
|
|
83
|
-
isUniformValue: () => isUniformValue,
|
|
84
|
-
loadFile: () => loadFile,
|
|
85
|
-
loadImage: () => loadImage,
|
|
86
|
-
loadImageBitmap: () => loadImageBitmap,
|
|
87
|
-
loadScript: () => loadScript,
|
|
88
69
|
log: () => log,
|
|
89
|
-
luma: () => luma
|
|
90
|
-
makeRandomNumberGenerator: () => makeRandomNumberGenerator,
|
|
91
|
-
mergeShaderLayout: () => mergeShaderLayout,
|
|
92
|
-
random: () => random,
|
|
93
|
-
requestAnimationFrame: () => requestAnimationFrame,
|
|
94
|
-
setPathPrefix: () => setPathPrefix,
|
|
95
|
-
splitUniformsAndBindings: () => splitUniformsAndBindings,
|
|
96
|
-
stubRemovedMethods: () => stubRemovedMethods,
|
|
97
|
-
uid: () => uid
|
|
70
|
+
luma: () => luma
|
|
98
71
|
});
|
|
99
72
|
|
|
73
|
+
// ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
74
|
+
function getHiResTimestamp() {
|
|
75
|
+
let timestamp;
|
|
76
|
+
if (typeof window !== "undefined" && window.performance) {
|
|
77
|
+
timestamp = window.performance.now();
|
|
78
|
+
} else if (typeof process !== "undefined" && process.hrtime) {
|
|
79
|
+
const timeParts = process.hrtime();
|
|
80
|
+
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
81
|
+
} else {
|
|
82
|
+
timestamp = Date.now();
|
|
83
|
+
}
|
|
84
|
+
return timestamp;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ../../node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
88
|
+
var Stat = class {
|
|
89
|
+
constructor(name2, type) {
|
|
90
|
+
this.sampleSize = 1;
|
|
91
|
+
this.time = 0;
|
|
92
|
+
this.count = 0;
|
|
93
|
+
this.samples = 0;
|
|
94
|
+
this.lastTiming = 0;
|
|
95
|
+
this.lastSampleTime = 0;
|
|
96
|
+
this.lastSampleCount = 0;
|
|
97
|
+
this._count = 0;
|
|
98
|
+
this._time = 0;
|
|
99
|
+
this._samples = 0;
|
|
100
|
+
this._startTime = 0;
|
|
101
|
+
this._timerPending = false;
|
|
102
|
+
this.name = name2;
|
|
103
|
+
this.type = type;
|
|
104
|
+
this.reset();
|
|
105
|
+
}
|
|
106
|
+
reset() {
|
|
107
|
+
this.time = 0;
|
|
108
|
+
this.count = 0;
|
|
109
|
+
this.samples = 0;
|
|
110
|
+
this.lastTiming = 0;
|
|
111
|
+
this.lastSampleTime = 0;
|
|
112
|
+
this.lastSampleCount = 0;
|
|
113
|
+
this._count = 0;
|
|
114
|
+
this._time = 0;
|
|
115
|
+
this._samples = 0;
|
|
116
|
+
this._startTime = 0;
|
|
117
|
+
this._timerPending = false;
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
setSampleSize(samples) {
|
|
121
|
+
this.sampleSize = samples;
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
/** Call to increment count (+1) */
|
|
125
|
+
incrementCount() {
|
|
126
|
+
this.addCount(1);
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
/** Call to decrement count (-1) */
|
|
130
|
+
decrementCount() {
|
|
131
|
+
this.subtractCount(1);
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
/** Increase count */
|
|
135
|
+
addCount(value) {
|
|
136
|
+
this._count += value;
|
|
137
|
+
this._samples++;
|
|
138
|
+
this._checkSampling();
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
/** Decrease count */
|
|
142
|
+
subtractCount(value) {
|
|
143
|
+
this._count -= value;
|
|
144
|
+
this._samples++;
|
|
145
|
+
this._checkSampling();
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
/** Add an arbitrary timing and bump the count */
|
|
149
|
+
addTime(time) {
|
|
150
|
+
this._time += time;
|
|
151
|
+
this.lastTiming = time;
|
|
152
|
+
this._samples++;
|
|
153
|
+
this._checkSampling();
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
/** Start a timer */
|
|
157
|
+
timeStart() {
|
|
158
|
+
this._startTime = getHiResTimestamp();
|
|
159
|
+
this._timerPending = true;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
/** End a timer. Adds to time and bumps the timing count. */
|
|
163
|
+
timeEnd() {
|
|
164
|
+
if (!this._timerPending) {
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
this.addTime(getHiResTimestamp() - this._startTime);
|
|
168
|
+
this._timerPending = false;
|
|
169
|
+
this._checkSampling();
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
getSampleAverageCount() {
|
|
173
|
+
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
174
|
+
}
|
|
175
|
+
/** Calculate average time / count for the previous window */
|
|
176
|
+
getSampleAverageTime() {
|
|
177
|
+
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
178
|
+
}
|
|
179
|
+
/** Calculate counts per second for the previous window */
|
|
180
|
+
getSampleHz() {
|
|
181
|
+
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
182
|
+
}
|
|
183
|
+
getAverageCount() {
|
|
184
|
+
return this.samples > 0 ? this.count / this.samples : 0;
|
|
185
|
+
}
|
|
186
|
+
/** Calculate average time / count */
|
|
187
|
+
getAverageTime() {
|
|
188
|
+
return this.samples > 0 ? this.time / this.samples : 0;
|
|
189
|
+
}
|
|
190
|
+
/** Calculate counts per second */
|
|
191
|
+
getHz() {
|
|
192
|
+
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
193
|
+
}
|
|
194
|
+
_checkSampling() {
|
|
195
|
+
if (this._samples === this.sampleSize) {
|
|
196
|
+
this.lastSampleTime = this._time;
|
|
197
|
+
this.lastSampleCount = this._count;
|
|
198
|
+
this.count += this._count;
|
|
199
|
+
this.time += this._time;
|
|
200
|
+
this.samples += this._samples;
|
|
201
|
+
this._time = 0;
|
|
202
|
+
this._count = 0;
|
|
203
|
+
this._samples = 0;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// ../../node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
209
|
+
var Stats = class {
|
|
210
|
+
constructor(options) {
|
|
211
|
+
this.stats = {};
|
|
212
|
+
this.id = options.id;
|
|
213
|
+
this.stats = {};
|
|
214
|
+
this._initializeStats(options.stats);
|
|
215
|
+
Object.seal(this);
|
|
216
|
+
}
|
|
217
|
+
/** Acquire a stat. Create if it doesn't exist. */
|
|
218
|
+
get(name2, type = "count") {
|
|
219
|
+
return this._getOrCreate({ name: name2, type });
|
|
220
|
+
}
|
|
221
|
+
get size() {
|
|
222
|
+
return Object.keys(this.stats).length;
|
|
223
|
+
}
|
|
224
|
+
/** Reset all stats */
|
|
225
|
+
reset() {
|
|
226
|
+
for (const stat of Object.values(this.stats)) {
|
|
227
|
+
stat.reset();
|
|
228
|
+
}
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
forEach(fn) {
|
|
232
|
+
for (const stat of Object.values(this.stats)) {
|
|
233
|
+
fn(stat);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
getTable() {
|
|
237
|
+
const table = {};
|
|
238
|
+
this.forEach((stat) => {
|
|
239
|
+
table[stat.name] = {
|
|
240
|
+
time: stat.time || 0,
|
|
241
|
+
count: stat.count || 0,
|
|
242
|
+
average: stat.getAverageTime() || 0,
|
|
243
|
+
hz: stat.getHz() || 0
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
return table;
|
|
247
|
+
}
|
|
248
|
+
_initializeStats(stats = []) {
|
|
249
|
+
stats.forEach((stat) => this._getOrCreate(stat));
|
|
250
|
+
}
|
|
251
|
+
_getOrCreate(stat) {
|
|
252
|
+
const { name: name2, type } = stat;
|
|
253
|
+
let result = this.stats[name2];
|
|
254
|
+
if (!result) {
|
|
255
|
+
if (stat instanceof Stat) {
|
|
256
|
+
result = stat;
|
|
257
|
+
} else {
|
|
258
|
+
result = new Stat(name2, type);
|
|
259
|
+
}
|
|
260
|
+
this.stats[name2] = result;
|
|
261
|
+
}
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/utils/stats-manager.ts
|
|
267
|
+
var StatsManager = class {
|
|
268
|
+
stats = /* @__PURE__ */ new Map();
|
|
269
|
+
getStats(name2) {
|
|
270
|
+
return this.get(name2);
|
|
271
|
+
}
|
|
272
|
+
get(name2) {
|
|
273
|
+
if (!this.stats.has(name2)) {
|
|
274
|
+
this.stats.set(name2, new Stats({ id: name2 }));
|
|
275
|
+
}
|
|
276
|
+
return this.stats.get(name2);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
var lumaStats = new StatsManager();
|
|
280
|
+
|
|
100
281
|
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
101
282
|
var window_ = globalThis;
|
|
102
283
|
var document_ = globalThis.document || {};
|
|
@@ -254,7 +435,7 @@ var __exports__ = (() => {
|
|
|
254
435
|
}
|
|
255
436
|
|
|
256
437
|
// ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
|
|
257
|
-
function
|
|
438
|
+
function getHiResTimestamp2() {
|
|
258
439
|
let timestamp;
|
|
259
440
|
if (isBrowser() && window_.performance) {
|
|
260
441
|
timestamp = window_?.performance?.now?.();
|
|
@@ -286,8 +467,8 @@ var __exports__ = (() => {
|
|
|
286
467
|
var Log = class {
|
|
287
468
|
constructor({ id } = { id: "" }) {
|
|
288
469
|
this.VERSION = VERSION;
|
|
289
|
-
this._startTs =
|
|
290
|
-
this._deltaTs =
|
|
470
|
+
this._startTs = getHiResTimestamp2();
|
|
471
|
+
this._deltaTs = getHiResTimestamp2();
|
|
291
472
|
this.userData = {};
|
|
292
473
|
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
293
474
|
this.id = id;
|
|
@@ -311,11 +492,11 @@ var __exports__ = (() => {
|
|
|
311
492
|
}
|
|
312
493
|
/** @return milliseconds, with fractions */
|
|
313
494
|
getTotal() {
|
|
314
|
-
return Number((
|
|
495
|
+
return Number((getHiResTimestamp2() - this._startTs).toPrecision(10));
|
|
315
496
|
}
|
|
316
497
|
/** @return milliseconds, with fractions */
|
|
317
498
|
getDelta() {
|
|
318
|
-
return Number((
|
|
499
|
+
return Number((getHiResTimestamp2() - this._deltaTs).toPrecision(10));
|
|
319
500
|
}
|
|
320
501
|
/** @deprecated use logLevel */
|
|
321
502
|
set priority(newPriority) {
|
|
@@ -445,11 +626,11 @@ var __exports__ = (() => {
|
|
|
445
626
|
assert(method);
|
|
446
627
|
opts.total = this.getTotal();
|
|
447
628
|
opts.delta = this.getDelta();
|
|
448
|
-
this._deltaTs =
|
|
629
|
+
this._deltaTs = getHiResTimestamp2();
|
|
449
630
|
const tag = opts.tag || opts.message;
|
|
450
631
|
if (opts.once && tag) {
|
|
451
632
|
if (!cache[tag]) {
|
|
452
|
-
cache[tag] =
|
|
633
|
+
cache[tag] = getHiResTimestamp2();
|
|
453
634
|
} else {
|
|
454
635
|
return noop;
|
|
455
636
|
}
|
|
@@ -489,308 +670,55 @@ var __exports__ = (() => {
|
|
|
489
670
|
case "string":
|
|
490
671
|
case "function":
|
|
491
672
|
if (message !== void 0) {
|
|
492
|
-
args.unshift(message);
|
|
493
|
-
}
|
|
494
|
-
opts.message = logLevel;
|
|
495
|
-
break;
|
|
496
|
-
case "object":
|
|
497
|
-
Object.assign(opts, logLevel);
|
|
498
|
-
break;
|
|
499
|
-
default:
|
|
500
|
-
}
|
|
501
|
-
if (typeof opts.message === "function") {
|
|
502
|
-
opts.message = opts.message();
|
|
503
|
-
}
|
|
504
|
-
const messageType = typeof opts.message;
|
|
505
|
-
assert(messageType === "string" || messageType === "object");
|
|
506
|
-
return Object.assign(opts, { args }, opts.opts);
|
|
507
|
-
}
|
|
508
|
-
function decorateMessage(id, message, opts) {
|
|
509
|
-
if (typeof message === "string") {
|
|
510
|
-
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
511
|
-
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
512
|
-
message = addColor(message, opts.color, opts.background);
|
|
513
|
-
}
|
|
514
|
-
return message;
|
|
515
|
-
}
|
|
516
|
-
function getTableHeader(table) {
|
|
517
|
-
for (const key in table) {
|
|
518
|
-
for (const title in table[key]) {
|
|
519
|
-
return title || "untitled";
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return "empty";
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
526
|
-
globalThis.probe = {};
|
|
527
|
-
|
|
528
|
-
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
529
|
-
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
530
|
-
|
|
531
|
-
// src/utils/log.ts
|
|
532
|
-
var log = new Log({ id: "luma.gl" });
|
|
533
|
-
|
|
534
|
-
// ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
535
|
-
function getHiResTimestamp2() {
|
|
536
|
-
let timestamp;
|
|
537
|
-
if (typeof window !== "undefined" && window.performance) {
|
|
538
|
-
timestamp = window.performance.now();
|
|
539
|
-
} else if (typeof process !== "undefined" && process.hrtime) {
|
|
540
|
-
const timeParts = process.hrtime();
|
|
541
|
-
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
542
|
-
} else {
|
|
543
|
-
timestamp = Date.now();
|
|
544
|
-
}
|
|
545
|
-
return timestamp;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// ../../node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
549
|
-
var Stat = class {
|
|
550
|
-
constructor(name2, type) {
|
|
551
|
-
this.sampleSize = 1;
|
|
552
|
-
this.time = 0;
|
|
553
|
-
this.count = 0;
|
|
554
|
-
this.samples = 0;
|
|
555
|
-
this.lastTiming = 0;
|
|
556
|
-
this.lastSampleTime = 0;
|
|
557
|
-
this.lastSampleCount = 0;
|
|
558
|
-
this._count = 0;
|
|
559
|
-
this._time = 0;
|
|
560
|
-
this._samples = 0;
|
|
561
|
-
this._startTime = 0;
|
|
562
|
-
this._timerPending = false;
|
|
563
|
-
this.name = name2;
|
|
564
|
-
this.type = type;
|
|
565
|
-
this.reset();
|
|
566
|
-
}
|
|
567
|
-
reset() {
|
|
568
|
-
this.time = 0;
|
|
569
|
-
this.count = 0;
|
|
570
|
-
this.samples = 0;
|
|
571
|
-
this.lastTiming = 0;
|
|
572
|
-
this.lastSampleTime = 0;
|
|
573
|
-
this.lastSampleCount = 0;
|
|
574
|
-
this._count = 0;
|
|
575
|
-
this._time = 0;
|
|
576
|
-
this._samples = 0;
|
|
577
|
-
this._startTime = 0;
|
|
578
|
-
this._timerPending = false;
|
|
579
|
-
return this;
|
|
580
|
-
}
|
|
581
|
-
setSampleSize(samples) {
|
|
582
|
-
this.sampleSize = samples;
|
|
583
|
-
return this;
|
|
584
|
-
}
|
|
585
|
-
/** Call to increment count (+1) */
|
|
586
|
-
incrementCount() {
|
|
587
|
-
this.addCount(1);
|
|
588
|
-
return this;
|
|
589
|
-
}
|
|
590
|
-
/** Call to decrement count (-1) */
|
|
591
|
-
decrementCount() {
|
|
592
|
-
this.subtractCount(1);
|
|
593
|
-
return this;
|
|
594
|
-
}
|
|
595
|
-
/** Increase count */
|
|
596
|
-
addCount(value) {
|
|
597
|
-
this._count += value;
|
|
598
|
-
this._samples++;
|
|
599
|
-
this._checkSampling();
|
|
600
|
-
return this;
|
|
601
|
-
}
|
|
602
|
-
/** Decrease count */
|
|
603
|
-
subtractCount(value) {
|
|
604
|
-
this._count -= value;
|
|
605
|
-
this._samples++;
|
|
606
|
-
this._checkSampling();
|
|
607
|
-
return this;
|
|
608
|
-
}
|
|
609
|
-
/** Add an arbitrary timing and bump the count */
|
|
610
|
-
addTime(time) {
|
|
611
|
-
this._time += time;
|
|
612
|
-
this.lastTiming = time;
|
|
613
|
-
this._samples++;
|
|
614
|
-
this._checkSampling();
|
|
615
|
-
return this;
|
|
616
|
-
}
|
|
617
|
-
/** Start a timer */
|
|
618
|
-
timeStart() {
|
|
619
|
-
this._startTime = getHiResTimestamp2();
|
|
620
|
-
this._timerPending = true;
|
|
621
|
-
return this;
|
|
622
|
-
}
|
|
623
|
-
/** End a timer. Adds to time and bumps the timing count. */
|
|
624
|
-
timeEnd() {
|
|
625
|
-
if (!this._timerPending) {
|
|
626
|
-
return this;
|
|
627
|
-
}
|
|
628
|
-
this.addTime(getHiResTimestamp2() - this._startTime);
|
|
629
|
-
this._timerPending = false;
|
|
630
|
-
this._checkSampling();
|
|
631
|
-
return this;
|
|
632
|
-
}
|
|
633
|
-
getSampleAverageCount() {
|
|
634
|
-
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
635
|
-
}
|
|
636
|
-
/** Calculate average time / count for the previous window */
|
|
637
|
-
getSampleAverageTime() {
|
|
638
|
-
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
639
|
-
}
|
|
640
|
-
/** Calculate counts per second for the previous window */
|
|
641
|
-
getSampleHz() {
|
|
642
|
-
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
643
|
-
}
|
|
644
|
-
getAverageCount() {
|
|
645
|
-
return this.samples > 0 ? this.count / this.samples : 0;
|
|
646
|
-
}
|
|
647
|
-
/** Calculate average time / count */
|
|
648
|
-
getAverageTime() {
|
|
649
|
-
return this.samples > 0 ? this.time / this.samples : 0;
|
|
650
|
-
}
|
|
651
|
-
/** Calculate counts per second */
|
|
652
|
-
getHz() {
|
|
653
|
-
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
654
|
-
}
|
|
655
|
-
_checkSampling() {
|
|
656
|
-
if (this._samples === this.sampleSize) {
|
|
657
|
-
this.lastSampleTime = this._time;
|
|
658
|
-
this.lastSampleCount = this._count;
|
|
659
|
-
this.count += this._count;
|
|
660
|
-
this.time += this._time;
|
|
661
|
-
this.samples += this._samples;
|
|
662
|
-
this._time = 0;
|
|
663
|
-
this._count = 0;
|
|
664
|
-
this._samples = 0;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
// ../../node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
670
|
-
var Stats = class {
|
|
671
|
-
constructor(options) {
|
|
672
|
-
this.stats = {};
|
|
673
|
-
this.id = options.id;
|
|
674
|
-
this.stats = {};
|
|
675
|
-
this._initializeStats(options.stats);
|
|
676
|
-
Object.seal(this);
|
|
677
|
-
}
|
|
678
|
-
/** Acquire a stat. Create if it doesn't exist. */
|
|
679
|
-
get(name2, type = "count") {
|
|
680
|
-
return this._getOrCreate({ name: name2, type });
|
|
681
|
-
}
|
|
682
|
-
get size() {
|
|
683
|
-
return Object.keys(this.stats).length;
|
|
684
|
-
}
|
|
685
|
-
/** Reset all stats */
|
|
686
|
-
reset() {
|
|
687
|
-
for (const stat of Object.values(this.stats)) {
|
|
688
|
-
stat.reset();
|
|
689
|
-
}
|
|
690
|
-
return this;
|
|
691
|
-
}
|
|
692
|
-
forEach(fn) {
|
|
693
|
-
for (const stat of Object.values(this.stats)) {
|
|
694
|
-
fn(stat);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
getTable() {
|
|
698
|
-
const table = {};
|
|
699
|
-
this.forEach((stat) => {
|
|
700
|
-
table[stat.name] = {
|
|
701
|
-
time: stat.time || 0,
|
|
702
|
-
count: stat.count || 0,
|
|
703
|
-
average: stat.getAverageTime() || 0,
|
|
704
|
-
hz: stat.getHz() || 0
|
|
705
|
-
};
|
|
706
|
-
});
|
|
707
|
-
return table;
|
|
708
|
-
}
|
|
709
|
-
_initializeStats(stats = []) {
|
|
710
|
-
stats.forEach((stat) => this._getOrCreate(stat));
|
|
711
|
-
}
|
|
712
|
-
_getOrCreate(stat) {
|
|
713
|
-
const { name: name2, type } = stat;
|
|
714
|
-
let result = this.stats[name2];
|
|
715
|
-
if (!result) {
|
|
716
|
-
if (stat instanceof Stat) {
|
|
717
|
-
result = stat;
|
|
718
|
-
} else {
|
|
719
|
-
result = new Stat(name2, type);
|
|
720
|
-
}
|
|
721
|
-
this.stats[name2] = result;
|
|
722
|
-
}
|
|
723
|
-
return result;
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
// src/utils/stats-manager.ts
|
|
728
|
-
var StatsManager = class {
|
|
729
|
-
stats = /* @__PURE__ */ new Map();
|
|
730
|
-
getStats(name2) {
|
|
731
|
-
return this.get(name2);
|
|
732
|
-
}
|
|
733
|
-
get(name2) {
|
|
734
|
-
if (!this.stats.has(name2)) {
|
|
735
|
-
this.stats.set(name2, new Stats({ id: name2 }));
|
|
736
|
-
}
|
|
737
|
-
return this.stats.get(name2);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
var lumaStats = new StatsManager();
|
|
741
|
-
|
|
742
|
-
// src/init.ts
|
|
743
|
-
function initializeLuma() {
|
|
744
|
-
const VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "running from source";
|
|
745
|
-
const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
|
|
746
|
-
if (globalThis.luma && globalThis.luma.VERSION !== VERSION3) {
|
|
747
|
-
throw new Error(
|
|
748
|
-
`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION3}`
|
|
749
|
-
);
|
|
673
|
+
args.unshift(message);
|
|
674
|
+
}
|
|
675
|
+
opts.message = logLevel;
|
|
676
|
+
break;
|
|
677
|
+
case "object":
|
|
678
|
+
Object.assign(opts, logLevel);
|
|
679
|
+
break;
|
|
680
|
+
default:
|
|
750
681
|
}
|
|
751
|
-
if (
|
|
752
|
-
|
|
753
|
-
log.log(1, `${VERSION3} - ${STARTUP_MESSAGE}`)();
|
|
754
|
-
}
|
|
755
|
-
globalThis.luma = globalThis.luma || {
|
|
756
|
-
VERSION: VERSION3,
|
|
757
|
-
version: VERSION3,
|
|
758
|
-
log,
|
|
759
|
-
// A global stats object that various components can add information to
|
|
760
|
-
// E.g. see webgl/resource.js
|
|
761
|
-
stats: lumaStats
|
|
762
|
-
};
|
|
682
|
+
if (typeof opts.message === "function") {
|
|
683
|
+
opts.message = opts.message();
|
|
763
684
|
}
|
|
764
|
-
|
|
685
|
+
const messageType = typeof opts.message;
|
|
686
|
+
assert(messageType === "string" || messageType === "object");
|
|
687
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
765
688
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
689
|
+
function decorateMessage(id, message, opts) {
|
|
690
|
+
if (typeof message === "string") {
|
|
691
|
+
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
692
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
693
|
+
message = addColor(message, opts.color, opts.background);
|
|
694
|
+
}
|
|
695
|
+
return message;
|
|
771
696
|
}
|
|
772
|
-
function
|
|
773
|
-
|
|
774
|
-
|
|
697
|
+
function getTableHeader(table) {
|
|
698
|
+
for (const key in table) {
|
|
699
|
+
for (const title in table[key]) {
|
|
700
|
+
return title || "untitled";
|
|
701
|
+
}
|
|
775
702
|
}
|
|
776
|
-
return
|
|
703
|
+
return "empty";
|
|
777
704
|
}
|
|
778
705
|
|
|
779
|
-
//
|
|
706
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
707
|
+
globalThis.probe = {};
|
|
708
|
+
|
|
709
|
+
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
710
|
+
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
711
|
+
|
|
712
|
+
// src/utils/log.ts
|
|
713
|
+
var log = new Log({ id: "luma.gl" });
|
|
714
|
+
|
|
715
|
+
// src/utils/uid.ts
|
|
780
716
|
var uidCounters = {};
|
|
781
717
|
function uid(id = "id") {
|
|
782
718
|
uidCounters[id] = uidCounters[id] || 1;
|
|
783
719
|
const count = uidCounters[id]++;
|
|
784
720
|
return `${id}-${count}`;
|
|
785
721
|
}
|
|
786
|
-
function isObjectEmpty(obj) {
|
|
787
|
-
let isEmpty = true;
|
|
788
|
-
for (const key in obj) {
|
|
789
|
-
isEmpty = false;
|
|
790
|
-
break;
|
|
791
|
-
}
|
|
792
|
-
return isEmpty;
|
|
793
|
-
}
|
|
794
722
|
|
|
795
723
|
// src/adapter/resources/resource.ts
|
|
796
724
|
var Resource = class {
|
|
@@ -955,17 +883,17 @@ var __exports__ = (() => {
|
|
|
955
883
|
debugData = new ArrayBuffer(0);
|
|
956
884
|
/** This doesn't handle partial non-zero offset updates correctly */
|
|
957
885
|
_setDebugData(data, byteOffset, byteLength) {
|
|
958
|
-
const
|
|
886
|
+
const arrayBuffer2 = ArrayBuffer.isView(data) ? data.buffer : data;
|
|
959
887
|
const debugDataLength = Math.min(
|
|
960
888
|
data ? data.byteLength : byteLength,
|
|
961
889
|
_Buffer.DEBUG_DATA_MAX_LENGTH
|
|
962
890
|
);
|
|
963
|
-
if (
|
|
891
|
+
if (arrayBuffer2 === null) {
|
|
964
892
|
this.debugData = new ArrayBuffer(debugDataLength);
|
|
965
|
-
} else if (byteOffset === 0 && byteLength ===
|
|
966
|
-
this.debugData =
|
|
893
|
+
} else if (byteOffset === 0 && byteLength === arrayBuffer2.byteLength) {
|
|
894
|
+
this.debugData = arrayBuffer2.slice(0, debugDataLength);
|
|
967
895
|
} else {
|
|
968
|
-
this.debugData =
|
|
896
|
+
this.debugData = arrayBuffer2.slice(byteOffset, byteOffset + debugDataLength);
|
|
969
897
|
}
|
|
970
898
|
}
|
|
971
899
|
};
|
|
@@ -999,7 +927,7 @@ var __exports__ = (() => {
|
|
|
999
927
|
/** Max amount of debug data saved. Two vec4's */
|
|
1000
928
|
__publicField(Buffer2, "DEBUG_DATA_MAX_LENGTH", 32);
|
|
1001
929
|
|
|
1002
|
-
// src/
|
|
930
|
+
// src/gpu-type-utils/decode-data-type.ts
|
|
1003
931
|
function decodeVertexType(type) {
|
|
1004
932
|
const dataType = TYPE_MAP[type];
|
|
1005
933
|
const bytes = getDataTypeBytes(dataType);
|
|
@@ -1043,7 +971,7 @@ var __exports__ = (() => {
|
|
|
1043
971
|
sint32: 4
|
|
1044
972
|
};
|
|
1045
973
|
|
|
1046
|
-
// src/
|
|
974
|
+
// src/gpu-type-utils/decode-texture-format.ts
|
|
1047
975
|
var COMPRESSED_TEXTURE_FORMAT_PREFIXES = [
|
|
1048
976
|
"bc1",
|
|
1049
977
|
"bc2",
|
|
@@ -1059,63 +987,97 @@ var __exports__ = (() => {
|
|
|
1059
987
|
"astc",
|
|
1060
988
|
"pvrtc"
|
|
1061
989
|
];
|
|
1062
|
-
var REGEX = /^(rg
|
|
990
|
+
var REGEX = /^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;
|
|
1063
991
|
function isTextureFormatCompressed(textureFormat) {
|
|
1064
992
|
return COMPRESSED_TEXTURE_FORMAT_PREFIXES.some((prefix) => textureFormat.startsWith(prefix));
|
|
1065
993
|
}
|
|
1066
994
|
function decodeTextureFormat(format) {
|
|
1067
995
|
const matches = REGEX.exec(format);
|
|
1068
996
|
if (matches) {
|
|
1069
|
-
const [,
|
|
1070
|
-
if (
|
|
997
|
+
const [, channels, length, type, srgb, suffix] = matches;
|
|
998
|
+
if (format) {
|
|
1071
999
|
const dataType = `${type}${length}`;
|
|
1072
1000
|
const decodedType = decodeVertexType(dataType);
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
components:
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1001
|
+
const info = {
|
|
1002
|
+
channels,
|
|
1003
|
+
components: channels.length,
|
|
1004
|
+
bitsPerChannel: decodedType.byteLength * 8,
|
|
1005
|
+
bytesPerPixel: decodedType.byteLength * channels.length,
|
|
1006
|
+
dataType: decodedType.dataType,
|
|
1007
|
+
integer: decodedType.integer,
|
|
1008
|
+
signed: decodedType.signed,
|
|
1009
|
+
normalized: decodedType.normalized
|
|
1081
1010
|
};
|
|
1011
|
+
if (suffix === "-webgl") {
|
|
1012
|
+
info.webgl = true;
|
|
1013
|
+
}
|
|
1014
|
+
if (srgb === "-srgb") {
|
|
1015
|
+
info.srgb = true;
|
|
1016
|
+
}
|
|
1017
|
+
return info;
|
|
1082
1018
|
}
|
|
1083
1019
|
}
|
|
1084
1020
|
return decodeNonStandardFormat(format);
|
|
1085
1021
|
}
|
|
1086
1022
|
var EXCEPTIONS = {
|
|
1087
1023
|
// Packed 16 bit formats
|
|
1088
|
-
"rgba4unorm-webgl": {
|
|
1089
|
-
"rgb565unorm-webgl": {
|
|
1090
|
-
"rgb5a1unorm-webgl": {
|
|
1024
|
+
"rgba4unorm-webgl": { channels: "rgba", bytesPerPixel: 2, packed: true },
|
|
1025
|
+
"rgb565unorm-webgl": { channels: "rgb", bytesPerPixel: 2, packed: true },
|
|
1026
|
+
"rgb5a1unorm-webgl": { channels: "rgba", bytesPerPixel: 2, packed: true },
|
|
1091
1027
|
// Packed 32 bit formats
|
|
1092
|
-
rgb9e5ufloat: {
|
|
1093
|
-
rg11b10ufloat: {
|
|
1094
|
-
rgb10a2unorm: {
|
|
1095
|
-
"rgb10a2uint-webgl": {
|
|
1028
|
+
rgb9e5ufloat: { channels: "rgb", bytesPerPixel: 4, packed: true },
|
|
1029
|
+
rg11b10ufloat: { channels: "rgb", bytesPerPixel: 4, packed: true },
|
|
1030
|
+
rgb10a2unorm: { channels: "rgba", bytesPerPixel: 4, packed: true },
|
|
1031
|
+
"rgb10a2uint-webgl": { channels: "rgba", bytesPerPixel: 4, packed: true },
|
|
1096
1032
|
// Depth/stencil
|
|
1097
|
-
stencil8: { components: 1,
|
|
1098
|
-
depth16unorm: { components: 1,
|
|
1099
|
-
depth24plus: { components: 1,
|
|
1100
|
-
depth32float: { components: 1,
|
|
1101
|
-
"depth24plus-stencil8": { components: 2,
|
|
1102
|
-
// "depth24unorm-stencil8" feature
|
|
1103
|
-
"depth24unorm-stencil8": { components: 2, bpp: 4, a: "depth-stencil" },
|
|
1033
|
+
stencil8: { components: 1, bytesPerPixel: 1, a: "stencil", dataType: "uint8" },
|
|
1034
|
+
depth16unorm: { components: 1, bytesPerPixel: 2, a: "depth", dataType: "uint16" },
|
|
1035
|
+
depth24plus: { components: 1, bytesPerPixel: 3, a: "depth", dataType: "uint32" },
|
|
1036
|
+
depth32float: { components: 1, bytesPerPixel: 4, a: "depth", dataType: "float32" },
|
|
1037
|
+
"depth24plus-stencil8": { components: 2, bytesPerPixel: 4, a: "depth-stencil", packed: true },
|
|
1104
1038
|
// "depth32float-stencil8" feature
|
|
1105
|
-
"depth32float-stencil8": { components: 2,
|
|
1039
|
+
"depth32float-stencil8": { components: 2, bytesPerPixel: 4, a: "depth-stencil", packed: true }
|
|
1106
1040
|
};
|
|
1107
1041
|
function decodeNonStandardFormat(format) {
|
|
1042
|
+
if (isTextureFormatCompressed(format)) {
|
|
1043
|
+
const info2 = {
|
|
1044
|
+
channels: "rgb",
|
|
1045
|
+
components: 3,
|
|
1046
|
+
bytesPerPixel: 1,
|
|
1047
|
+
srgb: false,
|
|
1048
|
+
compressed: true
|
|
1049
|
+
};
|
|
1050
|
+
const blockSize = getCompressedTextureBlockSize(format);
|
|
1051
|
+
if (blockSize) {
|
|
1052
|
+
info2.blockWidth = blockSize.blockWidth;
|
|
1053
|
+
info2.blockHeight = blockSize.blockHeight;
|
|
1054
|
+
}
|
|
1055
|
+
return info2;
|
|
1056
|
+
}
|
|
1108
1057
|
const data = EXCEPTIONS[format];
|
|
1109
1058
|
if (!data) {
|
|
1110
1059
|
throw new Error(`Unknown format ${format}`);
|
|
1111
1060
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1061
|
+
const info = {
|
|
1062
|
+
...data,
|
|
1063
|
+
channels: data.channels || "",
|
|
1064
|
+
components: data.components || data.channels?.length || 1,
|
|
1065
|
+
bytesPerPixel: data.bytesPerPixel || 1,
|
|
1066
|
+
srgb: false
|
|
1118
1067
|
};
|
|
1068
|
+
if (data.packed) {
|
|
1069
|
+
info.packed = data.packed;
|
|
1070
|
+
}
|
|
1071
|
+
return info;
|
|
1072
|
+
}
|
|
1073
|
+
function getCompressedTextureBlockSize(format) {
|
|
1074
|
+
const REGEX2 = /.*-(\d+)x(\d+)-.*/;
|
|
1075
|
+
const matches = REGEX2.exec(format);
|
|
1076
|
+
if (matches) {
|
|
1077
|
+
const [, blockWidth, blockHeight] = matches;
|
|
1078
|
+
return { blockWidth: Number(blockWidth), blockHeight: Number(blockHeight) };
|
|
1079
|
+
}
|
|
1080
|
+
return null;
|
|
1119
1081
|
}
|
|
1120
1082
|
|
|
1121
1083
|
// src/adapter/device.ts
|
|
@@ -1132,7 +1094,7 @@ var __exports__ = (() => {
|
|
|
1132
1094
|
yield* this.features;
|
|
1133
1095
|
}
|
|
1134
1096
|
has(feature) {
|
|
1135
|
-
return !this.disabledFeatures[feature] && this.features.has(feature);
|
|
1097
|
+
return !this.disabledFeatures?.[feature] && this.features.has(feature);
|
|
1136
1098
|
}
|
|
1137
1099
|
};
|
|
1138
1100
|
var _Device = class {
|
|
@@ -1165,6 +1127,10 @@ var __exports__ = (() => {
|
|
|
1165
1127
|
loseDevice() {
|
|
1166
1128
|
return false;
|
|
1167
1129
|
}
|
|
1130
|
+
/** Report error (normally for unhandled device errors) */
|
|
1131
|
+
error(error) {
|
|
1132
|
+
this.props.onError(error);
|
|
1133
|
+
}
|
|
1168
1134
|
/** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */
|
|
1169
1135
|
getCanvasContext() {
|
|
1170
1136
|
if (!this.canvasContext) {
|
|
@@ -1172,10 +1138,8 @@ var __exports__ = (() => {
|
|
|
1172
1138
|
}
|
|
1173
1139
|
return this.canvasContext;
|
|
1174
1140
|
}
|
|
1141
|
+
// createTexture(data: Promise<TextureData>): Texture;
|
|
1175
1142
|
createTexture(props) {
|
|
1176
|
-
if (props instanceof Promise || typeof props === "string") {
|
|
1177
|
-
props = { data: props };
|
|
1178
|
-
}
|
|
1179
1143
|
return this._createTexture(props);
|
|
1180
1144
|
}
|
|
1181
1145
|
createCommandEncoder(props = {}) {
|
|
@@ -1249,16 +1213,9 @@ var __exports__ = (() => {
|
|
|
1249
1213
|
// width are height are only used by headless gl
|
|
1250
1214
|
height: 600,
|
|
1251
1215
|
requestMaxLimits: true,
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
// Initialize the SpectorJS WebGL debugger
|
|
1256
|
-
break: [],
|
|
1257
|
-
// TODO - Change these after confirming things work as expected
|
|
1258
|
-
initalizeFeatures: true,
|
|
1259
|
-
disabledFeatures: {
|
|
1260
|
-
"compilation-status-async-webgl": true
|
|
1261
|
-
},
|
|
1216
|
+
// Callbacks
|
|
1217
|
+
onError: (error) => log.error(error.message),
|
|
1218
|
+
gl: null,
|
|
1262
1219
|
// alpha: undefined,
|
|
1263
1220
|
// depth: undefined,
|
|
1264
1221
|
// stencil: undefined,
|
|
@@ -1266,133 +1223,154 @@ var __exports__ = (() => {
|
|
|
1266
1223
|
// premultipliedAlpha: undefined,
|
|
1267
1224
|
// preserveDrawingBuffer: undefined,
|
|
1268
1225
|
// failIfMajorPerformanceCaveat: undefined
|
|
1269
|
-
|
|
1270
|
-
//
|
|
1271
|
-
|
|
1226
|
+
debug: Boolean(log.get("debug")),
|
|
1227
|
+
// Instrument context (at the expense of performance)
|
|
1228
|
+
break: log.get("break") || [],
|
|
1229
|
+
// WebGL specific debugging
|
|
1230
|
+
debugWithSpectorJS: void 0,
|
|
1231
|
+
spectorUrl: void 0,
|
|
1232
|
+
// TODO - Change these after confirming things work as expected
|
|
1233
|
+
initalizeFeatures: true,
|
|
1234
|
+
disabledFeatures: {
|
|
1235
|
+
"compilation-status-async-webgl": true
|
|
1236
|
+
},
|
|
1237
|
+
_factoryDestroyPolicy: "unused"
|
|
1272
1238
|
});
|
|
1273
|
-
__publicField(Device, "VERSION", VERSION2);
|
|
1274
1239
|
|
|
1275
|
-
// src/
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1240
|
+
// src/adapter/luma.ts
|
|
1241
|
+
var STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
|
|
1242
|
+
var ERROR_MESSAGE = "No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.";
|
|
1243
|
+
var _Luma = class {
|
|
1244
|
+
/** Global stats for all devices */
|
|
1245
|
+
stats = lumaStats;
|
|
1246
|
+
/**
|
|
1247
|
+
* Global log
|
|
1248
|
+
*
|
|
1249
|
+
* Assign luma.log.level in console to control logging: \
|
|
1250
|
+
* 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs
|
|
1251
|
+
* luma.log.break[], set to gl funcs, luma.log.profile[] set to model names`;
|
|
1252
|
+
*/
|
|
1253
|
+
log = log;
|
|
1254
|
+
/** Version of luma.gl */
|
|
1255
|
+
VERSION = (
|
|
1256
|
+
// Version detection using build plugin
|
|
1257
|
+
// @ts-expect-error no-undef
|
|
1258
|
+
typeof __VERSION__ !== "undefined" ? __VERSION__ : "running from source"
|
|
1259
|
+
);
|
|
1260
|
+
spector;
|
|
1261
|
+
preregisteredAdapters = /* @__PURE__ */ new Map();
|
|
1262
|
+
constructor() {
|
|
1263
|
+
if (globalThis.luma) {
|
|
1264
|
+
if (globalThis.luma.VERSION !== this.VERSION) {
|
|
1265
|
+
log.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)();
|
|
1266
|
+
log.error(`'yarn why @luma.gl/core' can help identify the source of the conflict`)();
|
|
1267
|
+
throw new Error(`luma.gl - multiple versions detected: see console log`);
|
|
1268
|
+
}
|
|
1269
|
+
log.error("This version of luma.gl has already been initialized")();
|
|
1270
|
+
}
|
|
1271
|
+
log.log(1, `${this.VERSION} - ${STARTUP_MESSAGE}`)();
|
|
1272
|
+
globalThis.luma = this;
|
|
1279
1273
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
var deviceMap = /* @__PURE__ */ new Map();
|
|
1284
|
-
var _luma = class {
|
|
1285
|
-
static registerDevices(deviceClasses) {
|
|
1286
|
-
for (const deviceClass of deviceClasses) {
|
|
1287
|
-
assert2(deviceClass.type && deviceClass.isSupported && deviceClass.create);
|
|
1288
|
-
deviceMap.set(deviceClass.type, deviceClass);
|
|
1274
|
+
registerAdapters(adapters) {
|
|
1275
|
+
for (const deviceClass of adapters) {
|
|
1276
|
+
this.preregisteredAdapters.set(deviceClass.type, deviceClass);
|
|
1289
1277
|
}
|
|
1290
1278
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1279
|
+
/** Get type strings for supported Devices */
|
|
1280
|
+
getSupportedAdapters(adapters = []) {
|
|
1281
|
+
const adapterMap = this.getAdapterMap(adapters);
|
|
1282
|
+
return Array.from(adapterMap).map(([, adapter]) => adapter).filter((adapter) => adapter.isSupported?.()).map((adapter) => adapter.type);
|
|
1283
|
+
}
|
|
1284
|
+
/** Get type strings for best available Device */
|
|
1285
|
+
getBestAvailableAdapter(adapters = []) {
|
|
1286
|
+
const adapterMap = this.getAdapterMap(adapters);
|
|
1287
|
+
if (adapterMap.get("webgpu")?.isSupported?.()) {
|
|
1288
|
+
return "webgpu";
|
|
1289
|
+
}
|
|
1290
|
+
if (adapterMap.get("webgl")?.isSupported?.()) {
|
|
1291
|
+
return "webgl";
|
|
1292
|
+
}
|
|
1293
|
+
return null;
|
|
1293
1294
|
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1295
|
+
setDefaultDeviceProps(props) {
|
|
1296
|
+
Object.assign(_Luma.defaultProps, props);
|
|
1296
1297
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1298
|
+
/** Creates a device. Asynchronously. */
|
|
1299
|
+
async createDevice(props = {}) {
|
|
1300
|
+
props = { ..._Luma.defaultProps, ...props };
|
|
1301
|
+
const adapterMap = this.getAdapterMap(props.adapters);
|
|
1302
|
+
let type = props.type || "";
|
|
1303
|
+
if (type === "best-available") {
|
|
1304
|
+
type = this.getBestAvailableAdapter(props.adapters) || type;
|
|
1305
|
+
}
|
|
1306
|
+
const adapters = this.getAdapterMap(props.adapters) || adapterMap;
|
|
1307
|
+
const adapter = adapters.get(type);
|
|
1308
|
+
const device = await adapter?.create?.(props);
|
|
1309
|
+
if (device) {
|
|
1310
|
+
return device;
|
|
1311
|
+
}
|
|
1312
|
+
throw new Error(ERROR_MESSAGE);
|
|
1299
1313
|
}
|
|
1300
1314
|
/** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */
|
|
1301
|
-
|
|
1302
|
-
const
|
|
1315
|
+
async attachDevice(props) {
|
|
1316
|
+
const adapters = this.getAdapterMap(props.adapters);
|
|
1317
|
+
let type = "";
|
|
1303
1318
|
if (props.handle instanceof WebGL2RenderingContext) {
|
|
1304
|
-
|
|
1305
|
-
if (WebGLDevice) {
|
|
1306
|
-
return await WebGLDevice.attach(props.handle);
|
|
1307
|
-
}
|
|
1319
|
+
type = "webgl";
|
|
1308
1320
|
}
|
|
1309
1321
|
if (props.handle === null) {
|
|
1310
|
-
|
|
1311
|
-
if (UnknownDevice) {
|
|
1312
|
-
return await UnknownDevice.attach(null);
|
|
1313
|
-
}
|
|
1322
|
+
type = "unknown";
|
|
1314
1323
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
)
|
|
1318
|
-
|
|
1319
|
-
/** Creates a device. Asynchronously. */
|
|
1320
|
-
static async createDevice(props = {}) {
|
|
1321
|
-
props = { ..._luma.defaultProps, ...props };
|
|
1322
|
-
if (props.gl) {
|
|
1323
|
-
props.type = "webgl";
|
|
1324
|
-
}
|
|
1325
|
-
const devices = getDeviceMap(props.devices) || deviceMap;
|
|
1326
|
-
switch (props.type) {
|
|
1327
|
-
case "webgpu":
|
|
1328
|
-
let WebGPUDevice = devices.get("webgpu");
|
|
1329
|
-
if (WebGPUDevice) {
|
|
1330
|
-
return await WebGPUDevice.create(props);
|
|
1331
|
-
}
|
|
1332
|
-
break;
|
|
1333
|
-
case "webgl":
|
|
1334
|
-
let WebGLDevice = devices.get("webgl");
|
|
1335
|
-
if (WebGLDevice) {
|
|
1336
|
-
return await WebGLDevice.create(props);
|
|
1337
|
-
}
|
|
1338
|
-
break;
|
|
1339
|
-
case "unknown":
|
|
1340
|
-
const UnknownDevice = devices.get("unknown");
|
|
1341
|
-
if (UnknownDevice) {
|
|
1342
|
-
return await UnknownDevice.create(props);
|
|
1343
|
-
}
|
|
1344
|
-
break;
|
|
1345
|
-
case "best-available":
|
|
1346
|
-
WebGPUDevice = devices.get("webgpu");
|
|
1347
|
-
if (WebGPUDevice?.isSupported?.()) {
|
|
1348
|
-
return await WebGPUDevice.create(props);
|
|
1349
|
-
}
|
|
1350
|
-
WebGLDevice = devices.get("webgl");
|
|
1351
|
-
if (WebGLDevice?.isSupported?.()) {
|
|
1352
|
-
return await WebGLDevice.create(props);
|
|
1353
|
-
}
|
|
1354
|
-
break;
|
|
1324
|
+
const adapter = adapters.get(type);
|
|
1325
|
+
const device = await adapter?.attach?.(null);
|
|
1326
|
+
if (device) {
|
|
1327
|
+
return device;
|
|
1355
1328
|
}
|
|
1356
|
-
throw new Error(
|
|
1357
|
-
"No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported."
|
|
1358
|
-
);
|
|
1329
|
+
throw new Error(ERROR_MESSAGE);
|
|
1359
1330
|
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1331
|
+
/**
|
|
1332
|
+
* Override `HTMLCanvasContext.getCanvas()` to always create WebGL2 contexts with additional WebGL1 compatibility.
|
|
1333
|
+
* Useful when attaching luma to a context from an external library does not support creating WebGL2 contexts.
|
|
1334
|
+
*/
|
|
1335
|
+
enforceWebGL2(enforce = true, adapters = []) {
|
|
1336
|
+
const adapterMap = this.getAdapterMap(adapters);
|
|
1337
|
+
const webgl2Adapter = adapterMap.get("webgl");
|
|
1338
|
+
if (!webgl2Adapter) {
|
|
1339
|
+
log.warn("enforceWebGL2: webgl adapter not found")();
|
|
1340
|
+
}
|
|
1341
|
+
webgl2Adapter?.enforceWebGL2?.(enforce);
|
|
1342
|
+
}
|
|
1343
|
+
/** Convert a list of adapters to a map */
|
|
1344
|
+
getAdapterMap(adapters = []) {
|
|
1345
|
+
const map = new Map(this.preregisteredAdapters);
|
|
1346
|
+
for (const adapter of adapters) {
|
|
1347
|
+
map.set(adapter.type, adapter);
|
|
1348
|
+
}
|
|
1349
|
+
return map;
|
|
1350
|
+
}
|
|
1351
|
+
// DEPRECATED
|
|
1352
|
+
/** @deprecated Use registerAdapters */
|
|
1353
|
+
registerDevices(deviceClasses) {
|
|
1354
|
+
log.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");
|
|
1355
|
+
for (const deviceClass of deviceClasses) {
|
|
1356
|
+
const adapter = deviceClass.adapter;
|
|
1357
|
+
if (adapter) {
|
|
1358
|
+
this.preregisteredAdapters.set(adapter.type, adapter);
|
|
1371
1359
|
}
|
|
1372
|
-
|
|
1373
|
-
};
|
|
1360
|
+
}
|
|
1374
1361
|
}
|
|
1375
1362
|
};
|
|
1376
|
-
var
|
|
1377
|
-
__publicField(
|
|
1363
|
+
var Luma = _Luma;
|
|
1364
|
+
__publicField(Luma, "defaultProps", {
|
|
1378
1365
|
...Device.defaultProps,
|
|
1379
1366
|
type: "best-available",
|
|
1380
|
-
|
|
1367
|
+
adapters: void 0
|
|
1381
1368
|
});
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
if (!deviceClasses || deviceClasses?.length === 0) {
|
|
1388
|
-
return null;
|
|
1389
|
-
}
|
|
1390
|
-
const map = /* @__PURE__ */ new Map();
|
|
1391
|
-
for (const deviceClass of deviceClasses) {
|
|
1392
|
-
map.set(deviceClass.type, deviceClass);
|
|
1393
|
-
}
|
|
1394
|
-
return map;
|
|
1395
|
-
}
|
|
1369
|
+
var luma = new Luma();
|
|
1370
|
+
|
|
1371
|
+
// src/adapter/adapter.ts
|
|
1372
|
+
var Adapter = class {
|
|
1373
|
+
};
|
|
1396
1374
|
|
|
1397
1375
|
// src/adapter/canvas-context.ts
|
|
1398
1376
|
var isPage = isBrowser() && typeof document !== "undefined";
|
|
@@ -1684,20 +1662,106 @@ var __exports__ = (() => {
|
|
|
1684
1662
|
height;
|
|
1685
1663
|
/** depth of this texture */
|
|
1686
1664
|
depth;
|
|
1665
|
+
/** mip levels in this texture */
|
|
1666
|
+
mipLevels;
|
|
1687
1667
|
/** "Time" of last update. Monotonically increasing timestamp */
|
|
1688
1668
|
updateTimestamp;
|
|
1669
|
+
/** Check if data is an external image */
|
|
1670
|
+
static isExternalImage(data) {
|
|
1671
|
+
return typeof ImageData !== "undefined" && data instanceof ImageData || typeof ImageBitmap !== "undefined" && data instanceof ImageBitmap || typeof HTMLImageElement !== "undefined" && data instanceof HTMLImageElement || typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement || typeof VideoFrame !== "undefined" && data instanceof VideoFrame || typeof HTMLCanvasElement !== "undefined" && data instanceof HTMLCanvasElement || typeof OffscreenCanvas !== "undefined" && data instanceof OffscreenCanvas;
|
|
1672
|
+
}
|
|
1673
|
+
/** Determine size (width and height) of provided image data */
|
|
1674
|
+
static getExternalImageSize(data) {
|
|
1675
|
+
if (typeof ImageData !== "undefined" && data instanceof ImageData || typeof ImageBitmap !== "undefined" && data instanceof ImageBitmap || typeof HTMLCanvasElement !== "undefined" && data instanceof HTMLCanvasElement || typeof OffscreenCanvas !== "undefined" && data instanceof OffscreenCanvas) {
|
|
1676
|
+
return { width: data.width, height: data.height };
|
|
1677
|
+
}
|
|
1678
|
+
if (typeof HTMLImageElement !== "undefined" && data instanceof HTMLImageElement) {
|
|
1679
|
+
return { width: data.naturalWidth, height: data.naturalHeight };
|
|
1680
|
+
}
|
|
1681
|
+
if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
|
|
1682
|
+
return { width: data.videoWidth, height: data.videoHeight };
|
|
1683
|
+
}
|
|
1684
|
+
if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
|
|
1685
|
+
return { width: data.displayWidth, height: data.displayHeight };
|
|
1686
|
+
}
|
|
1687
|
+
throw new Error("Unknown image type");
|
|
1688
|
+
}
|
|
1689
|
+
/** Check if texture data is a typed array */
|
|
1690
|
+
static isTextureLevelData(data) {
|
|
1691
|
+
const typedArray = data?.data;
|
|
1692
|
+
return ArrayBuffer.isView(typedArray);
|
|
1693
|
+
}
|
|
1694
|
+
/** Get the size of the texture described by the provided TextureData */
|
|
1695
|
+
static getTextureDataSize(data) {
|
|
1696
|
+
if (!data) {
|
|
1697
|
+
return null;
|
|
1698
|
+
}
|
|
1699
|
+
if (ArrayBuffer.isView(data)) {
|
|
1700
|
+
return null;
|
|
1701
|
+
}
|
|
1702
|
+
if (Array.isArray(data)) {
|
|
1703
|
+
return _Texture.getTextureDataSize(data[0]);
|
|
1704
|
+
}
|
|
1705
|
+
if (_Texture.isExternalImage(data)) {
|
|
1706
|
+
return _Texture.getExternalImageSize(data);
|
|
1707
|
+
}
|
|
1708
|
+
if (data && typeof data === "object" && data.constructor === Object) {
|
|
1709
|
+
const textureDataArray = Object.values(data);
|
|
1710
|
+
const untypedData = textureDataArray[0];
|
|
1711
|
+
return { width: untypedData.width, height: untypedData.height };
|
|
1712
|
+
}
|
|
1713
|
+
throw new Error("texture size deduction failed");
|
|
1714
|
+
}
|
|
1715
|
+
/** Calculate the number of mip levels for a texture of width and height */
|
|
1716
|
+
static getMipLevelCount(width, height) {
|
|
1717
|
+
return Math.floor(Math.log2(Math.max(width, height))) + 1;
|
|
1718
|
+
}
|
|
1719
|
+
/** Convert luma.gl cubemap face constants to depth index */
|
|
1720
|
+
static getCubeFaceDepth(face) {
|
|
1721
|
+
switch (face) {
|
|
1722
|
+
case "+X":
|
|
1723
|
+
return 0;
|
|
1724
|
+
case "-X":
|
|
1725
|
+
return 1;
|
|
1726
|
+
case "+Y":
|
|
1727
|
+
return 2;
|
|
1728
|
+
case "-Y":
|
|
1729
|
+
return 3;
|
|
1730
|
+
case "+Z":
|
|
1731
|
+
return 4;
|
|
1732
|
+
case "-Z":
|
|
1733
|
+
return 5;
|
|
1734
|
+
default:
|
|
1735
|
+
throw new Error(face);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1689
1738
|
/** Do not use directly. Create with device.createTexture() */
|
|
1690
|
-
constructor(device, props
|
|
1691
|
-
super(device, props, defaultProps);
|
|
1739
|
+
constructor(device, props) {
|
|
1740
|
+
super(device, props, _Texture.defaultProps);
|
|
1692
1741
|
this.dimension = this.props.dimension;
|
|
1693
1742
|
this.format = this.props.format;
|
|
1694
1743
|
this.width = this.props.width;
|
|
1695
1744
|
this.height = this.props.height;
|
|
1696
1745
|
this.depth = this.props.depth;
|
|
1746
|
+
if (this.props.width === void 0 || this.props.height === void 0) {
|
|
1747
|
+
const size = _Texture.getTextureDataSize(this.props.data);
|
|
1748
|
+
this.width = size?.width || 1;
|
|
1749
|
+
this.height = size?.height || 1;
|
|
1750
|
+
}
|
|
1751
|
+
if (this.props.mipmaps && this.props.mipLevels === void 0) {
|
|
1752
|
+
this.props.mipLevels = "pyramid";
|
|
1753
|
+
}
|
|
1754
|
+
this.mipLevels = this.props.mipLevels === "pyramid" ? _Texture.getMipLevelCount(this.width, this.height) : this.props.mipLevels || 1;
|
|
1697
1755
|
this.updateTimestamp = device.incrementTimestamp();
|
|
1698
1756
|
}
|
|
1699
1757
|
};
|
|
1700
1758
|
var Texture = _Texture;
|
|
1759
|
+
__publicField(Texture, "COPY_SRC", 1);
|
|
1760
|
+
__publicField(Texture, "COPY_DST", 2);
|
|
1761
|
+
__publicField(Texture, "TEXTURE", 4);
|
|
1762
|
+
__publicField(Texture, "STORAGE", 8);
|
|
1763
|
+
__publicField(Texture, "RENDER_ATTACHMENT", 16);
|
|
1764
|
+
__publicField(Texture, "CubeFaces", ["+X", "-X", "+Y", "-Y", "+Z", "-Z"]);
|
|
1701
1765
|
__publicField(Texture, "defaultProps", {
|
|
1702
1766
|
...Resource.defaultProps,
|
|
1703
1767
|
data: null,
|
|
@@ -1706,23 +1770,30 @@ var __exports__ = (() => {
|
|
|
1706
1770
|
width: void 0,
|
|
1707
1771
|
height: void 0,
|
|
1708
1772
|
depth: 1,
|
|
1709
|
-
mipmaps:
|
|
1710
|
-
// type: undefined,
|
|
1773
|
+
mipmaps: false,
|
|
1711
1774
|
compressed: false,
|
|
1712
|
-
// mipLevels: 1,
|
|
1713
1775
|
usage: 0,
|
|
1714
|
-
// usage: GPUTextureUsage.COPY_DST
|
|
1715
1776
|
mipLevels: void 0,
|
|
1716
1777
|
samples: void 0,
|
|
1717
|
-
type: void 0,
|
|
1718
1778
|
sampler: {},
|
|
1719
1779
|
view: void 0
|
|
1720
1780
|
});
|
|
1721
|
-
|
|
1722
|
-
__publicField(Texture, "
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1781
|
+
/** Default options */
|
|
1782
|
+
__publicField(Texture, "defaultCopyExternalImageOptions", {
|
|
1783
|
+
image: void 0,
|
|
1784
|
+
sourceX: 0,
|
|
1785
|
+
sourceY: 0,
|
|
1786
|
+
width: void 0,
|
|
1787
|
+
height: void 0,
|
|
1788
|
+
depth: 1,
|
|
1789
|
+
mipLevel: 0,
|
|
1790
|
+
x: 0,
|
|
1791
|
+
y: 0,
|
|
1792
|
+
z: 0,
|
|
1793
|
+
aspect: "all",
|
|
1794
|
+
colorSpace: "srgb",
|
|
1795
|
+
premultipliedAlpha: false
|
|
1796
|
+
});
|
|
1726
1797
|
|
|
1727
1798
|
// src/adapter/resources/texture-view.ts
|
|
1728
1799
|
var _TextureView = class extends Resource {
|
|
@@ -1758,11 +1829,11 @@ var __exports__ = (() => {
|
|
|
1758
1829
|
var ExternalTexture = _ExternalTexture;
|
|
1759
1830
|
__publicField(ExternalTexture, "defaultProps", {
|
|
1760
1831
|
...Resource.defaultProps,
|
|
1761
|
-
source:
|
|
1832
|
+
source: void 0,
|
|
1762
1833
|
colorSpace: "srgb"
|
|
1763
1834
|
});
|
|
1764
1835
|
|
|
1765
|
-
// src/
|
|
1836
|
+
// src/adapter-utils/format-compiler-log.ts
|
|
1766
1837
|
function formatCompilerLog(shaderLog, source, options) {
|
|
1767
1838
|
let formattedLog = "";
|
|
1768
1839
|
const lines = source.split(/\r?\n/);
|
|
@@ -1828,31 +1899,6 @@ ${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.mes
|
|
|
1828
1899
|
return unsafe.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1829
1900
|
}
|
|
1830
1901
|
|
|
1831
|
-
// src/lib/compiler-log/get-shader-info.ts
|
|
1832
|
-
function getShaderInfo(source, defaultName) {
|
|
1833
|
-
return {
|
|
1834
|
-
name: getShaderName(source, defaultName),
|
|
1835
|
-
language: "glsl",
|
|
1836
|
-
version: getShaderVersion(source)
|
|
1837
|
-
};
|
|
1838
|
-
}
|
|
1839
|
-
function getShaderName(shader, defaultName = "unnamed") {
|
|
1840
|
-
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
1841
|
-
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
1842
|
-
return match ? match[1] : defaultName;
|
|
1843
|
-
}
|
|
1844
|
-
function getShaderVersion(source) {
|
|
1845
|
-
let version = 100;
|
|
1846
|
-
const words = source.match(/[^\s]+/g);
|
|
1847
|
-
if (words && words.length >= 2 && words[0] === "#version") {
|
|
1848
|
-
const v = parseInt(words[1], 10);
|
|
1849
|
-
if (Number.isFinite(v)) {
|
|
1850
|
-
version = v;
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
return version;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
1902
|
// src/adapter/resources/shader.ts
|
|
1857
1903
|
var _Shader = class extends Resource {
|
|
1858
1904
|
get [Symbol.toStringTag]() {
|
|
@@ -1900,12 +1946,15 @@ ${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.mes
|
|
|
1900
1946
|
this._displayShaderLog(messages);
|
|
1901
1947
|
}
|
|
1902
1948
|
// PRIVATE
|
|
1903
|
-
/**
|
|
1949
|
+
/**
|
|
1950
|
+
* In-browser UI logging of errors
|
|
1951
|
+
* TODO - this HTML formatting code should not be in Device, should be pluggable
|
|
1952
|
+
*/
|
|
1904
1953
|
_displayShaderLog(messages) {
|
|
1905
1954
|
if (typeof document === "undefined" || !document?.createElement) {
|
|
1906
1955
|
return;
|
|
1907
1956
|
}
|
|
1908
|
-
const shaderName =
|
|
1957
|
+
const shaderName = getShaderName(this.source);
|
|
1909
1958
|
const shaderTitle = `${this.stage} ${shaderName}`;
|
|
1910
1959
|
let htmlLog = formatCompilerLog(messages, this.source, { showSourceCode: "all", html: true });
|
|
1911
1960
|
const translatedSource = this.getTranslatedSource();
|
|
@@ -1926,9 +1975,7 @@ ${htmlLog}
|
|
|
1926
1975
|
button.style.textAlign = "left";
|
|
1927
1976
|
document.body.appendChild(button);
|
|
1928
1977
|
const errors = document.getElementsByClassName("luma-compiler-log-error");
|
|
1929
|
-
|
|
1930
|
-
errors[0].scrollIntoView();
|
|
1931
|
-
}
|
|
1978
|
+
errors[0]?.scrollIntoView();
|
|
1932
1979
|
button.onclick = () => {
|
|
1933
1980
|
const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;
|
|
1934
1981
|
navigator.clipboard.writeText(dataURI);
|
|
@@ -1946,7 +1993,12 @@ ${htmlLog}
|
|
|
1946
1993
|
debug: "errors"
|
|
1947
1994
|
});
|
|
1948
1995
|
function getShaderIdFromProps(props) {
|
|
1949
|
-
return
|
|
1996
|
+
return getShaderName(props.source) || props.id || uid(`unnamed ${props.stage}-shader`);
|
|
1997
|
+
}
|
|
1998
|
+
function getShaderName(shader, defaultName = "unnamed") {
|
|
1999
|
+
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
2000
|
+
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
2001
|
+
return match ? match[1] : defaultName;
|
|
1950
2002
|
}
|
|
1951
2003
|
|
|
1952
2004
|
// src/adapter/resources/sampler.ts
|
|
@@ -1984,10 +2036,6 @@ ${htmlLog}
|
|
|
1984
2036
|
width;
|
|
1985
2037
|
/** Height of all attachments in this framebuffer */
|
|
1986
2038
|
height;
|
|
1987
|
-
/** Color attachments */
|
|
1988
|
-
colorAttachments = [];
|
|
1989
|
-
/** Depth-stencil attachment, if provided */
|
|
1990
|
-
depthStencilAttachment = null;
|
|
1991
2039
|
constructor(device, props = {}) {
|
|
1992
2040
|
super(device, props, _Framebuffer.defaultProps);
|
|
1993
2041
|
this.width = this.props.width;
|
|
@@ -2064,7 +2112,7 @@ ${htmlLog}
|
|
|
2064
2112
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
2065
2113
|
if (this.colorAttachments[i]) {
|
|
2066
2114
|
const resizedTexture = this.device._createTexture({
|
|
2067
|
-
...this.colorAttachments[i].props,
|
|
2115
|
+
...this.colorAttachments[i].texture.props,
|
|
2068
2116
|
width,
|
|
2069
2117
|
height
|
|
2070
2118
|
});
|
|
@@ -2075,7 +2123,7 @@ ${htmlLog}
|
|
|
2075
2123
|
}
|
|
2076
2124
|
if (this.depthStencilAttachment) {
|
|
2077
2125
|
const resizedTexture = this.device._createTexture({
|
|
2078
|
-
...this.depthStencilAttachment.props,
|
|
2126
|
+
...this.depthStencilAttachment.texture.props,
|
|
2079
2127
|
width,
|
|
2080
2128
|
height
|
|
2081
2129
|
});
|
|
@@ -2189,8 +2237,11 @@ ${htmlLog}
|
|
|
2189
2237
|
return "ComputePipeline";
|
|
2190
2238
|
}
|
|
2191
2239
|
hash = "";
|
|
2240
|
+
/** The merged shader layout */
|
|
2241
|
+
shaderLayout;
|
|
2192
2242
|
constructor(device, props) {
|
|
2193
2243
|
super(device, props, _ComputePipeline.defaultProps);
|
|
2244
|
+
this.shaderLayout = props.shaderLayout;
|
|
2194
2245
|
}
|
|
2195
2246
|
};
|
|
2196
2247
|
var ComputePipeline = _ComputePipeline;
|
|
@@ -2251,7 +2302,7 @@ ${htmlLog}
|
|
|
2251
2302
|
...Resource.defaultProps
|
|
2252
2303
|
});
|
|
2253
2304
|
|
|
2254
|
-
// src/
|
|
2305
|
+
// src/gpu-type-utils/decode-attribute-type.ts
|
|
2255
2306
|
function decodeShaderAttributeType(attributeType) {
|
|
2256
2307
|
const [dataType, components] = TYPE_INFO[attributeType];
|
|
2257
2308
|
const integer = dataType === "i32" || dataType === "u32";
|
|
@@ -2313,7 +2364,7 @@ ${htmlLog}
|
|
|
2313
2364
|
// 'bool-webgl': 4,
|
|
2314
2365
|
};
|
|
2315
2366
|
|
|
2316
|
-
// src/
|
|
2367
|
+
// src/gpu-type-utils/decode-vertex-format.ts
|
|
2317
2368
|
function decodeVertexFormat(format) {
|
|
2318
2369
|
let webglOnly;
|
|
2319
2370
|
if (format.endsWith("-webgl")) {
|
|
@@ -2338,15 +2389,14 @@ ${htmlLog}
|
|
|
2338
2389
|
return result;
|
|
2339
2390
|
}
|
|
2340
2391
|
|
|
2341
|
-
// src/adapter
|
|
2392
|
+
// src/adapter-utils/get-attribute-from-layouts.ts
|
|
2342
2393
|
function getAttributeInfosFromLayouts(shaderLayout, bufferLayout) {
|
|
2343
2394
|
const attributeInfos = {};
|
|
2344
2395
|
for (const attribute of shaderLayout.attributes) {
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
);
|
|
2396
|
+
const attributeInfo = getAttributeInfoFromLayouts(shaderLayout, bufferLayout, attribute.name);
|
|
2397
|
+
if (attributeInfo) {
|
|
2398
|
+
attributeInfos[attribute.name] = attributeInfo;
|
|
2399
|
+
}
|
|
2350
2400
|
}
|
|
2351
2401
|
return attributeInfos;
|
|
2352
2402
|
}
|
|
@@ -2360,7 +2410,10 @@ ${htmlLog}
|
|
|
2360
2410
|
}
|
|
2361
2411
|
function getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name2) {
|
|
2362
2412
|
const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name2);
|
|
2363
|
-
const bufferMapping = getAttributeFromBufferLayout(
|
|
2413
|
+
const bufferMapping = getAttributeFromBufferLayout(
|
|
2414
|
+
bufferLayout,
|
|
2415
|
+
name2
|
|
2416
|
+
);
|
|
2364
2417
|
if (!shaderDeclaration) {
|
|
2365
2418
|
return null;
|
|
2366
2419
|
}
|
|
@@ -2381,7 +2434,7 @@ ${htmlLog}
|
|
|
2381
2434
|
normalized: vertexFormatInfo.normalized,
|
|
2382
2435
|
// integer is a property of the shader declaration
|
|
2383
2436
|
integer: attributeTypeInfo.integer,
|
|
2384
|
-
stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode,
|
|
2437
|
+
stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode || "vertex",
|
|
2385
2438
|
byteOffset: bufferMapping?.byteOffset || 0,
|
|
2386
2439
|
byteStride: bufferMapping?.byteStride || 0
|
|
2387
2440
|
};
|
|
@@ -2446,28 +2499,13 @@ ${htmlLog}
|
|
|
2446
2499
|
stepMode: bufferLayout.stepMode,
|
|
2447
2500
|
vertexFormat: attributeMapping.format,
|
|
2448
2501
|
byteOffset: attributeMapping.byteOffset,
|
|
2502
|
+
// @ts-ignore
|
|
2449
2503
|
byteStride
|
|
2450
2504
|
};
|
|
2451
2505
|
}
|
|
2452
2506
|
}
|
|
2453
2507
|
return null;
|
|
2454
2508
|
}
|
|
2455
|
-
function mergeShaderLayout(baseLayout, overrideLayout) {
|
|
2456
|
-
const mergedLayout = {
|
|
2457
|
-
...baseLayout,
|
|
2458
|
-
attributes: baseLayout.attributes.map((attribute) => ({ ...attribute }))
|
|
2459
|
-
};
|
|
2460
|
-
for (const attribute of overrideLayout?.attributes || []) {
|
|
2461
|
-
const baseAttribute = mergedLayout.attributes.find((attr) => attr.name === attribute.name);
|
|
2462
|
-
if (!baseAttribute) {
|
|
2463
|
-
log.warn(`shader layout attribute ${attribute.name} not present in shader`);
|
|
2464
|
-
} else {
|
|
2465
|
-
baseAttribute.type = attribute.type || baseAttribute.type;
|
|
2466
|
-
baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
return mergedLayout;
|
|
2470
|
-
}
|
|
2471
2509
|
|
|
2472
2510
|
// src/adapter/resources/vertex-array.ts
|
|
2473
2511
|
var _VertexArray = class extends Resource {
|
|
@@ -2486,9 +2524,13 @@ ${htmlLog}
|
|
|
2486
2524
|
super(device, props, _VertexArray.defaultProps);
|
|
2487
2525
|
this.maxVertexAttributes = device.limits.maxVertexAttributes;
|
|
2488
2526
|
this.attributes = new Array(this.maxVertexAttributes).fill(null);
|
|
2527
|
+
const { shaderLayout, bufferLayout } = props.renderPipeline || {};
|
|
2528
|
+
if (!shaderLayout || !bufferLayout) {
|
|
2529
|
+
throw new Error("VertexArray");
|
|
2530
|
+
}
|
|
2489
2531
|
this.attributeInfos = getAttributeInfosByLocation(
|
|
2490
|
-
|
|
2491
|
-
|
|
2532
|
+
shaderLayout,
|
|
2533
|
+
bufferLayout,
|
|
2492
2534
|
this.maxVertexAttributes
|
|
2493
2535
|
);
|
|
2494
2536
|
}
|
|
@@ -2536,7 +2578,7 @@ ${htmlLog}
|
|
|
2536
2578
|
count: void 0
|
|
2537
2579
|
});
|
|
2538
2580
|
|
|
2539
|
-
// src/
|
|
2581
|
+
// src/gpu-type-utils/decode-shader-types.ts
|
|
2540
2582
|
var UNIFORM_FORMATS = {
|
|
2541
2583
|
f32: { type: "f32", components: 1 },
|
|
2542
2584
|
i32: { type: "i32", components: 1 },
|
|
@@ -2563,7 +2605,6 @@ ${htmlLog}
|
|
|
2563
2605
|
};
|
|
2564
2606
|
function decodeShaderUniformType(format) {
|
|
2565
2607
|
const decoded = UNIFORM_FORMATS[format];
|
|
2566
|
-
assert2(format);
|
|
2567
2608
|
return decoded;
|
|
2568
2609
|
}
|
|
2569
2610
|
function alignTo(size, count) {
|
|
@@ -2589,27 +2630,19 @@ ${htmlLog}
|
|
|
2589
2630
|
const scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);
|
|
2590
2631
|
return new Type(scratchArrayBuffer, 0, length);
|
|
2591
2632
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
while (copied < total) {
|
|
2601
|
-
if (copied < total - copied) {
|
|
2602
|
-
target.copyWithin(start + copied, start, start + copied);
|
|
2603
|
-
copied *= 2;
|
|
2604
|
-
} else {
|
|
2605
|
-
target.copyWithin(start + copied, start, start + total - copied);
|
|
2606
|
-
copied = total;
|
|
2607
|
-
}
|
|
2633
|
+
|
|
2634
|
+
// src/utils/is-array.ts
|
|
2635
|
+
function isTypedArray(value) {
|
|
2636
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
2637
|
+
}
|
|
2638
|
+
function isNumberArray(value) {
|
|
2639
|
+
if (Array.isArray(value)) {
|
|
2640
|
+
return value.length === 0 || typeof value[0] === "number";
|
|
2608
2641
|
}
|
|
2609
|
-
return
|
|
2642
|
+
return isTypedArray(value);
|
|
2610
2643
|
}
|
|
2611
2644
|
|
|
2612
|
-
// src/
|
|
2645
|
+
// src/portable/uniform-buffer-layout.ts
|
|
2613
2646
|
var minBufferSize = 1024;
|
|
2614
2647
|
var UniformBufferLayout = class {
|
|
2615
2648
|
layout = {};
|
|
@@ -2658,14 +2691,13 @@ ${htmlLog}
|
|
|
2658
2691
|
}
|
|
2659
2692
|
typedArray[offset] = Number(value);
|
|
2660
2693
|
} else {
|
|
2661
|
-
|
|
2662
|
-
if (!numericArray) {
|
|
2694
|
+
if (!isNumberArray(value)) {
|
|
2663
2695
|
log.warn(
|
|
2664
2696
|
`Supplied value for multi component / array uniform ${name2} is not a numeric array: ${value}`
|
|
2665
2697
|
)();
|
|
2666
2698
|
continue;
|
|
2667
2699
|
}
|
|
2668
|
-
typedArray.set(
|
|
2700
|
+
typedArray.set(value, offset);
|
|
2669
2701
|
}
|
|
2670
2702
|
}
|
|
2671
2703
|
return new Uint8Array(arrayBuffer2);
|
|
@@ -2686,12 +2718,12 @@ ${htmlLog}
|
|
|
2686
2718
|
if (a !== b) {
|
|
2687
2719
|
return false;
|
|
2688
2720
|
}
|
|
2689
|
-
const arrayA =
|
|
2690
|
-
|
|
2721
|
+
const arrayA = a;
|
|
2722
|
+
const arrayB = b;
|
|
2723
|
+
if (!isNumberArray(arrayA)) {
|
|
2691
2724
|
return false;
|
|
2692
2725
|
}
|
|
2693
|
-
|
|
2694
|
-
if (arrayB && arrayA.length === arrayB.length) {
|
|
2726
|
+
if (isNumberArray(arrayB) && arrayA.length === arrayB.length) {
|
|
2695
2727
|
for (let i = 0; i < arrayA.length; ++i) {
|
|
2696
2728
|
if (arrayB[i] !== arrayA[i]) {
|
|
2697
2729
|
return false;
|
|
@@ -2701,14 +2733,13 @@ ${htmlLog}
|
|
|
2701
2733
|
return true;
|
|
2702
2734
|
}
|
|
2703
2735
|
function arrayCopy(a) {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
return numberArray.slice();
|
|
2736
|
+
if (isNumberArray(a)) {
|
|
2737
|
+
return a.slice();
|
|
2707
2738
|
}
|
|
2708
2739
|
return a;
|
|
2709
2740
|
}
|
|
2710
2741
|
|
|
2711
|
-
// src/
|
|
2742
|
+
// src/portable/uniform-block.ts
|
|
2712
2743
|
var UniformBlock = class {
|
|
2713
2744
|
name;
|
|
2714
2745
|
uniforms = {};
|
|
@@ -2717,7 +2748,7 @@ ${htmlLog}
|
|
|
2717
2748
|
bindingLayout = {};
|
|
2718
2749
|
needsRedraw = "initialized";
|
|
2719
2750
|
constructor(props) {
|
|
2720
|
-
this.name = props?.name;
|
|
2751
|
+
this.name = props?.name || "unnamed";
|
|
2721
2752
|
if (props?.name && props?.shaderLayout) {
|
|
2722
2753
|
const binding = props?.shaderLayout.bindings?.find(
|
|
2723
2754
|
(binding2) => binding2.type === "uniform" && binding2.name === props?.name
|
|
@@ -2760,7 +2791,7 @@ ${htmlLog}
|
|
|
2760
2791
|
}
|
|
2761
2792
|
};
|
|
2762
2793
|
|
|
2763
|
-
// src/
|
|
2794
|
+
// src/portable/uniform-store.ts
|
|
2764
2795
|
var UniformStore = class {
|
|
2765
2796
|
/** Stores the uniform values for each uniform block */
|
|
2766
2797
|
uniformBlocks = /* @__PURE__ */ new Map();
|
|
@@ -2794,18 +2825,18 @@ ${htmlLog}
|
|
|
2794
2825
|
*/
|
|
2795
2826
|
setUniforms(uniforms) {
|
|
2796
2827
|
for (const [blockName, uniformValues] of Object.entries(uniforms)) {
|
|
2797
|
-
this.uniformBlocks.get(blockName)
|
|
2828
|
+
this.uniformBlocks.get(blockName)?.setUniforms(uniformValues);
|
|
2798
2829
|
}
|
|
2799
2830
|
this.updateUniformBuffers();
|
|
2800
2831
|
}
|
|
2801
2832
|
/** Get the required minimum length of the uniform buffer */
|
|
2802
2833
|
getUniformBufferByteLength(uniformBufferName) {
|
|
2803
|
-
return this.uniformBufferLayouts.get(uniformBufferName)
|
|
2834
|
+
return this.uniformBufferLayouts.get(uniformBufferName)?.byteLength || 0;
|
|
2804
2835
|
}
|
|
2805
2836
|
/** Get formatted binary memory that can be uploaded to a buffer */
|
|
2806
2837
|
getUniformBufferData(uniformBufferName) {
|
|
2807
|
-
const uniformValues = this.uniformBlocks.get(uniformBufferName)
|
|
2808
|
-
return this.uniformBufferLayouts.get(uniformBufferName)
|
|
2838
|
+
const uniformValues = this.uniformBlocks.get(uniformBufferName)?.getAllUniforms() || {};
|
|
2839
|
+
return this.uniformBufferLayouts.get(uniformBufferName)?.getData(uniformValues);
|
|
2809
2840
|
}
|
|
2810
2841
|
/**
|
|
2811
2842
|
* Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)
|
|
@@ -2853,12 +2884,12 @@ ${htmlLog}
|
|
|
2853
2884
|
const uniformBlock = this.uniformBlocks.get(uniformBufferName);
|
|
2854
2885
|
const uniformBuffer = this.uniformBuffers.get(uniformBufferName);
|
|
2855
2886
|
let reason = false;
|
|
2856
|
-
if (uniformBuffer && uniformBlock
|
|
2887
|
+
if (uniformBuffer && uniformBlock?.needsRedraw) {
|
|
2857
2888
|
reason ||= uniformBlock.needsRedraw;
|
|
2858
2889
|
const uniformBufferData = this.getUniformBufferData(uniformBufferName);
|
|
2859
2890
|
const uniformBuffer2 = this.uniformBuffers.get(uniformBufferName);
|
|
2860
|
-
uniformBuffer2
|
|
2861
|
-
const uniformValues = this.uniformBlocks.get(uniformBufferName)
|
|
2891
|
+
uniformBuffer2?.write(uniformBufferData);
|
|
2892
|
+
const uniformValues = this.uniformBlocks.get(uniformBufferName)?.getAllUniforms();
|
|
2862
2893
|
log.log(
|
|
2863
2894
|
4,
|
|
2864
2895
|
`Writing to uniform buffer ${String(uniformBufferName)}`,
|
|
@@ -2870,7 +2901,7 @@ ${htmlLog}
|
|
|
2870
2901
|
}
|
|
2871
2902
|
};
|
|
2872
2903
|
|
|
2873
|
-
// src/
|
|
2904
|
+
// src/gpu-type-utils/vertex-format-from-attribute.ts
|
|
2874
2905
|
function getDataTypeFromTypedArray(arrayOrType) {
|
|
2875
2906
|
const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
2876
2907
|
switch (type) {
|
|
@@ -2946,223 +2977,6 @@ ${htmlLog}
|
|
|
2946
2977
|
}
|
|
2947
2978
|
return `${dataType}x${components}`;
|
|
2948
2979
|
}
|
|
2949
|
-
|
|
2950
|
-
// src/utils/cast.ts
|
|
2951
|
-
function cast(value) {
|
|
2952
|
-
return value;
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
// src/lib/uniforms/uniform.ts
|
|
2956
|
-
function isUniformValue(value) {
|
|
2957
|
-
return isNumberArray(value) !== null || typeof value === "number" || typeof value === "boolean";
|
|
2958
|
-
}
|
|
2959
|
-
function splitUniformsAndBindings(uniforms) {
|
|
2960
|
-
const result = { bindings: {}, uniforms: {} };
|
|
2961
|
-
Object.keys(uniforms).forEach((name2) => {
|
|
2962
|
-
const uniform = uniforms[name2];
|
|
2963
|
-
if (isUniformValue(uniform)) {
|
|
2964
|
-
result.uniforms[name2] = uniform;
|
|
2965
|
-
} else {
|
|
2966
|
-
result.bindings[name2] = uniform;
|
|
2967
|
-
}
|
|
2968
|
-
});
|
|
2969
|
-
return result;
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
// src/utils/format-value.ts
|
|
2973
|
-
function formatArrayValue(v, opts = {}) {
|
|
2974
|
-
const { maxElts = 16, size = 1 } = opts;
|
|
2975
|
-
let string = "[";
|
|
2976
|
-
for (let i = 0; i < v.length && i < maxElts; ++i) {
|
|
2977
|
-
if (i > 0) {
|
|
2978
|
-
string += `,${i % size === 0 ? " " : ""}`;
|
|
2979
|
-
}
|
|
2980
|
-
string += formatValue(v[i], opts);
|
|
2981
|
-
}
|
|
2982
|
-
const terminator = v.length > maxElts ? "..." : "]";
|
|
2983
|
-
return `${string}${terminator}`;
|
|
2984
|
-
}
|
|
2985
|
-
function formatValue(v, opts = {}) {
|
|
2986
|
-
const EPSILON = 1e-16;
|
|
2987
|
-
const { isInteger = false } = opts;
|
|
2988
|
-
if (Array.isArray(v) || ArrayBuffer.isView(v)) {
|
|
2989
|
-
return formatArrayValue(v, opts);
|
|
2990
|
-
}
|
|
2991
|
-
if (typeof v !== "number") {
|
|
2992
|
-
return String(v);
|
|
2993
|
-
}
|
|
2994
|
-
if (Math.abs(v) < EPSILON) {
|
|
2995
|
-
return isInteger ? "0" : "0.";
|
|
2996
|
-
}
|
|
2997
|
-
if (isInteger) {
|
|
2998
|
-
return v.toFixed(0);
|
|
2999
|
-
}
|
|
3000
|
-
if (Math.abs(v) > 100 && Math.abs(v) < 1e4) {
|
|
3001
|
-
return v.toFixed(0);
|
|
3002
|
-
}
|
|
3003
|
-
const string = v.toPrecision(2);
|
|
3004
|
-
const decimal = string.indexOf(".0");
|
|
3005
|
-
return decimal === string.length - 2 ? string.slice(0, -1) : string;
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
|
-
// src/utils/stub-methods.ts
|
|
3009
|
-
function stubRemovedMethods(instance, className, version, methodNames) {
|
|
3010
|
-
const upgradeMessage = `See luma.gl ${version} Upgrade Guide at https://luma.gl/docs/upgrade-guide`;
|
|
3011
|
-
const prototype = Object.getPrototypeOf(instance);
|
|
3012
|
-
methodNames.forEach((methodName) => {
|
|
3013
|
-
if (prototype.methodName) {
|
|
3014
|
-
return;
|
|
3015
|
-
}
|
|
3016
|
-
prototype[methodName] = () => {
|
|
3017
|
-
log.removed(`Calling removed method ${className}.${methodName}: `, upgradeMessage)();
|
|
3018
|
-
throw new Error(methodName);
|
|
3019
|
-
};
|
|
3020
|
-
});
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
// src/utils/check-props.ts
|
|
3024
|
-
function checkProps(className, props, propChecks) {
|
|
3025
|
-
const { removedProps = {}, deprecatedProps = {}, replacedProps = {} } = propChecks;
|
|
3026
|
-
for (const propName in removedProps) {
|
|
3027
|
-
if (propName in props) {
|
|
3028
|
-
const replacementProp = removedProps[propName];
|
|
3029
|
-
const replacement = replacementProp ? `${className}.${removedProps[propName]}` : "N/A";
|
|
3030
|
-
log.removed(`${className}.${propName}`, replacement)();
|
|
3031
|
-
}
|
|
3032
|
-
}
|
|
3033
|
-
for (const propName in deprecatedProps) {
|
|
3034
|
-
if (propName in props) {
|
|
3035
|
-
const replacementProp = deprecatedProps[propName];
|
|
3036
|
-
log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();
|
|
3037
|
-
}
|
|
3038
|
-
}
|
|
3039
|
-
let newProps = null;
|
|
3040
|
-
for (const [propName, replacementProp] of Object.entries(replacedProps)) {
|
|
3041
|
-
if (propName in props) {
|
|
3042
|
-
log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();
|
|
3043
|
-
newProps = newProps || Object.assign({}, props);
|
|
3044
|
-
newProps[replacementProp] = props[propName];
|
|
3045
|
-
delete newProps[propName];
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
|
-
return newProps || props;
|
|
3049
|
-
}
|
|
3050
|
-
|
|
3051
|
-
// src/utils/load-file.ts
|
|
3052
|
-
var pathPrefix = "";
|
|
3053
|
-
function setPathPrefix(prefix) {
|
|
3054
|
-
pathPrefix = prefix;
|
|
3055
|
-
}
|
|
3056
|
-
async function loadFile(url, options) {
|
|
3057
|
-
url = url.startsWith("http") ? url : pathPrefix + url;
|
|
3058
|
-
const dataType = options?.dataType || "text";
|
|
3059
|
-
const response = await fetch(url, options);
|
|
3060
|
-
return await response[dataType]();
|
|
3061
|
-
}
|
|
3062
|
-
async function loadImageBitmap(url, opts) {
|
|
3063
|
-
const image = new Image();
|
|
3064
|
-
image.crossOrigin = opts?.crossOrigin || "anonymous";
|
|
3065
|
-
image.src = url.startsWith("http") ? url : pathPrefix + url;
|
|
3066
|
-
await image.decode();
|
|
3067
|
-
return await createImageBitmap(image);
|
|
3068
|
-
}
|
|
3069
|
-
async function loadImage(url, opts) {
|
|
3070
|
-
return await new Promise((resolve, reject) => {
|
|
3071
|
-
try {
|
|
3072
|
-
const image = new Image();
|
|
3073
|
-
image.onload = () => resolve(image);
|
|
3074
|
-
image.onerror = () => reject(new Error(`Could not load image ${url}.`));
|
|
3075
|
-
image.crossOrigin = opts?.crossOrigin || "anonymous";
|
|
3076
|
-
image.src = url.startsWith("http") ? url : pathPrefix + url;
|
|
3077
|
-
} catch (error) {
|
|
3078
|
-
reject(error);
|
|
3079
|
-
}
|
|
3080
|
-
});
|
|
3081
|
-
}
|
|
3082
|
-
async function loadScript(scriptUrl, scriptId) {
|
|
3083
|
-
const head = document.getElementsByTagName("head")[0];
|
|
3084
|
-
if (!head) {
|
|
3085
|
-
throw new Error("loadScript");
|
|
3086
|
-
}
|
|
3087
|
-
const script = document.createElement("script");
|
|
3088
|
-
script.setAttribute("type", "text/javascript");
|
|
3089
|
-
script.setAttribute("src", scriptUrl);
|
|
3090
|
-
if (scriptId) {
|
|
3091
|
-
script.id = scriptId;
|
|
3092
|
-
}
|
|
3093
|
-
return new Promise((resolve, reject) => {
|
|
3094
|
-
script.onload = resolve;
|
|
3095
|
-
script.onerror = (error) => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));
|
|
3096
|
-
head.appendChild(script);
|
|
3097
|
-
});
|
|
3098
|
-
}
|
|
3099
|
-
|
|
3100
|
-
// src/utils/random.ts
|
|
3101
|
-
function makeRandomNumberGenerator() {
|
|
3102
|
-
let s = 1;
|
|
3103
|
-
let c = 1;
|
|
3104
|
-
return () => {
|
|
3105
|
-
s = Math.sin(c * 17.23);
|
|
3106
|
-
c = Math.cos(s * 27.92);
|
|
3107
|
-
return fract(Math.abs(s * c) * 1432.71);
|
|
3108
|
-
};
|
|
3109
|
-
}
|
|
3110
|
-
function fract(n) {
|
|
3111
|
-
return n - Math.floor(n);
|
|
3112
|
-
}
|
|
3113
|
-
var random = makeRandomNumberGenerator();
|
|
3114
|
-
|
|
3115
|
-
// src/utils/deep-equal.ts
|
|
3116
|
-
function deepEqual(a, b, depth) {
|
|
3117
|
-
if (a === b) {
|
|
3118
|
-
return true;
|
|
3119
|
-
}
|
|
3120
|
-
if (!depth || !a || !b) {
|
|
3121
|
-
return false;
|
|
3122
|
-
}
|
|
3123
|
-
if (Array.isArray(a)) {
|
|
3124
|
-
if (!Array.isArray(b) || a.length !== b.length) {
|
|
3125
|
-
return false;
|
|
3126
|
-
}
|
|
3127
|
-
for (let i = 0; i < a.length; i++) {
|
|
3128
|
-
if (!deepEqual(a[i], b[i], depth - 1)) {
|
|
3129
|
-
return false;
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
return true;
|
|
3133
|
-
}
|
|
3134
|
-
if (Array.isArray(b)) {
|
|
3135
|
-
return false;
|
|
3136
|
-
}
|
|
3137
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
3138
|
-
const aKeys = Object.keys(a);
|
|
3139
|
-
const bKeys = Object.keys(b);
|
|
3140
|
-
if (aKeys.length !== bKeys.length) {
|
|
3141
|
-
return false;
|
|
3142
|
-
}
|
|
3143
|
-
for (const key of aKeys) {
|
|
3144
|
-
if (!b.hasOwnProperty(key)) {
|
|
3145
|
-
return false;
|
|
3146
|
-
}
|
|
3147
|
-
if (!deepEqual(a[key], b[key], depth - 1)) {
|
|
3148
|
-
return false;
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
return true;
|
|
3152
|
-
}
|
|
3153
|
-
return false;
|
|
3154
|
-
}
|
|
3155
|
-
|
|
3156
|
-
// src/utils/request-animation-frame.ts
|
|
3157
|
-
function requestAnimationFrame(callback) {
|
|
3158
|
-
return typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame(callback) : setTimeout(callback, 1e3 / 60);
|
|
3159
|
-
}
|
|
3160
|
-
function cancelAnimationFrame(timerId) {
|
|
3161
|
-
return typeof window !== "undefined" && window.cancelAnimationFrame ? window.cancelAnimationFrame(timerId) : clearTimeout(timerId);
|
|
3162
|
-
}
|
|
3163
|
-
|
|
3164
|
-
// src/index.ts
|
|
3165
|
-
var glsl = (x) => `${x}`;
|
|
3166
2980
|
return __toCommonJS(bundle_exports);
|
|
3167
2981
|
})();
|
|
3168
2982
|
return __exports__;
|