@luma.gl/engine 9.0.0-beta.1 → 9.0.0-beta.2
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/dist.dev.js +19 -27
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/index.cjs +4 -12
- package/dist/lib/pipeline-factory.d.ts +2 -3
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +0 -17
- package/dist/lib/pipeline-factory.js.map +1 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +6 -1
- package/dist/model/model.js.map +1 -1
- package/dist.min.js +41 -41
- package/package.json +5 -5
- package/src/geometry/geometry-utils.ts +16 -0
- package/src/lib/pipeline-factory.ts +7 -21
- package/src/model/model.ts +8 -1
package/dist/dist.dev.js
CHANGED
|
@@ -1212,6 +1212,15 @@ var __exports__ = (() => {
|
|
|
1212
1212
|
readPixelsToBufferWebGL2(source, options) {
|
|
1213
1213
|
throw new Error("not implemented");
|
|
1214
1214
|
}
|
|
1215
|
+
setParametersWebGL(parameters) {
|
|
1216
|
+
throw new Error("not implemented");
|
|
1217
|
+
}
|
|
1218
|
+
withParametersWebGL(parameters, func) {
|
|
1219
|
+
throw new Error("not implemented");
|
|
1220
|
+
}
|
|
1221
|
+
clearWebGL(options) {
|
|
1222
|
+
throw new Error("not implemented");
|
|
1223
|
+
}
|
|
1215
1224
|
_getBufferProps(props) {
|
|
1216
1225
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
1217
1226
|
props = {
|
|
@@ -1875,7 +1884,7 @@ var __exports__ = (() => {
|
|
|
1875
1884
|
}
|
|
1876
1885
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
1877
1886
|
const uniformBuffer = device.createBuffer({
|
|
1878
|
-
usage: Buffer2.UNIFORM,
|
|
1887
|
+
usage: Buffer2.UNIFORM | Buffer2.COPY_DST,
|
|
1879
1888
|
byteLength
|
|
1880
1889
|
});
|
|
1881
1890
|
const uniformBufferData = this.getUniformBufferData(uniformBufferName);
|
|
@@ -1886,7 +1895,7 @@ var __exports__ = (() => {
|
|
|
1886
1895
|
if (!this.uniformBuffers.get(uniformBufferName)) {
|
|
1887
1896
|
const byteLength = this.getUniformBufferByteLength(uniformBufferName);
|
|
1888
1897
|
const uniformBuffer = device.createBuffer({
|
|
1889
|
-
usage: Buffer2.UNIFORM,
|
|
1898
|
+
usage: Buffer2.UNIFORM | Buffer2.COPY_DST,
|
|
1890
1899
|
byteLength
|
|
1891
1900
|
});
|
|
1892
1901
|
this.uniformBuffers.set(uniformBufferName, uniformBuffer);
|
|
@@ -3117,18 +3126,12 @@ precision highp float;
|
|
|
3117
3126
|
source,
|
|
3118
3127
|
stage,
|
|
3119
3128
|
modules,
|
|
3120
|
-
defines = {},
|
|
3121
3129
|
hookFunctions = [],
|
|
3122
3130
|
inject = {},
|
|
3123
3131
|
log: log2
|
|
3124
3132
|
} = options;
|
|
3125
3133
|
assert3(typeof source === "string", "shader source must be a string");
|
|
3126
3134
|
const coreSource = source;
|
|
3127
|
-
const allDefines = {};
|
|
3128
|
-
modules.forEach((module) => {
|
|
3129
|
-
Object.assign(allDefines, module.getDefines());
|
|
3130
|
-
});
|
|
3131
|
-
Object.assign(allDefines, defines);
|
|
3132
3135
|
let assembledSource = "";
|
|
3133
3136
|
const hookFunctionMap = normalizeShaderHooks(hookFunctions);
|
|
3134
3137
|
const hookInjections = {};
|
|
@@ -3156,7 +3159,8 @@ precision highp float;
|
|
|
3156
3159
|
mainInjections[key] = [injection];
|
|
3157
3160
|
}
|
|
3158
3161
|
}
|
|
3159
|
-
|
|
3162
|
+
const modulesToInject = platformInfo.type !== "webgpu" ? modules : [];
|
|
3163
|
+
for (const module of modulesToInject) {
|
|
3160
3164
|
if (log2) {
|
|
3161
3165
|
module.checkDeprecations(coreSource, log2);
|
|
3162
3166
|
}
|
|
@@ -8362,23 +8366,6 @@ void main() {
|
|
|
8362
8366
|
delete this._useCounts[hash];
|
|
8363
8367
|
}
|
|
8364
8368
|
}
|
|
8365
|
-
_createRenderPipeline(props) {
|
|
8366
|
-
if (!props.fs) {
|
|
8367
|
-
throw new Error("fs");
|
|
8368
|
-
}
|
|
8369
|
-
const pipeline = this.device.createRenderPipeline({
|
|
8370
|
-
...props,
|
|
8371
|
-
vs: this.device.createShader({
|
|
8372
|
-
stage: "vertex",
|
|
8373
|
-
source: props.vs
|
|
8374
|
-
}),
|
|
8375
|
-
fs: props.fs ? this.device.createShader({
|
|
8376
|
-
stage: "fragment",
|
|
8377
|
-
source: props.fs
|
|
8378
|
-
}) : null
|
|
8379
|
-
});
|
|
8380
|
-
return pipeline;
|
|
8381
|
-
}
|
|
8382
8369
|
_hashRenderPipeline(props) {
|
|
8383
8370
|
const vsHash = this._getHash(props.vs);
|
|
8384
8371
|
const fsHash = props.fs ? this._getHash(props.fs) : 0;
|
|
@@ -8590,11 +8577,16 @@ void main() {
|
|
|
8590
8577
|
this.pipeline = this._updatePipeline();
|
|
8591
8578
|
this.pipeline.setBindings(this.bindings);
|
|
8592
8579
|
this.pipeline.setUniforms(this.uniforms);
|
|
8580
|
+
const {
|
|
8581
|
+
indexBuffer
|
|
8582
|
+
} = this.vertexArray;
|
|
8583
|
+
const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
|
|
8593
8584
|
this.pipeline.draw({
|
|
8594
8585
|
renderPass,
|
|
8595
8586
|
vertexArray: this.vertexArray,
|
|
8596
8587
|
vertexCount: this.vertexCount,
|
|
8597
8588
|
instanceCount: this.instanceCount,
|
|
8589
|
+
indexCount,
|
|
8598
8590
|
transformFeedback: this.transformFeedback
|
|
8599
8591
|
});
|
|
8600
8592
|
} finally {
|
|
@@ -8605,7 +8597,7 @@ void main() {
|
|
|
8605
8597
|
setGeometry(geometry) {
|
|
8606
8598
|
const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);
|
|
8607
8599
|
this.setTopology(gpuGeometry.topology || "triangle-list");
|
|
8608
|
-
this.bufferLayout = mergeBufferLayouts(
|
|
8600
|
+
this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout);
|
|
8609
8601
|
if (this.vertexArray) {
|
|
8610
8602
|
this._setGeometryAttributes(gpuGeometry);
|
|
8611
8603
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-utils.js","names":["unpackIndexedGeometry","geometry","indices","attributes","vertexCount","value","length","unpackedAttributes","attributeName","attribute","constant","size","unpackedValue","constructor","x","index","i","Object","assign"],"sources":["../../src/geometry/geometry-utils.ts"],"sourcesContent":["// import type {Geometry} from './geometry';\n\nexport function unpackIndexedGeometry(geometry: any) {\n const {indices, attributes} = geometry;\n if (!indices) {\n return geometry;\n }\n\n const vertexCount = indices.value.length;\n const unpackedAttributes: Record<string, any> = {};\n\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {constant, value, size} = attribute;\n if (constant || !size) {\n continue; // eslint-disable-line\n }\n const unpackedValue = new value.constructor(vertexCount * size);\n for (let x = 0; x < vertexCount; ++x) {\n const index = indices.value[x];\n for (let i = 0; i < size; i++) {\n unpackedValue[x * size + i] = value[index * size + i];\n }\n }\n unpackedAttributes[attributeName] = {size, value: unpackedValue};\n }\n\n return {\n attributes: Object.assign({}, attributes, unpackedAttributes)\n };\n}\n"],"mappings":"AAEA,OAAO,SAASA,qBAAqBA,CAACC,QAAa,EAAE;EACnD,MAAM;IAACC,OAAO;IAAEC;EAAU,CAAC,GAAGF,QAAQ;EACtC,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOD,QAAQ;EACjB;EAEA,MAAMG,WAAW,GAAGF,OAAO,CAACG,KAAK,CAACC,MAAM;EACxC,MAAMC,kBAAuC,GAAG,CAAC,CAAC;EAElD,KAAK,MAAMC,aAAa,IAAIL,UAAU,EAAE;IACtC,MAAMM,SAAS,GAAGN,UAAU,CAACK,aAAa,CAAC;IAC3C,MAAM;MAACE,QAAQ;MAAEL,KAAK;MAAEM;IAAI,CAAC,GAAGF,SAAS;IACzC,IAAIC,QAAQ,IAAI,CAACC,IAAI,EAAE;MACrB;IACF;IACA,MAAMC,aAAa,GAAG,IAAIP,KAAK,CAACQ,WAAW,CAACT,WAAW,GAAGO,IAAI,CAAC;IAC/D,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,WAAW,EAAE,EAAEU,CAAC,EAAE;MACpC,MAAMC,KAAK,GAAGb,OAAO,CAACG,KAAK,CAACS,CAAC,CAAC;MAC9B,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,EAAEK,CAAC,EAAE,EAAE;QAC7BJ,aAAa,CAACE,CAAC,GAAGH,IAAI,GAAGK,CAAC,CAAC,GAAGX,KAAK,CAACU,KAAK,GAAGJ,IAAI,GAAGK,CAAC,CAAC;MACvD;IACF;IACAT,kBAAkB,CAACC,aAAa,CAAC,GAAG;MAACG,IAAI;MAAEN,KAAK,EAAEO;IAAa,CAAC;EAClE;EAEA,OAAO;IACLT,UAAU,EAAEc,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEf,UAAU,EAAEI,kBAAkB;EAC9D,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"geometry-utils.js","names":["unpackIndexedGeometry","geometry","indices","attributes","vertexCount","value","length","unpackedAttributes","attributeName","attribute","constant","size","unpackedValue","constructor","x","index","i","Object","assign"],"sources":["../../src/geometry/geometry-utils.ts"],"sourcesContent":["// import type {Geometry} from './geometry';\n\nexport function unpackIndexedGeometry(geometry: any) {\n const {indices, attributes} = geometry;\n if (!indices) {\n return geometry;\n }\n\n const vertexCount = indices.value.length;\n const unpackedAttributes: Record<string, any> = {};\n\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {constant, value, size} = attribute;\n if (constant || !size) {\n continue; // eslint-disable-line\n }\n const unpackedValue = new value.constructor(vertexCount * size);\n for (let x = 0; x < vertexCount; ++x) {\n const index = indices.value[x];\n for (let i = 0; i < size; i++) {\n unpackedValue[x * size + i] = value[index * size + i];\n }\n }\n unpackedAttributes[attributeName] = {size, value: unpackedValue};\n }\n\n return {\n attributes: Object.assign({}, attributes, unpackedAttributes)\n };\n}\n\n// export function calculateVertexNormals(positions: Float32Array): Uint8Array {\n// let normals = new Uint8Array(positions.length / 3);\n\n// for (let i = 0; i < positions.length; i++) {\n// const vec1 = new Vector3(positions.subarray(i * 3, i + 0, i + 3));\n// const vec2 = new Vector3(positions.subarray(i + 3, i + 6));\n// const vec3 = new Vector3(positions.subarray(i + 6, i + 9));\n\n// const normal = new Vector3(vec1).cross(vec2).normalize();\n// normals.set(normal[0], i + 4);\n// normals.set(normal[1], i + 4 + 1);\n// normals.set(normal[2], i + 2);\n// }\n// const normal = new Vector3(vec1).cross(vec2).normalize();\n// }"],"mappings":"AAEA,OAAO,SAASA,qBAAqBA,CAACC,QAAa,EAAE;EACnD,MAAM;IAACC,OAAO;IAAEC;EAAU,CAAC,GAAGF,QAAQ;EACtC,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOD,QAAQ;EACjB;EAEA,MAAMG,WAAW,GAAGF,OAAO,CAACG,KAAK,CAACC,MAAM;EACxC,MAAMC,kBAAuC,GAAG,CAAC,CAAC;EAElD,KAAK,MAAMC,aAAa,IAAIL,UAAU,EAAE;IACtC,MAAMM,SAAS,GAAGN,UAAU,CAACK,aAAa,CAAC;IAC3C,MAAM;MAACE,QAAQ;MAAEL,KAAK;MAAEM;IAAI,CAAC,GAAGF,SAAS;IACzC,IAAIC,QAAQ,IAAI,CAACC,IAAI,EAAE;MACrB;IACF;IACA,MAAMC,aAAa,GAAG,IAAIP,KAAK,CAACQ,WAAW,CAACT,WAAW,GAAGO,IAAI,CAAC;IAC/D,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,WAAW,EAAE,EAAEU,CAAC,EAAE;MACpC,MAAMC,KAAK,GAAGb,OAAO,CAACG,KAAK,CAACS,CAAC,CAAC;MAC9B,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,EAAEK,CAAC,EAAE,EAAE;QAC7BJ,aAAa,CAACE,CAAC,GAAGH,IAAI,GAAGK,CAAC,CAAC,GAAGX,KAAK,CAACU,KAAK,GAAGJ,IAAI,GAAGK,CAAC,CAAC;MACvD;IACF;IACAT,kBAAkB,CAACC,aAAa,CAAC,GAAG;MAACG,IAAI;MAAEN,KAAK,EAAEO;IAAa,CAAC;EAClE;EAEA,OAAO;IACLT,UAAU,EAAEc,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEf,UAAU,EAAEI,kBAAkB;EAC9D,CAAC;AACH"}
|
package/dist/index.cjs
CHANGED
|
@@ -852,17 +852,6 @@ var _PipelineFactory = class {
|
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
// PRIVATE
|
|
855
|
-
_createRenderPipeline(props) {
|
|
856
|
-
if (!props.fs) {
|
|
857
|
-
throw new Error("fs");
|
|
858
|
-
}
|
|
859
|
-
const pipeline = this.device.createRenderPipeline({
|
|
860
|
-
...props,
|
|
861
|
-
vs: this.device.createShader({ stage: "vertex", source: props.vs }),
|
|
862
|
-
fs: props.fs ? this.device.createShader({ stage: "fragment", source: props.fs }) : null
|
|
863
|
-
});
|
|
864
|
-
return pipeline;
|
|
865
|
-
}
|
|
866
855
|
/** Calculate a hash based on all the inputs for a render pipeline */
|
|
867
856
|
_hashRenderPipeline(props) {
|
|
868
857
|
const vsHash = this._getHash(props.vs);
|
|
@@ -1093,11 +1082,14 @@ var _Model = class {
|
|
|
1093
1082
|
this.pipeline = this._updatePipeline();
|
|
1094
1083
|
this.pipeline.setBindings(this.bindings);
|
|
1095
1084
|
this.pipeline.setUniforms(this.uniforms);
|
|
1085
|
+
const { indexBuffer } = this.vertexArray;
|
|
1086
|
+
const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
|
|
1096
1087
|
this.pipeline.draw({
|
|
1097
1088
|
renderPass,
|
|
1098
1089
|
vertexArray: this.vertexArray,
|
|
1099
1090
|
vertexCount: this.vertexCount,
|
|
1100
1091
|
instanceCount: this.instanceCount,
|
|
1092
|
+
indexCount,
|
|
1101
1093
|
transformFeedback: this.transformFeedback
|
|
1102
1094
|
});
|
|
1103
1095
|
} finally {
|
|
@@ -1114,7 +1106,7 @@ var _Model = class {
|
|
|
1114
1106
|
setGeometry(geometry) {
|
|
1115
1107
|
const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);
|
|
1116
1108
|
this.setTopology(gpuGeometry.topology || "triangle-list");
|
|
1117
|
-
this.bufferLayout = mergeBufferLayouts(
|
|
1109
|
+
this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout);
|
|
1118
1110
|
if (this.vertexArray) {
|
|
1119
1111
|
this._setGeometryAttributes(gpuGeometry);
|
|
1120
1112
|
}
|
|
@@ -19,9 +19,8 @@ export declare class PipelineFactory {
|
|
|
19
19
|
constructor(device: Device);
|
|
20
20
|
createRenderPipeline(options: PipelineFactoryProps): RenderPipeline;
|
|
21
21
|
release(pipeline: RenderPipeline): void;
|
|
22
|
-
_createRenderPipeline(props: PipelineFactoryProps): RenderPipeline;
|
|
23
22
|
/** Calculate a hash based on all the inputs for a render pipeline */
|
|
24
|
-
_hashRenderPipeline
|
|
25
|
-
_getHash
|
|
23
|
+
private _hashRenderPipeline;
|
|
24
|
+
private _getHash;
|
|
26
25
|
}
|
|
27
26
|
//# sourceMappingURL=pipeline-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-factory.d.ts","sourceRoot":"","sources":["../../src/lib/pipeline-factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAErD,m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,23 +48,6 @@ export class PipelineFactory {
|
|
|
48
48
|
delete this._useCounts[hash];
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
_createRenderPipeline(props) {
|
|
52
|
-
if (!props.fs) {
|
|
53
|
-
throw new Error('fs');
|
|
54
|
-
}
|
|
55
|
-
const pipeline = this.device.createRenderPipeline({
|
|
56
|
-
...props,
|
|
57
|
-
vs: this.device.createShader({
|
|
58
|
-
stage: 'vertex',
|
|
59
|
-
source: props.vs
|
|
60
|
-
}),
|
|
61
|
-
fs: props.fs ? this.device.createShader({
|
|
62
|
-
stage: 'fragment',
|
|
63
|
-
source: props.fs
|
|
64
|
-
}) : null
|
|
65
|
-
});
|
|
66
|
-
return pipeline;
|
|
67
|
-
}
|
|
68
51
|
_hashRenderPipeline(props) {
|
|
69
52
|
const vsHash = this._getHash(props.vs);
|
|
70
53
|
const fsHash = props.fs ? this._getHash(props.fs) : 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-factory.js","names":["RenderPipeline","PipelineFactory","getDefaultPipelineFactory","device","_lumaData","defaultPipelineFactory","constructor","_hashCounter","_hashes","_useCounts","_pipelineCache","createRenderPipeline","options","props","defaultProps","hash","_hashRenderPipeline","pipeline","vs","createShader","stage","source","fs","release","destroy","
|
|
1
|
+
{"version":3,"file":"pipeline-factory.js","names":["RenderPipeline","PipelineFactory","getDefaultPipelineFactory","device","_lumaData","defaultPipelineFactory","constructor","_hashCounter","_hashes","_useCounts","_pipelineCache","createRenderPipeline","options","props","defaultProps","hash","_hashRenderPipeline","pipeline","vs","createShader","stage","source","fs","release","destroy","vsHash","_getHash","fsHash","varyingHash","info","type","parameterHash","JSON","stringify","parameters","bufferLayoutHash","bufferLayout","topology","key","undefined"],"sources":["../../src/lib/pipeline-factory.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {RenderPipelineProps} from '@luma.gl/core';\nimport {Device, RenderPipeline} from '@luma.gl/core';\n\n/** Todo - should be same as RenderPipelineProps */\nexport type PipelineFactoryProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Only accepts string shaders\n vs: string;\n fs: string;\n};\n\n/**\n * Efficiently creates / caches pipelines\n */\nexport class PipelineFactory {\n static defaultProps: Required<PipelineFactoryProps> = {\n ...RenderPipeline.defaultProps,\n vs: undefined!,\n fs: undefined!\n };\n\n readonly device: Device;\n\n private _hashCounter: number = 0;\n private readonly _hashes: Record<string, number> = {};\n private readonly _useCounts: Record<string, number> = {};\n private readonly _pipelineCache: Record<string, RenderPipeline> = {};\n\n static getDefaultPipelineFactory(device: Device): PipelineFactory {\n device._lumaData.defaultPipelineFactory =\n device._lumaData.defaultPipelineFactory || new PipelineFactory(device);\n return device._lumaData.defaultPipelineFactory as PipelineFactory;\n }\n\n constructor(device: Device) {\n this.device = device;\n }\n\n createRenderPipeline(options: PipelineFactoryProps): RenderPipeline {\n const props: Required<PipelineFactoryProps> = {...PipelineFactory.defaultProps, ...options};\n\n const hash = this._hashRenderPipeline({...props});\n\n if (!this._pipelineCache[hash]) {\n const pipeline = this.device.createRenderPipeline({\n ...props,\n vs: this.device.createShader({stage: 'vertex', source: props.vs}),\n fs: props.fs ? this.device.createShader({stage: 'fragment', source: props.fs}) : null\n });\n\n pipeline.hash = hash;\n this._pipelineCache[hash] = pipeline;\n this._useCounts[hash] = 0;\n }\n\n this._useCounts[hash]++;\n\n return this._pipelineCache[hash];\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._useCounts[hash];\n }\n }\n\n // PRIVATE\n\n /** Calculate a hash based on all the inputs for a render pipeline */\n private _hashRenderPipeline(props: PipelineFactoryProps): string {\n const vsHash = this._getHash(props.vs);\n const fsHash = props.fs ? this._getHash(props.fs) : 0;\n\n // WebGL specific\n // const {varyings = [], bufferMode = {}} = props;\n // const varyingHashes = varyings.map((v) => this._getHash(v));\n const varyingHash = '-'; // `${varyingHashes.join('/')}B${bufferMode}`\n\n switch (this.device.info.type) {\n case 'webgpu':\n // On WebGPU we need to rebuild the pipeline if topology, parameters or bufferLayout change\n const parameterHash = this._getHash(JSON.stringify(props.parameters));\n const bufferLayoutHash = this._getHash(JSON.stringify(props.bufferLayout));\n // TODO - Can json.stringify() generate different strings for equivalent objects if order of params is different?\n // create a deepHash() to deduplicate?\n return `${vsHash}/${fsHash}V${varyingHash}T${props.topology}P${parameterHash}BL${bufferLayoutHash}}`;\n default:\n // WebGL is more dynamic\n return `${vsHash}/${fsHash}V${varyingHash}`;\n }\n }\n\n private _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"],"mappings":"AAEA,SAAgBA,cAAc,QAAO,eAAe;AAYpD,OAAO,MAAMC,eAAe,CAAC;EAc3B,OAAOC,yBAAyBA,CAACC,MAAc,EAAmB;IAChEA,MAAM,CAACC,SAAS,CAACC,sBAAsB,GACrCF,MAAM,CAACC,SAAS,CAACC,sBAAsB,IAAI,IAAIJ,eAAe,CAACE,MAAM,CAAC;IACxE,OAAOA,MAAM,CAACC,SAAS,CAACC,sBAAsB;EAChD;EAEAC,WAAWA,CAACH,MAAc,EAAE;IAAA,KAbnBA,MAAM;IAAA,KAEPI,YAAY,GAAW,CAAC;IAAA,KACfC,OAAO,GAA2B,CAAC,CAAC;IAAA,KACpCC,UAAU,GAA2B,CAAC,CAAC;IAAA,KACvCC,cAAc,GAAmC,CAAC,CAAC;IASlE,IAAI,CAACP,MAAM,GAAGA,MAAM;EACtB;EAEAQ,oBAAoBA,CAACC,OAA6B,EAAkB;IAClE,MAAMC,KAAqC,GAAG;MAAC,GAAGZ,eAAe,CAACa,YAAY;MAAE,GAAGF;IAAO,CAAC;IAE3F,MAAMG,IAAI,GAAG,IAAI,CAACC,mBAAmB,CAAC;MAAC,GAAGH;IAAK,CAAC,CAAC;IAEjD,IAAI,CA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C,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;CAMlF;AAkBD,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAQ5D"}
|
package/dist/model/model.js
CHANGED
|
@@ -141,11 +141,16 @@ export class Model {
|
|
|
141
141
|
this.pipeline = this._updatePipeline();
|
|
142
142
|
this.pipeline.setBindings(this.bindings);
|
|
143
143
|
this.pipeline.setUniforms(this.uniforms);
|
|
144
|
+
const {
|
|
145
|
+
indexBuffer
|
|
146
|
+
} = this.vertexArray;
|
|
147
|
+
const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === 'uint32' ? 4 : 2) : undefined;
|
|
144
148
|
this.pipeline.draw({
|
|
145
149
|
renderPass,
|
|
146
150
|
vertexArray: this.vertexArray,
|
|
147
151
|
vertexCount: this.vertexCount,
|
|
148
152
|
instanceCount: this.instanceCount,
|
|
153
|
+
indexCount,
|
|
149
154
|
transformFeedback: this.transformFeedback
|
|
150
155
|
});
|
|
151
156
|
} finally {
|
|
@@ -156,7 +161,7 @@ export class Model {
|
|
|
156
161
|
setGeometry(geometry) {
|
|
157
162
|
const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);
|
|
158
163
|
this.setTopology(gpuGeometry.topology || 'triangle-list');
|
|
159
|
-
this.bufferLayout = mergeBufferLayouts(
|
|
164
|
+
this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout);
|
|
160
165
|
if (this.vertexArray) {
|
|
161
166
|
this._setGeometryAttributes(gpuGeometry);
|
|
162
167
|
}
|
package/dist/model/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":["Buffer","RenderPipeline","UniformStore","getTypedArrayFromDataType","log","uid","deepEqual","splitUniformsAndBindings","isNumberArray","getAttributeInfosFromLayouts","ShaderAssembler","getShaderLayoutFromWGSL","ShaderInputs","makeGPUGeometry","PipelineFactory","getDebugTableForShaderLayout","debugFramebuffer","LOG_DRAW_PRIORITY","LOG_DRAW_TIMEOUT","Model","constructor","device","props","_this$props$modules","_this$props$modules2","_this$shaderInputs","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","vertexArray","transformFeedback","pipeline","shaderInputs","_uniformStore","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","_lastLogTime","_logOpen","_drawCount","defaultProps","Object","assign","moduleMap","fromEntries","modules","map","module","name","setShaderInputs","isWebGPU","info","type","source","_this$props","shaderLayout","_this$props2","wgsl","platformInfo","getPlatformInfo","length","getModules","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","warn","updateModuleSettings","seal","destroy","release","predraw","updateShaderInputs","draw","renderPass","_logDrawCallStart","_logDrawCallEnd","_logFramebuffer","gpuGeometry","setTopology","mergeBufferLayouts","attributeName","entries","find","layout","_setPipelineNeedsUpdate","setBufferLayout","setParameters","moduleName","keys","uniformBuffer","getManagedUniformBuffer","setShaderModuleProps","filter","k","uniform","getUniformValues","setTransformFeedback","buffers","_option","bufferName","buffer","getAttributeNames","includes","attributeNames","set","attributeInfo","setBuffer","location","value","setConstant","reason","createShader","stage","createRenderPipeline","logDrawTimeout","level","Date","now","group","collapsed","shaderLayoutTable","table","uniformTable","getDebugTable","attributeTable","_getAttributeDebugTable","groupEnd","debugFramebuffers","get","framebuffer","minimap","shaderType","values","_getBufferOrConstantValues","bufferDataType","indexType","Uint32Array","debugData","Uint16Array","toString","attribute","dataType","TypedArrayConstructor","typedArray","handle","undefined","defines","varyings","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push","shaderLanguage","shadingLanguage","shaderLanguageVersion","shadingLanguageVersion","gpu","features","_bufferLayout$attribu"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, RenderPipelineProps, RenderPipelineParameters} from '@luma.gl/core';\nimport type {BufferLayout, VertexArray, TransformFeedback} from '@luma.gl/core';\nimport type {AttributeInfo, Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {\n Device,\n Buffer,\n RenderPipeline,\n RenderPass,\n UniformStore,\n getTypedArrayFromDataType\n} from '@luma.gl/core';\nimport {log, uid, deepEqual, splitUniformsAndBindings, isNumberArray} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler, getShaderLayoutFromWGSL} from '@luma.gl/shadertools';\nimport {ShaderInputs} from '../shader-inputs';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\nimport {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';\nimport {debugFramebuffer} from '../debug/debug-framebuffer';\n\nconst LOG_DRAW_PRIORITY = 2;\nconst LOG_DRAW_TIMEOUT = 10000;\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n source?: string;\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** Shader inputs, used to generated uniform buffers and bindings */\n shaderInputs?: ShaderInputs;\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n /** @internal For use with {@link TransformFeedback}, WebGL 2 only. */\n varyings?: string[];\n\n transformFeedback?: TransformFeedback;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n source: null,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: undefined!,\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n varyings: [],\n\n shaderInputs: undefined!,\n pipelineFactory: undefined!,\n transformFeedback: undefined,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n /** TransformFeedback, WebGL 2 only. */\n transformFeedback: TransformFeedback | null = null;\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /** ShaderInputs instance */\n shaderInputs: ShaderInputs;\n\n _uniformStore: UniformStore;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n // Setup shader module inputs\n const moduleMap = Object.fromEntries(\n this.props.modules?.map(module => [module.name, module]) || []\n );\n this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));\n\n const isWebGPU = this.device.info.type === 'webgpu';\n // TODO - hack to support unified WGSL shader\n // TODO - this is wrong, compile a single shader\n if (this.props.source) {\n if (isWebGPU) {\n this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.source);\n }\n this.props.fs = this.props.source;\n this.props.vs = this.props.source;\n }\n\n // Support WGSL shader layout introspection\n if (isWebGPU && typeof this.props.vs !== 'string') {\n this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.vs.wgsl);\n }\n\n // Setup shader assembler\n const platformInfo = getPlatformInfo(device);\n const modules =\n (this.props.modules?.length > 0 ? this.props.modules : this.shaderInputs?.getModules()) || [];\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders({\n platformInfo,\n ...this.props,\n modules\n });\n\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer');\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\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 log.warn('Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()')();\n this.updateModuleSettings(props.moduleSettings);\n }\n if (props.transformFeedback) {\n this.transformFeedback = props.transformFeedback;\n }\n\n // WebGL1?\n // this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n this._uniformStore.destroy();\n }\n\n // Draw call\n\n predraw() {\n // Update uniform buffers if needed\n this.updateShaderInputs();\n }\n\n draw(renderPass: RenderPass): void {\n this.predraw();\n\n try {\n this._logDrawCallStart();\n\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount,\n transformFeedback: this.transformFeedback\n });\n } finally {\n this._logDrawCallEnd();\n }\n this._logFramebuffer(renderPass);\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // Filter geometry attribute so that we don't issue warnings for unused attributes\n const attributes = {...gpuGeometry.attributes};\n for (const [attributeName] of Object.entries(attributes)) {\n if (\n !this.pipeline.shaderLayout.attributes.find(layout => layout.name === attributeName) &&\n attributeName !== 'positions'\n ) {\n delete attributes[attributeName];\n }\n }\n\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setIndexBuffer(gpuGeometry.indices);\n this.setAttributes(gpuGeometry.attributes, 'ignore-unknown');\n this.setAttributes(attributes);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n\n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n setShaderInputs(shaderInputs: ShaderInputs): void {\n this.shaderInputs = shaderInputs;\n this._uniformStore = new UniformStore(this.shaderInputs.modules);\n // Create uniform buffer bindings for all modules\n for (const moduleName of Object.keys(this.shaderInputs.modules)) {\n const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);\n this.bindings[`${moduleName}Uniforms`] = uniformBuffer;\n }\n }\n\n /**\n * Updates shader module settings (which results in uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const uniforms = this._getModuleUniforms(props);\n\n // Extract textures & framebuffers set by the modules\n // TODO better way to extract bindings\n const keys = Object.keys(uniforms).filter(k => {\n const uniform = uniforms[k];\n return !isNumberArray(uniform) && typeof uniform !== 'number' && typeof uniform !== 'boolean';\n });\n const bindings: Record<string, Binding> = {};\n for (const k of keys) {\n bindings[k] = uniforms[k];\n delete uniforms[k];\n }\n }\n\n updateShaderInputs(): void {\n this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n log.warn('Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()')();\n const {bindings, uniforms} = splitUniformsAndBindings(this._getModuleUniforms(props));\n Object.assign(this.bindings, bindings);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Updates optional transform feedback. WebGL 2 only.\n */\n setTransformFeedback(transformFeedback: TransformFeedback | null): void {\n this.transformFeedback = transformFeedback;\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>, _option?: 'ignore-unknown'): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n )();\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => getAttributeNames(layout).includes(bufferName));\n if (!bufferLayout) {\n log.warn(`Model(${this.id}): Missing layout for buffer \"${bufferName}\".`)();\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = getAttributeNames(bufferLayout);\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set && _option !== 'ignore-unknown') {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(\n `Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`\n )();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(\n 1,\n `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`\n )();\n }\n \n this._pipelineNeedsUpdate = false;\n\n const vs = this.device.createShader({\n id: `${this.id}-vertex`,\n stage: 'vertex',\n source: this.vs\n });\n\n const fs = this.fs\n ? this.device.createShader({\n id: `${this.id}-fragment`,\n stage: 'fragment',\n source: this.fs\n })\n : null;\n\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs,\n fs\n });\n\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n\n /** Throttle draw call logging */\n _lastLogTime = 0;\n _logOpen = false;\n\n _logDrawCallStart(): void {\n // IF level is 4 or higher, log every frame.\n const logDrawTimeout = log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;\n if (log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {\n return;\n }\n\n this._lastLogTime = Date.now();\n this._logOpen = true;\n\n log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, {collapsed: log.level <= 2})();\n }\n\n _logDrawCallEnd(): void {\n if (this._logOpen) {\n const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout, this.id);\n\n // log.table(logLevel, attributeTable)();\n // log.table(logLevel, uniformTable)();\n log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();\n\n const uniformTable = this.shaderInputs.getDebugTable();\n // Add any global uniforms\n for (const [name, value] of Object.entries(this.uniforms)) {\n uniformTable[name] = {value};\n }\n log.table(LOG_DRAW_PRIORITY, uniformTable)();\n\n const attributeTable = this._getAttributeDebugTable();\n log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();\n log.table(LOG_DRAW_PRIORITY, attributeTable)();\n\n log.groupEnd(LOG_DRAW_PRIORITY)();\n this._logOpen = false;\n }\n }\n\n protected _drawCount = 0;\n _logFramebuffer(renderPass: RenderPass): void {\n const debugFramebuffers = log.get('framebuffer');\n this._drawCount++;\n // Update first 3 frames and then every 60 frames\n if (!debugFramebuffers || ((this._drawCount++ > 3) && (this._drawCount % 60))) {\n return;\n }\n // TODO - display framebuffer output in debug window\n const framebuffer = renderPass.props.framebuffer;\n if (framebuffer) {\n debugFramebuffer(framebuffer, {id: framebuffer.id, minimap: true});\n // log.image({logLevel: LOG_DRAW_PRIORITY, message: `${framebuffer.id} %c sup?`, image})();\n }\n }\n\n _getAttributeDebugTable(): Record<string, Record<string, unknown>> {\n const table: Record<string, Record<string, unknown>> = {};\n for (const [name, attributeInfo] of Object.entries(this._attributeInfos)) {\n table[attributeInfo.location] = {\n name,\n type: attributeInfo.shaderType,\n values: this._getBufferOrConstantValues(\n this.vertexArray.attributes[attributeInfo.location],\n attributeInfo.bufferDataType\n )\n };\n }\n if (this.vertexArray.indexBuffer) {\n const {indexBuffer} = this.vertexArray;\n const values =\n indexBuffer.indexType === 'uint32'\n ? new Uint32Array(indexBuffer.debugData)\n : new Uint16Array(indexBuffer.debugData);\n table.indices = {\n name: 'indices',\n type: indexBuffer.indexType,\n values: values.toString()\n };\n }\n return table;\n }\n\n // TODO - fix typing of luma data types\n _getBufferOrConstantValues(attribute: Buffer | TypedArray, dataType: any): string {\n const TypedArrayConstructor = getTypedArrayFromDataType(dataType);\n const typedArray =\n attribute instanceof Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;\n return typedArray.toString();\n }\n}\n\n// HELPERS\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n\n/** Create a shadertools platform info from the Device */\nexport function getPlatformInfo(device: Device): PlatformInfo {\n return {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguage,\n shaderLanguageVersion: device.info.shadingLanguageVersion as 100 | 300,\n gpu: device.info.gpu,\n features: device.features\n };\n}\n\n/** Get attribute names from a BufferLayout */\nfunction getAttributeNames(bufferLayout: BufferLayout): string[] {\n return bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\n}\n"],"mappings":"AAMA,SAEEA,MAAM,EACNC,cAAc,EAEdC,YAAY,EACZC,yBAAyB,QACpB,eAAe;AACtB,SAAQC,GAAG,EAAEC,GAAG,EAAEC,SAAS,EAAEC,wBAAwB,EAAEC,aAAa,QAAO,eAAe;AAC1F,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,EAAEC,uBAAuB,QAAO,sBAAsB;AAAC,SACtEC,YAAY;AAAA,SAECC,eAAe;AAAA,SAC5BC,eAAe;AAAA,SACfC,4BAA4B;AAAA,SAC5BC,gBAAgB;AAExB,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,KAAK;AAqD9B,OAAO,MAAMC,KAAK,CAAC;EAmFjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,kBAAA;IAAA,KA3DtCJ,MAAM;IAAA,KACNK,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,eAAe;IAAA,KACxBC,QAAQ,GAAyB,CAAC,CAAC;IAAA,KAKnCC,UAAU;IAAA,KAGVC,QAAQ;IAAA,KAERC,YAAY;IAAA,KAKZC,WAAW;IAAA,KAEXC,aAAa,GAAW,CAAC;IAAA,KAGzBC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,gBAAgB,GAA2B,CAAC,CAAC;IAAA,KAE7CC,kBAAkB,GAA+B,CAAC,CAAC;IAAA,KAEnDC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCC,QAAQ,GAAiC,CAAC,CAAC;IAAA,KAO3CC,WAAW;IAAA,KAGXC,iBAAiB,GAA6B,IAAI;IAAA,KAGlDC,QAAQ;IAAA,KAGRC,YAAY;IAAA,KAEZC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AwB,EAAEC,QAAwB,EAAkB;EAC9F,MAAMC,OAAO,GAAG,CAAC,GAAGF,QAAQ,CAAC;EAC7B,KAAK,MAAMT,SAAS,IAAIU,QAAQ,EAAE;IAChC,MAAME,KAAK,GAAGD,OAAO,CAACE,SAAS,CAACC,UAAU,IAAIA,UAAU,CAAC5H,IAAI,KAAK8G,SAAS,CAAC9G,IAAI,CAAC;IACjF,IAAI0H,KAAK,GAAG,CAAC,EAAE;MACbD,OAAO,CAACI,IAAI,CAACf,SAAS,CAAC;IACzB,CAAC,MAAM;MACLW,OAAO,CAACC,KAAK,CAAC,GAAGZ,SAAS;IAC5B;EACF;EACA,OAAOW,OAAO;AAChB;AAGA,OAAO,SAAS9G,eAAeA,CAACnD,MAAc,EAAgB;EAC5D,OAAO;IACL4C,IAAI,EAAE5C,MAAM,CAAC2C,IAAI,CAACC,IAAI;IACtB0H,cAAc,EAAEtK,MAAM,CAAC2C,IAAI,CAAC4H,eAAe;IAC3CC,qBAAqB,EAAExK,MAAM,CAAC2C,IAAI,CAAC8H,sBAAmC;IACtEC,GAAG,EAAE1K,MAAM,CAAC2C,IAAI,CAAC+H,GAAG;IACpBC,QAAQ,EAAE3K,MAAM,CAAC2K;EACnB,CAAC;AACH;AAGA,SAAS5D,iBAAiBA,CAACnG,YAA0B,EAAY;EAAA,IAAAgK,qBAAA;EAC/D,OAAOhK,YAAY,CAACyD,UAAU,IAAAuG,qBAAA,GAC1BhK,YAAY,CAACyD,UAAU,cAAAuG,qBAAA,uBAAvBA,qBAAA,CAAyBtI,GAAG,CAACuD,MAAM,IAAIA,MAAM,CAACyD,SAAS,CAAC,GACxD,CAAC1I,YAAY,CAAC4B,IAAI,CAAC;AACzB"}
|
|
1
|
+
{"version":3,"file":"model.js","names":["Buffer","RenderPipeline","UniformStore","getTypedArrayFromDataType","log","uid","deepEqual","splitUniformsAndBindings","isNumberArray","getAttributeInfosFromLayouts","ShaderAssembler","getShaderLayoutFromWGSL","ShaderInputs","makeGPUGeometry","PipelineFactory","getDebugTableForShaderLayout","debugFramebuffer","LOG_DRAW_PRIORITY","LOG_DRAW_TIMEOUT","Model","constructor","device","props","_this$props$modules","_this$props$modules2","_this$shaderInputs","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","vertexArray","transformFeedback","pipeline","shaderInputs","_uniformStore","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","_lastLogTime","_logOpen","_drawCount","defaultProps","Object","assign","moduleMap","fromEntries","modules","map","module","name","setShaderInputs","isWebGPU","info","type","source","_this$props","shaderLayout","_this$props2","wgsl","platformInfo","getPlatformInfo","length","getModules","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","warn","updateModuleSettings","seal","destroy","release","predraw","updateShaderInputs","draw","renderPass","_logDrawCallStart","indexCount","byteLength","indexType","undefined","_logDrawCallEnd","_logFramebuffer","gpuGeometry","setTopology","mergeBufferLayouts","attributeName","entries","find","layout","_setPipelineNeedsUpdate","setBufferLayout","setParameters","moduleName","keys","uniformBuffer","getManagedUniformBuffer","setShaderModuleProps","filter","k","uniform","getUniformValues","setTransformFeedback","buffers","_option","bufferName","buffer","getAttributeNames","includes","attributeNames","set","attributeInfo","setBuffer","location","value","setConstant","reason","createShader","stage","createRenderPipeline","logDrawTimeout","level","Date","now","group","collapsed","shaderLayoutTable","table","uniformTable","getDebugTable","attributeTable","_getAttributeDebugTable","groupEnd","debugFramebuffers","get","framebuffer","minimap","shaderType","values","_getBufferOrConstantValues","bufferDataType","Uint32Array","debugData","Uint16Array","toString","attribute","dataType","TypedArrayConstructor","typedArray","handle","defines","varyings","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push","shaderLanguage","shadingLanguage","shaderLanguageVersion","shadingLanguageVersion","gpu","features","_bufferLayout$attribu"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, RenderPipelineProps, RenderPipelineParameters} from '@luma.gl/core';\nimport type {BufferLayout, VertexArray, TransformFeedback} from '@luma.gl/core';\nimport type {AttributeInfo, Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {\n Device,\n Buffer,\n RenderPipeline,\n RenderPass,\n UniformStore,\n getTypedArrayFromDataType\n} from '@luma.gl/core';\nimport {log, uid, deepEqual, splitUniformsAndBindings, isNumberArray} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler, getShaderLayoutFromWGSL} from '@luma.gl/shadertools';\nimport {ShaderInputs} from '../shader-inputs';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\nimport {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';\nimport {debugFramebuffer} from '../debug/debug-framebuffer';\n\nconst LOG_DRAW_PRIORITY = 2;\nconst LOG_DRAW_TIMEOUT = 10000;\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n source?: string;\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** Shader inputs, used to generated uniform buffers and bindings */\n shaderInputs?: ShaderInputs;\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n /** @internal For use with {@link TransformFeedback}, WebGL 2 only. */\n varyings?: string[];\n\n transformFeedback?: TransformFeedback;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n source: null,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: undefined!,\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n varyings: [],\n\n shaderInputs: undefined!,\n pipelineFactory: undefined!,\n transformFeedback: undefined,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n /** TransformFeedback, WebGL 2 only. */\n transformFeedback: TransformFeedback | null = null;\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /** ShaderInputs instance */\n shaderInputs: ShaderInputs;\n\n _uniformStore: UniformStore;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n // Setup shader module inputs\n const moduleMap = Object.fromEntries(\n this.props.modules?.map(module => [module.name, module]) || []\n );\n this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));\n\n const isWebGPU = this.device.info.type === 'webgpu';\n // TODO - hack to support unified WGSL shader\n // TODO - this is wrong, compile a single shader\n if (this.props.source) {\n if (isWebGPU) {\n this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.source);\n }\n this.props.fs = this.props.source;\n this.props.vs = this.props.source;\n }\n\n // Support WGSL shader layout introspection\n if (isWebGPU && typeof this.props.vs !== 'string') {\n this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.vs.wgsl);\n }\n\n // Setup shader assembler\n const platformInfo = getPlatformInfo(device);\n\n // Extract modules from shader inputs if not supplied\n const modules =\n (this.props.modules?.length > 0 ? this.props.modules : this.shaderInputs?.getModules()) || [];\n\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders({\n platformInfo,\n ...this.props,\n modules\n });\n\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer');\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\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 log.warn('Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()')();\n this.updateModuleSettings(props.moduleSettings);\n }\n if (props.transformFeedback) {\n this.transformFeedback = props.transformFeedback;\n }\n\n // WebGL1?\n // this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n this._uniformStore.destroy();\n }\n\n // Draw call\n\n predraw() {\n // Update uniform buffers if needed\n this.updateShaderInputs();\n }\n\n draw(renderPass: RenderPass): void {\n this.predraw();\n\n try {\n this._logDrawCallStart();\n\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n const {indexBuffer} = this.vertexArray;\n const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === 'uint32' ? 4 : 2) : undefined;\n \n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount,\n indexCount,\n transformFeedback: this.transformFeedback\n });\n } finally {\n this._logDrawCallEnd();\n }\n this._logFramebuffer(renderPass);\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // Filter geometry attribute so that we don't issue warnings for unused attributes\n const attributes = {...gpuGeometry.attributes};\n for (const [attributeName] of Object.entries(attributes)) {\n if (\n !this.pipeline.shaderLayout.attributes.find(layout => layout.name === attributeName) &&\n attributeName !== 'positions'\n ) {\n delete attributes[attributeName];\n }\n }\n\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setIndexBuffer(gpuGeometry.indices);\n this.setAttributes(gpuGeometry.attributes, 'ignore-unknown');\n this.setAttributes(attributes);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n\n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n setShaderInputs(shaderInputs: ShaderInputs): void {\n this.shaderInputs = shaderInputs;\n this._uniformStore = new UniformStore(this.shaderInputs.modules);\n // Create uniform buffer bindings for all modules\n for (const moduleName of Object.keys(this.shaderInputs.modules)) {\n const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);\n this.bindings[`${moduleName}Uniforms`] = uniformBuffer;\n }\n }\n\n /**\n * Updates shader module settings (which results in uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const uniforms = this._getModuleUniforms(props);\n\n // Extract textures & framebuffers set by the modules\n // TODO better way to extract bindings\n const keys = Object.keys(uniforms).filter(k => {\n const uniform = uniforms[k];\n return !isNumberArray(uniform) && typeof uniform !== 'number' && typeof uniform !== 'boolean';\n });\n const bindings: Record<string, Binding> = {};\n for (const k of keys) {\n bindings[k] = uniforms[k];\n delete uniforms[k];\n }\n }\n\n updateShaderInputs(): void {\n this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n log.warn('Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()')();\n const {bindings, uniforms} = splitUniformsAndBindings(this._getModuleUniforms(props));\n Object.assign(this.bindings, bindings);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Updates optional transform feedback. WebGL 2 only.\n */\n setTransformFeedback(transformFeedback: TransformFeedback | null): void {\n this.transformFeedback = transformFeedback;\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>, _option?: 'ignore-unknown'): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n )();\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => getAttributeNames(layout).includes(bufferName));\n if (!bufferLayout) {\n log.warn(`Model(${this.id}): Missing layout for buffer \"${bufferName}\".`)();\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = getAttributeNames(bufferLayout);\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set && _option !== 'ignore-unknown') {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(\n `Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`\n )();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(\n 1,\n `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`\n )();\n }\n \n this._pipelineNeedsUpdate = false;\n\n const vs = this.device.createShader({\n id: `${this.id}-vertex`,\n stage: 'vertex',\n source: this.vs\n });\n\n const fs = this.fs\n ? this.device.createShader({\n id: `${this.id}-fragment`,\n stage: 'fragment',\n source: this.fs\n })\n : null;\n\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs,\n fs\n });\n\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n\n /** Throttle draw call logging */\n _lastLogTime = 0;\n _logOpen = false;\n\n _logDrawCallStart(): void {\n // IF level is 4 or higher, log every frame.\n const logDrawTimeout = log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;\n if (log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {\n return;\n }\n\n this._lastLogTime = Date.now();\n this._logOpen = true;\n\n log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, {collapsed: log.level <= 2})();\n }\n\n _logDrawCallEnd(): void {\n if (this._logOpen) {\n const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout, this.id);\n\n // log.table(logLevel, attributeTable)();\n // log.table(logLevel, uniformTable)();\n log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();\n\n const uniformTable = this.shaderInputs.getDebugTable();\n // Add any global uniforms\n for (const [name, value] of Object.entries(this.uniforms)) {\n uniformTable[name] = {value};\n }\n log.table(LOG_DRAW_PRIORITY, uniformTable)();\n\n const attributeTable = this._getAttributeDebugTable();\n log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();\n log.table(LOG_DRAW_PRIORITY, attributeTable)();\n\n log.groupEnd(LOG_DRAW_PRIORITY)();\n this._logOpen = false;\n }\n }\n\n protected _drawCount = 0;\n _logFramebuffer(renderPass: RenderPass): void {\n const debugFramebuffers = log.get('framebuffer');\n this._drawCount++;\n // Update first 3 frames and then every 60 frames\n if (!debugFramebuffers || ((this._drawCount++ > 3) && (this._drawCount % 60))) {\n return;\n }\n // TODO - display framebuffer output in debug window\n const framebuffer = renderPass.props.framebuffer;\n if (framebuffer) {\n debugFramebuffer(framebuffer, {id: framebuffer.id, minimap: true});\n // log.image({logLevel: LOG_DRAW_PRIORITY, message: `${framebuffer.id} %c sup?`, image})();\n }\n }\n\n _getAttributeDebugTable(): Record<string, Record<string, unknown>> {\n const table: Record<string, Record<string, unknown>> = {};\n for (const [name, attributeInfo] of Object.entries(this._attributeInfos)) {\n table[attributeInfo.location] = {\n name,\n type: attributeInfo.shaderType,\n values: this._getBufferOrConstantValues(\n this.vertexArray.attributes[attributeInfo.location],\n attributeInfo.bufferDataType\n )\n };\n }\n if (this.vertexArray.indexBuffer) {\n const {indexBuffer} = this.vertexArray;\n const values =\n indexBuffer.indexType === 'uint32'\n ? new Uint32Array(indexBuffer.debugData)\n : new Uint16Array(indexBuffer.debugData);\n table.indices = {\n name: 'indices',\n type: indexBuffer.indexType,\n values: values.toString()\n };\n }\n return table;\n }\n\n // TODO - fix typing of luma data types\n _getBufferOrConstantValues(attribute: Buffer | TypedArray, dataType: any): string {\n const TypedArrayConstructor = getTypedArrayFromDataType(dataType);\n const typedArray =\n attribute instanceof Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;\n return typedArray.toString();\n }\n}\n\n// HELPERS\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n\n/** Create a shadertools platform info from the Device */\nexport function getPlatformInfo(device: Device): PlatformInfo {\n return {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguage,\n shaderLanguageVersion: device.info.shadingLanguageVersion as 100 | 300,\n gpu: device.info.gpu,\n features: device.features\n };\n}\n\n/** Get attribute names from a BufferLayout */\nfunction getAttributeNames(bufferLayout: BufferLayout): string[] {\n return bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\n}\n"],"mappings":"AAMA,SAEEA,MAAM,EACNC,cAAc,EAEdC,YAAY,EACZC,yBAAyB,QACpB,eAAe;AACtB,SAAQC,GAAG,EAAEC,GAAG,EAAEC,SAAS,EAAEC,wBAAwB,EAAEC,aAAa,QAAO,eAAe;AAC1F,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,EAAEC,uBAAuB,QAAO,sBAAsB;AAAC,SACtEC,YAAY;AAAA,SAECC,eAAe;AAAA,SAC5BC,eAAe;AAAA,SACfC,4BAA4B;AAAA,SAC5BC,gBAAgB;AAExB,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,KAAK;AAqD9B,OAAO,MAAMC,KAAK,CAAC;EAmFjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,kBAAA;IAAA,KA3DtCJ,MAAM;IAAA,KACNK,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,eAAe;IAAA,KACxBC,QAAQ,GAAyB,CAAC,CAAC;IAAA,KAKnCC,UAAU;IAAA,KAGVC,QAAQ;IAAA,KAERC,YAAY;IAAA,KAKZC,WAAW;IAAA,KAEXC,aAAa,GAAW,CAAC;IAAA,KAGzBC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,gBAAgB,GAA2B,CAAC,CAAC;IAAA,KAE7CC,kBAAkB,GAA+B,CAAC,CAAC;IAAA,KAEnDC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCC,QAAQ,GAAiC,CAAC,CAAC;IAAA,KAO3CC,WAAW;IAAA,KAGXC,iBAAiB,GAA6B,IAAI;IAAA,KAGlDC,QAAQ;IAAA,KAGRC,YAAY;IAAA,KAEZ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