@luma.gl/engine 9.4.1 → 10.0.0-alpha.1

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 +483 -127
  24. package/dist/dist.min.js +23 -23
  25. package/dist/index.cjs +485 -110
  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 +13 -2
  32. package/dist/model/model.d.ts.map +1 -1
  33. package/dist/model/model.js +137 -66
  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 +4 -4
  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 +149 -87
  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,
@@ -2944,7 +3018,7 @@ var Model = class _Model {
2944
3018
  instanceCount = 0;
2945
3019
  /** Vertex count */
2946
3020
  vertexCount;
2947
- /** Indexed draw count override. Undefined draws the full bound index buffer. */
3021
+ /** Indexed draw count override. Undefined uses vertexCount, then the full bound index buffer. */
2948
3022
  indexCount;
2949
3023
  /** First vertex byte offset for WebGL indexed draws or first vertex for non-indexed draws. */
2950
3024
  firstVertex;
@@ -2985,9 +3059,11 @@ var Model = class _Model {
2985
3059
  _needsRedraw = "initializing";
2986
3060
  _drawBlockedReason = false;
2987
3061
  _destroyed = false;
3062
+ _vertexCountSet = false;
2988
3063
  /** "Time" of last draw. Monotonically increasing timestamp */
2989
3064
  _lastDrawTimestamp = -1;
2990
3065
  _bindingTable = [];
3066
+ _pipelineInitialization;
2991
3067
  get [Symbol.toStringTag]() {
2992
3068
  return "Model";
2993
3069
  }
@@ -2997,11 +3073,13 @@ var Model = class _Model {
2997
3073
  constructor(device, props) {
2998
3074
  var _a;
2999
3075
  const defaultShaderAssembler = _Model.defaultProps.shaderAssembler;
3076
+ const vertexCountSet = Object.hasOwn(props, "vertexCount");
3000
3077
  this.props = {
3001
3078
  ..._Model.defaultProps,
3002
3079
  ...props,
3003
3080
  shaderAssembler: props.shaderAssembler ?? (isShaderAssemblerForLanguage(defaultShaderAssembler, device.info.shadingLanguage) ? defaultShaderAssembler : import_shadertools3.ShaderAssembler.getDefaultShaderAssembler(device.info.shadingLanguage))
3004
3081
  };
3082
+ this._vertexCountSet = vertexCountSet;
3005
3083
  props = this.props;
3006
3084
  this.id = props.id || uid("model");
3007
3085
  this.device = device;
@@ -3074,46 +3152,52 @@ var Model = class _Model {
3074
3152
  }
3075
3153
  this.pipelineFactory = props.pipelineFactory || import_core13.PipelineFactory.getDefaultPipelineFactory(this.device);
3076
3154
  this.shaderFactory = props.shaderFactory || import_core13.ShaderFactory.getDefaultShaderFactory(this.device);
3077
- this.pipeline = this._updatePipeline();
3078
- 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({
3079
3170
  shaderLayout: this.pipeline.shaderLayout,
3080
3171
  bufferLayout: this.pipeline.bufferLayout
3081
3172
  });
3082
- if (this._gpuGeometry) {
3173
+ if (this._gpuGeometry)
3083
3174
  this._setGeometryAttributes(this._gpuGeometry);
3084
- }
3085
- if ("isInstanced" in props) {
3175
+ if ("isInstanced" in props)
3086
3176
  this.isInstanced = props.isInstanced;
3087
- }
3088
- if (props.instanceCount) {
3177
+ if (props.instanceCount)
3089
3178
  this.setInstanceCount(props.instanceCount);
3090
- }
3091
- if (props.vertexCount) {
3179
+ if (props.vertexCount)
3092
3180
  this.setVertexCount(props.vertexCount);
3093
- }
3094
- if (props.indexBuffer) {
3181
+ if (props.indexBuffer)
3095
3182
  this.setIndexBuffer(props.indexBuffer);
3096
- }
3097
- if (props.attributes) {
3183
+ if (props.attributes)
3098
3184
  this.setAttributes(props.attributes);
3099
- }
3100
- if (props.constantAttributes) {
3185
+ if (props.constantAttributes)
3101
3186
  this.setConstantAttributes(props.constantAttributes);
3102
- }
3103
- if (props.bindings) {
3187
+ if (props.bindings)
3104
3188
  this.setBindings(props.bindings);
3105
- }
3106
- if (props.transformFeedback) {
3189
+ if (props.transformFeedback)
3107
3190
  this.transformFeedback = props.transformFeedback;
3108
- }
3109
3191
  }
3110
3192
  destroy() {
3111
3193
  var _a;
3112
3194
  if (!this._destroyed) {
3113
- this.pipelineFactory.release(this.pipeline);
3114
- this.shaderFactory.release(this.pipeline.vs);
3115
- if (this.pipeline.fs && this.pipeline.fs !== this.pipeline.vs) {
3116
- 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
+ }
3117
3201
  }
3118
3202
  this._uniformStore.destroy();
3119
3203
  (_a = this._gpuGeometry) == null ? void 0 : _a.destroy();
@@ -3202,7 +3286,7 @@ var Model = class _Model {
3202
3286
  const syncBindings = this._getBindings(shaderLayout);
3203
3287
  const syncBindGroups = this._getBindGroups(shaderLayout, syncBindings);
3204
3288
  const { indexBuffer } = this.vertexArray;
3205
- const indexCount = indexBuffer ? this.indexCount ?? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
3289
+ const indexCount = indexBuffer ? this.indexCount ?? (this._vertexCountSet ? this.vertexCount : indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2)) : void 0;
3206
3290
  renderPass.setPipeline(this.pipeline);
3207
3291
  renderPass.setBindings(syncBindGroups, {
3208
3292
  _bindGroupCacheKeys: this._getBindGroupCacheKeys()
@@ -3323,6 +3407,7 @@ var Model = class _Model {
3323
3407
  */
3324
3408
  setVertexCount(vertexCount) {
3325
3409
  this.vertexCount = vertexCount;
3410
+ this._vertexCountSet = true;
3326
3411
  this.setNeedsRedraw("vertexCount");
3327
3412
  }
3328
3413
  /** Updates the indexed draw count override. */
@@ -3556,6 +3641,7 @@ var Model = class _Model {
3556
3641
  }
3557
3642
  }
3558
3643
  this.vertexCount = gpuGeometry.vertexCount;
3644
+ this._vertexCountSet = true;
3559
3645
  this.setIndexBuffer(gpuGeometry.indices || null);
3560
3646
  this.setAttributes(gpuGeometry.attributes, { disableWarnings: true });
3561
3647
  this.setAttributes(attributes, { disableWarnings: this.props.disableWarnings });
@@ -3569,33 +3655,57 @@ var Model = class _Model {
3569
3655
  }
3570
3656
  /** Update pipeline if needed */
3571
3657
  _updatePipeline() {
3572
- if (this._pipelineNeedsUpdate) {
3573
- let prevShaderVs = null;
3574
- let prevShaderFs = null;
3575
- if (this.pipeline) {
3576
- import_core13.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
3577
- prevShaderVs = this.pipeline.vs;
3578
- prevShaderFs = this.pipeline.fs;
3579
- }
3580
- this._pipelineNeedsUpdate = false;
3581
- const vs4 = this.shaderFactory.createShader({
3582
- id: `${this.id}-vertex`,
3583
- stage: "vertex",
3584
- 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,
3585
3704
  debugShaders: this.props.debugShaders
3586
3705
  });
3587
- let fs4 = null;
3588
- if (this.source) {
3589
- fs4 = vs4;
3590
- } else if (this.fs) {
3591
- fs4 = this.shaderFactory.createShader({
3592
- id: `${this.id}-fragment`,
3593
- stage: "fragment",
3594
- source: this.source || this.fs,
3595
- debugShaders: this.props.debugShaders
3596
- });
3597
- }
3598
- this.pipeline = this.pipelineFactory.createRenderPipeline({
3706
+ }
3707
+ return {
3708
+ props: {
3599
3709
  ...this.props,
3600
3710
  bindings: void 0,
3601
3711
  bufferLayout: this.bufferLayout,
@@ -3604,17 +3714,25 @@ var Model = class _Model {
3604
3714
  topology: this.topology,
3605
3715
  parameters: this.parameters,
3606
3716
  bindGroups: void 0,
3607
- vs: vs4,
3608
- fs: fs4
3609
- });
3610
- this._attributeInfos = (0, import_core13.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout, this.bufferLayout);
3611
- if (prevShaderVs)
3612
- this.shaderFactory.release(prevShaderVs);
3613
- if (prevShaderFs && prevShaderFs !== prevShaderVs) {
3614
- this.shaderFactory.release(prevShaderFs);
3615
- }
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);
3616
3735
  }
3617
- return this.pipeline;
3618
3736
  }
3619
3737
  /** Throttle draw call logging */
3620
3738
  _lastLogTime = 0;
@@ -7802,6 +7920,34 @@ var import_types2 = require("@math.gl/types");
7802
7920
  var LOG_DRAW_PRIORITY2 = 2;
7803
7921
  var LOG_DRAW_TIMEOUT2 = 1e4;
7804
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
+ }
7805
7951
  static defaultProps = {
7806
7952
  ...import_core27.ComputePipeline.defaultProps,
7807
7953
  id: "unnamed",
@@ -7840,6 +7986,7 @@ var Computation = class _Computation {
7840
7986
  _getModuleUniforms;
7841
7987
  props;
7842
7988
  _destroyed = false;
7989
+ _pipelineInitialization;
7843
7990
  constructor(device, props) {
7844
7991
  var _a, _b;
7845
7992
  if (device.type !== "webgpu") {
@@ -7881,7 +8028,13 @@ var Computation = class _Computation {
7881
8028
  this._getModuleUniforms = getUniforms2;
7882
8029
  const inferredShaderLayout = assembledShaderLayout ?? ((_b = device.getShaderLayout) == null ? void 0 : _b.call(device, this.source, { scanVertexAttributes: false }));
7883
8030
  this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout || inferredShaderLayout || null, modules) || null;
7884
- 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
+ }
7885
8038
  if (props.bindings) {
7886
8039
  this.setBindings(props.bindings);
7887
8040
  }
@@ -7889,8 +8042,10 @@ var Computation = class _Computation {
7889
8042
  destroy() {
7890
8043
  if (this._destroyed)
7891
8044
  return;
7892
- this.pipelineFactory.release(this.pipeline);
7893
- 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);
7894
8049
  this._uniformStore.destroy();
7895
8050
  this._destroyed = true;
7896
8051
  }
@@ -7985,29 +8140,49 @@ var Computation = class _Computation {
7985
8140
  this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;
7986
8141
  }
7987
8142
  _updatePipeline() {
7988
- if (this._pipelineNeedsUpdate) {
7989
- let prevShader = null;
7990
- if (this.pipeline) {
7991
- import_core27.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
7992
- prevShader = this.shader;
7993
- }
7994
- this._pipelineNeedsUpdate = false;
7995
- this.shader = this.shaderFactory.createShader({
7996
- id: `${this.id}-fragment`,
7997
- stage: "compute",
7998
- source: this.source,
7999
- debugShaders: this.props.debugShaders
8000
- });
8001
- this.pipeline = this.pipelineFactory.createComputePipeline({
8002
- ...this.props,
8003
- shader: this.shader
8004
- });
8005
- if (prevShader) {
8006
- 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;
8007
8161
  }
8162
+ this._finishPipelineUpdate(update.previousShader);
8008
8163
  }
8009
8164
  return this.pipeline;
8010
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
+ }
8011
8186
  /** Throttle draw call logging */
8012
8187
  _lastLogTime = 0;
8013
8188
  _logOpen = false;
@@ -8239,7 +8414,7 @@ var ShaderPassRenderer = class {
8239
8414
  passRenderer.resize(size);
8240
8415
  }
8241
8416
  }
8242
- /** Invalidates persistent pipeline targets without destroying their allocations. */
8417
+ /** Invalidates persistent composite-pass targets without destroying their allocations. */
8243
8418
  resetHistory() {
8244
8419
  for (const passRenderer of this.passRenderers) {
8245
8420
  passRenderer.resetHistory();
@@ -8373,11 +8548,11 @@ var PassRenderer = class {
8373
8548
  this.device = device;
8374
8549
  this.shaderInputs = shaderInputs;
8375
8550
  this.passDefinition = passDefinition;
8376
- if (isShaderPassPipeline(passDefinition)) {
8551
+ if (isCompositeShaderPass(passDefinition)) {
8377
8552
  validateRenderTargetNames(passDefinition.name, passDefinition.renderTargets || {});
8378
8553
  this.renderTargets = createManagedRenderTargets(device, passDefinition.renderTargets || {});
8379
8554
  if (supportsComputeOptimization(device, passDefinition)) {
8380
- this.computeRenderer = new PipelineComputeRenderer(device, passDefinition.compute, this.renderTargets, shaderInputs);
8555
+ this.computeRenderer = new CompositeShaderPassComputeRenderer(device, passDefinition.compute, this.renderTargets, shaderInputs);
8381
8556
  }
8382
8557
  const executableSteps = this.computeRenderer ? passDefinition.steps.filter((step) => !passDefinition.compute.replacedPasses.includes(step.shaderPass.name)) : passDefinition.steps;
8383
8558
  this.subPassExecutions = executableSteps.flatMap((step) => this.createStepExecutions(passDefinition, step, flipY));
@@ -8508,10 +8683,10 @@ var PassRenderer = class {
8508
8683
  }
8509
8684
  return resolvedBindings;
8510
8685
  }
8511
- createStepExecutions(pipeline, step, flipY) {
8512
- validateShaderPassDoesNotOwnRenderTargets(step.shaderPass, `${pipeline.name}/${step.shaderPass.name}`);
8686
+ createStepExecutions(compositeShaderPass, step, flipY) {
8687
+ validateShaderPassDoesNotOwnRenderTargets(step.shaderPass, `${compositeShaderPass.name}/${step.shaderPass.name}`);
8513
8688
  return this.createPassExecutions(step.shaderPass, {
8514
- ownerName: `${pipeline.name}/${step.shaderPass.name}`,
8689
+ ownerName: `${compositeShaderPass.name}/${step.shaderPass.name}`,
8515
8690
  firstInputs: step.inputs,
8516
8691
  lastOutput: step.output,
8517
8692
  uniformOverrides: step.uniforms,
@@ -8555,7 +8730,7 @@ var PassRenderer = class {
8555
8730
  return this.passDefinition.name;
8556
8731
  }
8557
8732
  };
8558
- var PipelineComputeRenderer = class {
8733
+ var CompositeShaderPassComputeRenderer = class {
8559
8734
  optimization;
8560
8735
  renderTargets;
8561
8736
  shaderInputs;
@@ -8680,13 +8855,13 @@ var SubPassRenderer = class {
8680
8855
  }
8681
8856
  };
8682
8857
  function getExecutableShaderPasses(shaderPasses) {
8683
- 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]);
8684
8859
  }
8685
- function isShaderPassPipeline(shaderPass) {
8860
+ function isCompositeShaderPass(shaderPass) {
8686
8861
  return "steps" in shaderPass;
8687
8862
  }
8688
- function supportsComputeOptimization(device, pipeline) {
8689
- const optimization = pipeline.compute;
8863
+ function supportsComputeOptimization(device, compositeShaderPass) {
8864
+ const optimization = compositeShaderPass.compute;
8690
8865
  if (!optimization || device.type !== "webgpu") {
8691
8866
  return false;
8692
8867
  }
@@ -8696,7 +8871,7 @@ function supportsComputeOptimization(device, pipeline) {
8696
8871
  }
8697
8872
  return outputNames.every((targetName) => {
8698
8873
  var _a;
8699
- const target = (_a = pipeline.renderTargets) == null ? void 0 : _a[targetName];
8874
+ const target = (_a = compositeShaderPass.renderTargets) == null ? void 0 : _a[targetName];
8700
8875
  if (!(target == null ? void 0 : target.storage)) {
8701
8876
  return false;
8702
8877
  }
@@ -8707,7 +8882,7 @@ function supportsComputeOptimization(device, pipeline) {
8707
8882
  function validateShaderPassDoesNotOwnRenderTargets(shaderPass, ownerName) {
8708
8883
  const renderTargets = shaderPass.renderTargets;
8709
8884
  if (renderTargets && Object.keys(renderTargets).length > 0) {
8710
- 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`);
8711
8886
  }
8712
8887
  }
8713
8888
  function validateRenderTargetNames(ownerName, renderTargets) {
@@ -8883,8 +9058,208 @@ function calculateTextureScale(sourceTexture, outputTexture) {
8883
9058
  return [sourceAspect / outputAspect, 1];
8884
9059
  }
8885
9060
 
8886
- // dist/modules/picking/picking-manager.js
9061
+ // dist/compute/kernel.js
8887
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");
8888
9263
 
8889
9264
  // dist/modules/picking/picking-uniforms.js
8890
9265
  var DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
@@ -9143,13 +9518,13 @@ var PickingManager = class _PickingManager {
9143
9518
  format: "rgba8unorm",
9144
9519
  width: 1,
9145
9520
  height: 1,
9146
- usage: import_core29.Texture.RENDER_ATTACHMENT
9521
+ usage: import_core31.Texture.RENDER_ATTACHMENT
9147
9522
  });
9148
9523
  const pickingTexture = this.device.createTexture({
9149
9524
  format: "rg32sint",
9150
9525
  width: 1,
9151
9526
  height: 1,
9152
- usage: import_core29.Texture.RENDER_ATTACHMENT | import_core29.Texture.COPY_SRC
9527
+ usage: import_core31.Texture.RENDER_ATTACHMENT | import_core31.Texture.COPY_SRC
9153
9528
  });
9154
9529
  return this.device.createFramebuffer({
9155
9530
  colorAttachments: [colorTexture, pickingTexture],
@@ -9161,7 +9536,7 @@ var PickingManager = class _PickingManager {
9161
9536
  format: "rgba8unorm",
9162
9537
  width: 1,
9163
9538
  height: 1,
9164
- usage: import_core29.Texture.RENDER_ATTACHMENT | import_core29.Texture.COPY_SRC
9539
+ usage: import_core31.Texture.RENDER_ATTACHMENT | import_core31.Texture.COPY_SRC
9165
9540
  });
9166
9541
  return this.device.createFramebuffer({
9167
9542
  colorAttachments: [pickingTexture],
@@ -9185,7 +9560,7 @@ var PickingManager = class _PickingManager {
9185
9560
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
9186
9561
  const readBuffer = this.device.createBuffer({
9187
9562
  byteLength: layout.byteLength,
9188
- usage: import_core29.Buffer.COPY_DST | import_core29.Buffer.MAP_READ
9563
+ usage: import_core31.Buffer.COPY_DST | import_core31.Buffer.MAP_READ
9189
9564
  });
9190
9565
  try {
9191
9566
  pickTexture.readBuffer({
@@ -9219,7 +9594,7 @@ var PickingManager = class _PickingManager {
9219
9594
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
9220
9595
  const readBuffer = this.device.createBuffer({
9221
9596
  byteLength: layout.byteLength,
9222
- usage: import_core29.Buffer.COPY_DST | import_core29.Buffer.MAP_READ
9597
+ usage: import_core31.Buffer.COPY_DST | import_core31.Buffer.MAP_READ
9223
9598
  });
9224
9599
  try {
9225
9600
  pickTexture.readBuffer({