@luma.gl/engine 9.4.2 → 10.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/animation-loop/animation-loop.d.ts +12 -5
  2. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  3. package/dist/animation-loop/animation-loop.js +3 -1
  4. package/dist/animation-loop/animation-loop.js.map +1 -1
  5. package/dist/animation-loop/animation-props.d.ts +3 -1
  6. package/dist/animation-loop/animation-props.d.ts.map +1 -1
  7. package/dist/compute/computation.d.ts +12 -0
  8. package/dist/compute/computation.d.ts.map +1 -1
  9. package/dist/compute/computation.js +85 -22
  10. package/dist/compute/computation.js.map +1 -1
  11. package/dist/compute/kernel.d.ts +54 -0
  12. package/dist/compute/kernel.d.ts.map +1 -0
  13. package/dist/compute/kernel.js +103 -0
  14. package/dist/compute/kernel.js.map +1 -0
  15. package/dist/compute/render-kernel.d.ts +65 -0
  16. package/dist/compute/render-kernel.d.ts.map +1 -0
  17. package/dist/compute/render-kernel.js +129 -0
  18. package/dist/compute/render-kernel.js.map +1 -0
  19. package/dist/controls/orbit-controls.d.ts +9 -2
  20. package/dist/controls/orbit-controls.d.ts.map +1 -1
  21. package/dist/controls/orbit-controls.js +55 -8
  22. package/dist/controls/orbit-controls.js.map +1 -1
  23. package/dist/dist.dev.js +547 -358
  24. package/dist/dist.min.js +21 -21
  25. package/dist/index.cjs +479 -109
  26. package/dist/index.cjs.map +3 -3
  27. package/dist/index.d.ts +4 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +2 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/model/model.d.ts +10 -0
  32. package/dist/model/model.d.ts.map +1 -1
  33. package/dist/model/model.js +129 -65
  34. package/dist/model/model.js.map +1 -1
  35. package/dist/passes/shader-pass-renderer.d.ts +12 -12
  36. package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
  37. package/dist/passes/shader-pass-renderer.js +17 -17
  38. package/dist/passes/shader-pass-renderer.js.map +1 -1
  39. package/package.json +6 -6
  40. package/src/animation-loop/animation-loop.ts +16 -7
  41. package/src/animation-loop/animation-props.ts +4 -1
  42. package/src/compute/computation.ts +83 -30
  43. package/src/compute/kernel.ts +146 -0
  44. package/src/compute/render-kernel.ts +192 -0
  45. package/src/controls/orbit-controls.ts +61 -9
  46. package/src/index.ts +12 -0
  47. package/src/model/model.ts +140 -85
  48. package/src/passes/shader-pass-renderer.ts +28 -25
package/dist/index.cjs CHANGED
@@ -42,6 +42,7 @@ __export(index_exports, {
42
42
  Geometry: () => Geometry,
43
43
  GroupNode: () => GroupNode,
44
44
  IcoSphereGeometry: () => IcoSphereGeometry,
45
+ Kernel: () => Kernel,
45
46
  KeyFrames: () => KeyFrames,
46
47
  LegacyPickingManager: () => LegacyPickingManager,
47
48
  Material: () => Material,
@@ -52,6 +53,7 @@ __export(index_exports, {
52
53
  PickingManager: () => PickingManager,
53
54
  PlaneGeometry: () => PlaneGeometry,
54
55
  PointLightModel: () => PointLightModel,
56
+ RenderKernel: () => RenderKernel,
55
57
  ScenegraphNode: () => ScenegraphNode,
56
58
  ShaderInputs: () => ShaderInputs,
57
59
  ShaderPassRenderer: () => ShaderPassRenderer,
@@ -1182,6 +1184,7 @@ var defaultAnimationFrameProvider = {
1182
1184
  var AnimationLoop = class _AnimationLoop {
1183
1185
  static defaultAnimationLoopProps = {
1184
1186
  device: null,
1187
+ mobileQuality: void 0,
1185
1188
  onAddHTML: () => "",
1186
1189
  onInitialize: async () => null,
1187
1190
  onRender: () => {
@@ -1476,8 +1479,9 @@ var AnimationLoop = class _AnimationLoop {
1476
1479
  tock: 0,
1477
1480
  // Experimental
1478
1481
  animationFrame: null,
1479
- _mousePosition: null
1482
+ _mousePosition: null,
1480
1483
  // Event props
1484
+ mobileQuality: this.props.mobileQuality
1481
1485
  };
1482
1486
  }
1483
1487
  _getAnimationProps() {
@@ -1720,6 +1724,7 @@ var DEFAULT_PROPS = {
1720
1724
  distance: 10,
1721
1725
  yaw: 0,
1722
1726
  pitch: 0.25,
1727
+ roll: 0,
1723
1728
  minDistance: 1,
1724
1729
  maxDistance: 100,
1725
1730
  minPitch: -Math.PI / 2 + 0.01,
@@ -1727,6 +1732,7 @@ var DEFAULT_PROPS = {
1727
1732
  rotateSpeed: 6e-3,
1728
1733
  zoomSpeed: 1e-3,
1729
1734
  enabled: true,
1735
+ enableRotate: false,
1730
1736
  enableZoom: true,
1731
1737
  enablePan: false,
1732
1738
  panSpeed: 18e-4,
@@ -1738,11 +1744,13 @@ var OrbitControls = class {
1738
1744
  props;
1739
1745
  yaw;
1740
1746
  pitch;
1747
+ roll;
1741
1748
  distance;
1742
1749
  dragging = false;
1743
1750
  activePointers = /* @__PURE__ */ new Map();
1744
1751
  lastPointer = [0, 0];
1745
1752
  previousPinchDistance = null;
1753
+ previousPinchAngle = null;
1746
1754
  previousTimeMilliseconds = null;
1747
1755
  previousCursor;
1748
1756
  previousTouchAction;
@@ -1752,6 +1760,7 @@ var OrbitControls = class {
1752
1760
  this.props.target = [...this.props.target];
1753
1761
  this.yaw = this.props.yaw;
1754
1762
  this.pitch = clampNumber(this.props.pitch, this.props.minPitch, this.props.maxPitch);
1763
+ this.roll = this.props.roll;
1755
1764
  this.distance = clampNumber(this.props.distance, this.props.minDistance, this.props.maxDistance);
1756
1765
  this.previousCursor = canvas.style.cursor;
1757
1766
  this.previousTouchAction = canvas.style.touchAction;
@@ -1780,6 +1789,32 @@ var OrbitControls = class {
1780
1789
  this.props.target[2] + horizontalDistance * Math.cos(this.yaw)
1781
1790
  ];
1782
1791
  }
1792
+ /** Returns the camera up direction after applying pitch and optional two-finger roll. */
1793
+ getUpDirection() {
1794
+ return this.getCameraFrame().up;
1795
+ }
1796
+ getCameraFrame() {
1797
+ const sineYaw = Math.sin(this.yaw);
1798
+ const cosineYaw = Math.cos(this.yaw);
1799
+ const sinePitch = Math.sin(this.pitch);
1800
+ const cosinePitch = Math.cos(this.pitch);
1801
+ const sineRoll = Math.sin(this.roll);
1802
+ const cosineRoll = Math.cos(this.roll);
1803
+ const right = [cosineYaw, 0, -sineYaw];
1804
+ const up = [-sinePitch * sineYaw, cosinePitch, -sinePitch * cosineYaw];
1805
+ return {
1806
+ right: [
1807
+ right[0] * cosineRoll - up[0] * sineRoll,
1808
+ right[1] * cosineRoll - up[1] * sineRoll,
1809
+ right[2] * cosineRoll - up[2] * sineRoll
1810
+ ],
1811
+ up: [
1812
+ up[0] * cosineRoll + right[0] * sineRoll,
1813
+ up[1] * cosineRoll + right[1] * sineRoll,
1814
+ up[2] * cosineRoll + right[2] * sineRoll
1815
+ ]
1816
+ };
1817
+ }
1783
1818
  /** Enables or pauses automatic rotation without losing the current manual angle. */
1784
1819
  setAutoRotate(autoRotate) {
1785
1820
  this.props.autoRotate = autoRotate;
@@ -1799,14 +1834,18 @@ var OrbitControls = class {
1799
1834
  if (props.pitch !== void 0 || props.minPitch !== void 0 || props.maxPitch !== void 0) {
1800
1835
  this.pitch = clampNumber(props.pitch ?? this.pitch, this.props.minPitch, this.props.maxPitch);
1801
1836
  }
1837
+ if (props.roll !== void 0) {
1838
+ this.roll = props.roll;
1839
+ }
1802
1840
  if (props.distance !== void 0 || props.minDistance !== void 0 || props.maxDistance !== void 0) {
1803
1841
  this.distance = clampNumber(props.distance ?? this.distance, this.props.minDistance, this.props.maxDistance);
1804
1842
  }
1805
1843
  }
1806
- /** Restores the configured starting angle and zoom. */
1844
+ /** Restores the configured starting orbit, roll, and zoom. */
1807
1845
  reset() {
1808
1846
  this.yaw = this.props.yaw;
1809
1847
  this.pitch = clampNumber(this.props.pitch, this.props.minPitch, this.props.maxPitch);
1848
+ this.roll = this.props.roll;
1810
1849
  this.distance = clampNumber(this.props.distance, this.props.minDistance, this.props.maxDistance);
1811
1850
  }
1812
1851
  destroy() {
@@ -1832,9 +1871,10 @@ var OrbitControls = class {
1832
1871
  if (this.activePointers.size === 1) {
1833
1872
  this.lastPointer = [event.clientX, event.clientY];
1834
1873
  } else {
1835
- const { center, distance } = this.getMultiPointerState();
1874
+ const { center, distance, angle } = this.getMultiPointerState();
1836
1875
  this.lastPointer = center;
1837
1876
  this.previousPinchDistance = distance;
1877
+ this.previousPinchAngle = distance > 0 ? angle : null;
1838
1878
  }
1839
1879
  this.canvas.setPointerCapture(event.pointerId);
1840
1880
  this.canvas.style.cursor = "grabbing";
@@ -1845,15 +1885,19 @@ var OrbitControls = class {
1845
1885
  }
1846
1886
  this.activePointers.set(event.pointerId, [event.clientX, event.clientY]);
1847
1887
  if (this.activePointers.size > 1) {
1848
- const { center, distance } = this.getMultiPointerState();
1888
+ const { center, distance, angle } = this.getMultiPointerState();
1849
1889
  if (this.props.enablePan) {
1850
1890
  this.panTarget(center[0] - this.lastPointer[0], center[1] - this.lastPointer[1]);
1851
1891
  }
1852
1892
  if (this.props.enableZoom && this.previousPinchDistance && distance > 0) {
1853
1893
  this.distance = clampNumber(this.distance * this.previousPinchDistance / distance, this.props.minDistance, this.props.maxDistance);
1854
1894
  }
1895
+ if (this.props.enableRotate && this.previousPinchAngle !== null && distance > 0) {
1896
+ this.roll += normalizeAngleDelta(angle - this.previousPinchAngle);
1897
+ }
1855
1898
  this.lastPointer = center;
1856
1899
  this.previousPinchDistance = distance;
1900
+ this.previousPinchAngle = distance > 0 ? angle : null;
1857
1901
  return;
1858
1902
  }
1859
1903
  const deltaX = event.clientX - this.lastPointer[0];
@@ -1875,6 +1919,7 @@ var OrbitControls = class {
1875
1919
  }
1876
1920
  this.activePointers.delete(event.pointerId);
1877
1921
  this.previousPinchDistance = null;
1922
+ this.previousPinchAngle = null;
1878
1923
  const remainingPointer = this.activePointers.entries().next().value;
1879
1924
  if (remainingPointer) {
1880
1925
  this.lastPointer = remainingPointer[1];
@@ -1891,6 +1936,7 @@ var OrbitControls = class {
1891
1936
  }
1892
1937
  this.activePointers.clear();
1893
1938
  this.previousPinchDistance = null;
1939
+ this.previousPinchAngle = null;
1894
1940
  this.canvas.style.cursor = "grab";
1895
1941
  }
1896
1942
  getMultiPointerState() {
@@ -1899,15 +1945,17 @@ var OrbitControls = class {
1899
1945
  const deltaY = secondPointer[1] - firstPointer[1];
1900
1946
  return {
1901
1947
  center: [(firstPointer[0] + secondPointer[0]) / 2, (firstPointer[1] + secondPointer[1]) / 2],
1902
- distance: Math.hypot(deltaX, deltaY)
1948
+ distance: Math.hypot(deltaX, deltaY),
1949
+ angle: Math.atan2(deltaY, deltaX)
1903
1950
  };
1904
1951
  }
1905
1952
  panTarget(deltaX, deltaY) {
1906
1953
  const panScale = this.distance * this.props.panSpeed;
1954
+ const { right, up } = this.getCameraFrame();
1907
1955
  this.props.target = [
1908
- this.props.target[0] - Math.cos(this.yaw) * deltaX * panScale,
1909
- this.props.target[1] + deltaY * panScale,
1910
- this.props.target[2] + Math.sin(this.yaw) * deltaX * panScale
1956
+ this.props.target[0] + (-right[0] * deltaX + up[0] * deltaY) * panScale,
1957
+ this.props.target[1] + (-right[1] * deltaX + up[1] * deltaY) * panScale,
1958
+ this.props.target[2] + (-right[2] * deltaX + up[2] * deltaY) * panScale
1911
1959
  ];
1912
1960
  }
1913
1961
  handleWheel = (event) => {
@@ -1924,6 +1972,9 @@ var OrbitControls = class {
1924
1972
  function clampNumber(value, minimum, maximum) {
1925
1973
  return Math.min(Math.max(value, minimum), maximum);
1926
1974
  }
1975
+ function normalizeAngleDelta(angle) {
1976
+ return Math.atan2(Math.sin(angle), Math.cos(angle));
1977
+ }
1927
1978
 
1928
1979
  // dist/model/model.js
1929
1980
  var import_core13 = require("@luma.gl/core");
@@ -2878,6 +2929,29 @@ var DEPTH_STENCIL_ATTACHMENT_FORMATS = [
2878
2929
  "depth32float-stencil8"
2879
2930
  ];
2880
2931
  var Model = class _Model {
2932
+ /** Creates a model while allowing the backend to compile its render pipeline asynchronously. */
2933
+ static async createAsync(device, props) {
2934
+ const ownsCompilation = !import_core13.PipelineFactory.getAsyncCompilation(device);
2935
+ const asyncCompilation = ownsCompilation ? import_core13.PipelineFactory.beginAsyncCompilation(device) : import_core13.PipelineFactory.getAsyncCompilation(device);
2936
+ let model;
2937
+ try {
2938
+ model = new _Model(device, props);
2939
+ } finally {
2940
+ if (ownsCompilation)
2941
+ import_core13.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
2942
+ }
2943
+ try {
2944
+ if (ownsCompilation) {
2945
+ await Promise.all(asyncCompilation);
2946
+ } else {
2947
+ await model._pipelineInitialization;
2948
+ }
2949
+ return model;
2950
+ } catch (error) {
2951
+ model.destroy();
2952
+ throw error;
2953
+ }
2954
+ }
2881
2955
  static defaultProps = {
2882
2956
  ...import_core13.RenderPipeline.defaultProps,
2883
2957
  source: void 0,
@@ -2989,6 +3063,7 @@ var Model = class _Model {
2989
3063
  /** "Time" of last draw. Monotonically increasing timestamp */
2990
3064
  _lastDrawTimestamp = -1;
2991
3065
  _bindingTable = [];
3066
+ _pipelineInitialization;
2992
3067
  get [Symbol.toStringTag]() {
2993
3068
  return "Model";
2994
3069
  }
@@ -2998,7 +3073,7 @@ var Model = class _Model {
2998
3073
  constructor(device, props) {
2999
3074
  var _a;
3000
3075
  const defaultShaderAssembler = _Model.defaultProps.shaderAssembler;
3001
- const vertexCountSet = props.vertexCount !== void 0;
3076
+ const vertexCountSet = Object.hasOwn(props, "vertexCount");
3002
3077
  this.props = {
3003
3078
  ..._Model.defaultProps,
3004
3079
  ...props,
@@ -3077,46 +3152,52 @@ var Model = class _Model {
3077
3152
  }
3078
3153
  this.pipelineFactory = props.pipelineFactory || import_core13.PipelineFactory.getDefaultPipelineFactory(this.device);
3079
3154
  this.shaderFactory = props.shaderFactory || import_core13.ShaderFactory.getDefaultShaderFactory(this.device);
3080
- this.pipeline = this._updatePipeline();
3081
- this.vertexArray = device.createVertexArray({
3155
+ const asyncCompilation = import_core13.PipelineFactory.getAsyncCompilation(this.device);
3156
+ if (asyncCompilation) {
3157
+ this._pipelineInitialization = this._initializePipelineAsync(props);
3158
+ asyncCompilation.push(this._pipelineInitialization);
3159
+ } else {
3160
+ this.pipeline = this._updatePipeline();
3161
+ this._initializePipelineResources(props);
3162
+ }
3163
+ }
3164
+ async _initializePipelineAsync(props) {
3165
+ await this._updatePipelineAsync();
3166
+ this._initializePipelineResources(props);
3167
+ }
3168
+ _initializePipelineResources(props) {
3169
+ this.vertexArray = this.device.createVertexArray({
3082
3170
  shaderLayout: this.pipeline.shaderLayout,
3083
3171
  bufferLayout: this.pipeline.bufferLayout
3084
3172
  });
3085
- if (this._gpuGeometry) {
3173
+ if (this._gpuGeometry)
3086
3174
  this._setGeometryAttributes(this._gpuGeometry);
3087
- }
3088
- if ("isInstanced" in props) {
3175
+ if ("isInstanced" in props)
3089
3176
  this.isInstanced = props.isInstanced;
3090
- }
3091
- if (props.instanceCount) {
3177
+ if (props.instanceCount)
3092
3178
  this.setInstanceCount(props.instanceCount);
3093
- }
3094
- if (props.vertexCount) {
3179
+ if (props.vertexCount)
3095
3180
  this.setVertexCount(props.vertexCount);
3096
- }
3097
- if (props.indexBuffer) {
3181
+ if (props.indexBuffer)
3098
3182
  this.setIndexBuffer(props.indexBuffer);
3099
- }
3100
- if (props.attributes) {
3183
+ if (props.attributes)
3101
3184
  this.setAttributes(props.attributes);
3102
- }
3103
- if (props.constantAttributes) {
3185
+ if (props.constantAttributes)
3104
3186
  this.setConstantAttributes(props.constantAttributes);
3105
- }
3106
- if (props.bindings) {
3187
+ if (props.bindings)
3107
3188
  this.setBindings(props.bindings);
3108
- }
3109
- if (props.transformFeedback) {
3189
+ if (props.transformFeedback)
3110
3190
  this.transformFeedback = props.transformFeedback;
3111
- }
3112
3191
  }
3113
3192
  destroy() {
3114
3193
  var _a;
3115
3194
  if (!this._destroyed) {
3116
- this.pipelineFactory.release(this.pipeline);
3117
- this.shaderFactory.release(this.pipeline.vs);
3118
- if (this.pipeline.fs && this.pipeline.fs !== this.pipeline.vs) {
3119
- this.shaderFactory.release(this.pipeline.fs);
3195
+ if (this.pipeline) {
3196
+ this.pipelineFactory.release(this.pipeline);
3197
+ this.shaderFactory.release(this.pipeline.vs);
3198
+ if (this.pipeline.fs && this.pipeline.fs !== this.pipeline.vs) {
3199
+ this.shaderFactory.release(this.pipeline.fs);
3200
+ }
3120
3201
  }
3121
3202
  this._uniformStore.destroy();
3122
3203
  (_a = this._gpuGeometry) == null ? void 0 : _a.destroy();
@@ -3574,33 +3655,57 @@ var Model = class _Model {
3574
3655
  }
3575
3656
  /** Update pipeline if needed */
3576
3657
  _updatePipeline() {
3577
- if (this._pipelineNeedsUpdate) {
3578
- let prevShaderVs = null;
3579
- let prevShaderFs = null;
3580
- if (this.pipeline) {
3581
- import_core13.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
3582
- prevShaderVs = this.pipeline.vs;
3583
- prevShaderFs = this.pipeline.fs;
3584
- }
3585
- this._pipelineNeedsUpdate = false;
3586
- const vs4 = this.shaderFactory.createShader({
3587
- id: `${this.id}-vertex`,
3588
- stage: "vertex",
3589
- source: this.source || this.vs,
3658
+ const update = this._preparePipelineUpdate();
3659
+ if (update) {
3660
+ this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
3661
+ this._finishPipelineUpdate(update);
3662
+ }
3663
+ return this.pipeline;
3664
+ }
3665
+ /** Creates or replaces the render pipeline through the backend's asynchronous compilation path. */
3666
+ async _updatePipelineAsync() {
3667
+ const update = this._preparePipelineUpdate();
3668
+ if (update) {
3669
+ try {
3670
+ this.pipeline = await this.pipelineFactory.createRenderPipelineAsync(update.props);
3671
+ } catch (error) {
3672
+ this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
3673
+ this._pipelineNeedsUpdate = "asynchronous pipeline creation failed";
3674
+ throw error;
3675
+ }
3676
+ this._finishPipelineUpdate(update);
3677
+ }
3678
+ return this.pipeline;
3679
+ }
3680
+ _preparePipelineUpdate() {
3681
+ var _a, _b;
3682
+ if (!this._pipelineNeedsUpdate)
3683
+ return null;
3684
+ const previousVertexShader = ((_a = this.pipeline) == null ? void 0 : _a.vs) ?? null;
3685
+ const previousFragmentShader = ((_b = this.pipeline) == null ? void 0 : _b.fs) ?? null;
3686
+ if (this.pipeline) {
3687
+ import_core13.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
3688
+ }
3689
+ this._pipelineNeedsUpdate = false;
3690
+ const vertexShader = this.shaderFactory.createShader({
3691
+ id: `${this.id}-vertex`,
3692
+ stage: "vertex",
3693
+ source: this.source || this.vs,
3694
+ debugShaders: this.props.debugShaders
3695
+ });
3696
+ let fragmentShader = null;
3697
+ if (this.source) {
3698
+ fragmentShader = vertexShader;
3699
+ } else if (this.fs) {
3700
+ fragmentShader = this.shaderFactory.createShader({
3701
+ id: `${this.id}-fragment`,
3702
+ stage: "fragment",
3703
+ source: this.fs,
3590
3704
  debugShaders: this.props.debugShaders
3591
3705
  });
3592
- let fs4 = null;
3593
- if (this.source) {
3594
- fs4 = vs4;
3595
- } else if (this.fs) {
3596
- fs4 = this.shaderFactory.createShader({
3597
- id: `${this.id}-fragment`,
3598
- stage: "fragment",
3599
- source: this.source || this.fs,
3600
- debugShaders: this.props.debugShaders
3601
- });
3602
- }
3603
- this.pipeline = this.pipelineFactory.createRenderPipeline({
3706
+ }
3707
+ return {
3708
+ props: {
3604
3709
  ...this.props,
3605
3710
  bindings: void 0,
3606
3711
  bufferLayout: this.bufferLayout,
@@ -3609,17 +3714,25 @@ var Model = class _Model {
3609
3714
  topology: this.topology,
3610
3715
  parameters: this.parameters,
3611
3716
  bindGroups: void 0,
3612
- vs: vs4,
3613
- fs: fs4
3614
- });
3615
- this._attributeInfos = (0, import_core13.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout, this.bufferLayout);
3616
- if (prevShaderVs)
3617
- this.shaderFactory.release(prevShaderVs);
3618
- if (prevShaderFs && prevShaderFs !== prevShaderVs) {
3619
- this.shaderFactory.release(prevShaderFs);
3620
- }
3717
+ vs: vertexShader,
3718
+ fs: fragmentShader
3719
+ },
3720
+ vertexShader,
3721
+ fragmentShader,
3722
+ previousVertexShader,
3723
+ previousFragmentShader
3724
+ };
3725
+ }
3726
+ _finishPipelineUpdate(update) {
3727
+ this._attributeInfos = (0, import_core13.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout, this.bufferLayout);
3728
+ this._releasePipelineShaders(update.previousVertexShader, update.previousFragmentShader);
3729
+ }
3730
+ _releasePipelineShaders(vertexShader, fragmentShader) {
3731
+ if (vertexShader)
3732
+ this.shaderFactory.release(vertexShader);
3733
+ if (fragmentShader && fragmentShader !== vertexShader) {
3734
+ this.shaderFactory.release(fragmentShader);
3621
3735
  }
3622
- return this.pipeline;
3623
3736
  }
3624
3737
  /** Throttle draw call logging */
3625
3738
  _lastLogTime = 0;
@@ -7807,6 +7920,34 @@ var import_types2 = require("@math.gl/types");
7807
7920
  var LOG_DRAW_PRIORITY2 = 2;
7808
7921
  var LOG_DRAW_TIMEOUT2 = 1e4;
7809
7922
  var Computation = class _Computation {
7923
+ /**
7924
+ * Creates a computation while allowing the backend to compile its pipeline asynchronously.
7925
+ *
7926
+ * Use this factory when several independent computations can be prepared together. Calling the
7927
+ * constructor remains the synchronous compatibility path.
7928
+ */
7929
+ static async createAsync(device, props) {
7930
+ const ownsCompilation = !import_core27.PipelineFactory.getAsyncCompilation(device);
7931
+ const asyncCompilation = ownsCompilation ? import_core27.PipelineFactory.beginAsyncCompilation(device) : import_core27.PipelineFactory.getAsyncCompilation(device);
7932
+ let computation;
7933
+ try {
7934
+ computation = new _Computation(device, props);
7935
+ } finally {
7936
+ if (ownsCompilation)
7937
+ import_core27.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
7938
+ }
7939
+ try {
7940
+ if (ownsCompilation) {
7941
+ await Promise.all(asyncCompilation);
7942
+ } else {
7943
+ await computation._pipelineInitialization;
7944
+ }
7945
+ return computation;
7946
+ } catch (error) {
7947
+ computation.destroy();
7948
+ throw error;
7949
+ }
7950
+ }
7810
7951
  static defaultProps = {
7811
7952
  ...import_core27.ComputePipeline.defaultProps,
7812
7953
  id: "unnamed",
@@ -7845,6 +7986,7 @@ var Computation = class _Computation {
7845
7986
  _getModuleUniforms;
7846
7987
  props;
7847
7988
  _destroyed = false;
7989
+ _pipelineInitialization;
7848
7990
  constructor(device, props) {
7849
7991
  var _a, _b;
7850
7992
  if (device.type !== "webgpu") {
@@ -7886,7 +8028,13 @@ var Computation = class _Computation {
7886
8028
  this._getModuleUniforms = getUniforms2;
7887
8029
  const inferredShaderLayout = assembledShaderLayout ?? ((_b = device.getShaderLayout) == null ? void 0 : _b.call(device, this.source, { scanVertexAttributes: false }));
7888
8030
  this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout || inferredShaderLayout || null, modules) || null;
7889
- this.pipeline = this._updatePipeline();
8031
+ const asyncCompilation = import_core27.PipelineFactory.getAsyncCompilation(this.device);
8032
+ if (asyncCompilation) {
8033
+ this._pipelineInitialization = this._updatePipelineAsync();
8034
+ asyncCompilation.push(this._pipelineInitialization);
8035
+ } else {
8036
+ this.pipeline = this._updatePipeline();
8037
+ }
7890
8038
  if (props.bindings) {
7891
8039
  this.setBindings(props.bindings);
7892
8040
  }
@@ -7894,8 +8042,10 @@ var Computation = class _Computation {
7894
8042
  destroy() {
7895
8043
  if (this._destroyed)
7896
8044
  return;
7897
- this.pipelineFactory.release(this.pipeline);
7898
- this.shaderFactory.release(this.shader);
8045
+ if (this.pipeline)
8046
+ this.pipelineFactory.release(this.pipeline);
8047
+ if (this.shader)
8048
+ this.shaderFactory.release(this.shader);
7899
8049
  this._uniformStore.destroy();
7900
8050
  this._destroyed = true;
7901
8051
  }
@@ -7990,29 +8140,49 @@ var Computation = class _Computation {
7990
8140
  this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;
7991
8141
  }
7992
8142
  _updatePipeline() {
7993
- if (this._pipelineNeedsUpdate) {
7994
- let prevShader = null;
7995
- if (this.pipeline) {
7996
- import_core27.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
7997
- prevShader = this.shader;
7998
- }
7999
- this._pipelineNeedsUpdate = false;
8000
- this.shader = this.shaderFactory.createShader({
8001
- id: `${this.id}-fragment`,
8002
- stage: "compute",
8003
- source: this.source,
8004
- debugShaders: this.props.debugShaders
8005
- });
8006
- this.pipeline = this.pipelineFactory.createComputePipeline({
8007
- ...this.props,
8008
- shader: this.shader
8009
- });
8010
- if (prevShader) {
8011
- this.shaderFactory.release(prevShader);
8143
+ const update = this._preparePipelineUpdate();
8144
+ if (update) {
8145
+ this.pipeline = this.pipelineFactory.createComputePipeline(update.props);
8146
+ this._finishPipelineUpdate(update.previousShader);
8147
+ }
8148
+ return this.pipeline;
8149
+ }
8150
+ /** Creates or replaces the pipeline through the backend's asynchronous compilation path. */
8151
+ async _updatePipelineAsync() {
8152
+ const update = this._preparePipelineUpdate();
8153
+ if (update) {
8154
+ try {
8155
+ this.pipeline = await this.pipelineFactory.createComputePipelineAsync(update.props);
8156
+ } catch (error) {
8157
+ this.shaderFactory.release(this.shader);
8158
+ this.shader = update.previousShader;
8159
+ this._pipelineNeedsUpdate = "asynchronous pipeline creation failed";
8160
+ throw error;
8012
8161
  }
8162
+ this._finishPipelineUpdate(update.previousShader);
8013
8163
  }
8014
8164
  return this.pipeline;
8015
8165
  }
8166
+ _preparePipelineUpdate() {
8167
+ if (!this._pipelineNeedsUpdate)
8168
+ return null;
8169
+ const previousShader = this.pipeline ? this.shader : null;
8170
+ if (this.pipeline) {
8171
+ import_core27.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
8172
+ }
8173
+ this._pipelineNeedsUpdate = false;
8174
+ this.shader = this.shaderFactory.createShader({
8175
+ id: `${this.id}-fragment`,
8176
+ stage: "compute",
8177
+ source: this.source,
8178
+ debugShaders: this.props.debugShaders
8179
+ });
8180
+ return { props: { ...this.props, shader: this.shader }, previousShader };
8181
+ }
8182
+ _finishPipelineUpdate(previousShader) {
8183
+ if (previousShader)
8184
+ this.shaderFactory.release(previousShader);
8185
+ }
8016
8186
  /** Throttle draw call logging */
8017
8187
  _lastLogTime = 0;
8018
8188
  _logOpen = false;
@@ -8244,7 +8414,7 @@ var ShaderPassRenderer = class {
8244
8414
  passRenderer.resize(size);
8245
8415
  }
8246
8416
  }
8247
- /** Invalidates persistent pipeline targets without destroying their allocations. */
8417
+ /** Invalidates persistent composite-pass targets without destroying their allocations. */
8248
8418
  resetHistory() {
8249
8419
  for (const passRenderer of this.passRenderers) {
8250
8420
  passRenderer.resetHistory();
@@ -8378,11 +8548,11 @@ var PassRenderer = class {
8378
8548
  this.device = device;
8379
8549
  this.shaderInputs = shaderInputs;
8380
8550
  this.passDefinition = passDefinition;
8381
- if (isShaderPassPipeline(passDefinition)) {
8551
+ if (isCompositeShaderPass(passDefinition)) {
8382
8552
  validateRenderTargetNames(passDefinition.name, passDefinition.renderTargets || {});
8383
8553
  this.renderTargets = createManagedRenderTargets(device, passDefinition.renderTargets || {});
8384
8554
  if (supportsComputeOptimization(device, passDefinition)) {
8385
- this.computeRenderer = new PipelineComputeRenderer(device, passDefinition.compute, this.renderTargets, shaderInputs);
8555
+ this.computeRenderer = new CompositeShaderPassComputeRenderer(device, passDefinition.compute, this.renderTargets, shaderInputs);
8386
8556
  }
8387
8557
  const executableSteps = this.computeRenderer ? passDefinition.steps.filter((step) => !passDefinition.compute.replacedPasses.includes(step.shaderPass.name)) : passDefinition.steps;
8388
8558
  this.subPassExecutions = executableSteps.flatMap((step) => this.createStepExecutions(passDefinition, step, flipY));
@@ -8513,10 +8683,10 @@ var PassRenderer = class {
8513
8683
  }
8514
8684
  return resolvedBindings;
8515
8685
  }
8516
- createStepExecutions(pipeline, step, flipY) {
8517
- validateShaderPassDoesNotOwnRenderTargets(step.shaderPass, `${pipeline.name}/${step.shaderPass.name}`);
8686
+ createStepExecutions(compositeShaderPass, step, flipY) {
8687
+ validateShaderPassDoesNotOwnRenderTargets(step.shaderPass, `${compositeShaderPass.name}/${step.shaderPass.name}`);
8518
8688
  return this.createPassExecutions(step.shaderPass, {
8519
- ownerName: `${pipeline.name}/${step.shaderPass.name}`,
8689
+ ownerName: `${compositeShaderPass.name}/${step.shaderPass.name}`,
8520
8690
  firstInputs: step.inputs,
8521
8691
  lastOutput: step.output,
8522
8692
  uniformOverrides: step.uniforms,
@@ -8560,7 +8730,7 @@ var PassRenderer = class {
8560
8730
  return this.passDefinition.name;
8561
8731
  }
8562
8732
  };
8563
- var PipelineComputeRenderer = class {
8733
+ var CompositeShaderPassComputeRenderer = class {
8564
8734
  optimization;
8565
8735
  renderTargets;
8566
8736
  shaderInputs;
@@ -8685,13 +8855,13 @@ var SubPassRenderer = class {
8685
8855
  }
8686
8856
  };
8687
8857
  function getExecutableShaderPasses(shaderPasses) {
8688
- return shaderPasses.flatMap((shaderPass) => isShaderPassPipeline(shaderPass) ? shaderPass.steps.map((step) => step.shaderPass) : [shaderPass]);
8858
+ return shaderPasses.flatMap((shaderPass) => isCompositeShaderPass(shaderPass) ? shaderPass.steps.map((step) => step.shaderPass) : [shaderPass]);
8689
8859
  }
8690
- function isShaderPassPipeline(shaderPass) {
8860
+ function isCompositeShaderPass(shaderPass) {
8691
8861
  return "steps" in shaderPass;
8692
8862
  }
8693
- function supportsComputeOptimization(device, pipeline) {
8694
- const optimization = pipeline.compute;
8863
+ function supportsComputeOptimization(device, compositeShaderPass) {
8864
+ const optimization = compositeShaderPass.compute;
8695
8865
  if (!optimization || device.type !== "webgpu") {
8696
8866
  return false;
8697
8867
  }
@@ -8701,7 +8871,7 @@ function supportsComputeOptimization(device, pipeline) {
8701
8871
  }
8702
8872
  return outputNames.every((targetName) => {
8703
8873
  var _a;
8704
- const target = (_a = pipeline.renderTargets) == null ? void 0 : _a[targetName];
8874
+ const target = (_a = compositeShaderPass.renderTargets) == null ? void 0 : _a[targetName];
8705
8875
  if (!(target == null ? void 0 : target.storage)) {
8706
8876
  return false;
8707
8877
  }
@@ -8712,7 +8882,7 @@ function supportsComputeOptimization(device, pipeline) {
8712
8882
  function validateShaderPassDoesNotOwnRenderTargets(shaderPass, ownerName) {
8713
8883
  const renderTargets = shaderPass.renderTargets;
8714
8884
  if (renderTargets && Object.keys(renderTargets).length > 0) {
8715
- throw new Error(`${ownerName}: ShaderPass.renderTargets is not supported; use ShaderPassPipeline.renderTargets instead`);
8885
+ throw new Error(`${ownerName}: ShaderPass.renderTargets is not supported; use CompositeShaderPass.renderTargets instead`);
8716
8886
  }
8717
8887
  }
8718
8888
  function validateRenderTargetNames(ownerName, renderTargets) {
@@ -8888,8 +9058,208 @@ function calculateTextureScale(sourceTexture, outputTexture) {
8888
9058
  return [sourceAspect / outputAspect, 1];
8889
9059
  }
8890
9060
 
8891
- // dist/modules/picking/picking-manager.js
9061
+ // dist/compute/kernel.js
8892
9062
  var import_core29 = require("@luma.gl/core");
9063
+ var Kernel = class _Kernel {
9064
+ /** Creates a kernel while allowing the backend to compile its pipeline asynchronously. */
9065
+ static async createAsync(device, props) {
9066
+ const ownsCompilation = !import_core29.PipelineFactory.getAsyncCompilation(device);
9067
+ const asyncCompilation = ownsCompilation ? import_core29.PipelineFactory.beginAsyncCompilation(device) : import_core29.PipelineFactory.getAsyncCompilation(device);
9068
+ let kernel;
9069
+ try {
9070
+ kernel = new _Kernel(device, props);
9071
+ } finally {
9072
+ if (ownsCompilation)
9073
+ import_core29.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
9074
+ }
9075
+ try {
9076
+ if (ownsCompilation) {
9077
+ await Promise.all(asyncCompilation);
9078
+ } else {
9079
+ await kernel._pipelineInitialization;
9080
+ }
9081
+ return kernel;
9082
+ } catch (error) {
9083
+ kernel.destroy();
9084
+ throw error;
9085
+ }
9086
+ }
9087
+ device;
9088
+ id;
9089
+ source;
9090
+ pipelineFactory;
9091
+ shaderFactory;
9092
+ shader;
9093
+ pipeline;
9094
+ _pipelineInitialization;
9095
+ _destroyed = false;
9096
+ constructor(device, props) {
9097
+ if (device.type !== "webgpu") {
9098
+ throw new Error("Kernel is only supported in WebGPU");
9099
+ }
9100
+ const { source: source4, pipelineFactory, shaderFactory, debugShaders, ...pipelineProps } = props;
9101
+ this.device = device;
9102
+ this.id = props.id ?? "kernel";
9103
+ this.source = source4;
9104
+ this.pipelineFactory = pipelineFactory ?? import_core29.PipelineFactory.getDefaultPipelineFactory(device);
9105
+ this.shaderFactory = shaderFactory ?? import_core29.ShaderFactory.getDefaultShaderFactory(device);
9106
+ this.shader = this.shaderFactory.createShader({
9107
+ id: `${this.id}-compute`,
9108
+ stage: "compute",
9109
+ source: this.source,
9110
+ debugShaders
9111
+ });
9112
+ const computePipelineProps = { ...pipelineProps, shader: this.shader };
9113
+ const asyncCompilation = import_core29.PipelineFactory.getAsyncCompilation(device);
9114
+ if (asyncCompilation) {
9115
+ const pipelineInitialization = this.pipelineFactory.createComputePipelineAsync(computePipelineProps);
9116
+ this._pipelineInitialization = pipelineInitialization;
9117
+ asyncCompilation.push(pipelineInitialization.then((pipeline) => {
9118
+ this.pipeline = pipeline;
9119
+ return pipeline;
9120
+ }));
9121
+ } else {
9122
+ this.pipeline = this.pipelineFactory.createComputePipeline(computePipelineProps);
9123
+ }
9124
+ }
9125
+ /** Applies per-dispatch bindings and records a direct compute dispatch. */
9126
+ dispatch(computePass, options) {
9127
+ this._setPipeline(computePass, options.bindings);
9128
+ computePass.dispatch(options.x, options.y, options.z);
9129
+ }
9130
+ /** Applies per-dispatch bindings and records a GPU-driven indirect compute dispatch. */
9131
+ dispatchIndirect(computePass, options) {
9132
+ this._setPipeline(computePass, options.bindings);
9133
+ computePass.dispatchIndirect(options.indirectBuffer, options.indirectOffset ?? 0);
9134
+ }
9135
+ destroy() {
9136
+ if (this._destroyed)
9137
+ return;
9138
+ if (this.pipeline)
9139
+ this.pipelineFactory.release(this.pipeline);
9140
+ this.shaderFactory.release(this.shader);
9141
+ this._destroyed = true;
9142
+ }
9143
+ _setPipeline(computePass, bindings = {}) {
9144
+ computePass.setPipeline(this.pipeline);
9145
+ computePass.setBindings(bindings);
9146
+ }
9147
+ };
9148
+
9149
+ // dist/compute/render-kernel.js
9150
+ var import_core30 = require("@luma.gl/core");
9151
+ var RenderKernel = class _RenderKernel {
9152
+ /** Creates a render kernel while allowing the backend to compile its pipeline asynchronously. */
9153
+ static async createAsync(device, props) {
9154
+ const ownsCompilation = !import_core30.PipelineFactory.getAsyncCompilation(device);
9155
+ const asyncCompilation = ownsCompilation ? import_core30.PipelineFactory.beginAsyncCompilation(device) : import_core30.PipelineFactory.getAsyncCompilation(device);
9156
+ let kernel;
9157
+ try {
9158
+ kernel = new _RenderKernel(device, props);
9159
+ } finally {
9160
+ if (ownsCompilation)
9161
+ import_core30.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
9162
+ }
9163
+ try {
9164
+ if (ownsCompilation) {
9165
+ await Promise.all(asyncCompilation);
9166
+ } else {
9167
+ await kernel._pipelineInitialization;
9168
+ }
9169
+ return kernel;
9170
+ } catch (error) {
9171
+ kernel.destroy();
9172
+ throw error;
9173
+ }
9174
+ }
9175
+ device;
9176
+ id;
9177
+ vertexSource;
9178
+ fragmentSource;
9179
+ pipelineFactory;
9180
+ shaderFactory;
9181
+ vertexShader;
9182
+ fragmentShader;
9183
+ pipeline;
9184
+ _pipelineInitialization;
9185
+ _destroyed = false;
9186
+ constructor(device, props) {
9187
+ if (device.type !== "webgpu") {
9188
+ throw new Error("RenderKernel is only supported in WebGPU");
9189
+ }
9190
+ const { vertexSource, fragmentSource, pipelineFactory, shaderFactory, debugShaders, ...pipelineProps } = props;
9191
+ this.device = device;
9192
+ this.id = props.id ?? "render-kernel";
9193
+ this.vertexSource = vertexSource;
9194
+ this.fragmentSource = fragmentSource;
9195
+ this.pipelineFactory = pipelineFactory ?? import_core30.PipelineFactory.getDefaultPipelineFactory(device);
9196
+ this.shaderFactory = shaderFactory ?? import_core30.ShaderFactory.getDefaultShaderFactory(device);
9197
+ this.vertexShader = this.shaderFactory.createShader({
9198
+ id: `${this.id}-vertex`,
9199
+ stage: "vertex",
9200
+ source: this.vertexSource,
9201
+ debugShaders
9202
+ });
9203
+ this.fragmentShader = this.fragmentSource ? this.shaderFactory.createShader({
9204
+ id: `${this.id}-fragment`,
9205
+ stage: "fragment",
9206
+ source: this.fragmentSource,
9207
+ debugShaders
9208
+ }) : null;
9209
+ const renderPipelineProps = {
9210
+ ...pipelineProps,
9211
+ vs: this.vertexShader,
9212
+ fs: this.fragmentShader
9213
+ };
9214
+ const asyncCompilation = import_core30.PipelineFactory.getAsyncCompilation(device);
9215
+ if (asyncCompilation) {
9216
+ const pipelineInitialization = this.pipelineFactory.createRenderPipelineAsync(renderPipelineProps);
9217
+ this._pipelineInitialization = pipelineInitialization;
9218
+ asyncCompilation.push(pipelineInitialization.then((pipeline) => {
9219
+ this.pipeline = pipeline;
9220
+ return pipeline;
9221
+ }));
9222
+ } else {
9223
+ this.pipeline = this.pipelineFactory.createRenderPipeline(renderPipelineProps);
9224
+ }
9225
+ }
9226
+ /** Applies per-draw bindings/vertex state and records a direct draw. */
9227
+ draw(renderPass, options) {
9228
+ const { bindings = {}, vertexArray, ...drawOptions } = options;
9229
+ this._setPipeline(renderPass, bindings, vertexArray);
9230
+ return renderPass.draw(drawOptions);
9231
+ }
9232
+ /** Applies per-draw state and records a non-indexed indirect draw. */
9233
+ drawIndirect(renderPass, options) {
9234
+ const { bindings = {}, vertexArray, indirectBuffer, indirectOffset = 0 } = options;
9235
+ this._setPipeline(renderPass, bindings, vertexArray);
9236
+ renderPass.drawIndirect(indirectBuffer, indirectOffset);
9237
+ }
9238
+ /** Applies per-draw state and records an indexed indirect draw. */
9239
+ drawIndexedIndirect(renderPass, options) {
9240
+ const { bindings = {}, vertexArray, indirectBuffer, indirectOffset = 0 } = options;
9241
+ this._setPipeline(renderPass, bindings, vertexArray);
9242
+ renderPass.drawIndexedIndirect(indirectBuffer, indirectOffset);
9243
+ }
9244
+ destroy() {
9245
+ if (this._destroyed)
9246
+ return;
9247
+ if (this.pipeline)
9248
+ this.pipelineFactory.release(this.pipeline);
9249
+ this.shaderFactory.release(this.vertexShader);
9250
+ if (this.fragmentShader)
9251
+ this.shaderFactory.release(this.fragmentShader);
9252
+ this._destroyed = true;
9253
+ }
9254
+ _setPipeline(renderPass, bindings, vertexArray) {
9255
+ renderPass.setPipeline(this.pipeline);
9256
+ renderPass.setBindings(bindings);
9257
+ renderPass.setVertexArray(vertexArray);
9258
+ }
9259
+ };
9260
+
9261
+ // dist/modules/picking/picking-manager.js
9262
+ var import_core31 = require("@luma.gl/core");
8893
9263
 
8894
9264
  // dist/modules/picking/picking-uniforms.js
8895
9265
  var DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
@@ -9148,13 +9518,13 @@ var PickingManager = class _PickingManager {
9148
9518
  format: "rgba8unorm",
9149
9519
  width: 1,
9150
9520
  height: 1,
9151
- usage: import_core29.Texture.RENDER_ATTACHMENT
9521
+ usage: import_core31.Texture.RENDER_ATTACHMENT
9152
9522
  });
9153
9523
  const pickingTexture = this.device.createTexture({
9154
9524
  format: "rg32sint",
9155
9525
  width: 1,
9156
9526
  height: 1,
9157
- usage: import_core29.Texture.RENDER_ATTACHMENT | import_core29.Texture.COPY_SRC
9527
+ usage: import_core31.Texture.RENDER_ATTACHMENT | import_core31.Texture.COPY_SRC
9158
9528
  });
9159
9529
  return this.device.createFramebuffer({
9160
9530
  colorAttachments: [colorTexture, pickingTexture],
@@ -9166,7 +9536,7 @@ var PickingManager = class _PickingManager {
9166
9536
  format: "rgba8unorm",
9167
9537
  width: 1,
9168
9538
  height: 1,
9169
- usage: import_core29.Texture.RENDER_ATTACHMENT | import_core29.Texture.COPY_SRC
9539
+ usage: import_core31.Texture.RENDER_ATTACHMENT | import_core31.Texture.COPY_SRC
9170
9540
  });
9171
9541
  return this.device.createFramebuffer({
9172
9542
  colorAttachments: [pickingTexture],
@@ -9190,7 +9560,7 @@ var PickingManager = class _PickingManager {
9190
9560
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
9191
9561
  const readBuffer = this.device.createBuffer({
9192
9562
  byteLength: layout.byteLength,
9193
- usage: import_core29.Buffer.COPY_DST | import_core29.Buffer.MAP_READ
9563
+ usage: import_core31.Buffer.COPY_DST | import_core31.Buffer.MAP_READ
9194
9564
  });
9195
9565
  try {
9196
9566
  pickTexture.readBuffer({
@@ -9224,7 +9594,7 @@ var PickingManager = class _PickingManager {
9224
9594
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
9225
9595
  const readBuffer = this.device.createBuffer({
9226
9596
  byteLength: layout.byteLength,
9227
- usage: import_core29.Buffer.COPY_DST | import_core29.Buffer.MAP_READ
9597
+ usage: import_core31.Buffer.COPY_DST | import_core31.Buffer.MAP_READ
9228
9598
  });
9229
9599
  try {
9230
9600
  pickTexture.readBuffer({