@luma.gl/engine 9.0.0-alpha.52 → 9.0.0-alpha.53

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.
@@ -0,0 +1,9 @@
1
+ import type { ShaderLayout } from '@luma.gl/core';
2
+ /**
3
+ * Extracts a table suitable for `console.table()` from a shader layout to assist in debugging.
4
+ * @param layout shader layout
5
+ * @param name app should provide the most meaningful name, usually the model or pipeline name / id.
6
+ * @returns
7
+ */
8
+ export declare function getDebugTableForShaderLayout(layout: ShaderLayout, name?: string): Record<string, Record<string, string>>;
9
+ //# sourceMappingURL=debug-shader-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-shader-layout.d.ts","sourceRoot":"","sources":["../../src/debug/debug-shader-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,IAAI,GAAE,MAAW,GAChB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkBxC"}
@@ -0,0 +1,21 @@
1
+ export function getDebugTableForShaderLayout(layout) {
2
+ let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3
+ const table = {};
4
+ const header = `Shader Layout for ${name}`;
5
+ for (const attributeDeclaration of layout.attributes) {
6
+ if (attributeDeclaration) {
7
+ const glslDeclaration = `${attributeDeclaration.location} ${attributeDeclaration.name}: ${attributeDeclaration.type}`;
8
+ table[`in ${glslDeclaration}`] = {
9
+ [header]: attributeDeclaration.stepMode || 'vertex'
10
+ };
11
+ }
12
+ }
13
+ for (const varyingDeclaration of layout.varyings || []) {
14
+ const glslDeclaration = `${varyingDeclaration.location} ${varyingDeclaration.name}`;
15
+ table[`out ${glslDeclaration}`] = {
16
+ [header]: JSON.stringify(varyingDeclaration.accessor)
17
+ };
18
+ }
19
+ return table;
20
+ }
21
+ //# sourceMappingURL=debug-shader-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-shader-layout.js","names":["getDebugTableForShaderLayout","layout","name","arguments","length","undefined","table","header","attributeDeclaration","attributes","glslDeclaration","location","type","stepMode","varyingDeclaration","varyings","JSON","stringify","accessor"],"sources":["../../src/debug/debug-shader-layout.ts"],"sourcesContent":["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderLayout} from '@luma.gl/core';\n\n/**\n * Extracts a table suitable for `console.table()` from a shader layout to assist in debugging.\n * @param layout shader layout\n * @param name app should provide the most meaningful name, usually the model or pipeline name / id.\n * @returns \n */\nexport function getDebugTableForShaderLayout(\n layout: ShaderLayout,\n name: string = ''\n): Record<string, Record<string, string>> {\n const table: Record<string, Record<string, string>> = {};\n\n const header = `Shader Layout for ${name}`;\n\n for (const attributeDeclaration of layout.attributes) {\n if (attributeDeclaration) {\n const glslDeclaration = `${attributeDeclaration.location} ${attributeDeclaration.name}: ${attributeDeclaration.type}`;\n table[`in ${glslDeclaration}`] = {[header]: attributeDeclaration.stepMode || 'vertex'};\n }\n }\n\n for (const varyingDeclaration of layout.varyings || []) {\n const glslDeclaration = `${varyingDeclaration.location} ${varyingDeclaration.name}`;\n table[`out ${glslDeclaration}`] = {[header]: JSON.stringify(varyingDeclaration.accessor)};\n }\n\n return table;\n}\n"],"mappings":"AAYA,OAAO,SAASA,4BAA4BA,CAC1CC,MAAoB,EAEoB;EAAA,IADxCC,IAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAEjB,MAAMG,KAA6C,GAAG,CAAC,CAAC;EAExD,MAAMC,MAAM,GAAI,qBAAoBL,IAAK,EAAC;EAE1C,KAAK,MAAMM,oBAAoB,IAAIP,MAAM,CAACQ,UAAU,EAAE;IACpD,IAAID,oBAAoB,EAAE;MACxB,MAAME,eAAe,GAAI,GAAEF,oBAAoB,CAACG,QAAS,IAAGH,oBAAoB,CAACN,IAAK,KAAIM,oBAAoB,CAACI,IAAK,EAAC;MACrHN,KAAK,CAAE,MAAKI,eAAgB,EAAC,CAAC,GAAG;QAAC,CAACH,MAAM,GAAGC,oBAAoB,CAACK,QAAQ,IAAI;MAAQ,CAAC;IACxF;EACF;EAEA,KAAK,MAAMC,kBAAkB,IAAIb,MAAM,CAACc,QAAQ,IAAI,EAAE,EAAE;IACtD,MAAML,eAAe,GAAI,GAAEI,kBAAkB,CAACH,QAAS,IAAGG,kBAAkB,CAACZ,IAAK,EAAC;IACnFI,KAAK,CAAE,OAAMI,eAAgB,EAAC,CAAC,GAAG;MAAC,CAACH,MAAM,GAAGS,IAAI,CAACC,SAAS,CAACH,kBAAkB,CAACI,QAAQ;IAAC,CAAC;EAC3F;EAEA,OAAOZ,KAAK;AACd"}
package/dist/dist.dev.js CHANGED
@@ -764,7 +764,7 @@ var __exports__ = (() => {
764
764
  id: "@probe.gl/log"
765
765
  });
766
766
 
767
- // ../core/src/lib/utils/log.ts
767
+ // ../core/src/utils/log.ts
768
768
  var log = new Log({
769
769
  id: "luma.gl"
770
770
  });
@@ -960,7 +960,7 @@ var __exports__ = (() => {
960
960
  }
961
961
  };
962
962
 
963
- // ../core/src/lib/utils/stats-manager.ts
963
+ // ../core/src/utils/stats-manager.ts
964
964
  var StatsManager = class {
965
965
  stats = /* @__PURE__ */ new Map();
966
966
  getStats(name2) {
@@ -979,14 +979,14 @@ var __exports__ = (() => {
979
979
 
980
980
  // ../core/src/init.ts
981
981
  function initializeLuma() {
982
- const VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
982
+ const VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "running from source";
983
983
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
984
984
  if (globalThis.luma && globalThis.luma.VERSION !== VERSION3) {
985
985
  throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION3}`);
986
986
  }
987
987
  if (!globalThis.luma) {
988
988
  if (isBrowser()) {
989
- log.log(1, `luma.gl ${VERSION3} - ${STARTUP_MESSAGE}`)();
989
+ log.log(1, `${VERSION3} - ${STARTUP_MESSAGE}`)();
990
990
  }
991
991
  globalThis.luma = globalThis.luma || {
992
992
  VERSION: VERSION3,
@@ -999,7 +999,7 @@ var __exports__ = (() => {
999
999
  }
1000
1000
  var VERSION2 = initializeLuma();
1001
1001
 
1002
- // ../core/src/lib/utils/is-array.ts
1002
+ // ../core/src/utils/is-array.ts
1003
1003
  function isTypedArray(value) {
1004
1004
  return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
1005
1005
  }
@@ -1010,7 +1010,7 @@ var __exports__ = (() => {
1010
1010
  return isTypedArray(value);
1011
1011
  }
1012
1012
 
1013
- // ../core/src/lib/utils/utils.ts
1013
+ // ../core/src/utils/utils.ts
1014
1014
  var uidCounters = {};
1015
1015
  function uid(id = "id") {
1016
1016
  uidCounters[id] = uidCounters[id] || 1;
@@ -1237,6 +1237,13 @@ var __exports__ = (() => {
1237
1237
  });
1238
1238
  __publicField(Device, "VERSION", VERSION2);
1239
1239
 
1240
+ // ../core/src/utils/assert.ts
1241
+ function assert2(condition, message) {
1242
+ if (!condition) {
1243
+ throw new Error(message || "luma.gl: assertion failed.");
1244
+ }
1245
+ }
1246
+
1240
1247
  // ../core/src/lib/luma.ts
1241
1248
  var deviceList = /* @__PURE__ */ new Map();
1242
1249
  var luma = class {
@@ -1280,6 +1287,10 @@ var __exports__ = (() => {
1280
1287
  }
1281
1288
  break;
1282
1289
  case "best-available":
1290
+ DeviceClass = deviceList.get("webgpu");
1291
+ if (DeviceClass && DeviceClass.isSupported()) {
1292
+ return await DeviceClass.create(props);
1293
+ }
1283
1294
  DeviceClass = deviceList.get("webgl");
1284
1295
  if (DeviceClass && DeviceClass.isSupported()) {
1285
1296
  return await DeviceClass.create(props);
@@ -1553,13 +1564,6 @@ var __exports__ = (() => {
1553
1564
  return null;
1554
1565
  }
1555
1566
 
1556
- // ../core/src/lib/utils/assert.ts
1557
- function assert2(condition, message) {
1558
- if (!condition) {
1559
- throw new Error(message || "luma.gl: assertion failed.");
1560
- }
1561
- }
1562
-
1563
1567
  // ../core/src/adapter/type-utils/decode-shader-types.ts
1564
1568
  var UNIFORM_FORMATS = {
1565
1569
  "f32": {
@@ -1663,7 +1667,7 @@ var __exports__ = (() => {
1663
1667
  }
1664
1668
  }
1665
1669
 
1666
- // ../core/src/lib/utils/array-utils-flat.ts
1670
+ // ../core/src/utils/array-utils-flat.ts
1667
1671
  var arrayBuffer;
1668
1672
  function getScratchArrayBuffer(byteLength) {
1669
1673
  if (!arrayBuffer || arrayBuffer.byteLength < byteLength) {
@@ -1744,7 +1748,7 @@ var __exports__ = (() => {
1744
1748
  }
1745
1749
  };
1746
1750
 
1747
- // ../core/src/lib/utils/array-equal.ts
1751
+ // ../core/src/utils/array-equal.ts
1748
1752
  function arrayEqual(a, b, limit = 16) {
1749
1753
  if (a !== b) {
1750
1754
  return false;
@@ -1976,7 +1980,7 @@ var __exports__ = (() => {
1976
1980
  return result;
1977
1981
  }
1978
1982
 
1979
- // ../core/src/lib/utils/deep-equal.ts
1983
+ // ../core/src/utils/deep-equal.ts
1980
1984
  function deepEqual(a, b, depth) {
1981
1985
  if (a === b) {
1982
1986
  return true;
@@ -2017,7 +2021,7 @@ var __exports__ = (() => {
2017
2021
  return false;
2018
2022
  }
2019
2023
 
2020
- // ../core/src/lib/utils/request-animation-frame.ts
2024
+ // ../core/src/utils/request-animation-frame.ts
2021
2025
  function requestAnimationFrame(callback) {
2022
2026
  return typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame(callback) : setTimeout(callback, 1e3 / 60);
2023
2027
  }
@@ -2025,27 +2029,6 @@ var __exports__ = (() => {
2025
2029
  return typeof window !== "undefined" && window.cancelAnimationFrame ? window.cancelAnimationFrame(timerId) : clearTimeout(timerId);
2026
2030
  }
2027
2031
 
2028
- // ../core/src/lib/debug/debug-shader-layout.ts
2029
- function getDebugTableForShaderLayout(layout, name2 = "") {
2030
- const table = {};
2031
- const header = `Shader Layout for ${name2}`;
2032
- for (const attributeDeclaration of layout.attributes) {
2033
- if (attributeDeclaration) {
2034
- const glslDeclaration = `${attributeDeclaration.location} ${attributeDeclaration.name}: ${attributeDeclaration.type}`;
2035
- table[`in ${glslDeclaration}`] = {
2036
- [header]: attributeDeclaration.stepMode || "vertex"
2037
- };
2038
- }
2039
- }
2040
- for (const varyingDeclaration of layout.varyings || []) {
2041
- const glslDeclaration = `${varyingDeclaration.location} ${varyingDeclaration.name}`;
2042
- table[`out ${glslDeclaration}`] = {
2043
- [header]: JSON.stringify(varyingDeclaration.accessor)
2044
- };
2045
- }
2046
- return table;
2047
- }
2048
-
2049
2032
  // ../core/src/index.ts
2050
2033
  var glsl = (x) => `${x}`;
2051
2034
 
@@ -5407,6 +5390,18 @@ void main() {
5407
5390
  }
5408
5391
  return bindings;
5409
5392
  }
5393
+ getDebugTable() {
5394
+ const table = {};
5395
+ for (const [moduleName, module] of Object.entries(this.moduleUniforms)) {
5396
+ for (const [key, value] of Object.entries(module)) {
5397
+ table[`${moduleName}.${key}`] = {
5398
+ type: this.modules[moduleName].uniformTypes?.[key],
5399
+ value: String(value)
5400
+ };
5401
+ }
5402
+ }
5403
+ return table;
5404
+ }
5410
5405
  };
5411
5406
 
5412
5407
  // src/geometry/gpu-geometry.ts
@@ -5487,6 +5482,9 @@ void main() {
5487
5482
  case "TEXCOORD_0":
5488
5483
  name2 = "texCoords";
5489
5484
  break;
5485
+ case "COLOR_0":
5486
+ name2 = "colors";
5487
+ break;
5490
5488
  }
5491
5489
  attributes[name2] = device.createBuffer({
5492
5490
  data: attribute.value,
@@ -5603,6 +5601,27 @@ void main() {
5603
5601
  fs: void 0
5604
5602
  });
5605
5603
 
5604
+ // src/debug/debug-shader-layout.ts
5605
+ function getDebugTableForShaderLayout(layout, name2 = "") {
5606
+ const table = {};
5607
+ const header = `Shader Layout for ${name2}`;
5608
+ for (const attributeDeclaration of layout.attributes) {
5609
+ if (attributeDeclaration) {
5610
+ const glslDeclaration = `${attributeDeclaration.location} ${attributeDeclaration.name}: ${attributeDeclaration.type}`;
5611
+ table[`in ${glslDeclaration}`] = {
5612
+ [header]: attributeDeclaration.stepMode || "vertex"
5613
+ };
5614
+ }
5615
+ }
5616
+ for (const varyingDeclaration of layout.varyings || []) {
5617
+ const glslDeclaration = `${varyingDeclaration.location} ${varyingDeclaration.name}`;
5618
+ table[`out ${glslDeclaration}`] = {
5619
+ [header]: JSON.stringify(varyingDeclaration.accessor)
5620
+ };
5621
+ }
5622
+ return table;
5623
+ }
5624
+
5606
5625
  // src/model/model.ts
5607
5626
  var LOG_DRAW_PRIORITY = 2;
5608
5627
  var LOG_DRAW_TIMEOUT = 1e4;
@@ -5684,7 +5703,7 @@ void main() {
5684
5703
  this.setUniforms(props.uniforms);
5685
5704
  }
5686
5705
  if (props.moduleSettings) {
5687
- console.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()");
5706
+ log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")();
5688
5707
  this.updateModuleSettings(props.moduleSettings);
5689
5708
  }
5690
5709
  if (props.transformFeedback) {
@@ -5728,7 +5747,7 @@ void main() {
5728
5747
  }
5729
5748
  _setGeometryAttributes(gpuGeometry) {
5730
5749
  this.vertexCount = gpuGeometry.vertexCount;
5731
- this.setAttributes(gpuGeometry.attributes);
5750
+ this.setAttributes(gpuGeometry.attributes, "ignore-unknown");
5732
5751
  this.setIndexBuffer(gpuGeometry.indices);
5733
5752
  }
5734
5753
  setTopology(topology) {
@@ -5772,7 +5791,7 @@ void main() {
5772
5791
  this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());
5773
5792
  }
5774
5793
  updateModuleSettings(props) {
5775
- console.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()");
5794
+ log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();
5776
5795
  const {
5777
5796
  bindings,
5778
5797
  uniforms
@@ -5793,9 +5812,9 @@ void main() {
5793
5812
  setTransformFeedback(transformFeedback) {
5794
5813
  this.transformFeedback = transformFeedback;
5795
5814
  }
5796
- setAttributes(buffers) {
5815
+ setAttributes(buffers, _option) {
5797
5816
  if (buffers.indices) {
5798
- log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`);
5817
+ log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();
5799
5818
  }
5800
5819
  for (const [bufferName, buffer] of Object.entries(buffers)) {
5801
5820
  const bufferLayout = this.bufferLayout.find((layout) => layout.name === bufferName);
@@ -5812,7 +5831,7 @@ void main() {
5812
5831
  set = true;
5813
5832
  }
5814
5833
  }
5815
- if (!set) {
5834
+ if (!set && _option !== "ignore-unknown") {
5816
5835
  log.warn(`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`)();
5817
5836
  }
5818
5837
  }
@@ -5873,6 +5892,13 @@ void main() {
5873
5892
  if (this._logOpen) {
5874
5893
  const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout);
5875
5894
  log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
5895
+ const uniformTable = this.shaderInputs.getDebugTable();
5896
+ for (const [name2, value] of Object.entries(this.uniforms)) {
5897
+ uniformTable[name2] = {
5898
+ value
5899
+ };
5900
+ }
5901
+ log.table(LOG_DRAW_PRIORITY, uniformTable)();
5876
5902
  log.groupEnd(LOG_DRAW_PRIORITY)();
5877
5903
  this._logOpen = false;
5878
5904
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/gpu-geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC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AE,YAAY,EAAE,CAAM;IAE3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEhC,KAAK,EAAE,gBAAgB;IAenC,OAAO,IAAI,IAAI;IAQf,cAAc,IAAI,MAAM;IAIxB,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIvC,UAAU,IAAI,MAAM,GAAG,IAAI;IAI3B,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAKjD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAc7F;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAMjG;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,GACjB;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,YAAY,EAAE,YAAY,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,CAqBzF"}
@@ -82,6 +82,9 @@ export function getAttributeBuffersFromGeometry(device, geometry) {
82
82
  case 'TEXCOORD_0':
83
83
  name = 'texCoords';
84
84
  break;
85
+ case 'COLOR_0':
86
+ name = 'colors';
87
+ break;
85
88
  }
86
89
  attributes[name] = device.createBuffer({
87
90
  data: attribute.value,
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-geometry.js","names":["Buffer","uid","assert","getVertexFormatFromAttribute","GPUGeometry","constructor","props","id","userData","topology","bufferLayout","vertexCount","indices","attributes","usage","INDEX","destroy","_this$attributes$colo","positions","normals","texCoords","colors","getVertexCount","getAttributes","getIndexes","_calculateVertexCount","byteLength","makeGPUGeometry","device","geometry","getIndexBufferFromGeometry","getAttributeBuffersFromGeometry","undefined","data","value","createBuffer","attributeName","attribute","Object","entries","name","size","normalized","push","format"],"sources":["../../src/geometry/gpu-geometry.ts"],"sourcesContent":["import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';\nimport {Device, Buffer, uid, assert, getVertexFormatFromAttribute} from '@luma.gl/core';\nimport type {Geometry} from '../geometry/geometry';\n\nexport type GPUGeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount: number;\n bufferLayout: BufferLayout[];\n indices?: Buffer | null;\n attributes: Record<string, Buffer>;\n};\n\nexport class GPUGeometry {\n readonly id: string;\n userData: Record<string, unknown> = {};\n\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly bufferLayout: BufferLayout[] = [];\n\n readonly vertexCount: number;\n readonly indices?: Buffer | null;\n readonly attributes: Record<string, Buffer>;\n\n constructor(props: GPUGeometryProps) {\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n this.indices = props.indices || null;\n this.attributes = props.attributes;\n\n this.vertexCount = props.vertexCount;\n\n this.bufferLayout = props.bufferLayout || [];\n\n if (this.indices) {\n assert(this.indices.usage === Buffer.INDEX);\n }\n }\n\n destroy(): void {\n this.indices.destroy();\n this.attributes.positions.destroy();\n this.attributes.normals.destroy();\n this.attributes.texCoords.destroy();\n this.attributes.colors?.destroy();\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n getAttributes(): Record<string, Buffer> {\n return this.attributes;\n }\n\n getIndexes(): Buffer | null {\n return this.indices;\n }\n\n _calculateVertexCount(positions: Buffer): number {\n // Assume that positions is a fully packed float32x3 buffer\n const vertexCount = positions.byteLength / 12;\n return vertexCount;\n }\n}\n\nexport function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry {\n if (geometry instanceof GPUGeometry) {\n return geometry;\n }\n\n const indices = getIndexBufferFromGeometry(device, geometry);\n const {attributes, bufferLayout} = getAttributeBuffersFromGeometry(device, geometry);\n return new GPUGeometry({\n topology: geometry.topology || 'triangle-list',\n bufferLayout,\n vertexCount: geometry.vertexCount,\n indices,\n attributes\n });\n}\n\nexport function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {\n if (!geometry.indices) {\n return undefined;\n }\n const data = geometry.indices.value;\n return device.createBuffer({usage: Buffer.INDEX, data});\n}\n\nexport function getAttributeBuffersFromGeometry(\n device: Device,\n geometry: Geometry\n): {attributes: Record<string, Buffer>, bufferLayout: BufferLayout[], vertexCount: number} {\n const bufferLayout: BufferLayout[] = [];\n\n const attributes: Record<string, Buffer> = {};\n for (const [attributeName, attribute] of Object.entries(geometry.attributes)) {\n let name: string = attributeName;\n // TODO Map some GLTF attribute names (is this still needed?)\n switch (attributeName) {\n case 'POSITION': name = 'positions'; break;\n case 'NORMAL': name = 'normals'; break;\n case 'TEXCOORD_0': name = 'texCoords'; break;\n }\n attributes[name] = device.createBuffer({data: attribute.value, id: `${attributeName}-buffer`});\n const {value, size, normalized} = attribute;\n bufferLayout.push({name, format: getVertexFormatFromAttribute(value, size, normalized)});\n }\n\n const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices)\n\n return {attributes, bufferLayout, vertexCount};\n}\n"],"mappings":"AACA,SAAgBA,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,4BAA4B,QAAO,eAAe;AAqBvF,OAAO,MAAMC,WAAW,CAAC;EAYvBC,WAAWA,CAACC,KAAuB,EAAE;IAAA,KAX5BC,EAAE;IAAA,KACXC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAG7BC,QAAQ;IAAA,KACRC,YAAY,GAAmB,EAAE;IAAA,KAEjCC,WAAW;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AAW;QAAE;IACzC;IACA3B,UAAU,CAAC2B,IAAI,CAAC,GAAGZ,MAAM,CAACO,YAAY,CAAC;MAACF,IAAI,EAAEI,SAAS,CAACH,KAAK;MAAE3B,EAAE,EAAG,GAAE6B,aAAc;IAAQ,CAAC,CAAC;IAC9F,MAAM;MAACF,KAAK;MAAEO,IAAI;MAAEC;IAAU,CAAC,GAAGL,SAAS;IAC3C3B,YAAY,CAACiC,IAAI,CAAC;MAACH,IAAI;MAAEI,MAAM,EAAEzC,4BAA4B,CAAC+B,KAAK,EAAEO,IAAI,EAAEC,UAAU;IAAC,CAAC,CAAC;EAC1F;EAEA,MAAM/B,WAAW,GAAGkB,QAAQ,CAACJ,qBAAqB,CAACI,QAAQ,CAAChB,UAAU,EAAEgB,QAAQ,CAACjB,OAAO,CAAC;EAEzF,OAAO;IAACC,UAAU;IAAEH,YAAY;IAAEC;EAAW,CAAC;AAChD"}
1
+ {"version":3,"file":"gpu-geometry.js","names":["Buffer","uid","assert","getVertexFormatFromAttribute","GPUGeometry","constructor","props","id","userData","topology","bufferLayout","vertexCount","indices","attributes","usage","INDEX","destroy","_this$attributes$colo","positions","normals","texCoords","colors","getVertexCount","getAttributes","getIndexes","_calculateVertexCount","byteLength","makeGPUGeometry","device","geometry","getIndexBufferFromGeometry","getAttributeBuffersFromGeometry","undefined","data","value","createBuffer","attributeName","attribute","Object","entries","name","size","normalized","push","format"],"sources":["../../src/geometry/gpu-geometry.ts"],"sourcesContent":["import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';\nimport {Device, Buffer, uid, assert, getVertexFormatFromAttribute} from '@luma.gl/core';\nimport type {Geometry} from '../geometry/geometry';\n\nexport type GPUGeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount: number;\n bufferLayout: BufferLayout[];\n indices?: Buffer | null;\n attributes: Record<string, Buffer>;\n};\n\nexport class GPUGeometry {\n readonly id: string;\n userData: Record<string, unknown> = {};\n\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly bufferLayout: BufferLayout[] = [];\n\n readonly vertexCount: number;\n readonly indices?: Buffer | null;\n readonly attributes: Record<string, Buffer>;\n\n constructor(props: GPUGeometryProps) {\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n this.indices = props.indices || null;\n this.attributes = props.attributes;\n\n this.vertexCount = props.vertexCount;\n\n this.bufferLayout = props.bufferLayout || [];\n\n if (this.indices) {\n assert(this.indices.usage === Buffer.INDEX);\n }\n }\n\n destroy(): void {\n this.indices.destroy();\n this.attributes.positions.destroy();\n this.attributes.normals.destroy();\n this.attributes.texCoords.destroy();\n this.attributes.colors?.destroy();\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n getAttributes(): Record<string, Buffer> {\n return this.attributes;\n }\n\n getIndexes(): Buffer | null {\n return this.indices;\n }\n\n _calculateVertexCount(positions: Buffer): number {\n // Assume that positions is a fully packed float32x3 buffer\n const vertexCount = positions.byteLength / 12;\n return vertexCount;\n }\n}\n\nexport function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry {\n if (geometry instanceof GPUGeometry) {\n return geometry;\n }\n\n const indices = getIndexBufferFromGeometry(device, geometry);\n const {attributes, bufferLayout} = getAttributeBuffersFromGeometry(device, geometry);\n return new GPUGeometry({\n topology: geometry.topology || 'triangle-list',\n bufferLayout,\n vertexCount: geometry.vertexCount,\n indices,\n attributes\n });\n}\n\nexport function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {\n if (!geometry.indices) {\n return undefined;\n }\n const data = geometry.indices.value;\n return device.createBuffer({usage: Buffer.INDEX, data});\n}\n\nexport function getAttributeBuffersFromGeometry(\n device: Device,\n geometry: Geometry\n): {attributes: Record<string, Buffer>, bufferLayout: BufferLayout[], vertexCount: number} {\n const bufferLayout: BufferLayout[] = [];\n\n const attributes: Record<string, Buffer> = {};\n for (const [attributeName, attribute] of Object.entries(geometry.attributes)) {\n let name: string = attributeName;\n // TODO Map some GLTF attribute names (is this still needed?)\n switch (attributeName) {\n case 'POSITION': name = 'positions'; break;\n case 'NORMAL': name = 'normals'; break;\n case 'TEXCOORD_0': name = 'texCoords'; break;\n case 'COLOR_0': name = 'colors'; break;\n }\n attributes[name] = device.createBuffer({data: attribute.value, id: `${attributeName}-buffer`});\n const {value, size, normalized} = attribute;\n bufferLayout.push({name, format: getVertexFormatFromAttribute(value, size, normalized)});\n }\n\n const vertexCount = geometry._calculateVertexCount(geometry.attributes, geometry.indices)\n\n return {attributes, bufferLayout, vertexCount};\n}\n"],"mappings":"AACA,SAAgBA,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,4BAA4B,QAAO,eAAe;AAqBvF,OAAO,MAAMC,WAAW,CAAC;EAYvBC,WAAWA,CAACC,KAAuB,EAAE;IAAA,KAX5BC,EAAE;IAAA,KACXC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAG7BC,QAAQ;IAAA,KACRC,YAAY,GAAmB,EAAE;IAAA,KAEjCC,WAAW;IAAA,KACXC,OAAO;IAAA,KACPC,UAAU;IAGjB,IAAI,CAACN,EAAE,GAAGD,KAAK,CAACC,EAAE,IAAIN,GAAG,CAAC,UAAU,CAAC;IACrC,IAAI,CAACQ,QAAQ,GAAGH,KAAK,CAACG,QAAQ;IAC9B,IAAI,CAACG,OAAO,GAAGN,KAAK,CAACM,OAAO,IAAI,IAAI;IACpC,IAAI,CAACC,UAAU,GAAGP,KAAK,CAACO,UAAU;IAElC,IAAI,CAACF,WAAW,GAAGL,KAAK,CAACK,WAAW;IAEpC,IAAI,CAACD,YAAY,GAAGJ,KAAK,CAACI,YAAY,IAAI,EAAE;IAE5C,IAAI,IAAI,CAACE,OAAO,EAAE;MAChBV,MAAM,CAAC,IAAI,CAACU,OAA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QAAQ,CAACJ,qBAAqB,CAACI,QAAQ,CAAChB,UAAU,EAAEgB,QAAQ,CAACjB,OAAO,CAAC;EAEzF,OAAO;IAACC,UAAU;IAAEH,YAAY;IAAEC;EAAW,CAAC;AAChD"}
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;
@@ -975,7 +1008,7 @@ var _Model = class {
975
1008
  this.setUniforms(props.uniforms);
976
1009
  }
977
1010
  if (props.moduleSettings) {
978
- console.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()");
1011
+ import_core8.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")();
979
1012
  this.updateModuleSettings(props.moduleSettings);
980
1013
  }
981
1014
  if (props.transformFeedback) {
@@ -1031,7 +1064,7 @@ var _Model = class {
1031
1064
  */
1032
1065
  _setGeometryAttributes(gpuGeometry) {
1033
1066
  this.vertexCount = gpuGeometry.vertexCount;
1034
- this.setAttributes(gpuGeometry.attributes);
1067
+ this.setAttributes(gpuGeometry.attributes, "ignore-unknown");
1035
1068
  this.setIndexBuffer(gpuGeometry.indices);
1036
1069
  }
1037
1070
  /**
@@ -1103,7 +1136,7 @@ var _Model = class {
1103
1136
  * @deprecated Updates shader module settings (which results in uniforms being set)
1104
1137
  */
1105
1138
  updateModuleSettings(props) {
1106
- console.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()");
1139
+ import_core8.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();
1107
1140
  const { bindings, uniforms } = (0, import_core8.splitUniformsAndBindings)(this._getModuleUniforms(props));
1108
1141
  Object.assign(this.bindings, bindings);
1109
1142
  Object.assign(this.uniforms, uniforms);
@@ -1141,12 +1174,12 @@ var _Model = class {
1141
1174
  * Sets attributes (buffers)
1142
1175
  * @note Overrides any attributes previously set with the same name
1143
1176
  */
1144
- setAttributes(buffers) {
1177
+ setAttributes(buffers, _option) {
1145
1178
  var _a;
1146
1179
  if (buffers.indices) {
1147
1180
  import_core8.log.warn(
1148
1181
  `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`
1149
- );
1182
+ )();
1150
1183
  }
1151
1184
  for (const [bufferName, buffer] of Object.entries(buffers)) {
1152
1185
  const bufferLayout = this.bufferLayout.find((layout) => layout.name === bufferName);
@@ -1163,7 +1196,7 @@ var _Model = class {
1163
1196
  set = true;
1164
1197
  }
1165
1198
  }
1166
- if (!set) {
1199
+ if (!set && _option !== "ignore-unknown") {
1167
1200
  import_core8.log.warn(
1168
1201
  `Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`
1169
1202
  )();
@@ -1235,8 +1268,13 @@ var _Model = class {
1235
1268
  }
1236
1269
  _logDrawCallEnd() {
1237
1270
  if (this._logOpen) {
1238
- const shaderLayoutTable = (0, import_core9.getDebugTableForShaderLayout)(this.pipeline.shaderLayout);
1271
+ const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout);
1239
1272
  import_core8.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
1273
+ const uniformTable = this.shaderInputs.getDebugTable();
1274
+ for (const [name, value] of Object.entries(this.uniforms)) {
1275
+ uniformTable[name] = { value };
1276
+ }
1277
+ import_core8.log.table(LOG_DRAW_PRIORITY, uniformTable)();
1240
1278
  import_core8.log.groupEnd(LOG_DRAW_PRIORITY)();
1241
1279
  this._logOpen = false;
1242
1280
  }
@@ -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>): void;
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
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAE,mBAAmB,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,KAAK,EAAC,YAAY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;IAI7C,eAAe,IAAI,cAAc;IA+BjC,iCAAiC;IACjC,YAAY,SAAK;IACjB,QAAQ,UAAS;IAEjB,iBAAiB,IAAI,IAAI;IAazB,eAAe,IAAI,IAAI;CAmBxB;AAkBD,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAQ5D"}
@@ -1,10 +1,11 @@
1
1
  import { RenderPipeline, UniformStore } from '@luma.gl/core';
2
2
  import { log, uid, deepEqual, splitUniformsAndBindings } from '@luma.gl/core';
3
- import { getAttributeInfosFromLayouts, getDebugTableForShaderLayout } from '@luma.gl/core';
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
- console.warn('Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()');
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
- console.warn('Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()');
195
+ log.warn('Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()')();
195
196
  const {
196
197
  bindings,
197
198
  uniforms
@@ -212,9 +213,9 @@ 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
  var _bufferLayout$attribu;
@@ -232,7 +233,7 @@ export class Model {
232
233
  set = true;
233
234
  }
234
235
  }
235
- if (!set) {
236
+ if (!set && _option !== 'ignore-unknown') {
236
237
  log.warn(`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`)();
237
238
  }
238
239
  }
@@ -291,6 +292,13 @@ export class Model {
291
292
  if (this._logOpen) {
292
293
  const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout);
293
294
  log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
295
+ const uniformTable = this.shaderInputs.getDebugTable();
296
+ for (const [name, value] of Object.entries(this.uniforms)) {
297
+ uniformTable[name] = {
298
+ value
299
+ };
300
+ }
301
+ log.table(LOG_DRAW_PRIORITY, uniformTable)();
294
302
  log.groupEnd(LOG_DRAW_PRIORITY)();
295
303
  this._logOpen = false;
296
304
  }