@luma.gl/engine 9.0.0-alpha.16 → 9.0.0-alpha.19
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/animation/key-frames.d.ts +1 -1
- package/dist/animation/key-frames.d.ts.map +1 -1
- package/dist/animation/key-frames.js +55 -54
- package/dist/animation/key-frames.js.map +1 -0
- package/dist/animation/timeline.d.ts +4 -4
- package/dist/animation/timeline.d.ts.map +1 -1
- package/dist/animation/timeline.js +101 -94
- package/dist/animation/timeline.js.map +1 -0
- package/dist/animation-loop/animation-loop.d.ts +4 -2
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +358 -414
- package/dist/animation-loop/animation-loop.js.map +1 -0
- package/dist/animation-loop/animation-props.d.ts +3 -1
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/animation-props.js +1 -0
- package/dist/animation-loop/animation-props.js.map +1 -0
- package/dist/animation-loop/make-animation-loop.d.ts +1 -1
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +25 -26
- package/dist/animation-loop/make-animation-loop.js.map +1 -0
- package/dist/animation-loop/render-loop.js +5 -17
- package/dist/animation-loop/render-loop.js.map +1 -0
- package/dist/dist.dev.js +12517 -0
- package/dist/geometries/cone-geometry.d.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +18 -12
- package/dist/geometries/cone-geometry.js.map +1 -0
- package/dist/geometries/cube-geometry.d.ts +1 -1
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +60 -187
- package/dist/geometries/cube-geometry.js.map +1 -0
- package/dist/geometries/cylinder-geometry.d.ts +1 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +15 -10
- package/dist/geometries/cylinder-geometry.js.map +1 -0
- package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +160 -141
- package/dist/geometries/ico-sphere-geometry.js.map +1 -0
- package/dist/geometries/plane-geometry.d.ts +1 -1
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +111 -93
- package/dist/geometries/plane-geometry.js.map +1 -0
- package/dist/geometries/sphere-geometry.d.ts +1 -1
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +95 -76
- package/dist/geometries/sphere-geometry.js.map +1 -0
- package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +126 -105
- package/dist/geometries/truncated-cone-geometry.js.map +1 -0
- package/dist/geometry/geometry-table.d.ts +1 -1
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-table.js +1 -0
- package/dist/geometry/geometry-table.js.map +1 -0
- package/dist/geometry/geometry-utils.js +32 -22
- package/dist/geometry/geometry-utils.js.map +1 -0
- package/dist/geometry/geometry.d.ts +4 -4
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +109 -96
- package/dist/geometry/geometry.js.map +1 -0
- package/dist/geometry/primitive-utils.js +1 -30
- package/dist/geometry/primitive-utils.js.map +1 -0
- package/dist/index.cjs +2268 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -20
- package/dist/index.js.map +1 -0
- package/dist/lib/clip-space.d.ts +8 -0
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +32 -45
- package/dist/lib/clip-space.js.map +1 -0
- package/dist/lib/model-utils.js +28 -101
- package/dist/lib/model-utils.js.map +1 -0
- package/dist/lib/model.d.ts +1 -1
- package/dist/lib/model.d.ts.map +1 -1
- package/dist/lib/model.js +129 -121
- package/dist/lib/model.js.map +1 -0
- package/dist/lib/pipeline-factory.d.ts +3 -3
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +165 -136
- package/dist/lib/pipeline-factory.js.map +1 -0
- package/dist.min.js +295 -0
- package/package.json +22 -13
- package/src/animation/timeline.ts +1 -1
- package/src/animation-loop/animation-loop.ts +5 -5
- package/src/animation-loop/make-animation-loop.ts +2 -1
- package/src/geometry/geometry.ts +2 -2
- package/src/index.ts +1 -1
- package/src/lib/clip-space.ts +14 -11
- package/src/lib/pipeline-factory.ts +1 -1
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/dist.min.js +0 -31
- package/dist/es5/animation/key-frames.js +0 -84
- package/dist/es5/animation/key-frames.js.map +0 -1
- package/dist/es5/animation/timeline.js +0 -183
- package/dist/es5/animation/timeline.js.map +0 -1
- package/dist/es5/animation-loop/animation-loop.js +0 -534
- package/dist/es5/animation-loop/animation-loop.js.map +0 -1
- package/dist/es5/animation-loop/animation-props.js +0 -2
- package/dist/es5/animation-loop/animation-props.js.map +0 -1
- package/dist/es5/animation-loop/make-animation-loop.js +0 -53
- package/dist/es5/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/es5/animation-loop/render-loop.js +0 -39
- package/dist/es5/animation-loop/render-loop.js.map +0 -1
- package/dist/es5/bundle.js +0 -6
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/geometries/cone-geometry.js +0 -43
- package/dist/es5/geometries/cone-geometry.js.map +0 -1
- package/dist/es5/geometries/cube-geometry.js +0 -84
- package/dist/es5/geometries/cube-geometry.js.map +0 -1
- package/dist/es5/geometries/cylinder-geometry.js +0 -39
- package/dist/es5/geometries/cylinder-geometry.js.map +0 -1
- package/dist/es5/geometries/ico-sphere-geometry.js +0 -185
- package/dist/es5/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/es5/geometries/plane-geometry.js +0 -137
- package/dist/es5/geometries/plane-geometry.js.map +0 -1
- package/dist/es5/geometries/sphere-geometry.js +0 -120
- package/dist/es5/geometries/sphere-geometry.js.map +0 -1
- package/dist/es5/geometries/truncated-cone-geometry.js +0 -160
- package/dist/es5/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/es5/geometry/geometry-table.js +0 -2
- package/dist/es5/geometry/geometry-table.js.map +0 -1
- package/dist/es5/geometry/geometry-utils.js +0 -39
- package/dist/es5/geometry/geometry-utils.js.map +0 -1
- package/dist/es5/geometry/geometry.js +0 -150
- package/dist/es5/geometry/geometry.js.map +0 -1
- package/dist/es5/geometry/primitive-utils.js +0 -2
- package/dist/es5/geometry/primitive-utils.js.map +0 -1
- package/dist/es5/index.js +0 -112
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/clip-space.js +0 -2
- package/dist/es5/lib/clip-space.js.map +0 -1
- package/dist/es5/lib/model-utils.js +0 -52
- package/dist/es5/lib/model-utils.js.map +0 -1
- package/dist/es5/lib/model.js +0 -173
- package/dist/es5/lib/model.js.map +0 -1
- package/dist/es5/lib/pipeline-factory.js +0 -244
- package/dist/es5/lib/pipeline-factory.js.map +0 -1
- package/dist/esm/animation/key-frames.js +0 -57
- package/dist/esm/animation/key-frames.js.map +0 -1
- package/dist/esm/animation/timeline.js +0 -113
- package/dist/esm/animation/timeline.js.map +0 -1
- package/dist/esm/animation-loop/animation-loop.js +0 -367
- package/dist/esm/animation-loop/animation-loop.js.map +0 -1
- package/dist/esm/animation-loop/animation-props.js +0 -2
- package/dist/esm/animation-loop/animation-props.js.map +0 -1
- package/dist/esm/animation-loop/make-animation-loop.js +0 -28
- package/dist/esm/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/esm/animation-loop/render-loop.js +0 -7
- package/dist/esm/animation-loop/render-loop.js.map +0 -1
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/geometries/cone-geometry.js +0 -21
- package/dist/esm/geometries/cone-geometry.js.map +0 -1
- package/dist/esm/geometries/cube-geometry.js +0 -67
- package/dist/esm/geometries/cube-geometry.js.map +0 -1
- package/dist/esm/geometries/cylinder-geometry.js +0 -18
- package/dist/esm/geometries/cylinder-geometry.js.map +0 -1
- package/dist/esm/geometries/ico-sphere-geometry.js +0 -170
- package/dist/esm/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/esm/geometries/plane-geometry.js +0 -119
- package/dist/esm/geometries/plane-geometry.js.map +0 -1
- package/dist/esm/geometries/sphere-geometry.js +0 -102
- package/dist/esm/geometries/sphere-geometry.js.map +0 -1
- package/dist/esm/geometries/truncated-cone-geometry.js +0 -136
- package/dist/esm/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/esm/geometry/geometry-table.js +0 -2
- package/dist/esm/geometry/geometry-table.js.map +0 -1
- package/dist/esm/geometry/geometry-utils.js +0 -37
- package/dist/esm/geometry/geometry-utils.js.map +0 -1
- package/dist/esm/geometry/geometry.js +0 -119
- package/dist/esm/geometry/geometry.js.map +0 -1
- package/dist/esm/geometry/primitive-utils.js +0 -2
- package/dist/esm/geometry/primitive-utils.js.map +0 -1
- package/dist/esm/index.js +0 -16
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/clip-space.js +0 -2
- package/dist/esm/lib/clip-space.js.map +0 -1
- package/dist/esm/lib/model-utils.js +0 -40
- package/dist/esm/lib/model-utils.js.map +0 -1
- package/dist/esm/lib/model.js +0 -146
- package/dist/esm/lib/model.js.map +0 -1
- package/dist/esm/lib/pipeline-factory.js +0 -180
- package/dist/esm/lib/pipeline-factory.js.map +0 -1
- package/src/bundle.ts +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","names":["RenderPipeline","getAttributeBuffersFromGeometry","getIndexBufferFromGeometry","PipelineFactory","DEFAULT_MODEL_PROPS","_DEFAULT_PROPS","vs","fs","id","handle","undefined","userData","modules","moduleSettings","geometry","Model","constructor","device","props","_defineProperty","Error","getShaderSource","vertexCount","topology","pipelineFactory","getDefaultPipelineFactory","pipeline","getUniforms","createRenderPipeline","parameters","layout","_getModuleUniforms","_setGeometry","setUniforms","setProps","destroy","draw","renderPass","instanceCount","indices","setIndexBuffer","attributes","setAttributes","bindings","setBindings","uniforms","updateModuleSettings","Object","assign","geometryBuffers","indexBuffer","shader","info","type","wgsl","glsl"],"sources":["../../src/lib/model.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, Buffer, RenderPipelineProps, RenderPass, Binding, PrimitiveTopology} from '@luma.gl/api';\nimport {RenderPipeline} from '@luma.gl/api';\nimport type { ShaderModule } from '@luma.gl/shadertools';\nimport type Geometry from '../geometry/geometry';\nimport {getAttributeBuffersFromGeometry, getIndexBufferFromGeometry} from './model-utils';\nimport {PipelineFactory} from './pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string\n vs?: {glsl?: string; wgsl?: string} | string | null;\n fs?: {glsl?: string; wgsl?: string} | string | null;\n modules?: ShaderModule[];\n moduleSettings?: Record<string, Record<string, any>>;\n geometry?: Geometry | null;\n};\n\nconst DEFAULT_MODEL_PROPS: Required<ModelProps> = {\n ...RenderPipeline._DEFAULT_PROPS,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n modules: [],\n moduleSettings: {},\n geometry: null\n};\n\n/** v9 API */\nexport class Model {\n readonly device: Device;\n readonly pipeline: RenderPipeline;\n readonly id: string;\n readonly vs: string;\n readonly fs: string | null = null;\n readonly topology: PrimitiveTopology;\n readonly vertexCount;\n props: Required<ModelProps>;\n\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...DEFAULT_MODEL_PROPS, ...props};\n props = this.props;\n this.id = this.props.id;\n this.device = device;\n\n // Create the pipeline\n if (!props.vs) {\n throw new Error('no vertex shader');\n }\n this.vs = getShaderSource(this.device, props.vs);\n if (props.fs) {\n this.fs = getShaderSource(this.device, props.fs);\n }\n\n this.vertexCount = this.props.vertexCount;\n this.topology = this.props.topology;\n\n if (this.props.geometry) {\n this.vertexCount = this.props.geometry.vertexCount;\n this.topology = this.props.geometry.topology || 'triangle-list';\n }\n\n const pipelineFactory = PipelineFactory.getDefaultPipelineFactory(this.device);\n const {pipeline, getUniforms} = pipelineFactory.createRenderPipeline({\n ...this.props,\n vs: this.vs,\n fs: this.fs,\n topology: this.topology,\n parameters: props.parameters,\n layout: props.layout\n });\n\n this.pipeline = pipeline;\n this._getModuleUniforms = getUniforms;\n\n if (this.props.geometry) {\n this._setGeometry(this.props.geometry);\n }\n this.setUniforms(this._getModuleUniforms()) // Get all default module uniforms\n this.setProps(this.props);\n }\n\n destroy(): void {\n this.pipeline.destroy();\n }\n\n draw(renderPass?: RenderPass): this {\n this.pipeline.draw({\n renderPass,\n vertexCount: this.vertexCount,\n instanceCount: this.props.instanceCount\n });\n return this;\n }\n\n setProps(props: ModelProps): this {\n if (props.indices) {\n this.setIndexBuffer(props.indices);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.bindings) {\n this.setBindings(props.bindings);\n }\n if (props.uniforms) {\n this.setUniforms(props.uniforms);\n }\n if (props.moduleSettings) {\n this.updateModuleSettings(props.moduleSettings);\n }\n return this;\n }\n\n updateModuleSettings(props: Record<string, any>): this {\n const uniforms = this._getModuleUniforms(props);\n this.setUniforms(uniforms);\n return this;\n }\n\n setIndexBuffer(indices: Buffer): this {\n this.pipeline.setIndexBuffer(indices);\n // this._indices = indices;\n return this;\n }\n\n setAttributes(attributes: Record<string, Buffer>): this {\n this.pipeline.setAttributes(attributes);\n Object.assign(this.props.attributes, attributes);\n return this;\n }\n\n /** Set the bindings */\n setBindings(bindings: Record<string, Binding>): this {\n this.pipeline.setBindings(bindings);\n Object.assign(this.props.bindings, bindings);\n return this;\n }\n\n setUniforms(uniforms: Record<string, any>): this {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.props.uniforms, uniforms);\n return this;\n }\n\n _setGeometry(geometry: Geometry): void {\n // this._deleteGeometryBuffers();\n\n const geometryBuffers = getAttributeBuffersFromGeometry(this.device, geometry);\n this.setAttributes(geometryBuffers);\n\n const indexBuffer = getIndexBufferFromGeometry(this.device, geometry);\n if (indexBuffer) {\n this.setIndexBuffer(indexBuffer);\n }\n }\n}\n\n/** Create a shader from the different overloads */\nfunction getShaderSource(device: Device, shader: string | {glsl?: string; wgsl?: string}): string {\n // TODO - detect WGSL/GLSL and throw an error if not supported\n if (typeof shader === 'string') {\n return shader;\n }\n\n switch (device.info.type) {\n case 'webgpu':\n if (shader?.wgsl) {\n return shader.wgsl;\n }\n throw new Error('WebGPU does not support GLSL shaders');\n\n default:\n if (shader?.glsl) {\n return shader.glsl;\n }\n throw new Error('WebGL does not support WGSL shaders');\n }\n}\n"],"mappings":";AAGA,SAAQA,cAAc,QAAO,cAAc;AAAC,SAGpCC,+BAA+B,EAAEC,0BAA0B;AAAA,SAC3DC,eAAe;AAWvB,MAAMC,mBAAyC,GAAG;EAChD,GAAGJ,cAAc,CAACK,cAAc;EAChCC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAEC,SAAS;EACjBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,EAAE;EACXC,cAAc,EAAE,CAAC,CAAC;EAClBC,QAAQ,EAAE;AACZ,CAAC;AAGD,OAAO,MAAMC,KAAK,CAAC;EAYjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,aAPlB,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAQ/B,IAAI,CAACD,KAAK,GAAG;MAAC,GAAGd,mBAAmB;MAAE,GAAGc;IAAK,CAAC;IAC/CA,KAAK,GAAG,IAAI,CAACA,KA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EAAE;IAC9B,OAAOA,MAAM;EACf;EAEA,QAAQlC,MAAM,CAACmC,IAAI,CAACC,IAAI;IACtB,KAAK,QAAQ;MACX,IAAIF,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEG,IAAI,EAAE;QAChB,OAAOH,MAAM,CAACG,IAAI;MACpB;MACA,MAAM,IAAIlC,KAAK,CAAC,sCAAsC,CAAC;IAEzD;MACE,IAAI+B,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEI,IAAI,EAAE;QAChB,OAAOJ,MAAM,CAACI,IAAI;MACpB;MACA,MAAM,IAAInC,KAAK,CAAC,qCAAqC,CAAC;EAAC;AAE7D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RenderPipelineParameters, PrimitiveTopology, ShaderLayout } from '@luma.gl/api';
|
|
2
2
|
import { Device, RenderPipeline } from '@luma.gl/api/';
|
|
3
3
|
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
4
|
-
export type GetRenderPipelineOptions = {
|
|
4
|
+
export declare type GetRenderPipelineOptions = {
|
|
5
5
|
vs: string;
|
|
6
6
|
fs: string | null;
|
|
7
7
|
topology: PrimitiveTopology;
|
|
@@ -14,7 +14,7 @@ export type GetRenderPipelineOptions = {
|
|
|
14
14
|
varyings?: string[];
|
|
15
15
|
bufferMode?: number;
|
|
16
16
|
};
|
|
17
|
-
export type GetComputePipelineOptions = {
|
|
17
|
+
export declare type GetComputePipelineOptions = {
|
|
18
18
|
cs: string;
|
|
19
19
|
parameters?: RenderPipelineParameters;
|
|
20
20
|
modules?: ShaderModule[];
|
|
@@ -24,7 +24,7 @@ export type GetComputePipelineOptions = {
|
|
|
24
24
|
varyings?: string[];
|
|
25
25
|
bufferMode?: number;
|
|
26
26
|
};
|
|
27
|
-
type GetUniformsFunc = (props?: Record<string, any>) => Record<string, any>;
|
|
27
|
+
declare type GetUniformsFunc = (props?: Record<string, any>) => Record<string, any>;
|
|
28
28
|
/** Efficiently create shared pipelines with varying parameters */
|
|
29
29
|
export declare class PipelineFactory {
|
|
30
30
|
readonly device: Device;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-factory.d.ts","sourceRoot":"","sources":["../../src/lib/pipeline-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,
|
|
1
|
+
{"version":3,"file":"pipeline-factory.d.ts","sourceRoot":"","sources":["../../src/lib/pipeline-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,oBAAY,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE,wBAAwB,CAAC;IAEtC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,yBAA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QACvD,QAAQ,EAAE,cAAc,CAAC;QACzB,WAAW,EAAE,eAAe,CAAC;KAC9B;IAuBD,OAAO,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAWvC,WAAW,CAAC,QAAQ,EAAE,cAAc;IAMpC,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,GAAG;QACtD,QAAQ,EAAE,cAAc,CAAC;QACzB,WAAW,EAAE,eAAe,CAAA;KAC7B;IAqBD,qEAAqE;IACrE,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,MAAM;IAiC5D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQ7B,cAAc,CAAC,UAAU,GAAE,YAAY,EAAO,GAAG,YAAY,EAAE;CAyBhE"}
|
|
@@ -1,151 +1,180 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import { assembleShaders } from '@luma.gl/shadertools';
|
|
2
3
|
const DEFAULT_RENDER_PIPELINE_OPTIONS = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
vs: '',
|
|
5
|
+
fs: '',
|
|
6
|
+
modules: [],
|
|
7
|
+
defines: {},
|
|
8
|
+
inject: {},
|
|
9
|
+
transpileToGLSL100: false,
|
|
10
|
+
layout: null,
|
|
11
|
+
varyings: [],
|
|
12
|
+
bufferMode: 0x8c8d,
|
|
13
|
+
topology: 'triangle-list',
|
|
14
|
+
parameters: {}
|
|
14
15
|
};
|
|
15
|
-
/** Efficiently create shared pipelines with varying parameters */
|
|
16
16
|
export class PipelineFactory {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
static getDefaultPipelineFactory(device) {
|
|
18
|
+
device.defaultPipelineFactory = device.defaultPipelineFactory || new PipelineFactory(device);
|
|
19
|
+
return device.defaultPipelineFactory;
|
|
20
|
+
}
|
|
21
|
+
constructor(device) {
|
|
22
|
+
_defineProperty(this, "device", void 0);
|
|
23
|
+
_defineProperty(this, "stateHash", 0);
|
|
24
|
+
_defineProperty(this, "_hashCounter", 0);
|
|
25
|
+
_defineProperty(this, "_hashes", {});
|
|
26
|
+
_defineProperty(this, "_useCounts", {});
|
|
27
|
+
_defineProperty(this, "_pipelineCache", {});
|
|
28
|
+
_defineProperty(this, "_getUniforms", {});
|
|
29
|
+
_defineProperty(this, "_hookFunctions", []);
|
|
30
|
+
_defineProperty(this, "_defaultModules", []);
|
|
31
|
+
this.device = device;
|
|
32
|
+
}
|
|
33
|
+
addDefaultModule(module) {
|
|
34
|
+
if (!this._defaultModules.find(m => m.name === (typeof module === 'string' ? module : module.name))) {
|
|
35
|
+
this._defaultModules.push(module);
|
|
23
36
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
this.stateHash++;
|
|
38
|
+
}
|
|
39
|
+
removeDefaultModule(module) {
|
|
40
|
+
const moduleName = typeof module === 'string' ? module : module.name;
|
|
41
|
+
this._defaultModules = this._defaultModules.filter(m => m.name !== moduleName);
|
|
42
|
+
this.stateHash++;
|
|
43
|
+
}
|
|
44
|
+
addShaderHook(hook, opts) {
|
|
45
|
+
if (opts) {
|
|
46
|
+
hook = Object.assign(opts, {
|
|
47
|
+
hook
|
|
48
|
+
});
|
|
34
49
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
this._hookFunctions.push(hook);
|
|
51
|
+
this.stateHash++;
|
|
52
|
+
}
|
|
53
|
+
createRenderPipeline(options) {
|
|
54
|
+
const props = {
|
|
55
|
+
...DEFAULT_RENDER_PIPELINE_OPTIONS,
|
|
56
|
+
...options
|
|
57
|
+
};
|
|
58
|
+
const modules = this._getModuleList(props.modules);
|
|
59
|
+
const hash = this._hashRenderPipeline({
|
|
60
|
+
...props,
|
|
61
|
+
modules
|
|
62
|
+
});
|
|
63
|
+
if (!this._pipelineCache[hash]) {
|
|
64
|
+
const {
|
|
65
|
+
pipeline,
|
|
66
|
+
getUniforms
|
|
67
|
+
} = this._createRenderPipeline({
|
|
68
|
+
...props,
|
|
69
|
+
modules
|
|
70
|
+
});
|
|
71
|
+
pipeline.hash = hash;
|
|
72
|
+
this._pipelineCache[hash] = pipeline;
|
|
73
|
+
this._getUniforms[hash] = getUniforms || (x => ({}));
|
|
74
|
+
this._useCounts[hash] = 0;
|
|
40
75
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
this._useCounts[hash]++;
|
|
77
|
+
return {
|
|
78
|
+
pipeline: this._pipelineCache[hash],
|
|
79
|
+
getUniforms: this._getUniforms[hash]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
release(pipeline) {
|
|
83
|
+
const hash = pipeline.hash;
|
|
84
|
+
this._useCounts[hash]--;
|
|
85
|
+
if (this._useCounts[hash] === 0) {
|
|
86
|
+
this._pipelineCache[hash].destroy();
|
|
87
|
+
delete this._pipelineCache[hash];
|
|
88
|
+
delete this._getUniforms[hash];
|
|
89
|
+
delete this._useCounts[hash];
|
|
45
90
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
91
|
+
}
|
|
92
|
+
getUniforms(pipeline) {
|
|
93
|
+
return this._getUniforms[pipeline.hash] || null;
|
|
94
|
+
}
|
|
95
|
+
_createRenderPipeline(props) {
|
|
96
|
+
const platformInfo = {
|
|
97
|
+
gpu: this.device.info.gpu,
|
|
98
|
+
features: this.device.features
|
|
99
|
+
};
|
|
100
|
+
if (!props.fs) {
|
|
101
|
+
throw new Error('fs');
|
|
52
102
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
103
|
+
const assembled = assembleShaders(platformInfo, {
|
|
104
|
+
...props,
|
|
105
|
+
fs: props.fs,
|
|
106
|
+
hookFunctions: this._hookFunctions
|
|
107
|
+
});
|
|
108
|
+
const pipeline = this.device.createRenderPipeline({
|
|
109
|
+
...props,
|
|
110
|
+
vs: this.device.createShader({
|
|
111
|
+
stage: 'vertex',
|
|
112
|
+
source: assembled.vs
|
|
113
|
+
}),
|
|
114
|
+
fs: assembled.fs ? this.device.createShader({
|
|
115
|
+
stage: 'fragment',
|
|
116
|
+
source: assembled.fs
|
|
117
|
+
}) : null
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
pipeline,
|
|
121
|
+
getUniforms: assembled.getUniforms
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
_hashRenderPipeline(props) {
|
|
125
|
+
const {
|
|
126
|
+
modules = [],
|
|
127
|
+
varyings = [],
|
|
128
|
+
defines = {},
|
|
129
|
+
inject = {},
|
|
130
|
+
parameters = {}
|
|
131
|
+
} = props;
|
|
132
|
+
const vsHash = this._getHash(props.vs);
|
|
133
|
+
const fsHash = props.fs ? this._getHash(props.fs) : 0;
|
|
134
|
+
const moduleHashes = modules.map(m => this._getHash(typeof m === 'string' ? m : m.name)).sort();
|
|
135
|
+
const varyingHashes = varyings.map(v => this._getHash(v));
|
|
136
|
+
const defineKeys = Object.keys(defines).sort();
|
|
137
|
+
const injectKeys = Object.keys(inject).sort();
|
|
138
|
+
const defineHashes = [];
|
|
139
|
+
const injectHashes = [];
|
|
140
|
+
for (const key of defineKeys) {
|
|
141
|
+
defineHashes.push(this._getHash(key));
|
|
142
|
+
defineHashes.push(this._getHash(String(defines[key])));
|
|
69
143
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (this._useCounts[hash] === 0) {
|
|
74
|
-
this._pipelineCache[hash].destroy();
|
|
75
|
-
delete this._pipelineCache[hash];
|
|
76
|
-
delete this._getUniforms[hash];
|
|
77
|
-
delete this._useCounts[hash];
|
|
78
|
-
}
|
|
144
|
+
for (const key of injectKeys) {
|
|
145
|
+
injectHashes.push(this._getHash(key));
|
|
146
|
+
injectHashes.push(this._getHash(inject[key]));
|
|
79
147
|
}
|
|
80
|
-
|
|
81
|
-
|
|
148
|
+
const parameterHash = JSON.stringify(parameters);
|
|
149
|
+
return "".concat(vsHash, "/").concat(fsHash, "D").concat(defineHashes.join('/'), "M").concat(moduleHashes.join('/'), "I").concat(injectHashes.join('/'), "V").concat(varyingHashes.join('/'), "H").concat(this.stateHash, "B").concat(props.bufferMode).concat(props.transpileToGLSL100 ? 'T' : '', "P").concat(parameterHash);
|
|
150
|
+
}
|
|
151
|
+
_getHash(key) {
|
|
152
|
+
if (this._hashes[key] === undefined) {
|
|
153
|
+
this._hashes[key] = this._hashCounter++;
|
|
82
154
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
vs: this.device.createShader({ stage: 'vertex', source: assembled.vs }),
|
|
96
|
-
fs: assembled.fs ? this.device.createShader({ stage: 'fragment', source: assembled.fs }) : null,
|
|
97
|
-
});
|
|
98
|
-
return { pipeline, getUniforms: assembled.getUniforms };
|
|
155
|
+
return this._hashes[key];
|
|
156
|
+
}
|
|
157
|
+
_getModuleList() {
|
|
158
|
+
let appModules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
159
|
+
const modules = new Array(this._defaultModules.length + appModules.length);
|
|
160
|
+
const seen = {};
|
|
161
|
+
let count = 0;
|
|
162
|
+
for (let i = 0, len = this._defaultModules.length; i < len; ++i) {
|
|
163
|
+
const module = this._defaultModules[i];
|
|
164
|
+
const name = module.name;
|
|
165
|
+
modules[count++] = module;
|
|
166
|
+
seen[name] = true;
|
|
99
167
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const defineKeys = Object.keys(defines).sort();
|
|
108
|
-
const injectKeys = Object.keys(inject).sort();
|
|
109
|
-
const defineHashes = [];
|
|
110
|
-
const injectHashes = [];
|
|
111
|
-
for (const key of defineKeys) {
|
|
112
|
-
defineHashes.push(this._getHash(key));
|
|
113
|
-
defineHashes.push(this._getHash(String(defines[key])));
|
|
114
|
-
}
|
|
115
|
-
for (const key of injectKeys) {
|
|
116
|
-
injectHashes.push(this._getHash(key));
|
|
117
|
-
injectHashes.push(this._getHash(inject[key]));
|
|
118
|
-
}
|
|
119
|
-
// TODO - hash parameters!
|
|
120
|
-
const parameterHash = JSON.stringify(parameters);
|
|
121
|
-
return `${vsHash}/${fsHash}D${defineHashes.join('/')}M${moduleHashes.join('/')}I${injectHashes.join('/')}V${varyingHashes.join('/')}H${this.stateHash}B${props.bufferMode}${props.transpileToGLSL100 ? 'T' : ''}P${parameterHash}`;
|
|
122
|
-
}
|
|
123
|
-
_getHash(key) {
|
|
124
|
-
if (this._hashes[key] === undefined) {
|
|
125
|
-
this._hashes[key] = this._hashCounter++;
|
|
126
|
-
}
|
|
127
|
-
return this._hashes[key];
|
|
128
|
-
}
|
|
129
|
-
// Dedupe and combine with default modules
|
|
130
|
-
_getModuleList(appModules = []) {
|
|
131
|
-
const modules = new Array(this._defaultModules.length + appModules.length);
|
|
132
|
-
const seen = {};
|
|
133
|
-
let count = 0;
|
|
134
|
-
for (let i = 0, len = this._defaultModules.length; i < len; ++i) {
|
|
135
|
-
const module = this._defaultModules[i];
|
|
136
|
-
const name = module.name;
|
|
137
|
-
modules[count++] = module;
|
|
138
|
-
seen[name] = true;
|
|
139
|
-
}
|
|
140
|
-
for (let i = 0, len = appModules.length; i < len; ++i) {
|
|
141
|
-
const module = appModules[i];
|
|
142
|
-
const name = module.name;
|
|
143
|
-
if (!seen[name]) {
|
|
144
|
-
modules[count++] = module;
|
|
145
|
-
seen[name] = true;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
modules.length = count;
|
|
149
|
-
return modules;
|
|
168
|
+
for (let i = 0, len = appModules.length; i < len; ++i) {
|
|
169
|
+
const module = appModules[i];
|
|
170
|
+
const name = module.name;
|
|
171
|
+
if (!seen[name]) {
|
|
172
|
+
modules[count++] = module;
|
|
173
|
+
seen[name] = true;
|
|
174
|
+
}
|
|
150
175
|
}
|
|
176
|
+
modules.length = count;
|
|
177
|
+
return modules;
|
|
178
|
+
}
|
|
151
179
|
}
|
|
180
|
+
//# sourceMappingURL=pipeline-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-factory.js","names":["assembleShaders","DEFAULT_RENDER_PIPELINE_OPTIONS","vs","fs","modules","defines","inject","transpileToGLSL100","layout","varyings","bufferMode","topology","parameters","PipelineFactory","getDefaultPipelineFactory","device","defaultPipelineFactory","constructor","_defineProperty","addDefaultModule","module","_defaultModules","find","m","name","push","stateHash","removeDefaultModule","moduleName","filter","addShaderHook","hook","opts","Object","assign","_hookFunctions","createRenderPipeline","options","props","_getModuleList","hash","_hashRenderPipeline","_pipelineCache","pipeline","getUniforms","_createRenderPipeline","_getUniforms","x","_useCounts","release","destroy","platformInfo","gpu","info","features","Error","assembled","hookFunctions","createShader","stage","source","vsHash","_getHash","fsHash","moduleHashes","map","sort","varyingHashes","v","defineKeys","keys","injectKeys","defineHashes","injectHashes","key","String","parameterHash","JSON","stringify","concat","join","_hashes","undefined","_hashCounter","appModules","arguments","length","Array","seen","count","i","len"],"sources":["../../src/lib/pipeline-factory.ts"],"sourcesContent":["import type {RenderPipelineParameters, PrimitiveTopology, ShaderLayout} from '@luma.gl/api';\nimport {Device, RenderPipeline} from '@luma.gl/api/';\nimport type { ShaderModule } from '@luma.gl/shadertools';\nimport {assembleShaders} from '@luma.gl/shadertools';\n\nexport type GetRenderPipelineOptions = {\n vs: string;\n fs: string | null;\n topology: PrimitiveTopology;\n layout?: ShaderLayout | null;\n parameters?: RenderPipelineParameters;\n\n modules?: ShaderModule[];\n defines?: Record<string, string | number | boolean>;\n inject?: Record<string, string>;\n transpileToGLSL100?: boolean;\n\n varyings?: string[];\n bufferMode?: number, \n};\n\nexport type GetComputePipelineOptions = {\n cs: string;\n parameters?: RenderPipelineParameters;\n\n modules?: ShaderModule[];\n defines?: Record<string, string>;\n inject?: Record<string, string>;\n transpileToGLSL100?: boolean;\n\n varyings?: string[];\n bufferMode?: number;\n};\n\nconst DEFAULT_RENDER_PIPELINE_OPTIONS: Required<GetRenderPipelineOptions> = {\n vs: '',\n fs: '',\n modules: [],\n defines: {},\n inject: {},\n transpileToGLSL100: false,\n layout: null,\n\n varyings: [],\n bufferMode: 0x8c8d, // // varyings/bufferMode for xform feedback, 0x8c8d: SEPARATE_ATTRIBS\n topology: 'triangle-list',\n parameters: {} \n};\n\ntype GetUniformsFunc = (props?: Record<string, any>) => Record<string, any>;\n\n/** Efficiently create shared pipelines with varying parameters */\nexport class PipelineFactory {\n readonly device: Device;\n\n stateHash: number = 0; // Used to change hashing if hooks are modified\n private _hashCounter: number = 0;\n private readonly _hashes: Record<string, number> = {};\n private readonly _useCounts: Record<string, number> = {};\n\n private readonly _pipelineCache: Record<string, RenderPipeline> = {};\n\n private readonly _getUniforms: Record<string, GetUniformsFunc> = {};\n private readonly _hookFunctions: any[] = [];\n private _defaultModules: any[] = [];\n // private readonly _registeredModules = {}; // TODO: Remove? This isn't used anywhere in luma.gl\n\n static getDefaultPipelineFactory(device: Device): PipelineFactory {\n // @ts-expect-error Add to device\n device.defaultPipelineFactory = device.defaultPipelineFactory || new PipelineFactory(device);\n // @ts-expect-error Add to device\n return device.defaultPipelineFactory;\n }\n\n constructor(device: Device) {\n this.device = device;\n }\n\n addDefaultModule(module: ShaderModule): void {\n if (!this._defaultModules.find((m) => m.name === (typeof module === 'string' ? module : module.name))) {\n this._defaultModules.push(module);\n }\n this.stateHash++;\n }\n\n removeDefaultModule(module: ShaderModule): void {\n const moduleName = typeof module === 'string' ? module : module.name;\n this._defaultModules = this._defaultModules.filter((m) => m.name !== moduleName);\n this.stateHash++;\n }\n\n addShaderHook(hook: string, opts?: any): void {\n if (opts) {\n hook = Object.assign(opts, {hook});\n }\n this._hookFunctions.push(hook);\n this.stateHash++;\n }\n\n createRenderPipeline(options: GetRenderPipelineOptions): {\n pipeline: RenderPipeline;\n getUniforms: GetUniformsFunc;\n } {\n const props: Required<GetRenderPipelineOptions> = {...DEFAULT_RENDER_PIPELINE_OPTIONS, ...options};\n\n const modules = this._getModuleList(props.modules); // Combine with default modules\n\n const hash = this._hashRenderPipeline({...props, modules});\n\n if (!this._pipelineCache[hash]) {\n const {pipeline, getUniforms} = this._createRenderPipeline({...props, modules});\n pipeline.hash = hash;\n this._pipelineCache[hash] = pipeline;\n this._getUniforms[hash] = getUniforms || ((x?: unknown) => ({}));\n this._useCounts[hash] = 0;\n }\n\n this._useCounts[hash]++;\n\n return {\n pipeline: this._pipelineCache[hash],\n getUniforms: this._getUniforms[hash]\n };\n }\n\n release(pipeline: RenderPipeline): void {\n const hash = pipeline.hash;\n this._useCounts[hash]--;\n if (this._useCounts[hash] === 0) {\n this._pipelineCache[hash].destroy();\n delete this._pipelineCache[hash];\n delete this._getUniforms[hash];\n delete this._useCounts[hash];\n }\n }\n\n getUniforms(pipeline: RenderPipeline) {\n return this._getUniforms[pipeline.hash] || null;\n }\n\n // PRIVATE\n\n _createRenderPipeline(props: GetRenderPipelineOptions): {\n pipeline: RenderPipeline,\n getUniforms: GetUniformsFunc\n } {\n const platformInfo = {\n gpu: this.device.info.gpu,\n features: this.device.features\n };\n\n if (!props.fs) {\n throw new Error('fs');\n }\n\n const assembled = assembleShaders(platformInfo, {...props, fs: props.fs, hookFunctions: this._hookFunctions});\n\n const pipeline = this.device.createRenderPipeline({\n ...props,\n vs: this.device.createShader({stage: 'vertex', source: assembled.vs}),\n fs: assembled.fs ? this.device.createShader({stage: 'fragment', source: assembled.fs}) : null,\n });\n\n return {pipeline, getUniforms: assembled.getUniforms};\n }\n\n /** Calculate a hash based on all the inputs for a render pipeline */\n _hashRenderPipeline(props: GetRenderPipelineOptions): string {\n const {modules = [], varyings = [], defines = {}, inject = {}, parameters = {}} = props;\n const vsHash = this._getHash(props.vs);\n const fsHash = props.fs ? this._getHash(props.fs) : 0;\n\n const moduleHashes = modules.map((m) => this._getHash(typeof m === 'string' ? m : m.name)).sort();\n const varyingHashes = varyings.map((v) => this._getHash(v));\n\n const defineKeys = Object.keys(defines).sort();\n const injectKeys = Object.keys(inject).sort();\n const defineHashes: number[] = [];\n const injectHashes: number[] = [];\n\n for (const key of defineKeys) {\n defineHashes.push(this._getHash(key));\n defineHashes.push(this._getHash(String(defines[key])));\n }\n\n for (const key of injectKeys) {\n injectHashes.push(this._getHash(key));\n injectHashes.push(this._getHash(inject[key]));\n }\n\n // TODO - hash parameters!\n const parameterHash = JSON.stringify(parameters);\n\n return `${vsHash}/${fsHash}D${defineHashes.join('/')}M${moduleHashes.join(\n '/'\n )}I${injectHashes.join('/')}V${varyingHashes.join('/')}H${this.stateHash}B${props.bufferMode}${\n props.transpileToGLSL100 ? 'T' : ''\n }P${parameterHash}`;\n }\n\n _getHash(key: string): number {\n if (this._hashes[key] === undefined) {\n this._hashes[key] = this._hashCounter++;\n }\n return this._hashes[key];\n }\n\n // Dedupe and combine with default modules\n _getModuleList(appModules: ShaderModule[] = []): ShaderModule[] {\n const modules = new Array(this._defaultModules.length + appModules.length);\n const seen: Record<string, boolean> = {};\n let count = 0;\n\n for (let i = 0, len = this._defaultModules.length; i < len; ++i) {\n const module = this._defaultModules[i];\n const name = module.name;\n modules[count++] = module;\n seen[name] = true;\n }\n\n for (let i = 0, len = appModules.length; i < len; ++i) {\n const module = appModules[i];\n const name = module.name;\n if (!seen[name]) {\n modules[count++] = module;\n seen[name] = true;\n }\n }\n\n modules.length = count;\n\n return modules;\n }\n}\n"],"mappings":";AAGA,SAAQA,eAAe,QAAO,sBAAsB;AA+BpD,MAAMC,+BAAmE,GAAG;EAC1EC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,OAAO,EAAE,EAAE;EACXC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC,CAAC;EACVC,kBAAkB,EAAE,KAAK;EACzBC,MAAM,EAAE,IAAI;EAEZC,QAAQ,EAAE,EAAE;EACZC,UAAU,EAAE,MAAM;EAClBC,QAAQ,EAAE,eAAe;EACzBC,UAAU,EAAE,CAAC;AACf,CAAC;AAKD,OAAO,MAAMC,eAAe,CAAC;EAe3B,OAAOC,yBAAyBA,CAACC,MAAc,EAAmB;IAEhEA,MAAM,CAACC,sBAAsB,GAAGD,MAAM,CAACC,sBAAsB,IAAI,IAAIH,eAAe,CAACE,MAAM,CAAC;IAE5F,OAAOA,MAAM,CAACC,sBAAsB;EACtC;EAEAC,WAAWA,CAACF,MAAc,EAAE;IAAAG,eAAA;IAAAA,eAAA,oBAnBR,CAAC;IAAAA,eAAA,uBACU,CAAC;IAAAA,eAAA,kBACmB,CAAC,CAAC;IAAAA,eAAA,qBACC,CAAC,CAAC;IAAAA,eAAA,yBAEU,CAAC,CAAC;IAAAA,eAAA,uBAEH,CAAC,CAAC;IAAAA,eAAA,yBAC1B,EAAE;IAAAA,eAAA,0BACV,EAAE;IAWjC,IAAI,CAACH,MAAM,GAAGA,MAAM;EACtB;EAEAI,gBAAgBA,CAACC,MAAoB,EAAQ;IAC3C,IAAI,CAAC,IAAI,CAACC,eAAe,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,MAAM,OAAOJ,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGA,MAAM,CAACI,IAAI,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