@luma.gl/engine 10.0.0-alpha.6 → 10.0.0-alpha.7
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/README.md +2 -2
- package/dist/arrow/arrow-geometry.cjs +1 -1
- package/dist/arrow/arrow-geometry.js +1 -1
- package/dist/arrow/arrow-picking.cjs +1 -1
- package/dist/arrow/arrow-picking.d.ts +1 -1
- package/dist/arrow/arrow-picking.js +1 -1
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.cjs +5 -5
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.d.ts +2 -2
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.js +5 -5
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.cjs +3 -3
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js +3 -3
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.cjs +1 -1
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.js +1 -1
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.cjs +5 -5
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.d.ts +1 -1
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.js +5 -5
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.cjs +3 -3
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.d.ts +1 -1
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js +3 -3
- package/dist/arrow/renderers/path/transforms/path-view-origins.cjs +1 -1
- package/dist/arrow/renderers/path/transforms/path-view-origins.d.ts +1 -1
- package/dist/arrow/renderers/path/transforms/path-view-origins.js +1 -1
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.cjs +1 -1
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.d.ts +1 -1
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.js +1 -1
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.cjs +4 -4
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.js +4 -4
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.cjs +1 -1
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.js +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.cjs +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.js +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.cjs +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.d.ts +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.js +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.cjs +5 -5
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.d.ts +1 -1
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.js +5 -5
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.cjs +1 -1
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.js +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.cjs +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.js +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.cjs +5 -5
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js +5 -5
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.cjs +1 -1
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.js +1 -1
- package/dist/compute/computation.cjs +2 -2
- package/dist/compute/computation.d.ts +1 -1
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +2 -2
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/texture-transform.d.ts +2 -2
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/dist.dev.js +395 -322
- package/dist/dist.min.js +68 -63
- package/dist/experimental/materials/emissive-material.cjs +1 -1
- package/dist/experimental/materials/emissive-material.d.ts +1 -1
- package/dist/experimental/materials/emissive-material.d.ts.map +1 -1
- package/dist/experimental/materials/emissive-material.js +1 -1
- package/dist/experimental/materials/emissive-material.js.map +1 -1
- package/dist/experimental/materials/glass-material.cjs +1 -1
- package/dist/experimental/materials/glass-material.d.ts +1 -1
- package/dist/experimental/materials/glass-material.d.ts.map +1 -1
- package/dist/experimental/materials/glass-material.js +1 -1
- package/dist/experimental/materials/glass-material.js.map +1 -1
- package/dist/experimental/materials/glass-transmission.cjs +1 -1
- package/dist/experimental/materials/glass-transmission.d.ts +1 -1
- package/dist/experimental/materials/glass-transmission.d.ts.map +1 -1
- package/dist/experimental/materials/glass-transmission.js +1 -1
- package/dist/experimental/materials/glass-transmission.js.map +1 -1
- package/dist/experimental/materials/index.cjs.map +1 -1
- package/dist/experimental/materials/optical-caustics.cjs +1 -1
- package/dist/experimental/materials/optical-caustics.d.ts +1 -1
- package/dist/experimental/materials/optical-caustics.d.ts.map +1 -1
- package/dist/experimental/materials/optical-caustics.js +1 -1
- package/dist/experimental/materials/optical-caustics.js.map +1 -1
- package/dist/experimental/materials/optical-point-lights.cjs +1 -1
- package/dist/experimental/materials/optical-point-lights.d.ts +1 -1
- package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -1
- package/dist/experimental/materials/optical-point-lights.js +1 -1
- package/dist/experimental/materials/optical-point-lights.js.map +1 -1
- package/dist/experimental/materials/reflective-material.cjs +1 -1
- package/dist/experimental/materials/reflective-material.d.ts +1 -1
- package/dist/experimental/materials/reflective-material.d.ts.map +1 -1
- package/dist/experimental/materials/reflective-material.js +1 -1
- package/dist/experimental/materials/reflective-material.js.map +1 -1
- package/dist/geometry/gpu-geometry.cjs +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +1 -1
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/gltf/gltf/gltf-lod.cjs +21 -6
- package/dist/gltf/gltf/gltf-lod.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-lod.js +20 -4
- package/dist/gltf/gltf/gltf-lod.js.map +1 -1
- package/dist/gltf/index.cjs.map +1 -1
- package/dist/gltf/types/gltf-json-schema.d.ts +37 -37
- package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts +28 -28
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/graph/models/index.cjs.map +1 -1
- package/dist/graph/models/path/path-attribute-model.cjs +2 -2
- package/dist/graph/models/path/path-attribute-model.d.ts +2 -2
- package/dist/graph/models/path/path-attribute-model.js +2 -2
- package/dist/graph/models/path/path-storage-model.cjs +1 -1
- package/dist/graph/models/path/path-storage-model.d.ts +1 -1
- package/dist/graph/models/path/path-storage-model.js +1 -1
- package/dist/graph/models/path/path-trips-storage-model.d.ts +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.cjs +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.js +2 -2
- package/dist/graph/models/polygon/polygon-storage-model.cjs +2 -2
- package/dist/graph/models/polygon/polygon-storage-model.js +2 -2
- package/dist/graph/tables/gpu-table-model.cjs +1 -1
- package/dist/graph/tables/gpu-table-model.js +1 -1
- package/dist/graph/tables/gpu-table-transform.cjs +2 -2
- package/dist/graph/tables/gpu-table-transform.d.ts +1 -1
- package/dist/graph/tables/gpu-table-transform.js +2 -2
- package/dist/graph/tables/index.cjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/model/gpu-vector-model.cjs +104 -79
- package/dist/model/gpu-vector-model.d.ts +1 -1
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +129 -98
- package/dist/model/gpu-vector-model.js.map +1 -1
- package/dist/splats/splat-data.cjs +1 -1
- package/dist/splats/splat-data.d.ts +1 -1
- package/dist/splats/splat-data.js +1 -1
- package/dist/splats/splat-renderer.cjs +1 -1
- package/dist/splats/splat-renderer.js +1 -1
- package/dist/text/experimental.cjs +151 -3
- package/dist/text/experimental.d.ts +1 -1
- package/dist/text/experimental.d.ts.map +1 -1
- package/dist/text/experimental.js +1 -1
- package/dist/text/experimental.js.map +1 -1
- package/dist/text/index.cjs +41 -3
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +1 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/text-2d/experimental.cjs +128 -18
- package/dist/text/text-2d/experimental.d.ts +8 -8
- package/dist/text/text-2d/experimental.d.ts.map +1 -1
- package/dist/text/text-2d/experimental.js +7 -8
- package/dist/text/text-2d/experimental.js.map +1 -1
- package/dist/text/text-2d/model-utils/text-model-props.d.ts +1 -1
- package/dist/text/text-2d/models/text-attribute-model.cjs +1 -1
- package/dist/text/text-2d/models/text-attribute-model.js +1 -1
- package/dist/utils/deep-equal.cjs +3 -1
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +3 -1
- package/dist/utils/deep-equal.js.map +1 -1
- package/dist/utils/get-platform-info.cjs +9 -3
- package/dist/utils/get-platform-info.d.ts +1 -1
- package/dist/utils/get-platform-info.d.ts.map +1 -1
- package/dist/utils/get-platform-info.js +1 -1
- package/dist/utils/get-platform-info.js.map +1 -1
- package/package.json +6 -7
- package/src/arrow/arrow-geometry.ts +1 -1
- package/src/arrow/arrow-picking.ts +2 -2
- package/src/arrow/renderers/path/conversion/arrow-path-gpu-vectors.ts +9 -9
- package/src/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.ts +4 -4
- package/src/arrow/renderers/path/source/arrow-path-source-mapping.ts +1 -1
- package/src/arrow/renderers/path/transforms/close-arrow-paths.ts +5 -5
- package/src/arrow/renderers/path/transforms/gpu-path-float64-deltas.ts +3 -3
- package/src/arrow/renderers/path/transforms/path-view-origins.ts +2 -2
- package/src/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.ts +1 -1
- package/src/arrow/renderers/polygon/renderers/arrow-polygon-renderer.ts +4 -4
- package/src/arrow/renderers/polygon/source/arrow-polygon-source-mapping.ts +1 -1
- package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.ts +1 -1
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.ts +2 -2
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-storage.ts +1 -1
- package/src/arrow/renderers/text/conversion/convert-arrow-text-vectors.ts +6 -6
- package/src/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.ts +1 -1
- package/src/arrow/renderers/text/renderers/arrow-text-picking.ts +1 -1
- package/src/arrow/renderers/text/renderers/arrow-text-renderer.ts +5 -5
- package/src/arrow/renderers/text/source/arrow-text-source-mapping.ts +1 -1
- package/src/compute/computation.ts +5 -3
- package/src/compute/texture-transform.ts +2 -2
- package/src/experimental/materials/emissive-material.ts +1 -1
- package/src/experimental/materials/glass-material.ts +1 -1
- package/src/experimental/materials/glass-transmission.ts +1 -1
- package/src/experimental/materials/optical-caustics.ts +1 -1
- package/src/experimental/materials/optical-point-lights.ts +1 -1
- package/src/experimental/materials/reflective-material.ts +1 -1
- package/src/experimental/textures/rgba-decoder.ts +1 -1
- package/src/geometry/gpu-geometry.ts +1 -4
- package/src/gltf/gltf/gltf-lod.ts +22 -4
- package/src/gltf/physics/README.md +1 -1
- package/src/gltf/types/gltf-json-schema.ts +37 -37
- package/src/gltf/types/gltf-postprocessed-schema.ts +28 -28
- package/src/graph/models/path/path-attribute-model.ts +3 -3
- package/src/graph/models/path/path-storage-model.ts +2 -2
- package/src/graph/models/path/path-trips-storage-model.ts +2 -2
- package/src/graph/models/polygon/polygon-attribute-model.ts +2 -2
- package/src/graph/models/polygon/polygon-storage-model.ts +2 -2
- package/src/graph/tables/gpu-table-model.ts +1 -1
- package/src/graph/tables/gpu-table-transform.ts +3 -3
- package/src/model/gpu-vector-model.ts +147 -120
- package/src/splats/splat-data.ts +1 -1
- package/src/splats/splat-renderer.ts +1 -1
- package/src/text/README.md +1 -1
- package/src/text/experimental.ts +122 -1
- package/src/text/index.ts +40 -1
- package/src/text/text-2d/experimental.ts +104 -8
- package/src/text/text-2d/model-utils/text-model-props.ts +1 -1
- package/src/text/text-2d/models/text-attribute-model.ts +1 -1
- package/src/utils/deep-equal.ts +4 -2
- package/src/utils/get-platform-info.ts +1 -1
|
@@ -237,70 +237,78 @@ class GPUVectorModel {
|
|
|
237
237
|
this.explicitBufferLayout = this.bufferLayout;
|
|
238
238
|
this.geometryVectorBindings = new import_gpu_vector_bindings.GPUVectorBindings(device, `${this.id}-geometry`);
|
|
239
239
|
this.attributeVectorBindings = new import_gpu_vector_bindings.GPUVectorBindings(device, `${this.id}-attributes`);
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
shaderInputs
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
this.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
240
|
+
try {
|
|
241
|
+
this._initializeProps(props);
|
|
242
|
+
const platformInfo = (0, import_get_platform_info.getPlatformInfo)(device);
|
|
243
|
+
const resolvedPlugins = (0, import_shaders.resolveShaderPlugins)(this.props.plugins, platformInfo.shaderLanguage);
|
|
244
|
+
const shaderInputModules = (0, import_shaders.mergeShaderPluginModules)(this.props.modules, resolvedPlugins.modules);
|
|
245
|
+
const moduleMap = Object.fromEntries(shaderInputModules.map((module2) => [module2.name, module2]));
|
|
246
|
+
const shaderInputs = props.shaderInputs || new import_shader_inputs.ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
|
|
247
|
+
if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
|
|
248
|
+
shaderInputs.addModules(resolvedPlugins.modules);
|
|
249
|
+
}
|
|
250
|
+
this.setShaderInputs(shaderInputs);
|
|
251
|
+
const modules = (0, import_shader_module_utils.mergeShaderModules)(this.props.modules, shaderInputs.getModules());
|
|
252
|
+
const defines = { ...resolvedPlugins.defines, ...this.props.defines };
|
|
253
|
+
if (this.device.type === "webgl") {
|
|
254
|
+
this.props._uniformBlockLayouts = (0, import_shader_module_utils.getShaderModuleUniformBlockLayouts)(modules);
|
|
255
|
+
}
|
|
256
|
+
this.props.shaderLayout = (0, import_shader_module_utils.mergeShaderModuleBindingsIntoLayout)(this.props.shaderLayout, modules) || null;
|
|
257
|
+
const isWebGPU = this.device.type === "webgpu";
|
|
258
|
+
if (isWebGPU && this.props.source) {
|
|
259
|
+
const shaderAssembler = this.props.shaderAssembler;
|
|
260
|
+
(0, import_core.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
|
|
261
|
+
const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
262
|
+
platformInfo,
|
|
263
|
+
...this.props,
|
|
264
|
+
modules,
|
|
265
|
+
defines,
|
|
266
|
+
pluginInjections: resolvedPlugins.injections,
|
|
267
|
+
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
268
|
+
pluginInterStageVariables: resolvedPlugins.interStageVariables
|
|
269
|
+
});
|
|
270
|
+
this.source = source;
|
|
271
|
+
this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
|
|
272
|
+
this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
|
|
273
|
+
this._getModuleUniforms = getUniforms;
|
|
274
|
+
this._bindingTable = bindingTable;
|
|
275
|
+
const scannedOrReflectedShaderLayout = assembledShaderLayout ?? ((_a = device.getShaderLayout) == null ? void 0 : _a.call(device, this.source));
|
|
276
|
+
const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
|
|
277
|
+
const shaderLayout = (0, import_shader_module_utils.mergeInferredShaderLayout)(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
|
|
278
|
+
this.props.shaderLayout = (0, import_shader_module_utils.mergeShaderModuleBindingsIntoLayout)(shaderLayout || null, modules) || null;
|
|
279
|
+
} else {
|
|
280
|
+
const shaderAssembler = this.props.shaderAssembler;
|
|
281
|
+
(0, import_core.assert)(isShaderAssemblerForLanguage(shaderAssembler, "glsl"));
|
|
282
|
+
const { vs, fs, getUniforms } = shaderAssembler.assembleGLSLShaderPair({
|
|
283
|
+
platformInfo,
|
|
284
|
+
...this.props,
|
|
285
|
+
modules,
|
|
286
|
+
defines,
|
|
287
|
+
pluginInjections: resolvedPlugins.injections,
|
|
288
|
+
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
289
|
+
pluginInterStageVariables: resolvedPlugins.interStageVariables
|
|
290
|
+
});
|
|
291
|
+
this.vs = vs;
|
|
292
|
+
this.fs = fs;
|
|
293
|
+
this._getModuleUniforms = getUniforms;
|
|
294
|
+
this._bindingTable = [];
|
|
295
|
+
}
|
|
296
|
+
this.pipelineFactory = props.pipelineFactory || import_core.PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
297
|
+
this.shaderFactory = props.shaderFactory || import_core.ShaderFactory.getDefaultShaderFactory(this.device);
|
|
298
|
+
const asyncCompilation = import_core.PipelineFactory.getAsyncCompilation(this.device);
|
|
299
|
+
if (asyncCompilation) {
|
|
300
|
+
this._pipelineInitialization = this._initializePipelineAsync(props);
|
|
301
|
+
asyncCompilation.push(this._pipelineInitialization);
|
|
302
|
+
} else {
|
|
303
|
+
this.pipeline = this._updatePipeline();
|
|
304
|
+
this._initializePipelineResources(props);
|
|
305
|
+
}
|
|
306
|
+
} catch (error) {
|
|
307
|
+
try {
|
|
308
|
+
GPUVectorModel.prototype.destroy.call(this);
|
|
309
|
+
} finally {
|
|
310
|
+
throw error;
|
|
311
|
+
}
|
|
304
312
|
}
|
|
305
313
|
}
|
|
306
314
|
/** Initializes subclass input policies before shader and pipeline creation. */
|
|
@@ -355,6 +363,7 @@ class GPUVectorModel {
|
|
|
355
363
|
this.transformFeedback = props.transformFeedback;
|
|
356
364
|
}
|
|
357
365
|
destroy() {
|
|
366
|
+
var _a, _b;
|
|
358
367
|
if (!this._destroyed) {
|
|
359
368
|
if (this.pipeline) {
|
|
360
369
|
this.pipelineFactory.release(this.pipeline);
|
|
@@ -363,9 +372,10 @@ class GPUVectorModel {
|
|
|
363
372
|
this.shaderFactory.release(this.pipeline.fs);
|
|
364
373
|
}
|
|
365
374
|
}
|
|
375
|
+
(_a = this.vertexArray) == null ? void 0 : _a.destroy();
|
|
366
376
|
this.geometryVectorBindings.destroy();
|
|
367
377
|
this.attributeVectorBindings.destroy();
|
|
368
|
-
this._uniformStore.destroy();
|
|
378
|
+
(_b = this._uniformStore) == null ? void 0 : _b.destroy();
|
|
369
379
|
this._destroyed = true;
|
|
370
380
|
}
|
|
371
381
|
}
|
|
@@ -767,10 +777,12 @@ class GPUVectorModel {
|
|
|
767
777
|
this.bufferLayout = nextBufferLayout;
|
|
768
778
|
this._setPipelineNeedsUpdate("bufferLayout");
|
|
769
779
|
this.pipeline = this._updatePipeline();
|
|
780
|
+
const previousVertexArray = this.vertexArray;
|
|
770
781
|
this.vertexArray = this.device.createVertexArray({
|
|
771
782
|
shaderLayout: this.pipeline.shaderLayout,
|
|
772
783
|
bufferLayout: this.pipeline.bufferLayout
|
|
773
784
|
});
|
|
785
|
+
previousVertexArray.destroy();
|
|
774
786
|
this._dynamicAttributeBufferSources = {};
|
|
775
787
|
this.applyVectorAttributes();
|
|
776
788
|
if (this.indexBuffer)
|
|
@@ -1035,7 +1047,13 @@ class GPUVectorModel {
|
|
|
1035
1047
|
_updatePipeline() {
|
|
1036
1048
|
const update = this._preparePipelineUpdate();
|
|
1037
1049
|
if (update) {
|
|
1038
|
-
|
|
1050
|
+
try {
|
|
1051
|
+
this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
|
|
1052
|
+
} catch (error) {
|
|
1053
|
+
this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
|
|
1054
|
+
this._pipelineNeedsUpdate = "pipeline creation failed";
|
|
1055
|
+
throw error;
|
|
1056
|
+
}
|
|
1039
1057
|
this._finishPipelineUpdate(update);
|
|
1040
1058
|
}
|
|
1041
1059
|
return this.pipeline;
|
|
@@ -1065,22 +1083,29 @@ class GPUVectorModel {
|
|
|
1065
1083
|
import_core.log.log(1, `GPUVectorModel ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
|
|
1066
1084
|
}
|
|
1067
1085
|
this._pipelineNeedsUpdate = false;
|
|
1068
|
-
|
|
1069
|
-
id: `${this.id}-vertex`,
|
|
1070
|
-
stage: "vertex",
|
|
1071
|
-
source: this.source || this.vs,
|
|
1072
|
-
debugShaders: this.props.debugShaders
|
|
1073
|
-
});
|
|
1086
|
+
let vertexShader = null;
|
|
1074
1087
|
let fragmentShader = null;
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
stage: "fragment",
|
|
1081
|
-
source: this.fs,
|
|
1088
|
+
try {
|
|
1089
|
+
vertexShader = this.shaderFactory.createShader({
|
|
1090
|
+
id: `${this.id}-vertex`,
|
|
1091
|
+
stage: "vertex",
|
|
1092
|
+
source: this.source || this.vs,
|
|
1082
1093
|
debugShaders: this.props.debugShaders
|
|
1083
1094
|
});
|
|
1095
|
+
if (this.source) {
|
|
1096
|
+
fragmentShader = vertexShader;
|
|
1097
|
+
} else if (this.fs) {
|
|
1098
|
+
fragmentShader = this.shaderFactory.createShader({
|
|
1099
|
+
id: `${this.id}-fragment`,
|
|
1100
|
+
stage: "fragment",
|
|
1101
|
+
source: this.fs,
|
|
1102
|
+
debugShaders: this.props.debugShaders
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
} catch (error) {
|
|
1106
|
+
this._releasePipelineShaders(vertexShader, fragmentShader);
|
|
1107
|
+
this._pipelineNeedsUpdate = "shader creation failed";
|
|
1108
|
+
throw error;
|
|
1084
1109
|
}
|
|
1085
1110
|
return {
|
|
1086
1111
|
props: {
|
|
@@ -107,7 +107,7 @@ export declare class GPUVectorModel {
|
|
|
107
107
|
readonly shaderFactory: ShaderFactory;
|
|
108
108
|
/** User-supplied per-model data */
|
|
109
109
|
userData: {
|
|
110
|
-
[key: string]:
|
|
110
|
+
[key: string]: unknown;
|
|
111
111
|
};
|
|
112
112
|
/** The render pipeline GPU parameters, depth testing etc */
|
|
113
113
|
parameters: RenderPipelineParameters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-vector-model.d.ts","sourceRoot":"","sources":["../../src/model/gpu-vector-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAIjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB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M,GAAG,IAAI;IAM7C,gCAAgC;IAChC,eAAe,IAAI,cAAc;IAejC,mGAAmG;IAC7F,oBAAoB,IAAI,OAAO,CAAC,cAAc,CAAC;IAerD,OAAO,CAAC,sBAAsB;IA8D9B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,uBAAuB;IAU/B,iCAAiC;IACjC,YAAY,SAAK;IACjB,QAAQ,UAAS;IAEjB,iBAAiB,IAAI,IAAI;IAazB,eAAe,IAAI,IAAI;IAoBvB,SAAS,CAAC,UAAU,SAAK;IACzB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAe7C,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA4BlE,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM;IAOjF,sFAAsF;IACtF,SAAS,CAAC,uBAAuB,IAAI,eAAe;IAIpD,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,sBAAsB;CAuC/B"}
|
|
@@ -245,90 +245,103 @@ export class GPUVectorModel {
|
|
|
245
245
|
this.explicitBufferLayout = this.bufferLayout;
|
|
246
246
|
this.geometryVectorBindings = new GPUVectorBindings(device, `${this.id}-geometry`);
|
|
247
247
|
this.attributeVectorBindings = new GPUVectorBindings(device, `${this.id}-attributes`);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
shaderInputs
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
|
|
269
|
-
const isWebGPU = this.device.type === 'webgpu';
|
|
270
|
-
// WebGPU
|
|
271
|
-
// TODO - hack to support unified WGSL shader
|
|
272
|
-
// TODO - this is wrong, compile a single shader
|
|
273
|
-
if (isWebGPU && this.props.source) {
|
|
274
|
-
// WGSL
|
|
275
|
-
const shaderAssembler = this.props.shaderAssembler;
|
|
276
|
-
// WGSL sources require an assembler with WGSL-specific hooks and binding state.
|
|
277
|
-
assert(isShaderAssemblerForLanguage(shaderAssembler, 'wgsl'));
|
|
278
|
-
const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
279
|
-
platformInfo,
|
|
280
|
-
...this.props,
|
|
281
|
-
modules,
|
|
282
|
-
defines,
|
|
283
|
-
pluginInjections: resolvedPlugins.injections,
|
|
284
|
-
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
285
|
-
pluginVaryings: resolvedPlugins.varyings
|
|
286
|
-
});
|
|
287
|
-
this.source = source;
|
|
288
|
-
this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
|
|
289
|
-
this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
|
|
290
|
-
// @ts-expect-error
|
|
291
|
-
this._getModuleUniforms = getUniforms;
|
|
292
|
-
this._bindingTable = bindingTable;
|
|
293
|
-
// Infer the layout after modules have been added so their bindings are included.
|
|
294
|
-
const scannedOrReflectedShaderLayout = assembledShaderLayout ??
|
|
295
|
-
device.getShaderLayout?.(this.source);
|
|
296
|
-
const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
|
|
297
|
-
const shaderLayout = mergeInferredShaderLayout(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
|
|
248
|
+
try {
|
|
249
|
+
this._initializeProps(props);
|
|
250
|
+
const platformInfo = getPlatformInfo(device);
|
|
251
|
+
const resolvedPlugins = resolveShaderPlugins(this.props.plugins, platformInfo.shaderLanguage);
|
|
252
|
+
// Setup shader module inputs
|
|
253
|
+
const shaderInputModules = mergeShaderPluginModules(this.props.modules, resolvedPlugins.modules);
|
|
254
|
+
const moduleMap = Object.fromEntries(shaderInputModules.map(module => [module.name, module]));
|
|
255
|
+
const shaderInputs = props.shaderInputs ||
|
|
256
|
+
new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
|
|
257
|
+
if (props.shaderInputs && resolvedPlugins.modules.length > 0) {
|
|
258
|
+
shaderInputs.addModules(resolvedPlugins.modules);
|
|
259
|
+
}
|
|
260
|
+
// @ts-ignore
|
|
261
|
+
this.setShaderInputs(shaderInputs);
|
|
262
|
+
// Setup shader assembler
|
|
263
|
+
const modules = mergeShaderModules(this.props.modules, shaderInputs.getModules());
|
|
264
|
+
const defines = { ...resolvedPlugins.defines, ...this.props.defines };
|
|
265
|
+
if (this.device.type === 'webgl') {
|
|
266
|
+
this.props._uniformBlockLayouts = getShaderModuleUniformBlockLayouts(modules);
|
|
267
|
+
}
|
|
298
268
|
this.props.shaderLayout =
|
|
299
|
-
mergeShaderModuleBindingsIntoLayout(shaderLayout
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
//
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
269
|
+
mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
|
|
270
|
+
const isWebGPU = this.device.type === 'webgpu';
|
|
271
|
+
// WebGPU
|
|
272
|
+
// TODO - hack to support unified WGSL shader
|
|
273
|
+
// TODO - this is wrong, compile a single shader
|
|
274
|
+
if (isWebGPU && this.props.source) {
|
|
275
|
+
// WGSL
|
|
276
|
+
const shaderAssembler = this.props.shaderAssembler;
|
|
277
|
+
// WGSL sources require an assembler with WGSL-specific hooks and binding state.
|
|
278
|
+
assert(isShaderAssemblerForLanguage(shaderAssembler, 'wgsl'));
|
|
279
|
+
const { source, getUniforms, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
280
|
+
platformInfo,
|
|
281
|
+
...this.props,
|
|
282
|
+
modules,
|
|
283
|
+
defines,
|
|
284
|
+
pluginInjections: resolvedPlugins.injections,
|
|
285
|
+
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
286
|
+
pluginInterStageVariables: resolvedPlugins.interStageVariables
|
|
287
|
+
});
|
|
288
|
+
this.source = source;
|
|
289
|
+
this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
|
|
290
|
+
this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
|
|
291
|
+
// @ts-expect-error
|
|
292
|
+
this._getModuleUniforms = getUniforms;
|
|
293
|
+
this._bindingTable = bindingTable;
|
|
294
|
+
// Infer the layout after modules have been added so their bindings are included.
|
|
295
|
+
const scannedOrReflectedShaderLayout = assembledShaderLayout ??
|
|
296
|
+
device.getShaderLayout?.(this.source);
|
|
297
|
+
const inferredShaderLayout = normalizeShaderPluginAttributeNames(scannedOrReflectedShaderLayout, resolvedPlugins.vertexInputs);
|
|
298
|
+
const shaderLayout = mergeInferredShaderLayout(this.props.shaderLayout, inferredShaderLayout, Object.keys(resolvedPlugins.vertexInputs));
|
|
299
|
+
this.props.shaderLayout =
|
|
300
|
+
mergeShaderModuleBindingsIntoLayout(shaderLayout || null, modules) || null;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
// GLSL
|
|
304
|
+
const shaderAssembler = this.props.shaderAssembler;
|
|
305
|
+
// GLSL shader pairs require an assembler with GLSL-specific hooks.
|
|
306
|
+
assert(isShaderAssemblerForLanguage(shaderAssembler, 'glsl'));
|
|
307
|
+
const { vs, fs, getUniforms } = shaderAssembler.assembleGLSLShaderPair({
|
|
308
|
+
platformInfo,
|
|
309
|
+
...this.props,
|
|
310
|
+
modules,
|
|
311
|
+
defines,
|
|
312
|
+
pluginInjections: resolvedPlugins.injections,
|
|
313
|
+
pluginVertexInputs: resolvedPlugins.vertexInputs,
|
|
314
|
+
pluginInterStageVariables: resolvedPlugins.interStageVariables
|
|
315
|
+
});
|
|
316
|
+
this.vs = vs;
|
|
317
|
+
this.fs = fs;
|
|
318
|
+
// @ts-expect-error
|
|
319
|
+
this._getModuleUniforms = getUniforms;
|
|
320
|
+
this._bindingTable = [];
|
|
321
|
+
}
|
|
322
|
+
this.pipelineFactory =
|
|
323
|
+
props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
324
|
+
this.shaderFactory =
|
|
325
|
+
props.shaderFactory || ShaderFactory.getDefaultShaderFactory(this.device);
|
|
326
|
+
const asyncCompilation = PipelineFactory.getAsyncCompilation(this.device);
|
|
327
|
+
if (asyncCompilation) {
|
|
328
|
+
this._pipelineInitialization = this._initializePipelineAsync(props);
|
|
329
|
+
asyncCompilation.push(this._pipelineInitialization);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
this.pipeline = this._updatePipeline();
|
|
333
|
+
this._initializePipelineResources(props);
|
|
334
|
+
}
|
|
328
335
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
336
|
+
catch (error) {
|
|
337
|
+
// Failed construction never returns a model for the caller to destroy.
|
|
338
|
+
// Subclass fields may not exist yet, so bypass virtual teardown.
|
|
339
|
+
try {
|
|
340
|
+
GPUVectorModel.prototype.destroy.call(this);
|
|
341
|
+
}
|
|
342
|
+
finally {
|
|
343
|
+
throw error;
|
|
344
|
+
}
|
|
332
345
|
}
|
|
333
346
|
}
|
|
334
347
|
/** Initializes subclass input policies before shader and pipeline creation. */
|
|
@@ -393,9 +406,10 @@ export class GPUVectorModel {
|
|
|
393
406
|
this.shaderFactory.release(this.pipeline.fs);
|
|
394
407
|
}
|
|
395
408
|
}
|
|
409
|
+
this.vertexArray?.destroy();
|
|
396
410
|
this.geometryVectorBindings.destroy();
|
|
397
411
|
this.attributeVectorBindings.destroy();
|
|
398
|
-
this._uniformStore
|
|
412
|
+
this._uniformStore?.destroy();
|
|
399
413
|
this._destroyed = true;
|
|
400
414
|
}
|
|
401
415
|
}
|
|
@@ -834,10 +848,12 @@ export class GPUVectorModel {
|
|
|
834
848
|
this.pipeline = this._updatePipeline();
|
|
835
849
|
// vertex array needs to be updated if we update buffer layout,
|
|
836
850
|
// but not if we update parameters
|
|
851
|
+
const previousVertexArray = this.vertexArray;
|
|
837
852
|
this.vertexArray = this.device.createVertexArray({
|
|
838
853
|
shaderLayout: this.pipeline.shaderLayout,
|
|
839
854
|
bufferLayout: this.pipeline.bufferLayout
|
|
840
855
|
});
|
|
856
|
+
previousVertexArray.destroy();
|
|
841
857
|
this._dynamicAttributeBufferSources = {};
|
|
842
858
|
this.applyVectorAttributes();
|
|
843
859
|
if (this.indexBuffer)
|
|
@@ -1128,7 +1144,14 @@ export class GPUVectorModel {
|
|
|
1128
1144
|
_updatePipeline() {
|
|
1129
1145
|
const update = this._preparePipelineUpdate();
|
|
1130
1146
|
if (update) {
|
|
1131
|
-
|
|
1147
|
+
try {
|
|
1148
|
+
this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
|
|
1149
|
+
}
|
|
1150
|
+
catch (error) {
|
|
1151
|
+
this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
|
|
1152
|
+
this._pipelineNeedsUpdate = 'pipeline creation failed';
|
|
1153
|
+
throw error;
|
|
1154
|
+
}
|
|
1132
1155
|
this._finishPipelineUpdate(update);
|
|
1133
1156
|
}
|
|
1134
1157
|
return this.pipeline;
|
|
@@ -1158,23 +1181,31 @@ export class GPUVectorModel {
|
|
|
1158
1181
|
log.log(1, `GPUVectorModel ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
|
|
1159
1182
|
}
|
|
1160
1183
|
this._pipelineNeedsUpdate = false;
|
|
1161
|
-
|
|
1162
|
-
id: `${this.id}-vertex`,
|
|
1163
|
-
stage: 'vertex',
|
|
1164
|
-
source: this.source || this.vs,
|
|
1165
|
-
debugShaders: this.props.debugShaders
|
|
1166
|
-
});
|
|
1184
|
+
let vertexShader = null;
|
|
1167
1185
|
let fragmentShader = null;
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
id: `${this.id}-fragment`,
|
|
1174
|
-
stage: 'fragment',
|
|
1175
|
-
source: this.fs,
|
|
1186
|
+
try {
|
|
1187
|
+
vertexShader = this.shaderFactory.createShader({
|
|
1188
|
+
id: `${this.id}-vertex`,
|
|
1189
|
+
stage: 'vertex',
|
|
1190
|
+
source: this.source || this.vs,
|
|
1176
1191
|
debugShaders: this.props.debugShaders
|
|
1177
1192
|
});
|
|
1193
|
+
if (this.source) {
|
|
1194
|
+
fragmentShader = vertexShader;
|
|
1195
|
+
}
|
|
1196
|
+
else if (this.fs) {
|
|
1197
|
+
fragmentShader = this.shaderFactory.createShader({
|
|
1198
|
+
id: `${this.id}-fragment`,
|
|
1199
|
+
stage: 'fragment',
|
|
1200
|
+
source: this.fs,
|
|
1201
|
+
debugShaders: this.props.debugShaders
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
catch (error) {
|
|
1206
|
+
this._releasePipelineShaders(vertexShader, fragmentShader);
|
|
1207
|
+
this._pipelineNeedsUpdate = 'shader creation failed';
|
|
1208
|
+
throw error;
|
|
1178
1209
|
}
|
|
1179
1210
|
return {
|
|
1180
1211
|
props: {
|