@luma.gl/core 9.0.0-beta.6 → 9.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/adapter/device.d.ts +22 -12
  2. package/dist/adapter/device.d.ts.map +1 -1
  3. package/dist/adapter/device.js +18 -7
  4. package/dist/adapter/resources/buffer.d.ts +3 -1
  5. package/dist/adapter/resources/buffer.d.ts.map +1 -1
  6. package/dist/adapter/resources/buffer.js +4 -0
  7. package/dist/adapter/resources/compute-pipeline.d.ts +14 -5
  8. package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
  9. package/dist/adapter/resources/compute-pipeline.js +4 -4
  10. package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
  11. package/dist/adapter/resources/framebuffer.js +4 -1
  12. package/dist/adapter/resources/render-pipeline.d.ts +8 -8
  13. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  14. package/dist/adapter/resources/render-pipeline.js +2 -2
  15. package/dist/adapter/resources/shader.d.ts +3 -3
  16. package/dist/adapter/resources/shader.d.ts.map +1 -1
  17. package/dist/adapter/resources/shader.js +1 -1
  18. package/dist/adapter/resources/texture.d.ts +5 -0
  19. package/dist/adapter/resources/texture.d.ts.map +1 -1
  20. package/dist/adapter/resources/texture.js +5 -0
  21. package/dist/adapter/types/shader-layout.d.ts +8 -4
  22. package/dist/adapter/types/shader-layout.d.ts.map +1 -1
  23. package/dist/adapter/types/texture-formats.d.ts.map +1 -1
  24. package/dist/dist.dev.js +114 -137
  25. package/dist/index.cjs +38 -19
  26. package/dist/index.cjs.map +2 -2
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/init.js +1 -1
  30. package/dist/lib/luma.d.ts +6 -2
  31. package/dist/lib/luma.d.ts.map +1 -1
  32. package/dist/lib/uniforms/uniform-store.js +1 -1
  33. package/dist.min.js +2 -2
  34. package/package.json +2 -2
  35. package/src/adapter/device.ts +45 -23
  36. package/src/adapter/resources/buffer.ts +5 -1
  37. package/src/adapter/resources/compute-pipeline.ts +19 -9
  38. package/src/adapter/resources/framebuffer.ts +5 -1
  39. package/src/adapter/resources/render-pipeline.ts +10 -10
  40. package/src/adapter/resources/shader.ts +3 -3
  41. package/src/adapter/resources/texture.ts +10 -0
  42. package/src/adapter/types/shader-layout.ts +9 -4
  43. package/src/adapter/types/texture-formats.ts +3 -4
  44. package/src/index.ts +1 -0
  45. package/src/lib/luma.ts +7 -2
  46. package/src/lib/uniforms/uniform-store.ts +1 -1
package/dist/index.cjs CHANGED
@@ -116,7 +116,7 @@ var lumaStats = new StatsManager();
116
116
 
117
117
  // dist/init.js
118
118
  function initializeLuma() {
119
- const VERSION2 = true ? "9.0.0-beta.5" : "running from source";
119
+ const VERSION2 = true ? "9.0.0-beta.6" : "running from source";
120
120
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
121
121
  if (globalThis.luma && globalThis.luma.VERSION !== VERSION2) {
122
122
  throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION2}`);
@@ -304,6 +304,8 @@ var _Buffer = class extends Resource {
304
304
  usage;
305
305
  /** For index buffers, whether indices are 16 or 32 bit */
306
306
  indexType;
307
+ /** "Time" of last update */
308
+ updateTimestamp;
307
309
  constructor(device, props) {
308
310
  const deducedProps = { ...props };
309
311
  if ((props.usage || 0) & _Buffer.INDEX && !props.indexType) {
@@ -316,6 +318,7 @@ var _Buffer = class extends Resource {
316
318
  super(device, deducedProps, _Buffer.defaultProps);
317
319
  this.usage = props.usage || 0;
318
320
  this.indexType = deducedProps.indexType;
321
+ this.updateTimestamp = device.incrementTimestamp();
319
322
  }
320
323
  /** Read data synchronously. @note WebGL2 only */
321
324
  readSyncWebGL(byteOffset, byteLength) {
@@ -491,14 +494,16 @@ var DeviceLimits = class {
491
494
  };
492
495
  var DeviceFeatures = class {
493
496
  features;
494
- constructor(features = []) {
497
+ disabledFeatures;
498
+ constructor(features = [], disabledFeatures) {
495
499
  this.features = new Set(features);
500
+ this.disabledFeatures = disabledFeatures || {};
496
501
  }
497
502
  *[Symbol.iterator]() {
498
503
  yield* this.features;
499
504
  }
500
505
  has(feature) {
501
- return this.features.has(feature);
506
+ return !this.disabledFeatures[feature] && this.features.has(feature);
502
507
  }
503
508
  };
504
509
  var _Device = class {
@@ -511,12 +516,12 @@ var _Device = class {
511
516
  }
512
517
  /** id of this device, primarily for debugging */
513
518
  id;
514
- /** stats */
515
- statsManager = lumaStats;
516
519
  /** A copy of the device props */
517
520
  props;
518
521
  /** Available for the application to store data on the device */
519
522
  userData = {};
523
+ /** stats */
524
+ statsManager = lumaStats;
520
525
  /** Used by other luma.gl modules to store data on the device */
521
526
  _lumaData = {};
522
527
  /** Check if a specific texture format is GPU compressed */
@@ -573,12 +578,17 @@ var _Device = class {
573
578
  clearWebGL(options) {
574
579
  throw new Error("not implemented");
575
580
  }
576
- // IMPLEMENTATION
581
+ timestamp = 0;
582
+ /** A monotonic counter for tracking buffer and texture updates */
583
+ incrementTimestamp() {
584
+ return this.timestamp++;
585
+ }
577
586
  // Error Handling
578
587
  /** Report unhandled device errors */
579
588
  onError(error) {
580
589
  this.props.onError(error);
581
590
  }
591
+ // IMPLEMENTATION
582
592
  _getBufferProps(props) {
583
593
  if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
584
594
  props = { data: props };
@@ -599,19 +609,23 @@ var _Device = class {
599
609
  var Device = _Device;
600
610
  __publicField(Device, "defaultProps", {
601
611
  id: null,
602
- type: "best-available",
603
612
  canvas: null,
604
613
  container: null,
605
614
  manageState: true,
606
615
  width: 800,
607
616
  // width are height are only used by headless gl
608
617
  height: 600,
609
- requestMaximalLimits: true,
618
+ requestMaxLimits: true,
610
619
  debug: Boolean(log.get("debug")),
611
620
  // Instrument context (at the expense of performance)
612
621
  spector: Boolean(log.get("spector")),
613
622
  // Initialize the SpectorJS WebGL debugger
614
623
  break: [],
624
+ // TODO - Change these after confirming things work as expected
625
+ initalizeFeatures: true,
626
+ disabledFeatures: {
627
+ "compilation-status-async-webgl": true
628
+ },
615
629
  // alpha: undefined,
616
630
  // depth: undefined,
617
631
  // stencil: undefined,
@@ -978,6 +992,9 @@ var _Texture = class extends Resource {
978
992
  height;
979
993
  /** depth of this texture */
980
994
  depth;
995
+ /** "Time" of last update. Monotonically increasing timestamp */
996
+ updateTimestamp;
997
+ /** Do not use directly. Create with device.createTexture() */
981
998
  constructor(device, props, defaultProps = _Texture.defaultProps) {
982
999
  super(device, props, defaultProps);
983
1000
  this.dimension = this.props.dimension;
@@ -985,6 +1002,7 @@ var _Texture = class extends Resource {
985
1002
  this.width = this.props.width;
986
1003
  this.height = this.props.height;
987
1004
  this.depth = this.props.depth;
1005
+ this.updateTimestamp = device.incrementTimestamp();
988
1006
  }
989
1007
  };
990
1008
  var Texture = _Texture;
@@ -1230,7 +1248,7 @@ var Shader = _Shader;
1230
1248
  __publicField(Shader, "defaultProps", {
1231
1249
  ...Resource.defaultProps,
1232
1250
  language: "auto",
1233
- stage: "vertex",
1251
+ stage: void 0,
1234
1252
  source: "",
1235
1253
  sourceMap: null,
1236
1254
  entryPoint: "main",
@@ -1299,6 +1317,9 @@ var _Framebuffer = class extends Resource {
1299
1317
  }
1300
1318
  /** Auto creates any textures */
1301
1319
  autoCreateAttachmentTextures() {
1320
+ if (this.props.colorAttachments.length === 0 && !this.props.depthStencilAttachment) {
1321
+ throw new Error("Framebuffer has noattachments");
1322
+ }
1302
1323
  this.colorAttachments = this.props.colorAttachments.map((attachment2) => {
1303
1324
  if (typeof attachment2 === "string") {
1304
1325
  const texture = this.createColorTexture(attachment2);
@@ -1379,7 +1400,7 @@ __publicField(Framebuffer, "defaultProps", {
1379
1400
  width: 1,
1380
1401
  height: 1,
1381
1402
  colorAttachments: [],
1382
- // ['rgba8unorm-unsized'],
1403
+ // ['rgba8unorm'],
1383
1404
  depthStencilAttachment: null
1384
1405
  // 'depth24plus-stencil8'
1385
1406
  });
@@ -1417,12 +1438,10 @@ var RenderPipeline = _RenderPipeline;
1417
1438
  __publicField(RenderPipeline, "defaultProps", {
1418
1439
  ...Resource.defaultProps,
1419
1440
  vs: null,
1420
- vsEntryPoint: "",
1421
- // main
1441
+ vertexEntryPoint: "vertexMain",
1422
1442
  vsConstants: {},
1423
1443
  fs: null,
1424
- fsEntryPoint: "",
1425
- // main
1444
+ fragmentEntryPoint: "fragmentMain",
1426
1445
  fsConstants: {},
1427
1446
  shaderLayout: null,
1428
1447
  bufferLayout: [],
@@ -1474,10 +1493,10 @@ var _ComputePipeline = class extends Resource {
1474
1493
  var ComputePipeline = _ComputePipeline;
1475
1494
  __publicField(ComputePipeline, "defaultProps", {
1476
1495
  ...Resource.defaultProps,
1477
- cs: void 0,
1478
- csEntryPoint: void 0,
1479
- csConstants: {},
1480
- shaderLayout: []
1496
+ shader: void 0,
1497
+ entryPoint: void 0,
1498
+ constants: {},
1499
+ shaderLayout: void 0
1481
1500
  });
1482
1501
 
1483
1502
  // dist/adapter/resources/compute-pass.js
@@ -2047,7 +2066,7 @@ var UniformStore = class {
2047
2066
  }
2048
2067
  /** Destroy any managed uniform buffers */
2049
2068
  destroy() {
2050
- for (const uniformBuffer of Object.values(this.uniformBuffers)) {
2069
+ for (const uniformBuffer of this.uniformBuffers.values()) {
2051
2070
  uniformBuffer.destroy();
2052
2071
  }
2053
2072
  }