@luma.gl/engine 9.0.0-alpha.52 → 9.0.0-alpha.54
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/debug/debug-shader-layout.d.ts +9 -0
- package/dist/debug/debug-shader-layout.d.ts.map +1 -0
- package/dist/debug/debug-shader-layout.js +21 -0
- package/dist/debug/debug-shader-layout.js.map +1 -0
- package/dist/dist.dev.js +142 -52
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +3 -0
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/index.cjs +92 -16
- package/dist/model/model.d.ts +3 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +52 -11
- package/dist/model/model.js.map +1 -1
- package/dist/shader-inputs.d.ts +1 -0
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +13 -0
- package/dist/shader-inputs.js.map +1 -1
- package/dist.min.js +64 -64
- package/package.json +5 -5
- package/src/debug/debug-shader-layout.ts +34 -0
- package/src/geometry/gpu-geometry.ts +1 -0
- package/src/model/model.ts +88 -23
- package/src/shader-inputs.ts +14 -1
package/dist/index.cjs
CHANGED
|
@@ -698,6 +698,19 @@ var ShaderInputs = class {
|
|
|
698
698
|
}
|
|
699
699
|
return bindings;
|
|
700
700
|
}
|
|
701
|
+
getDebugTable() {
|
|
702
|
+
var _a;
|
|
703
|
+
const table = {};
|
|
704
|
+
for (const [moduleName, module2] of Object.entries(this.moduleUniforms)) {
|
|
705
|
+
for (const [key, value] of Object.entries(module2)) {
|
|
706
|
+
table[`${moduleName}.${key}`] = {
|
|
707
|
+
type: (_a = this.modules[moduleName].uniformTypes) == null ? void 0 : _a[key],
|
|
708
|
+
value: String(value)
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return table;
|
|
713
|
+
}
|
|
701
714
|
};
|
|
702
715
|
|
|
703
716
|
// src/geometry/gpu-geometry.ts
|
|
@@ -780,6 +793,9 @@ function getAttributeBuffersFromGeometry(device, geometry) {
|
|
|
780
793
|
case "TEXCOORD_0":
|
|
781
794
|
name = "texCoords";
|
|
782
795
|
break;
|
|
796
|
+
case "COLOR_0":
|
|
797
|
+
name = "colors";
|
|
798
|
+
break;
|
|
783
799
|
}
|
|
784
800
|
attributes[name] = device.createBuffer({ data: attribute.value, id: `${attributeName}-buffer` });
|
|
785
801
|
const { value, size, normalized } = attribute;
|
|
@@ -869,6 +885,23 @@ __publicField(PipelineFactory, "defaultProps", {
|
|
|
869
885
|
fs: void 0
|
|
870
886
|
});
|
|
871
887
|
|
|
888
|
+
// src/debug/debug-shader-layout.ts
|
|
889
|
+
function getDebugTableForShaderLayout(layout, name = "") {
|
|
890
|
+
const table = {};
|
|
891
|
+
const header = `Shader Layout for ${name}`;
|
|
892
|
+
for (const attributeDeclaration of layout.attributes) {
|
|
893
|
+
if (attributeDeclaration) {
|
|
894
|
+
const glslDeclaration = `${attributeDeclaration.location} ${attributeDeclaration.name}: ${attributeDeclaration.type}`;
|
|
895
|
+
table[`in ${glslDeclaration}`] = { [header]: attributeDeclaration.stepMode || "vertex" };
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
for (const varyingDeclaration of layout.varyings || []) {
|
|
899
|
+
const glslDeclaration = `${varyingDeclaration.location} ${varyingDeclaration.name}`;
|
|
900
|
+
table[`out ${glslDeclaration}`] = { [header]: JSON.stringify(varyingDeclaration.accessor) };
|
|
901
|
+
}
|
|
902
|
+
return table;
|
|
903
|
+
}
|
|
904
|
+
|
|
872
905
|
// src/model/model.ts
|
|
873
906
|
var LOG_DRAW_PRIORITY = 2;
|
|
874
907
|
var LOG_DRAW_TIMEOUT = 1e4;
|
|
@@ -926,11 +959,17 @@ var _Model = class {
|
|
|
926
959
|
this.id = props.id || (0, import_core8.uid)("model");
|
|
927
960
|
this.device = device;
|
|
928
961
|
Object.assign(this.userData, props.userData);
|
|
929
|
-
const moduleMap = Object.fromEntries(
|
|
962
|
+
const moduleMap = Object.fromEntries(
|
|
963
|
+
((_a = this.props.modules) == null ? void 0 : _a.map((module2) => [module2.name, module2])) || []
|
|
964
|
+
);
|
|
930
965
|
this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));
|
|
931
966
|
const platformInfo = getPlatformInfo(device);
|
|
932
967
|
const modules = (((_b = this.props.modules) == null ? void 0 : _b.length) > 0 ? this.props.modules : (_c = this.shaderInputs) == null ? void 0 : _c.getModules()) || [];
|
|
933
|
-
const { vs, fs, getUniforms } = this.props.shaderAssembler.assembleShaders({
|
|
968
|
+
const { vs, fs, getUniforms } = this.props.shaderAssembler.assembleShaders({
|
|
969
|
+
platformInfo,
|
|
970
|
+
...this.props,
|
|
971
|
+
modules
|
|
972
|
+
});
|
|
934
973
|
this.vs = vs;
|
|
935
974
|
this.fs = fs;
|
|
936
975
|
this._getModuleUniforms = getUniforms;
|
|
@@ -975,7 +1014,7 @@ var _Model = class {
|
|
|
975
1014
|
this.setUniforms(props.uniforms);
|
|
976
1015
|
}
|
|
977
1016
|
if (props.moduleSettings) {
|
|
978
|
-
|
|
1017
|
+
import_core8.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")();
|
|
979
1018
|
this.updateModuleSettings(props.moduleSettings);
|
|
980
1019
|
}
|
|
981
1020
|
if (props.transformFeedback) {
|
|
@@ -1031,7 +1070,7 @@ var _Model = class {
|
|
|
1031
1070
|
*/
|
|
1032
1071
|
_setGeometryAttributes(gpuGeometry) {
|
|
1033
1072
|
this.vertexCount = gpuGeometry.vertexCount;
|
|
1034
|
-
this.setAttributes(gpuGeometry.attributes);
|
|
1073
|
+
this.setAttributes(gpuGeometry.attributes, "ignore-unknown");
|
|
1035
1074
|
this.setIndexBuffer(gpuGeometry.indices);
|
|
1036
1075
|
}
|
|
1037
1076
|
/**
|
|
@@ -1089,10 +1128,7 @@ var _Model = class {
|
|
|
1089
1128
|
this.shaderInputs = shaderInputs;
|
|
1090
1129
|
this._uniformStore = new import_core7.UniformStore(this.shaderInputs.modules);
|
|
1091
1130
|
for (const moduleName of Object.keys(this.shaderInputs.modules)) {
|
|
1092
|
-
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(
|
|
1093
|
-
this.device,
|
|
1094
|
-
moduleName
|
|
1095
|
-
);
|
|
1131
|
+
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
|
|
1096
1132
|
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
|
|
1097
1133
|
}
|
|
1098
1134
|
}
|
|
@@ -1103,7 +1139,7 @@ var _Model = class {
|
|
|
1103
1139
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
1104
1140
|
*/
|
|
1105
1141
|
updateModuleSettings(props) {
|
|
1106
|
-
|
|
1142
|
+
import_core8.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();
|
|
1107
1143
|
const { bindings, uniforms } = (0, import_core8.splitUniformsAndBindings)(this._getModuleUniforms(props));
|
|
1108
1144
|
Object.assign(this.bindings, bindings);
|
|
1109
1145
|
Object.assign(this.uniforms, uniforms);
|
|
@@ -1141,20 +1177,19 @@ var _Model = class {
|
|
|
1141
1177
|
* Sets attributes (buffers)
|
|
1142
1178
|
* @note Overrides any attributes previously set with the same name
|
|
1143
1179
|
*/
|
|
1144
|
-
setAttributes(buffers) {
|
|
1145
|
-
var _a;
|
|
1180
|
+
setAttributes(buffers, _option) {
|
|
1146
1181
|
if (buffers.indices) {
|
|
1147
1182
|
import_core8.log.warn(
|
|
1148
1183
|
`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`
|
|
1149
|
-
);
|
|
1184
|
+
)();
|
|
1150
1185
|
}
|
|
1151
1186
|
for (const [bufferName, buffer] of Object.entries(buffers)) {
|
|
1152
|
-
const bufferLayout = this.bufferLayout.find((layout) => layout.
|
|
1187
|
+
const bufferLayout = this.bufferLayout.find((layout) => getAttributeNames(layout).includes(bufferName));
|
|
1153
1188
|
if (!bufferLayout) {
|
|
1154
1189
|
import_core8.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
1155
1190
|
continue;
|
|
1156
1191
|
}
|
|
1157
|
-
const attributeNames =
|
|
1192
|
+
const attributeNames = getAttributeNames(bufferLayout);
|
|
1158
1193
|
let set = false;
|
|
1159
1194
|
for (const attributeName of attributeNames) {
|
|
1160
1195
|
const attributeInfo = this._attributeInfos[attributeName];
|
|
@@ -1163,7 +1198,7 @@ var _Model = class {
|
|
|
1163
1198
|
set = true;
|
|
1164
1199
|
}
|
|
1165
1200
|
}
|
|
1166
|
-
if (!set) {
|
|
1201
|
+
if (!set && _option !== "ignore-unknown") {
|
|
1167
1202
|
import_core8.log.warn(
|
|
1168
1203
|
`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`
|
|
1169
1204
|
)();
|
|
@@ -1235,12 +1270,49 @@ var _Model = class {
|
|
|
1235
1270
|
}
|
|
1236
1271
|
_logDrawCallEnd() {
|
|
1237
1272
|
if (this._logOpen) {
|
|
1238
|
-
const shaderLayoutTable =
|
|
1273
|
+
const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout);
|
|
1239
1274
|
import_core8.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
|
|
1275
|
+
const uniformTable = this.shaderInputs.getDebugTable();
|
|
1276
|
+
for (const [name, value] of Object.entries(this.uniforms)) {
|
|
1277
|
+
uniformTable[name] = { value };
|
|
1278
|
+
}
|
|
1279
|
+
import_core8.log.table(LOG_DRAW_PRIORITY, uniformTable)();
|
|
1280
|
+
const attributeTable = this._getAttributeDebugTable();
|
|
1281
|
+
import_core8.log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
|
|
1282
|
+
import_core8.log.table(LOG_DRAW_PRIORITY, attributeTable)();
|
|
1240
1283
|
import_core8.log.groupEnd(LOG_DRAW_PRIORITY)();
|
|
1241
1284
|
this._logOpen = false;
|
|
1242
1285
|
}
|
|
1243
1286
|
}
|
|
1287
|
+
_getAttributeDebugTable() {
|
|
1288
|
+
const table = {};
|
|
1289
|
+
for (const [name, attributeInfo] of Object.entries(this._attributeInfos)) {
|
|
1290
|
+
table[attributeInfo.location] = {
|
|
1291
|
+
name,
|
|
1292
|
+
type: attributeInfo.shaderType,
|
|
1293
|
+
values: this._getBufferOrConstantValues(
|
|
1294
|
+
this.vertexArray.attributes[attributeInfo.location],
|
|
1295
|
+
attributeInfo.bufferDataType
|
|
1296
|
+
)
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
if (this.vertexArray.indexBuffer) {
|
|
1300
|
+
const { indexBuffer } = this.vertexArray;
|
|
1301
|
+
const values = indexBuffer.indexType === "uint32" ? new Uint32Array(indexBuffer.debugData) : new Uint16Array(indexBuffer.debugData);
|
|
1302
|
+
table.indices = {
|
|
1303
|
+
name: "indices",
|
|
1304
|
+
type: indexBuffer.indexType,
|
|
1305
|
+
values: values.toString()
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
return table;
|
|
1309
|
+
}
|
|
1310
|
+
// TODO - fix typing of luma data types
|
|
1311
|
+
_getBufferOrConstantValues(attribute, dataType) {
|
|
1312
|
+
const TypedArrayConstructor = (0, import_core7.getTypedArrayFromDataType)(dataType);
|
|
1313
|
+
const typedArray = attribute instanceof import_core7.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
|
|
1314
|
+
return typedArray.toString();
|
|
1315
|
+
}
|
|
1244
1316
|
};
|
|
1245
1317
|
var Model = _Model;
|
|
1246
1318
|
__publicField(Model, "defaultProps", {
|
|
@@ -1284,6 +1356,10 @@ function getPlatformInfo(device) {
|
|
|
1284
1356
|
features: device.features
|
|
1285
1357
|
};
|
|
1286
1358
|
}
|
|
1359
|
+
function getAttributeNames(bufferLayout) {
|
|
1360
|
+
var _a;
|
|
1361
|
+
return bufferLayout.attributes ? (_a = bufferLayout.attributes) == null ? void 0 : _a.map((layout) => layout.attribute) : [bufferLayout.name];
|
|
1362
|
+
}
|
|
1287
1363
|
|
|
1288
1364
|
// src/transform/buffer-transform.ts
|
|
1289
1365
|
var import_core10 = require("@luma.gl/core");
|
package/dist/model/model.d.ts
CHANGED
|
@@ -174,7 +174,7 @@ export declare class Model {
|
|
|
174
174
|
* Sets attributes (buffers)
|
|
175
175
|
* @note Overrides any attributes previously set with the same name
|
|
176
176
|
*/
|
|
177
|
-
setAttributes(buffers: Record<string, Buffer
|
|
177
|
+
setAttributes(buffers: Record<string, Buffer>, _option?: 'ignore-unknown'): void;
|
|
178
178
|
/**
|
|
179
179
|
* Sets constant attributes
|
|
180
180
|
* @note Overrides any attributes previously set with the same name
|
|
@@ -191,6 +191,8 @@ export declare class Model {
|
|
|
191
191
|
_logOpen: boolean;
|
|
192
192
|
_logDrawCallStart(): void;
|
|
193
193
|
_logDrawCallEnd(): void;
|
|
194
|
+
_getAttributeDebugTable(): Record<string, Record<string, unknown>>;
|
|
195
|
+
_getBufferOrConstantValues(attribute: Buffer | TypedArray, dataType: any): string;
|
|
194
196
|
}
|
|
195
197
|
/** Create a shadertools platform info from the Device */
|
|
196
198
|
export declare function getPlatformInfo(device: Device): PlatformInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,EAAC,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EACL,MAAM,EACN,MAAM,EACN,cAAc,EACd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,YAAY,CAQ5D"}
|
package/dist/model/model.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { RenderPipeline, UniformStore } from '@luma.gl/core';
|
|
1
|
+
import { Buffer, RenderPipeline, UniformStore, getTypedArrayFromDataType } from '@luma.gl/core';
|
|
2
2
|
import { log, uid, deepEqual, splitUniformsAndBindings } from '@luma.gl/core';
|
|
3
|
-
import { getAttributeInfosFromLayouts
|
|
3
|
+
import { getAttributeInfosFromLayouts } from '@luma.gl/core';
|
|
4
4
|
import { ShaderAssembler } from '@luma.gl/shadertools';
|
|
5
5
|
import { ShaderInputs } from "../shader-inputs.js";
|
|
6
6
|
import { makeGPUGeometry } from "../geometry/gpu-geometry.js";
|
|
7
7
|
import { PipelineFactory } from "../lib/pipeline-factory.js";
|
|
8
|
+
import { getDebugTableForShaderLayout } from "../debug/debug-shader-layout.js";
|
|
8
9
|
const LOG_DRAW_PRIORITY = 2;
|
|
9
10
|
const LOG_DRAW_TIMEOUT = 10000;
|
|
10
11
|
export class Model {
|
|
@@ -103,7 +104,7 @@ export class Model {
|
|
|
103
104
|
this.setUniforms(props.uniforms);
|
|
104
105
|
}
|
|
105
106
|
if (props.moduleSettings) {
|
|
106
|
-
|
|
107
|
+
log.warn('Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()')();
|
|
107
108
|
this.updateModuleSettings(props.moduleSettings);
|
|
108
109
|
}
|
|
109
110
|
if (props.transformFeedback) {
|
|
@@ -147,7 +148,7 @@ export class Model {
|
|
|
147
148
|
}
|
|
148
149
|
_setGeometryAttributes(gpuGeometry) {
|
|
149
150
|
this.vertexCount = gpuGeometry.vertexCount;
|
|
150
|
-
this.setAttributes(gpuGeometry.attributes);
|
|
151
|
+
this.setAttributes(gpuGeometry.attributes, 'ignore-unknown');
|
|
151
152
|
this.setIndexBuffer(gpuGeometry.indices);
|
|
152
153
|
}
|
|
153
154
|
setTopology(topology) {
|
|
@@ -191,7 +192,7 @@ export class Model {
|
|
|
191
192
|
this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());
|
|
192
193
|
}
|
|
193
194
|
updateModuleSettings(props) {
|
|
194
|
-
|
|
195
|
+
log.warn('Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()')();
|
|
195
196
|
const {
|
|
196
197
|
bindings,
|
|
197
198
|
uniforms
|
|
@@ -212,18 +213,17 @@ export class Model {
|
|
|
212
213
|
setTransformFeedback(transformFeedback) {
|
|
213
214
|
this.transformFeedback = transformFeedback;
|
|
214
215
|
}
|
|
215
|
-
setAttributes(buffers) {
|
|
216
|
+
setAttributes(buffers, _option) {
|
|
216
217
|
if (buffers.indices) {
|
|
217
|
-
log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`);
|
|
218
|
+
log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();
|
|
218
219
|
}
|
|
219
220
|
for (const [bufferName, buffer] of Object.entries(buffers)) {
|
|
220
|
-
|
|
221
|
-
const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);
|
|
221
|
+
const bufferLayout = this.bufferLayout.find(layout => getAttributeNames(layout).includes(bufferName));
|
|
222
222
|
if (!bufferLayout) {
|
|
223
223
|
log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
224
224
|
continue;
|
|
225
225
|
}
|
|
226
|
-
const attributeNames =
|
|
226
|
+
const attributeNames = getAttributeNames(bufferLayout);
|
|
227
227
|
let set = false;
|
|
228
228
|
for (const attributeName of attributeNames) {
|
|
229
229
|
const attributeInfo = this._attributeInfos[attributeName];
|
|
@@ -232,7 +232,7 @@ export class Model {
|
|
|
232
232
|
set = true;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
if (!set) {
|
|
235
|
+
if (!set && _option !== 'ignore-unknown') {
|
|
236
236
|
log.warn(`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`)();
|
|
237
237
|
}
|
|
238
238
|
}
|
|
@@ -291,10 +291,47 @@ export class Model {
|
|
|
291
291
|
if (this._logOpen) {
|
|
292
292
|
const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout);
|
|
293
293
|
log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
|
|
294
|
+
const uniformTable = this.shaderInputs.getDebugTable();
|
|
295
|
+
for (const [name, value] of Object.entries(this.uniforms)) {
|
|
296
|
+
uniformTable[name] = {
|
|
297
|
+
value
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
log.table(LOG_DRAW_PRIORITY, uniformTable)();
|
|
301
|
+
const attributeTable = this._getAttributeDebugTable();
|
|
302
|
+
log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
|
|
303
|
+
log.table(LOG_DRAW_PRIORITY, attributeTable)();
|
|
294
304
|
log.groupEnd(LOG_DRAW_PRIORITY)();
|
|
295
305
|
this._logOpen = false;
|
|
296
306
|
}
|
|
297
307
|
}
|
|
308
|
+
_getAttributeDebugTable() {
|
|
309
|
+
const table = {};
|
|
310
|
+
for (const [name, attributeInfo] of Object.entries(this._attributeInfos)) {
|
|
311
|
+
table[attributeInfo.location] = {
|
|
312
|
+
name,
|
|
313
|
+
type: attributeInfo.shaderType,
|
|
314
|
+
values: this._getBufferOrConstantValues(this.vertexArray.attributes[attributeInfo.location], attributeInfo.bufferDataType)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
if (this.vertexArray.indexBuffer) {
|
|
318
|
+
const {
|
|
319
|
+
indexBuffer
|
|
320
|
+
} = this.vertexArray;
|
|
321
|
+
const values = indexBuffer.indexType === 'uint32' ? new Uint32Array(indexBuffer.debugData) : new Uint16Array(indexBuffer.debugData);
|
|
322
|
+
table.indices = {
|
|
323
|
+
name: 'indices',
|
|
324
|
+
type: indexBuffer.indexType,
|
|
325
|
+
values: values.toString()
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
return table;
|
|
329
|
+
}
|
|
330
|
+
_getBufferOrConstantValues(attribute, dataType) {
|
|
331
|
+
const TypedArrayConstructor = getTypedArrayFromDataType(dataType);
|
|
332
|
+
const typedArray = attribute instanceof Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
|
|
333
|
+
return typedArray.toString();
|
|
334
|
+
}
|
|
298
335
|
}
|
|
299
336
|
Model.defaultProps = {
|
|
300
337
|
...RenderPipeline.defaultProps,
|
|
@@ -337,4 +374,8 @@ export function getPlatformInfo(device) {
|
|
|
337
374
|
features: device.features
|
|
338
375
|
};
|
|
339
376
|
}
|
|
377
|
+
function getAttributeNames(bufferLayout) {
|
|
378
|
+
var _bufferLayout$attribu;
|
|
379
|
+
return bufferLayout.attributes ? (_bufferLayout$attribu = bufferLayout.attributes) === null || _bufferLayout$attribu === void 0 ? void 0 : _bufferLayout$attribu.map(layout => layout.attribute) : [bufferLayout.name];
|
|
380
|
+
}
|
|
340
381
|
//# sourceMappingURL=model.js.map
|
package/dist/model/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":["RenderPipeline","UniformStore","log","uid","deepEqual","splitUniformsAndBindings","getAttributeInfosFromLayouts","getDebugTableForShaderLayout","ShaderAssembler","ShaderInputs","makeGPUGeometry","PipelineFactory","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","defaultProps","Object","assign","moduleMap","fromEntries","modules","map","module","name","setShaderInputs","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","console","warn","updateModuleSettings","seal","destroy","release","predraw","updateShaderInputs","draw","renderPass","_logDrawCallStart","_logDrawCallEnd","gpuGeometry","setTopology","mergeBufferLayouts","_setPipelineNeedsUpdate","setBufferLayout","setParameters","moduleName","keys","uniformBuffer","getManagedUniformBuffer","getUniformValues","setTransformFeedback","buffers","bufferName","buffer","entries","_bufferLayout$attribu","find","layout","attributeNames","attribute","set","attributeName","attributeInfo","setBuffer","location","value","setConstant","reason","createRenderPipeline","createShader","stage","source","shaderLayout","logDrawTimeout","level","Date","now","undefined","group","collapsed","shaderLayoutTable","table","groupEnd","handle","defines","varyings","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push","type","info","shaderLanguage","shadingLanguage","shaderLanguageVersion","shadingLanguageVersion","gpu","features"],"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 {Device, Buffer, RenderPipeline, RenderPass, UniformStore} from '@luma.gl/core';\nimport {log, uid, deepEqual, splitUniformsAndBindings} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts, getDebugTableForShaderLayout} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler} 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';\n\nconst LOG_DRAW_PRIORITY = 2;\nconst LOG_DRAW_TIMEOUT = 10000;\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string shaders\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 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(this.props.modules?.map(module => [module.name, module]) || []);\n this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));\n\n // Setup shader assembler\n const platformInfo = getPlatformInfo(device);\n const modules = (this.props.modules?.length > 0 ? this.props.modules : this.shaderInputs?.getModules()) || [];\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders({platformInfo, ...this.props, modules});\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 // eslint-disable-next-line no-console\n console.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 }\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 // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setAttributes(gpuGeometry.attributes);\n this.setIndexBuffer(gpuGeometry.indices);\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(\n this.device,\n moduleName\n );\n this.bindings[`${moduleName}Uniforms`] = uniformBuffer;\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 // eslint-disable-next-line no-console\n console.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>): 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 => layout.name === 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 = bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\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) {\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 this._pipelineNeedsUpdate = false;\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),\n 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._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 (Date.now() - this._lastLogTime < logDrawTimeout) {\n return undefined;\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);\n\n // log.table(logLevel, attributeTable)();\n // log.table(logLevel, uniformTable)();\n log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();\n\n log.groupEnd(LOG_DRAW_PRIORITY)();\n this._logOpen = false;\n }\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"],"mappings":"AAMA,SAAwBA,cAAc,EAAcC,YAAY,QAAO,eAAe;AACtF,SAAQC,GAAG,EAAEC,GAAG,EAAEC,SAAS,EAAEC,wBAAwB,QAAO,eAAe;AAC3E,SAAQC,4BAA4B,EAAEC,4BAA4B,QAAO,eAAe;AAExF,SAAQC,eAAe,QAAO,sBAAsB;AAAC,SAC7CC,YAAY;AAAA,SAECC,eAAe;AAAA,SAC5BC,eAAe;AAEvB,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,KAAK;AAqD9B,OAAO,MAAMC,KAAK,CAAC;EAkFjBC,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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,MAAMC,OAAO,GAAG,CAAC,GAAGF,QAAQ,CAAC;EAC7B,KAAK,MAAM5B,SAAS,IAAI6B,QAAQ,EAAE;IAChC,MAAME,KAAK,GAAGD,OAAO,CAACE,SAAS,CAACC,UAAU,IAAIA,UAAU,CAAC5F,IAAI,KAAK2D,SAAS,CAAC3D,IAAI,CAAC;IACjF,IAAI0F,KAAK,GAAG,CAAC,EAAE;MACbD,OAAO,CAACI,IAAI,CAAClC,SAAS,CAAC;IACzB,CAAC,MAAM;MACL8B,OAAO,CAACC,KAAK,CAAC,GAAG/B,SAAS;IAC5B;EACF;EACA,OAAO8B,OAAO;AAChB;AAGA,OAAO,SAAStF,eAAeA,CAAC1C,MAAc,EAAgB;EAC5D,OAAO;IACLqI,IAAI,EAAErI,MAAM,CAACsI,IAAI,CAACD,IAAI;IACtBE,cAAc,EAAEvI,MAAM,CAACsI,IAAI,CAACE,eAAe;IAC3CC,qBAAqB,EAAEzI,MAAM,CAACsI,IAAI,CAACI,sBAAmC;IACtEC,GAAG,EAAE3I,MAAM,CAACsI,IAAI,CAACK,GAAG;IACpBC,QAAQ,EAAE5I,MAAM,CAAC4I;EACnB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"model.js","names":["Buffer","RenderPipeline","UniformStore","getTypedArrayFromDataType","log","uid","deepEqual","splitUniformsAndBindings","getAttributeInfosFromLayouts","ShaderAssembler","ShaderInputs","makeGPUGeometry","PipelineFactory","getDebugTableForShaderLayout","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","defaultProps","Object","assign","moduleMap","fromEntries","modules","map","module","name","setShaderInputs","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","gpuGeometry","setTopology","mergeBufferLayouts","_setPipelineNeedsUpdate","setBufferLayout","setParameters","moduleName","keys","uniformBuffer","getManagedUniformBuffer","getUniformValues","setTransformFeedback","buffers","_option","bufferName","buffer","entries","find","layout","getAttributeNames","includes","attributeNames","set","attributeName","attributeInfo","setBuffer","location","value","setConstant","reason","createRenderPipeline","createShader","stage","source","shaderLayout","logDrawTimeout","level","Date","now","undefined","group","collapsed","shaderLayoutTable","table","uniformTable","getDebugTable","attributeTable","_getAttributeDebugTable","groupEnd","type","shaderType","values","_getBufferOrConstantValues","bufferDataType","indexType","Uint32Array","debugData","Uint16Array","toString","attribute","dataType","TypedArrayConstructor","typedArray","handle","defines","varyings","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push","info","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 {\n TypedArray,\n RenderPipelineProps,\n RenderPipelineParameters\n} 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} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler} 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';\n\nconst LOG_DRAW_PRIORITY = 2;\nconst LOG_DRAW_TIMEOUT = 10000;\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string shaders\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 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 // 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 }\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 // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setAttributes(gpuGeometry.attributes, 'ignore-unknown');\n this.setIndexBuffer(gpuGeometry.indices);\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 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 this._pipelineNeedsUpdate = false;\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),\n 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._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 (Date.now() - this._lastLogTime < logDrawTimeout) {\n return undefined;\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);\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 _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":"AAUA,SAEEA,MAAM,EACNC,cAAc,EAEdC,YAAY,EACZC,yBAAyB,QACpB,eAAe;AACtB,SAAQC,GAAG,EAAEC,GAAG,EAAEC,SAAS,EAAEC,wBAAwB,QAAO,eAAe;AAC3E,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,QAAO,sBAAsB;AAAC,SAC7CC,YAAY;AAAA,SAECC,eAAe;AAAA,SAC5BC,eAAe;AAAA,SACfC,4BAA4B;AAEpC,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,KAAK;AAqD9B,OAAO,MAAMC,KAAK,CAAC;EAkFjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,kBAAA;IAAA,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QAAQ,EAAE7J,MAAM,CAAC6J;EACnB,CAAC;AACH;AAGA,SAAS7D,iBAAiBA,CAACpF,YAA0B,EAAY;EAAA,IAAAkJ,qBAAA;EAC/D,OAAOlJ,YAAY,CAACgD,UAAU,IAAAkG,qBAAA,GAC5BlJ,YAAY,CAACgD,UAAU,cAAAkG,qBAAA,uBAAvBA,qBAAA,CAAyBzH,GAAG,CAAC0D,MAAM,IAAIA,MAAM,CAACyC,SAAS,CAAC,GACxD,CAAC5H,YAAY,CAAC2B,IAAI,CAAC;AACvB"}
|
package/dist/shader-inputs.d.ts
CHANGED
|
@@ -58,5 +58,6 @@ export declare class ShaderInputs<ShaderPropsT extends Partial<Record<string, Re
|
|
|
58
58
|
getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>>;
|
|
59
59
|
/** Merges all bindings for the shader (from the various modules) */
|
|
60
60
|
getBindings(): Record<string, Texture | Sampler>;
|
|
61
|
+
getDebugTable(): Record<string, Record<string, unknown>>;
|
|
61
62
|
}
|
|
62
63
|
//# sourceMappingURL=shader-inputs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-inputs.d.ts","sourceRoot":"","sources":["../src/shader-inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAkB,oBAAoB,EAAC,MAAM,sBAAsB,CAAA;AAG1E,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,CAC5B,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC7E,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM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Y,CAAC,CAAC,CAAC,CAAC;KAAC,CAAC,GAAG,IAAI;IAyBtF,oEAAoE;IAKpE;;;OAGG;IACH,UAAU,IAAI,oBAAoB,EAAE;IAIpC,6CAA6C;IAC7C,gBAAgB,IAAI,MAAM,CAAC,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAI5E,oEAAoE;IACpE,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;IAQhD,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAYzD"}
|
package/dist/shader-inputs.js
CHANGED
|
@@ -49,5 +49,18 @@ export class ShaderInputs {
|
|
|
49
49
|
}
|
|
50
50
|
return bindings;
|
|
51
51
|
}
|
|
52
|
+
getDebugTable() {
|
|
53
|
+
const table = {};
|
|
54
|
+
for (const [moduleName, module] of Object.entries(this.moduleUniforms)) {
|
|
55
|
+
for (const [key, value] of Object.entries(module)) {
|
|
56
|
+
var _this$modules$moduleN;
|
|
57
|
+
table[`${moduleName}.${key}`] = {
|
|
58
|
+
type: (_this$modules$moduleN = this.modules[moduleName].uniformTypes) === null || _this$modules$moduleN === void 0 ? void 0 : _this$modules$moduleN[key],
|
|
59
|
+
value: String(value)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return table;
|
|
64
|
+
}
|
|
52
65
|
}
|
|
53
66
|
//# sourceMappingURL=shader-inputs.js.map
|