@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/dist.dev.js CHANGED
@@ -82,6 +82,7 @@ var __exports__ = (() => {
82
82
  Geometry: () => Geometry,
83
83
  GroupNode: () => GroupNode,
84
84
  IcoSphereGeometry: () => IcoSphereGeometry,
85
+ Kernel: () => Kernel,
85
86
  KeyFrames: () => KeyFrames,
86
87
  LegacyPickingManager: () => LegacyPickingManager,
87
88
  Material: () => Material,
@@ -92,6 +93,7 @@ var __exports__ = (() => {
92
93
  PickingManager: () => PickingManager,
93
94
  PlaneGeometry: () => PlaneGeometry,
94
95
  PointLightModel: () => PointLightModel,
96
+ RenderKernel: () => RenderKernel,
95
97
  ScenegraphNode: () => ScenegraphNode,
96
98
  ShaderInputs: () => ShaderInputs,
97
99
  ShaderPassRenderer: () => ShaderPassRenderer,
@@ -3472,6 +3474,7 @@ var __exports__ = (() => {
3472
3474
  var AnimationLoop = class _AnimationLoop {
3473
3475
  static defaultAnimationLoopProps = {
3474
3476
  device: null,
3477
+ mobileQuality: void 0,
3475
3478
  onAddHTML: () => "",
3476
3479
  onInitialize: async () => null,
3477
3480
  onRender: () => {
@@ -3764,8 +3767,9 @@ var __exports__ = (() => {
3764
3767
  tock: 0,
3765
3768
  // Experimental
3766
3769
  animationFrame: null,
3767
- _mousePosition: null
3770
+ _mousePosition: null,
3768
3771
  // Event props
3772
+ mobileQuality: this.props.mobileQuality
3769
3773
  };
3770
3774
  }
3771
3775
  _getAnimationProps() {
@@ -4004,6 +4008,7 @@ var __exports__ = (() => {
4004
4008
  distance: 10,
4005
4009
  yaw: 0,
4006
4010
  pitch: 0.25,
4011
+ roll: 0,
4007
4012
  minDistance: 1,
4008
4013
  maxDistance: 100,
4009
4014
  minPitch: -Math.PI / 2 + 0.01,
@@ -4011,6 +4016,7 @@ var __exports__ = (() => {
4011
4016
  rotateSpeed: 6e-3,
4012
4017
  zoomSpeed: 1e-3,
4013
4018
  enabled: true,
4019
+ enableRotate: false,
4014
4020
  enableZoom: true,
4015
4021
  enablePan: false,
4016
4022
  panSpeed: 18e-4,
@@ -4022,11 +4028,13 @@ var __exports__ = (() => {
4022
4028
  props;
4023
4029
  yaw;
4024
4030
  pitch;
4031
+ roll;
4025
4032
  distance;
4026
4033
  dragging = false;
4027
4034
  activePointers = /* @__PURE__ */ new Map();
4028
4035
  lastPointer = [0, 0];
4029
4036
  previousPinchDistance = null;
4037
+ previousPinchAngle = null;
4030
4038
  previousTimeMilliseconds = null;
4031
4039
  previousCursor;
4032
4040
  previousTouchAction;
@@ -4036,6 +4044,7 @@ var __exports__ = (() => {
4036
4044
  this.props.target = [...this.props.target];
4037
4045
  this.yaw = this.props.yaw;
4038
4046
  this.pitch = clampNumber(this.props.pitch, this.props.minPitch, this.props.maxPitch);
4047
+ this.roll = this.props.roll;
4039
4048
  this.distance = clampNumber(
4040
4049
  this.props.distance,
4041
4050
  this.props.minDistance,
@@ -4071,6 +4080,32 @@ var __exports__ = (() => {
4071
4080
  this.props.target[2] + horizontalDistance * Math.cos(this.yaw)
4072
4081
  ];
4073
4082
  }
4083
+ /** Returns the camera up direction after applying pitch and optional two-finger roll. */
4084
+ getUpDirection() {
4085
+ return this.getCameraFrame().up;
4086
+ }
4087
+ getCameraFrame() {
4088
+ const sineYaw = Math.sin(this.yaw);
4089
+ const cosineYaw = Math.cos(this.yaw);
4090
+ const sinePitch = Math.sin(this.pitch);
4091
+ const cosinePitch = Math.cos(this.pitch);
4092
+ const sineRoll = Math.sin(this.roll);
4093
+ const cosineRoll = Math.cos(this.roll);
4094
+ const right = [cosineYaw, 0, -sineYaw];
4095
+ const up = [-sinePitch * sineYaw, cosinePitch, -sinePitch * cosineYaw];
4096
+ return {
4097
+ right: [
4098
+ right[0] * cosineRoll - up[0] * sineRoll,
4099
+ right[1] * cosineRoll - up[1] * sineRoll,
4100
+ right[2] * cosineRoll - up[2] * sineRoll
4101
+ ],
4102
+ up: [
4103
+ up[0] * cosineRoll + right[0] * sineRoll,
4104
+ up[1] * cosineRoll + right[1] * sineRoll,
4105
+ up[2] * cosineRoll + right[2] * sineRoll
4106
+ ]
4107
+ };
4108
+ }
4074
4109
  /** Enables or pauses automatic rotation without losing the current manual angle. */
4075
4110
  setAutoRotate(autoRotate) {
4076
4111
  this.props.autoRotate = autoRotate;
@@ -4090,6 +4125,9 @@ var __exports__ = (() => {
4090
4125
  if (props.pitch !== void 0 || props.minPitch !== void 0 || props.maxPitch !== void 0) {
4091
4126
  this.pitch = clampNumber(props.pitch ?? this.pitch, this.props.minPitch, this.props.maxPitch);
4092
4127
  }
4128
+ if (props.roll !== void 0) {
4129
+ this.roll = props.roll;
4130
+ }
4093
4131
  if (props.distance !== void 0 || props.minDistance !== void 0 || props.maxDistance !== void 0) {
4094
4132
  this.distance = clampNumber(
4095
4133
  props.distance ?? this.distance,
@@ -4098,10 +4136,11 @@ var __exports__ = (() => {
4098
4136
  );
4099
4137
  }
4100
4138
  }
4101
- /** Restores the configured starting angle and zoom. */
4139
+ /** Restores the configured starting orbit, roll, and zoom. */
4102
4140
  reset() {
4103
4141
  this.yaw = this.props.yaw;
4104
4142
  this.pitch = clampNumber(this.props.pitch, this.props.minPitch, this.props.maxPitch);
4143
+ this.roll = this.props.roll;
4105
4144
  this.distance = clampNumber(
4106
4145
  this.props.distance,
4107
4146
  this.props.minDistance,
@@ -4130,9 +4169,10 @@ var __exports__ = (() => {
4130
4169
  if (this.activePointers.size === 1) {
4131
4170
  this.lastPointer = [event.clientX, event.clientY];
4132
4171
  } else {
4133
- const { center, distance } = this.getMultiPointerState();
4172
+ const { center, distance, angle: angle2 } = this.getMultiPointerState();
4134
4173
  this.lastPointer = center;
4135
4174
  this.previousPinchDistance = distance;
4175
+ this.previousPinchAngle = distance > 0 ? angle2 : null;
4136
4176
  }
4137
4177
  this.canvas.setPointerCapture(event.pointerId);
4138
4178
  this.canvas.style.cursor = "grabbing";
@@ -4143,7 +4183,7 @@ var __exports__ = (() => {
4143
4183
  }
4144
4184
  this.activePointers.set(event.pointerId, [event.clientX, event.clientY]);
4145
4185
  if (this.activePointers.size > 1) {
4146
- const { center, distance } = this.getMultiPointerState();
4186
+ const { center, distance, angle: angle2 } = this.getMultiPointerState();
4147
4187
  if (this.props.enablePan) {
4148
4188
  this.panTarget(center[0] - this.lastPointer[0], center[1] - this.lastPointer[1]);
4149
4189
  }
@@ -4154,8 +4194,12 @@ var __exports__ = (() => {
4154
4194
  this.props.maxDistance
4155
4195
  );
4156
4196
  }
4197
+ if (this.props.enableRotate && this.previousPinchAngle !== null && distance > 0) {
4198
+ this.roll += normalizeAngleDelta(angle2 - this.previousPinchAngle);
4199
+ }
4157
4200
  this.lastPointer = center;
4158
4201
  this.previousPinchDistance = distance;
4202
+ this.previousPinchAngle = distance > 0 ? angle2 : null;
4159
4203
  return;
4160
4204
  }
4161
4205
  const deltaX = event.clientX - this.lastPointer[0];
@@ -4181,6 +4225,7 @@ var __exports__ = (() => {
4181
4225
  }
4182
4226
  this.activePointers.delete(event.pointerId);
4183
4227
  this.previousPinchDistance = null;
4228
+ this.previousPinchAngle = null;
4184
4229
  const remainingPointer = this.activePointers.entries().next().value;
4185
4230
  if (remainingPointer) {
4186
4231
  this.lastPointer = remainingPointer[1];
@@ -4197,6 +4242,7 @@ var __exports__ = (() => {
4197
4242
  }
4198
4243
  this.activePointers.clear();
4199
4244
  this.previousPinchDistance = null;
4245
+ this.previousPinchAngle = null;
4200
4246
  this.canvas.style.cursor = "grab";
4201
4247
  }
4202
4248
  getMultiPointerState() {
@@ -4205,15 +4251,17 @@ var __exports__ = (() => {
4205
4251
  const deltaY = secondPointer[1] - firstPointer[1];
4206
4252
  return {
4207
4253
  center: [(firstPointer[0] + secondPointer[0]) / 2, (firstPointer[1] + secondPointer[1]) / 2],
4208
- distance: Math.hypot(deltaX, deltaY)
4254
+ distance: Math.hypot(deltaX, deltaY),
4255
+ angle: Math.atan2(deltaY, deltaX)
4209
4256
  };
4210
4257
  }
4211
4258
  panTarget(deltaX, deltaY) {
4212
4259
  const panScale = this.distance * this.props.panSpeed;
4260
+ const { right, up } = this.getCameraFrame();
4213
4261
  this.props.target = [
4214
- this.props.target[0] - Math.cos(this.yaw) * deltaX * panScale,
4215
- this.props.target[1] + deltaY * panScale,
4216
- this.props.target[2] + Math.sin(this.yaw) * deltaX * panScale
4262
+ this.props.target[0] + (-right[0] * deltaX + up[0] * deltaY) * panScale,
4263
+ this.props.target[1] + (-right[1] * deltaX + up[1] * deltaY) * panScale,
4264
+ this.props.target[2] + (-right[2] * deltaX + up[2] * deltaY) * panScale
4217
4265
  ];
4218
4266
  }
4219
4267
  handleWheel = (event) => {
@@ -4233,6 +4281,9 @@ var __exports__ = (() => {
4233
4281
  function clampNumber(value, minimum, maximum) {
4234
4282
  return Math.min(Math.max(value, minimum), maximum);
4235
4283
  }
4284
+ function normalizeAngleDelta(angle2) {
4285
+ return Math.atan2(Math.sin(angle2), Math.cos(angle2));
4286
+ }
4236
4287
 
4237
4288
  // src/model/model.ts
4238
4289
  var import_core13 = __toESM(require_core(), 1);
@@ -5270,6 +5321,28 @@ var __exports__ = (() => {
5270
5321
  "depth32float-stencil8"
5271
5322
  ];
5272
5323
  var Model = class _Model {
5324
+ /** Creates a model while allowing the backend to compile its render pipeline asynchronously. */
5325
+ static async createAsync(device, props) {
5326
+ const ownsCompilation = !import_core13.PipelineFactory.getAsyncCompilation(device);
5327
+ const asyncCompilation = ownsCompilation ? import_core13.PipelineFactory.beginAsyncCompilation(device) : import_core13.PipelineFactory.getAsyncCompilation(device);
5328
+ let model;
5329
+ try {
5330
+ model = new _Model(device, props);
5331
+ } finally {
5332
+ if (ownsCompilation) import_core13.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
5333
+ }
5334
+ try {
5335
+ if (ownsCompilation) {
5336
+ await Promise.all(asyncCompilation);
5337
+ } else {
5338
+ await model._pipelineInitialization;
5339
+ }
5340
+ return model;
5341
+ } catch (error) {
5342
+ model.destroy();
5343
+ throw error;
5344
+ }
5345
+ }
5273
5346
  static defaultProps = {
5274
5347
  ...import_core13.RenderPipeline.defaultProps,
5275
5348
  source: void 0,
@@ -5336,7 +5409,7 @@ var __exports__ = (() => {
5336
5409
  instanceCount = 0;
5337
5410
  /** Vertex count */
5338
5411
  vertexCount;
5339
- /** Indexed draw count override. Undefined draws the full bound index buffer. */
5412
+ /** Indexed draw count override. Undefined uses vertexCount, then the full bound index buffer. */
5340
5413
  indexCount;
5341
5414
  /** First vertex byte offset for WebGL indexed draws or first vertex for non-indexed draws. */
5342
5415
  firstVertex;
@@ -5377,9 +5450,11 @@ var __exports__ = (() => {
5377
5450
  _needsRedraw = "initializing";
5378
5451
  _drawBlockedReason = false;
5379
5452
  _destroyed = false;
5453
+ _vertexCountSet = false;
5380
5454
  /** "Time" of last draw. Monotonically increasing timestamp */
5381
5455
  _lastDrawTimestamp = -1;
5382
5456
  _bindingTable = [];
5457
+ _pipelineInitialization;
5383
5458
  get [Symbol.toStringTag]() {
5384
5459
  return "Model";
5385
5460
  }
@@ -5388,11 +5463,13 @@ var __exports__ = (() => {
5388
5463
  }
5389
5464
  constructor(device, props) {
5390
5465
  const defaultShaderAssembler = _Model.defaultProps.shaderAssembler;
5466
+ const vertexCountSet = Object.hasOwn(props, "vertexCount");
5391
5467
  this.props = {
5392
5468
  ..._Model.defaultProps,
5393
5469
  ...props,
5394
5470
  shaderAssembler: props.shaderAssembler ?? (isShaderAssemblerForLanguage(defaultShaderAssembler, device.info.shadingLanguage) ? defaultShaderAssembler : import_shadertools3.ShaderAssembler.getDefaultShaderAssembler(device.info.shadingLanguage))
5395
5471
  };
5472
+ this._vertexCountSet = vertexCountSet;
5396
5473
  props = this.props;
5397
5474
  this.id = props.id || uid("model");
5398
5475
  this.device = device;
@@ -5482,45 +5559,42 @@ var __exports__ = (() => {
5482
5559
  }
5483
5560
  this.pipelineFactory = props.pipelineFactory || import_core13.PipelineFactory.getDefaultPipelineFactory(this.device);
5484
5561
  this.shaderFactory = props.shaderFactory || import_core13.ShaderFactory.getDefaultShaderFactory(this.device);
5485
- this.pipeline = this._updatePipeline();
5486
- this.vertexArray = device.createVertexArray({
5562
+ const asyncCompilation = import_core13.PipelineFactory.getAsyncCompilation(this.device);
5563
+ if (asyncCompilation) {
5564
+ this._pipelineInitialization = this._initializePipelineAsync(props);
5565
+ asyncCompilation.push(this._pipelineInitialization);
5566
+ } else {
5567
+ this.pipeline = this._updatePipeline();
5568
+ this._initializePipelineResources(props);
5569
+ }
5570
+ }
5571
+ async _initializePipelineAsync(props) {
5572
+ await this._updatePipelineAsync();
5573
+ this._initializePipelineResources(props);
5574
+ }
5575
+ _initializePipelineResources(props) {
5576
+ this.vertexArray = this.device.createVertexArray({
5487
5577
  shaderLayout: this.pipeline.shaderLayout,
5488
5578
  bufferLayout: this.pipeline.bufferLayout
5489
5579
  });
5490
- if (this._gpuGeometry) {
5491
- this._setGeometryAttributes(this._gpuGeometry);
5492
- }
5493
- if ("isInstanced" in props) {
5494
- this.isInstanced = props.isInstanced;
5495
- }
5496
- if (props.instanceCount) {
5497
- this.setInstanceCount(props.instanceCount);
5498
- }
5499
- if (props.vertexCount) {
5500
- this.setVertexCount(props.vertexCount);
5501
- }
5502
- if (props.indexBuffer) {
5503
- this.setIndexBuffer(props.indexBuffer);
5504
- }
5505
- if (props.attributes) {
5506
- this.setAttributes(props.attributes);
5507
- }
5508
- if (props.constantAttributes) {
5509
- this.setConstantAttributes(props.constantAttributes);
5510
- }
5511
- if (props.bindings) {
5512
- this.setBindings(props.bindings);
5513
- }
5514
- if (props.transformFeedback) {
5515
- this.transformFeedback = props.transformFeedback;
5516
- }
5580
+ if (this._gpuGeometry) this._setGeometryAttributes(this._gpuGeometry);
5581
+ if ("isInstanced" in props) this.isInstanced = props.isInstanced;
5582
+ if (props.instanceCount) this.setInstanceCount(props.instanceCount);
5583
+ if (props.vertexCount) this.setVertexCount(props.vertexCount);
5584
+ if (props.indexBuffer) this.setIndexBuffer(props.indexBuffer);
5585
+ if (props.attributes) this.setAttributes(props.attributes);
5586
+ if (props.constantAttributes) this.setConstantAttributes(props.constantAttributes);
5587
+ if (props.bindings) this.setBindings(props.bindings);
5588
+ if (props.transformFeedback) this.transformFeedback = props.transformFeedback;
5517
5589
  }
5518
5590
  destroy() {
5519
5591
  if (!this._destroyed) {
5520
- this.pipelineFactory.release(this.pipeline);
5521
- this.shaderFactory.release(this.pipeline.vs);
5522
- if (this.pipeline.fs && this.pipeline.fs !== this.pipeline.vs) {
5523
- this.shaderFactory.release(this.pipeline.fs);
5592
+ if (this.pipeline) {
5593
+ this.pipelineFactory.release(this.pipeline);
5594
+ this.shaderFactory.release(this.pipeline.vs);
5595
+ if (this.pipeline.fs && this.pipeline.fs !== this.pipeline.vs) {
5596
+ this.shaderFactory.release(this.pipeline.fs);
5597
+ }
5524
5598
  }
5525
5599
  this._uniformStore.destroy();
5526
5600
  this._gpuGeometry?.destroy();
@@ -5610,7 +5684,7 @@ var __exports__ = (() => {
5610
5684
  const syncBindings = this._getBindings(shaderLayout);
5611
5685
  const syncBindGroups = this._getBindGroups(shaderLayout, syncBindings);
5612
5686
  const { indexBuffer } = this.vertexArray;
5613
- const indexCount = indexBuffer ? this.indexCount ?? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
5687
+ const indexCount = indexBuffer ? this.indexCount ?? (this._vertexCountSet ? this.vertexCount : indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2)) : void 0;
5614
5688
  renderPass.setPipeline(this.pipeline);
5615
5689
  renderPass.setBindings(syncBindGroups, {
5616
5690
  _bindGroupCacheKeys: this._getBindGroupCacheKeys()
@@ -5733,6 +5807,7 @@ var __exports__ = (() => {
5733
5807
  */
5734
5808
  setVertexCount(vertexCount) {
5735
5809
  this.vertexCount = vertexCount;
5810
+ this._vertexCountSet = true;
5736
5811
  this.setNeedsRedraw("vertexCount");
5737
5812
  }
5738
5813
  /** Updates the indexed draw count override. */
@@ -5978,6 +6053,7 @@ var __exports__ = (() => {
5978
6053
  }
5979
6054
  }
5980
6055
  this.vertexCount = gpuGeometry.vertexCount;
6056
+ this._vertexCountSet = true;
5981
6057
  this.setIndexBuffer(gpuGeometry.indices || null);
5982
6058
  this.setAttributes(gpuGeometry.attributes, { disableWarnings: true });
5983
6059
  this.setAttributes(attributes, { disableWarnings: this.props.disableWarnings });
@@ -5991,36 +6067,55 @@ var __exports__ = (() => {
5991
6067
  }
5992
6068
  /** Update pipeline if needed */
5993
6069
  _updatePipeline() {
5994
- if (this._pipelineNeedsUpdate) {
5995
- let prevShaderVs = null;
5996
- let prevShaderFs = null;
5997
- if (this.pipeline) {
5998
- import_core13.log.log(
5999
- 1,
6000
- `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
6001
- )();
6002
- prevShaderVs = this.pipeline.vs;
6003
- prevShaderFs = this.pipeline.fs;
6004
- }
6005
- this._pipelineNeedsUpdate = false;
6006
- const vs4 = this.shaderFactory.createShader({
6007
- id: `${this.id}-vertex`,
6008
- stage: "vertex",
6009
- source: this.source || this.vs,
6070
+ const update = this._preparePipelineUpdate();
6071
+ if (update) {
6072
+ this.pipeline = this.pipelineFactory.createRenderPipeline(update.props);
6073
+ this._finishPipelineUpdate(update);
6074
+ }
6075
+ return this.pipeline;
6076
+ }
6077
+ /** Creates or replaces the render pipeline through the backend's asynchronous compilation path. */
6078
+ async _updatePipelineAsync() {
6079
+ const update = this._preparePipelineUpdate();
6080
+ if (update) {
6081
+ try {
6082
+ this.pipeline = await this.pipelineFactory.createRenderPipelineAsync(update.props);
6083
+ } catch (error) {
6084
+ this._releasePipelineShaders(update.vertexShader, update.fragmentShader);
6085
+ this._pipelineNeedsUpdate = "asynchronous pipeline creation failed";
6086
+ throw error;
6087
+ }
6088
+ this._finishPipelineUpdate(update);
6089
+ }
6090
+ return this.pipeline;
6091
+ }
6092
+ _preparePipelineUpdate() {
6093
+ if (!this._pipelineNeedsUpdate) return null;
6094
+ const previousVertexShader = this.pipeline?.vs ?? null;
6095
+ const previousFragmentShader = this.pipeline?.fs ?? null;
6096
+ if (this.pipeline) {
6097
+ import_core13.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
6098
+ }
6099
+ this._pipelineNeedsUpdate = false;
6100
+ const vertexShader = this.shaderFactory.createShader({
6101
+ id: `${this.id}-vertex`,
6102
+ stage: "vertex",
6103
+ source: this.source || this.vs,
6104
+ debugShaders: this.props.debugShaders
6105
+ });
6106
+ let fragmentShader = null;
6107
+ if (this.source) {
6108
+ fragmentShader = vertexShader;
6109
+ } else if (this.fs) {
6110
+ fragmentShader = this.shaderFactory.createShader({
6111
+ id: `${this.id}-fragment`,
6112
+ stage: "fragment",
6113
+ source: this.fs,
6010
6114
  debugShaders: this.props.debugShaders
6011
6115
  });
6012
- let fs4 = null;
6013
- if (this.source) {
6014
- fs4 = vs4;
6015
- } else if (this.fs) {
6016
- fs4 = this.shaderFactory.createShader({
6017
- id: `${this.id}-fragment`,
6018
- stage: "fragment",
6019
- source: this.source || this.fs,
6020
- debugShaders: this.props.debugShaders
6021
- });
6022
- }
6023
- this.pipeline = this.pipelineFactory.createRenderPipeline({
6116
+ }
6117
+ return {
6118
+ props: {
6024
6119
  ...this.props,
6025
6120
  bindings: void 0,
6026
6121
  bufferLayout: this.bufferLayout,
@@ -6029,19 +6124,27 @@ var __exports__ = (() => {
6029
6124
  topology: this.topology,
6030
6125
  parameters: this.parameters,
6031
6126
  bindGroups: void 0,
6032
- vs: vs4,
6033
- fs: fs4
6034
- });
6035
- this._attributeInfos = (0, import_core13.getAttributeInfosFromLayouts)(
6036
- this.pipeline.shaderLayout,
6037
- this.bufferLayout
6038
- );
6039
- if (prevShaderVs) this.shaderFactory.release(prevShaderVs);
6040
- if (prevShaderFs && prevShaderFs !== prevShaderVs) {
6041
- this.shaderFactory.release(prevShaderFs);
6042
- }
6127
+ vs: vertexShader,
6128
+ fs: fragmentShader
6129
+ },
6130
+ vertexShader,
6131
+ fragmentShader,
6132
+ previousVertexShader,
6133
+ previousFragmentShader
6134
+ };
6135
+ }
6136
+ _finishPipelineUpdate(update) {
6137
+ this._attributeInfos = (0, import_core13.getAttributeInfosFromLayouts)(
6138
+ this.pipeline.shaderLayout,
6139
+ this.bufferLayout
6140
+ );
6141
+ this._releasePipelineShaders(update.previousVertexShader, update.previousFragmentShader);
6142
+ }
6143
+ _releasePipelineShaders(vertexShader, fragmentShader) {
6144
+ if (vertexShader) this.shaderFactory.release(vertexShader);
6145
+ if (fragmentShader && fragmentShader !== vertexShader) {
6146
+ this.shaderFactory.release(fragmentShader);
6043
6147
  }
6044
- return this.pipeline;
6045
6148
  }
6046
6149
  /** Throttle draw call logging */
6047
6150
  _lastLogTime = 0;
@@ -10290,6 +10393,33 @@ void main(void) {
10290
10393
  var LOG_DRAW_PRIORITY2 = 2;
10291
10394
  var LOG_DRAW_TIMEOUT2 = 1e4;
10292
10395
  var Computation = class _Computation {
10396
+ /**
10397
+ * Creates a computation while allowing the backend to compile its pipeline asynchronously.
10398
+ *
10399
+ * Use this factory when several independent computations can be prepared together. Calling the
10400
+ * constructor remains the synchronous compatibility path.
10401
+ */
10402
+ static async createAsync(device, props) {
10403
+ const ownsCompilation = !import_core27.PipelineFactory.getAsyncCompilation(device);
10404
+ const asyncCompilation = ownsCompilation ? import_core27.PipelineFactory.beginAsyncCompilation(device) : import_core27.PipelineFactory.getAsyncCompilation(device);
10405
+ let computation;
10406
+ try {
10407
+ computation = new _Computation(device, props);
10408
+ } finally {
10409
+ if (ownsCompilation) import_core27.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
10410
+ }
10411
+ try {
10412
+ if (ownsCompilation) {
10413
+ await Promise.all(asyncCompilation);
10414
+ } else {
10415
+ await computation._pipelineInitialization;
10416
+ }
10417
+ return computation;
10418
+ } catch (error) {
10419
+ computation.destroy();
10420
+ throw error;
10421
+ }
10422
+ }
10293
10423
  static defaultProps = {
10294
10424
  ...import_core27.ComputePipeline.defaultProps,
10295
10425
  id: "unnamed",
@@ -10328,6 +10458,7 @@ void main(void) {
10328
10458
  _getModuleUniforms;
10329
10459
  props;
10330
10460
  _destroyed = false;
10461
+ _pipelineInitialization;
10331
10462
  constructor(device, props) {
10332
10463
  if (device.type !== "webgpu") {
10333
10464
  throw new Error("Computation is only supported in WebGPU");
@@ -10378,15 +10509,21 @@ void main(void) {
10378
10509
  this.props.shaderLayout || inferredShaderLayout || null,
10379
10510
  modules
10380
10511
  ) || null;
10381
- this.pipeline = this._updatePipeline();
10512
+ const asyncCompilation = import_core27.PipelineFactory.getAsyncCompilation(this.device);
10513
+ if (asyncCompilation) {
10514
+ this._pipelineInitialization = this._updatePipelineAsync();
10515
+ asyncCompilation.push(this._pipelineInitialization);
10516
+ } else {
10517
+ this.pipeline = this._updatePipeline();
10518
+ }
10382
10519
  if (props.bindings) {
10383
10520
  this.setBindings(props.bindings);
10384
10521
  }
10385
10522
  }
10386
10523
  destroy() {
10387
10524
  if (this._destroyed) return;
10388
- this.pipelineFactory.release(this.pipeline);
10389
- this.shaderFactory.release(this.shader);
10525
+ if (this.pipeline) this.pipelineFactory.release(this.pipeline);
10526
+ if (this.shader) this.shaderFactory.release(this.shader);
10390
10527
  this._uniformStore.destroy();
10391
10528
  this._destroyed = true;
10392
10529
  }
@@ -10481,32 +10618,47 @@ void main(void) {
10481
10618
  this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;
10482
10619
  }
10483
10620
  _updatePipeline() {
10484
- if (this._pipelineNeedsUpdate) {
10485
- let prevShader = null;
10486
- if (this.pipeline) {
10487
- import_core27.log.log(
10488
- 1,
10489
- `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
10490
- )();
10491
- prevShader = this.shader;
10492
- }
10493
- this._pipelineNeedsUpdate = false;
10494
- this.shader = this.shaderFactory.createShader({
10495
- id: `${this.id}-fragment`,
10496
- stage: "compute",
10497
- source: this.source,
10498
- debugShaders: this.props.debugShaders
10499
- });
10500
- this.pipeline = this.pipelineFactory.createComputePipeline({
10501
- ...this.props,
10502
- shader: this.shader
10503
- });
10504
- if (prevShader) {
10505
- this.shaderFactory.release(prevShader);
10621
+ const update = this._preparePipelineUpdate();
10622
+ if (update) {
10623
+ this.pipeline = this.pipelineFactory.createComputePipeline(update.props);
10624
+ this._finishPipelineUpdate(update.previousShader);
10625
+ }
10626
+ return this.pipeline;
10627
+ }
10628
+ /** Creates or replaces the pipeline through the backend's asynchronous compilation path. */
10629
+ async _updatePipelineAsync() {
10630
+ const update = this._preparePipelineUpdate();
10631
+ if (update) {
10632
+ try {
10633
+ this.pipeline = await this.pipelineFactory.createComputePipelineAsync(update.props);
10634
+ } catch (error) {
10635
+ this.shaderFactory.release(this.shader);
10636
+ this.shader = update.previousShader;
10637
+ this._pipelineNeedsUpdate = "asynchronous pipeline creation failed";
10638
+ throw error;
10506
10639
  }
10640
+ this._finishPipelineUpdate(update.previousShader);
10507
10641
  }
10508
10642
  return this.pipeline;
10509
10643
  }
10644
+ _preparePipelineUpdate() {
10645
+ if (!this._pipelineNeedsUpdate) return null;
10646
+ const previousShader = this.pipeline ? this.shader : null;
10647
+ if (this.pipeline) {
10648
+ import_core27.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
10649
+ }
10650
+ this._pipelineNeedsUpdate = false;
10651
+ this.shader = this.shaderFactory.createShader({
10652
+ id: `${this.id}-fragment`,
10653
+ stage: "compute",
10654
+ source: this.source,
10655
+ debugShaders: this.props.debugShaders
10656
+ });
10657
+ return { props: { ...this.props, shader: this.shader }, previousShader };
10658
+ }
10659
+ _finishPipelineUpdate(previousShader) {
10660
+ if (previousShader) this.shaderFactory.release(previousShader);
10661
+ }
10510
10662
  /** Throttle draw call logging */
10511
10663
  _lastLogTime = 0;
10512
10664
  _logOpen = false;
@@ -10743,7 +10895,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
10743
10895
  passRenderer.resize(size);
10744
10896
  }
10745
10897
  }
10746
- /** Invalidates persistent pipeline targets without destroying their allocations. */
10898
+ /** Invalidates persistent composite-pass targets without destroying their allocations. */
10747
10899
  resetHistory() {
10748
10900
  for (const passRenderer of this.passRenderers) {
10749
10901
  passRenderer.resetHistory();
@@ -10884,11 +11036,11 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
10884
11036
  this.device = device;
10885
11037
  this.shaderInputs = shaderInputs;
10886
11038
  this.passDefinition = passDefinition;
10887
- if (isShaderPassPipeline(passDefinition)) {
11039
+ if (isCompositeShaderPass(passDefinition)) {
10888
11040
  validateRenderTargetNames(passDefinition.name, passDefinition.renderTargets || {});
10889
11041
  this.renderTargets = createManagedRenderTargets(device, passDefinition.renderTargets || {});
10890
11042
  if (supportsComputeOptimization(device, passDefinition)) {
10891
- this.computeRenderer = new PipelineComputeRenderer(
11043
+ this.computeRenderer = new CompositeShaderPassComputeRenderer(
10892
11044
  device,
10893
11045
  passDefinition.compute,
10894
11046
  this.renderTargets,
@@ -11036,13 +11188,13 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
11036
11188
  }
11037
11189
  return resolvedBindings;
11038
11190
  }
11039
- createStepExecutions(pipeline, step, flipY) {
11191
+ createStepExecutions(compositeShaderPass, step, flipY) {
11040
11192
  validateShaderPassDoesNotOwnRenderTargets(
11041
11193
  step.shaderPass,
11042
- `${pipeline.name}/${step.shaderPass.name}`
11194
+ `${compositeShaderPass.name}/${step.shaderPass.name}`
11043
11195
  );
11044
11196
  return this.createPassExecutions(step.shaderPass, {
11045
- ownerName: `${pipeline.name}/${step.shaderPass.name}`,
11197
+ ownerName: `${compositeShaderPass.name}/${step.shaderPass.name}`,
11046
11198
  firstInputs: step.inputs,
11047
11199
  lastOutput: step.output,
11048
11200
  uniformOverrides: step.uniforms,
@@ -11086,7 +11238,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
11086
11238
  return this.passDefinition.name;
11087
11239
  }
11088
11240
  };
11089
- var PipelineComputeRenderer = class {
11241
+ var CompositeShaderPassComputeRenderer = class {
11090
11242
  optimization;
11091
11243
  renderTargets;
11092
11244
  shaderInputs;
@@ -11221,14 +11373,14 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
11221
11373
  };
11222
11374
  function getExecutableShaderPasses(shaderPasses) {
11223
11375
  return shaderPasses.flatMap(
11224
- (shaderPass) => isShaderPassPipeline(shaderPass) ? shaderPass.steps.map((step) => step.shaderPass) : [shaderPass]
11376
+ (shaderPass) => isCompositeShaderPass(shaderPass) ? shaderPass.steps.map((step) => step.shaderPass) : [shaderPass]
11225
11377
  );
11226
11378
  }
11227
- function isShaderPassPipeline(shaderPass) {
11379
+ function isCompositeShaderPass(shaderPass) {
11228
11380
  return "steps" in shaderPass;
11229
11381
  }
11230
- function supportsComputeOptimization(device, pipeline) {
11231
- const optimization = pipeline.compute;
11382
+ function supportsComputeOptimization(device, compositeShaderPass) {
11383
+ const optimization = compositeShaderPass.compute;
11232
11384
  if (!optimization || device.type !== "webgpu") {
11233
11385
  return false;
11234
11386
  }
@@ -11237,7 +11389,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
11237
11389
  return false;
11238
11390
  }
11239
11391
  return outputNames.every((targetName) => {
11240
- const target = pipeline.renderTargets?.[targetName];
11392
+ const target = compositeShaderPass.renderTargets?.[targetName];
11241
11393
  if (!target?.storage) {
11242
11394
  return false;
11243
11395
  }
@@ -11249,7 +11401,7 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
11249
11401
  const renderTargets = shaderPass.renderTargets;
11250
11402
  if (renderTargets && Object.keys(renderTargets).length > 0) {
11251
11403
  throw new Error(
11252
- `${ownerName}: ShaderPass.renderTargets is not supported; use ShaderPassPipeline.renderTargets instead`
11404
+ `${ownerName}: ShaderPass.renderTargets is not supported; use CompositeShaderPass.renderTargets instead`
11253
11405
  );
11254
11406
  }
11255
11407
  }
@@ -11438,8 +11590,212 @@ vec2 shaderPassRenderer_getRenderTargetUV(vec2 textureUV) {
11438
11590
  return [sourceAspect / outputAspect, 1];
11439
11591
  }
11440
11592
 
11441
- // src/modules/picking/picking-manager.ts
11593
+ // src/compute/kernel.ts
11442
11594
  var import_core29 = __toESM(require_core(), 1);
11595
+ var Kernel = class _Kernel {
11596
+ /** Creates a kernel while allowing the backend to compile its pipeline asynchronously. */
11597
+ static async createAsync(device, props) {
11598
+ const ownsCompilation = !import_core29.PipelineFactory.getAsyncCompilation(device);
11599
+ const asyncCompilation = ownsCompilation ? import_core29.PipelineFactory.beginAsyncCompilation(device) : import_core29.PipelineFactory.getAsyncCompilation(device);
11600
+ let kernel;
11601
+ try {
11602
+ kernel = new _Kernel(device, props);
11603
+ } finally {
11604
+ if (ownsCompilation) import_core29.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
11605
+ }
11606
+ try {
11607
+ if (ownsCompilation) {
11608
+ await Promise.all(asyncCompilation);
11609
+ } else {
11610
+ await kernel._pipelineInitialization;
11611
+ }
11612
+ return kernel;
11613
+ } catch (error) {
11614
+ kernel.destroy();
11615
+ throw error;
11616
+ }
11617
+ }
11618
+ device;
11619
+ id;
11620
+ source;
11621
+ pipelineFactory;
11622
+ shaderFactory;
11623
+ shader;
11624
+ pipeline;
11625
+ _pipelineInitialization;
11626
+ _destroyed = false;
11627
+ constructor(device, props) {
11628
+ if (device.type !== "webgpu") {
11629
+ throw new Error("Kernel is only supported in WebGPU");
11630
+ }
11631
+ const { source: source4, pipelineFactory, shaderFactory, debugShaders, ...pipelineProps } = props;
11632
+ this.device = device;
11633
+ this.id = props.id ?? "kernel";
11634
+ this.source = source4;
11635
+ this.pipelineFactory = pipelineFactory ?? import_core29.PipelineFactory.getDefaultPipelineFactory(device);
11636
+ this.shaderFactory = shaderFactory ?? import_core29.ShaderFactory.getDefaultShaderFactory(device);
11637
+ this.shader = this.shaderFactory.createShader({
11638
+ id: `${this.id}-compute`,
11639
+ stage: "compute",
11640
+ source: this.source,
11641
+ debugShaders
11642
+ });
11643
+ const computePipelineProps = { ...pipelineProps, shader: this.shader };
11644
+ const asyncCompilation = import_core29.PipelineFactory.getAsyncCompilation(device);
11645
+ if (asyncCompilation) {
11646
+ const pipelineInitialization = this.pipelineFactory.createComputePipelineAsync(computePipelineProps);
11647
+ this._pipelineInitialization = pipelineInitialization;
11648
+ asyncCompilation.push(
11649
+ pipelineInitialization.then((pipeline) => {
11650
+ this.pipeline = pipeline;
11651
+ return pipeline;
11652
+ })
11653
+ );
11654
+ } else {
11655
+ this.pipeline = this.pipelineFactory.createComputePipeline(computePipelineProps);
11656
+ }
11657
+ }
11658
+ /** Applies per-dispatch bindings and records a direct compute dispatch. */
11659
+ dispatch(computePass, options) {
11660
+ this._setPipeline(computePass, options.bindings);
11661
+ computePass.dispatch(options.x, options.y, options.z);
11662
+ }
11663
+ /** Applies per-dispatch bindings and records a GPU-driven indirect compute dispatch. */
11664
+ dispatchIndirect(computePass, options) {
11665
+ this._setPipeline(computePass, options.bindings);
11666
+ computePass.dispatchIndirect(options.indirectBuffer, options.indirectOffset ?? 0);
11667
+ }
11668
+ destroy() {
11669
+ if (this._destroyed) return;
11670
+ if (this.pipeline) this.pipelineFactory.release(this.pipeline);
11671
+ this.shaderFactory.release(this.shader);
11672
+ this._destroyed = true;
11673
+ }
11674
+ _setPipeline(computePass, bindings = {}) {
11675
+ computePass.setPipeline(this.pipeline);
11676
+ computePass.setBindings(bindings);
11677
+ }
11678
+ };
11679
+
11680
+ // src/compute/render-kernel.ts
11681
+ var import_core30 = __toESM(require_core(), 1);
11682
+ var RenderKernel = class _RenderKernel {
11683
+ /** Creates a render kernel while allowing the backend to compile its pipeline asynchronously. */
11684
+ static async createAsync(device, props) {
11685
+ const ownsCompilation = !import_core30.PipelineFactory.getAsyncCompilation(device);
11686
+ const asyncCompilation = ownsCompilation ? import_core30.PipelineFactory.beginAsyncCompilation(device) : import_core30.PipelineFactory.getAsyncCompilation(device);
11687
+ let kernel;
11688
+ try {
11689
+ kernel = new _RenderKernel(device, props);
11690
+ } finally {
11691
+ if (ownsCompilation) import_core30.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
11692
+ }
11693
+ try {
11694
+ if (ownsCompilation) {
11695
+ await Promise.all(asyncCompilation);
11696
+ } else {
11697
+ await kernel._pipelineInitialization;
11698
+ }
11699
+ return kernel;
11700
+ } catch (error) {
11701
+ kernel.destroy();
11702
+ throw error;
11703
+ }
11704
+ }
11705
+ device;
11706
+ id;
11707
+ vertexSource;
11708
+ fragmentSource;
11709
+ pipelineFactory;
11710
+ shaderFactory;
11711
+ vertexShader;
11712
+ fragmentShader;
11713
+ pipeline;
11714
+ _pipelineInitialization;
11715
+ _destroyed = false;
11716
+ constructor(device, props) {
11717
+ if (device.type !== "webgpu") {
11718
+ throw new Error("RenderKernel is only supported in WebGPU");
11719
+ }
11720
+ const {
11721
+ vertexSource,
11722
+ fragmentSource,
11723
+ pipelineFactory,
11724
+ shaderFactory,
11725
+ debugShaders,
11726
+ ...pipelineProps
11727
+ } = props;
11728
+ this.device = device;
11729
+ this.id = props.id ?? "render-kernel";
11730
+ this.vertexSource = vertexSource;
11731
+ this.fragmentSource = fragmentSource;
11732
+ this.pipelineFactory = pipelineFactory ?? import_core30.PipelineFactory.getDefaultPipelineFactory(device);
11733
+ this.shaderFactory = shaderFactory ?? import_core30.ShaderFactory.getDefaultShaderFactory(device);
11734
+ this.vertexShader = this.shaderFactory.createShader({
11735
+ id: `${this.id}-vertex`,
11736
+ stage: "vertex",
11737
+ source: this.vertexSource,
11738
+ debugShaders
11739
+ });
11740
+ this.fragmentShader = this.fragmentSource ? this.shaderFactory.createShader({
11741
+ id: `${this.id}-fragment`,
11742
+ stage: "fragment",
11743
+ source: this.fragmentSource,
11744
+ debugShaders
11745
+ }) : null;
11746
+ const renderPipelineProps = {
11747
+ ...pipelineProps,
11748
+ vs: this.vertexShader,
11749
+ fs: this.fragmentShader
11750
+ };
11751
+ const asyncCompilation = import_core30.PipelineFactory.getAsyncCompilation(device);
11752
+ if (asyncCompilation) {
11753
+ const pipelineInitialization = this.pipelineFactory.createRenderPipelineAsync(renderPipelineProps);
11754
+ this._pipelineInitialization = pipelineInitialization;
11755
+ asyncCompilation.push(
11756
+ pipelineInitialization.then((pipeline) => {
11757
+ this.pipeline = pipeline;
11758
+ return pipeline;
11759
+ })
11760
+ );
11761
+ } else {
11762
+ this.pipeline = this.pipelineFactory.createRenderPipeline(renderPipelineProps);
11763
+ }
11764
+ }
11765
+ /** Applies per-draw bindings/vertex state and records a direct draw. */
11766
+ draw(renderPass, options) {
11767
+ const { bindings = {}, vertexArray, ...drawOptions } = options;
11768
+ this._setPipeline(renderPass, bindings, vertexArray);
11769
+ return renderPass.draw(drawOptions);
11770
+ }
11771
+ /** Applies per-draw state and records a non-indexed indirect draw. */
11772
+ drawIndirect(renderPass, options) {
11773
+ const { bindings = {}, vertexArray, indirectBuffer, indirectOffset = 0 } = options;
11774
+ this._setPipeline(renderPass, bindings, vertexArray);
11775
+ renderPass.drawIndirect(indirectBuffer, indirectOffset);
11776
+ }
11777
+ /** Applies per-draw state and records an indexed indirect draw. */
11778
+ drawIndexedIndirect(renderPass, options) {
11779
+ const { bindings = {}, vertexArray, indirectBuffer, indirectOffset = 0 } = options;
11780
+ this._setPipeline(renderPass, bindings, vertexArray);
11781
+ renderPass.drawIndexedIndirect(indirectBuffer, indirectOffset);
11782
+ }
11783
+ destroy() {
11784
+ if (this._destroyed) return;
11785
+ if (this.pipeline) this.pipelineFactory.release(this.pipeline);
11786
+ this.shaderFactory.release(this.vertexShader);
11787
+ if (this.fragmentShader) this.shaderFactory.release(this.fragmentShader);
11788
+ this._destroyed = true;
11789
+ }
11790
+ _setPipeline(renderPass, bindings, vertexArray) {
11791
+ renderPass.setPipeline(this.pipeline);
11792
+ renderPass.setBindings(bindings);
11793
+ renderPass.setVertexArray(vertexArray);
11794
+ }
11795
+ };
11796
+
11797
+ // src/modules/picking/picking-manager.ts
11798
+ var import_core31 = __toESM(require_core(), 1);
11443
11799
 
11444
11800
  // src/modules/picking/picking-uniforms.ts
11445
11801
  var DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
@@ -11703,13 +12059,13 @@ layout(std140) uniform pickingUniforms {
11703
12059
  format: "rgba8unorm",
11704
12060
  width: 1,
11705
12061
  height: 1,
11706
- usage: import_core29.Texture.RENDER_ATTACHMENT
12062
+ usage: import_core31.Texture.RENDER_ATTACHMENT
11707
12063
  });
11708
12064
  const pickingTexture = this.device.createTexture({
11709
12065
  format: "rg32sint",
11710
12066
  width: 1,
11711
12067
  height: 1,
11712
- usage: import_core29.Texture.RENDER_ATTACHMENT | import_core29.Texture.COPY_SRC
12068
+ usage: import_core31.Texture.RENDER_ATTACHMENT | import_core31.Texture.COPY_SRC
11713
12069
  });
11714
12070
  return this.device.createFramebuffer({
11715
12071
  colorAttachments: [colorTexture, pickingTexture],
@@ -11721,7 +12077,7 @@ layout(std140) uniform pickingUniforms {
11721
12077
  format: "rgba8unorm",
11722
12078
  width: 1,
11723
12079
  height: 1,
11724
- usage: import_core29.Texture.RENDER_ATTACHMENT | import_core29.Texture.COPY_SRC
12080
+ usage: import_core31.Texture.RENDER_ATTACHMENT | import_core31.Texture.COPY_SRC
11725
12081
  });
11726
12082
  return this.device.createFramebuffer({
11727
12083
  colorAttachments: [pickingTexture],
@@ -11743,7 +12099,7 @@ layout(std140) uniform pickingUniforms {
11743
12099
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
11744
12100
  const readBuffer = this.device.createBuffer({
11745
12101
  byteLength: layout.byteLength,
11746
- usage: import_core29.Buffer.COPY_DST | import_core29.Buffer.MAP_READ
12102
+ usage: import_core31.Buffer.COPY_DST | import_core31.Buffer.MAP_READ
11747
12103
  });
11748
12104
  try {
11749
12105
  pickTexture.readBuffer(
@@ -11779,7 +12135,7 @@ layout(std140) uniform pickingUniforms {
11779
12135
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
11780
12136
  const readBuffer = this.device.createBuffer({
11781
12137
  byteLength: layout.byteLength,
11782
- usage: import_core29.Buffer.COPY_DST | import_core29.Buffer.MAP_READ
12138
+ usage: import_core31.Buffer.COPY_DST | import_core31.Buffer.MAP_READ
11783
12139
  });
11784
12140
  try {
11785
12141
  pickTexture.readBuffer(