@ifc-lite/renderer 3.2.0 → 5.0.0
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.
- package/dist/aabb-edges.d.ts +10 -0
- package/dist/aabb-edges.d.ts.map +1 -1
- package/dist/aabb-edges.js +13 -0
- package/dist/aabb-edges.js.map +1 -1
- package/dist/ao-params.d.ts +85 -0
- package/dist/ao-params.d.ts.map +1 -0
- package/dist/ao-params.js +109 -0
- package/dist/ao-params.js.map +1 -0
- package/dist/ao-pass.d.ts +47 -0
- package/dist/ao-pass.d.ts.map +1 -0
- package/dist/ao-pass.js +157 -0
- package/dist/ao-pass.js.map +1 -0
- package/dist/camera-matrices.d.ts +3 -0
- package/dist/camera-matrices.d.ts.map +1 -1
- package/dist/camera-matrices.js +12 -1
- package/dist/camera-matrices.js.map +1 -1
- package/dist/camera-orientation.d.ts +62 -0
- package/dist/camera-orientation.d.ts.map +1 -0
- package/dist/camera-orientation.js +155 -0
- package/dist/camera-orientation.js.map +1 -0
- package/dist/camera-projection.d.ts +3 -1
- package/dist/camera-projection.d.ts.map +1 -1
- package/dist/camera-projection.js +26 -20
- package/dist/camera-projection.js.map +1 -1
- package/dist/camera-surface-zoom.d.ts +32 -0
- package/dist/camera-surface-zoom.d.ts.map +1 -0
- package/dist/camera-surface-zoom.js +37 -0
- package/dist/camera-surface-zoom.js.map +1 -0
- package/dist/camera.d.ts +32 -61
- package/dist/camera.d.ts.map +1 -1
- package/dist/camera.js +71 -167
- package/dist/camera.js.map +1 -1
- package/dist/clash-solid-pipeline.d.ts +9 -3
- package/dist/clash-solid-pipeline.d.ts.map +1 -1
- package/dist/clash-solid-pipeline.js +31 -8
- package/dist/clash-solid-pipeline.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -3
- package/dist/constants.js.map +1 -1
- package/dist/depth-reconstruct.d.ts +43 -0
- package/dist/depth-reconstruct.d.ts.map +1 -0
- package/dist/depth-reconstruct.js +35 -0
- package/dist/depth-reconstruct.js.map +1 -0
- package/dist/device.js +1 -1
- package/dist/device.js.map +1 -1
- package/dist/edge-params.d.ts +43 -0
- package/dist/edge-params.d.ts.map +1 -0
- package/dist/edge-params.js +63 -0
- package/dist/edge-params.js.map +1 -0
- package/dist/edge-pass.d.ts +38 -0
- package/dist/edge-pass.d.ts.map +1 -0
- package/dist/edge-pass.js +111 -0
- package/dist/edge-pass.js.map +1 -0
- package/dist/environment.d.ts +26 -15
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +24 -13
- package/dist/environment.js.map +1 -1
- package/dist/federation-registry.d.ts +16 -0
- package/dist/federation-registry.d.ts.map +1 -1
- package/dist/federation-registry.js +80 -9
- package/dist/federation-registry.js.map +1 -1
- package/dist/gpu-static-upload.d.ts +39 -0
- package/dist/gpu-static-upload.d.ts.map +1 -0
- package/dist/gpu-static-upload.js +70 -0
- package/dist/gpu-static-upload.js.map +1 -0
- package/dist/gpu-upload-guard.d.ts +12 -23
- package/dist/gpu-upload-guard.d.ts.map +1 -1
- package/dist/gpu-upload-guard.js +12 -26
- package/dist/gpu-upload-guard.js.map +1 -1
- package/dist/index.d.ts +58 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -284
- package/dist/index.js.map +1 -1
- package/dist/instanced-render.d.ts +25 -5
- package/dist/instanced-render.d.ts.map +1 -1
- package/dist/instanced-render.js +50 -13
- package/dist/instanced-render.js.map +1 -1
- package/dist/instanced-rte.d.ts +17 -0
- package/dist/instanced-rte.d.ts.map +1 -0
- package/dist/instanced-rte.js +32 -0
- package/dist/instanced-rte.js.map +1 -0
- package/dist/mesh-material.d.ts +26 -0
- package/dist/mesh-material.d.ts.map +1 -0
- package/dist/mesh-material.js +52 -0
- package/dist/mesh-material.js.map +1 -0
- package/dist/mesh-rte-uniforms.d.ts +47 -0
- package/dist/mesh-rte-uniforms.d.ts.map +1 -0
- package/dist/mesh-rte-uniforms.js +60 -0
- package/dist/mesh-rte-uniforms.js.map +1 -0
- package/dist/model-bounds-tracker.d.ts +7 -0
- package/dist/model-bounds-tracker.d.ts.map +1 -1
- package/dist/model-bounds-tracker.js +16 -5
- package/dist/model-bounds-tracker.js.map +1 -1
- package/dist/model-translation.d.ts +1 -1
- package/dist/model-translation.d.ts.map +1 -1
- package/dist/model-translation.js +50 -2
- package/dist/model-translation.js.map +1 -1
- package/dist/overlay-theme-uniforms.d.ts +54 -0
- package/dist/overlay-theme-uniforms.d.ts.map +1 -0
- package/dist/overlay-theme-uniforms.js +89 -0
- package/dist/overlay-theme-uniforms.js.map +1 -0
- package/dist/overlay-theme.d.ts +73 -0
- package/dist/overlay-theme.d.ts.map +1 -0
- package/dist/overlay-theme.js +24 -0
- package/dist/overlay-theme.js.map +1 -0
- package/dist/pick-rte-snapshot.d.ts +7 -0
- package/dist/pick-rte-snapshot.d.ts.map +1 -0
- package/dist/pick-rte-snapshot.js +15 -0
- package/dist/pick-rte-snapshot.js.map +1 -0
- package/dist/pick-types.d.ts +17 -0
- package/dist/pick-types.d.ts.map +1 -0
- package/dist/pick-types.js +5 -0
- package/dist/pick-types.js.map +1 -0
- package/dist/pick-uniforms.d.ts +6 -0
- package/dist/pick-uniforms.d.ts.map +1 -1
- package/dist/pick-uniforms.js +22 -18
- package/dist/pick-uniforms.js.map +1 -1
- package/dist/pick-world-position.d.ts +18 -0
- package/dist/pick-world-position.d.ts.map +1 -0
- package/dist/pick-world-position.js +21 -0
- package/dist/pick-world-position.js.map +1 -0
- package/dist/picker-readbacks.d.ts +6 -0
- package/dist/picker-readbacks.d.ts.map +1 -0
- package/dist/picker-readbacks.js +20 -0
- package/dist/picker-readbacks.js.map +1 -0
- package/dist/picker-rte-uniforms.d.ts +6 -0
- package/dist/picker-rte-uniforms.d.ts.map +1 -0
- package/dist/picker-rte-uniforms.js +41 -0
- package/dist/picker-rte-uniforms.js.map +1 -0
- package/dist/picker.d.ts +6 -7
- package/dist/picker.d.ts.map +1 -1
- package/dist/picker.js +88 -115
- package/dist/picker.js.map +1 -1
- package/dist/picking-manager.d.ts +8 -0
- package/dist/picking-manager.d.ts.map +1 -1
- package/dist/picking-manager.js +46 -19
- package/dist/picking-manager.js.map +1 -1
- package/dist/pipeline.d.ts +3 -7
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +27 -31
- package/dist/pipeline.js.map +1 -1
- package/dist/point-picker.d.ts +5 -1
- package/dist/point-picker.d.ts.map +1 -1
- package/dist/point-picker.js +49 -9
- package/dist/point-picker.js.map +1 -1
- package/dist/pointcloud/point-cloud-handle-ids.d.ts +22 -0
- package/dist/pointcloud/point-cloud-handle-ids.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-handle-ids.js +31 -0
- package/dist/pointcloud/point-cloud-handle-ids.js.map +1 -0
- package/dist/pointcloud/point-cloud-node.d.ts +14 -6
- package/dist/pointcloud/point-cloud-node.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-node.js.map +1 -1
- package/dist/pointcloud/point-cloud-pick-sources.d.ts +47 -0
- package/dist/pointcloud/point-cloud-pick-sources.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-pick-sources.js +32 -0
- package/dist/pointcloud/point-cloud-pick-sources.js.map +1 -0
- package/dist/pointcloud/point-cloud-placement.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-placement.js +20 -5
- package/dist/pointcloud/point-cloud-placement.js.map +1 -1
- package/dist/pointcloud/point-cloud-ray-transform.d.ts +78 -4
- package/dist/pointcloud/point-cloud-ray-transform.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-ray-transform.js +31 -84
- package/dist/pointcloud/point-cloud-ray-transform.js.map +1 -1
- package/dist/pointcloud/point-cloud-renderer.d.ts +21 -19
- package/dist/pointcloud/point-cloud-renderer.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-renderer.js +46 -52
- package/dist/pointcloud/point-cloud-renderer.js.map +1 -1
- package/dist/pointcloud/point-cloud-stream-lifecycle.d.ts +44 -0
- package/dist/pointcloud/point-cloud-stream-lifecycle.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-stream-lifecycle.js +44 -0
- package/dist/pointcloud/point-cloud-stream-lifecycle.js.map +1 -0
- package/dist/pointcloud/point-cloud-uniforms.d.ts +5 -0
- package/dist/pointcloud/point-cloud-uniforms.d.ts.map +1 -1
- package/dist/pointcloud/point-cloud-uniforms.js +55 -44
- package/dist/pointcloud/point-cloud-uniforms.js.map +1 -1
- package/dist/pointcloud/point-cloud-visibility.d.ts +10 -0
- package/dist/pointcloud/point-cloud-visibility.d.ts.map +1 -0
- package/dist/pointcloud/point-cloud-visibility.js +18 -0
- package/dist/pointcloud/point-cloud-visibility.js.map +1 -0
- package/dist/pointcloud/point-pipeline.d.ts +4 -9
- package/dist/pointcloud/point-pipeline.d.ts.map +1 -1
- package/dist/pointcloud/point-pipeline.js +4 -9
- package/dist/pointcloud/point-pipeline.js.map +1 -1
- package/dist/pointcloud/point-shader.wgsl.d.ts +1 -21
- package/dist/pointcloud/point-shader.wgsl.d.ts.map +1 -1
- package/dist/pointcloud/point-shader.wgsl.js +25 -5
- package/dist/pointcloud/point-shader.wgsl.js.map +1 -1
- package/dist/post-pass-chain.d.ts +38 -0
- package/dist/post-pass-chain.d.ts.map +1 -0
- package/dist/post-pass-chain.js +105 -0
- package/dist/post-pass-chain.js.map +1 -0
- package/dist/raycast-engine.d.ts +7 -5
- package/dist/raycast-engine.d.ts.map +1 -1
- package/dist/raycast-engine.js +17 -20
- package/dist/raycast-engine.js.map +1 -1
- package/dist/raycast-point-cloud-query.d.ts +1 -1
- package/dist/raycast-point-cloud-query.d.ts.map +1 -1
- package/dist/reference-image-pipeline.d.ts +1 -1
- package/dist/reference-image-pipeline.d.ts.map +1 -1
- package/dist/reference-image-pipeline.js +25 -7
- package/dist/reference-image-pipeline.js.map +1 -1
- package/dist/reference-images.d.ts +1 -1
- package/dist/reference-images.d.ts.map +1 -1
- package/dist/reference-images.js +13 -5
- package/dist/reference-images.js.map +1 -1
- package/dist/relative-to-eye.d.ts +146 -0
- package/dist/relative-to-eye.d.ts.map +1 -0
- package/dist/relative-to-eye.js +326 -0
- package/dist/relative-to-eye.js.map +1 -0
- package/dist/render-section-draw.d.ts +11 -0
- package/dist/render-section-draw.d.ts.map +1 -1
- package/dist/render-section-draw.js +6 -3
- package/dist/render-section-draw.js.map +1 -1
- package/dist/renderer-color-readback.d.ts +50 -0
- package/dist/renderer-color-readback.d.ts.map +1 -0
- package/dist/renderer-color-readback.js +145 -0
- package/dist/renderer-color-readback.js.map +1 -0
- package/dist/renderer-overlays.d.ts +20 -10
- package/dist/renderer-overlays.d.ts.map +1 -1
- package/dist/renderer-overlays.js +44 -34
- package/dist/renderer-overlays.js.map +1 -1
- package/dist/renderer-screenshot.d.ts +4 -0
- package/dist/renderer-screenshot.d.ts.map +1 -0
- package/dist/renderer-screenshot.js +17 -0
- package/dist/renderer-screenshot.js.map +1 -0
- package/dist/renderer-symbolic-overlays.d.ts +4 -2
- package/dist/renderer-symbolic-overlays.d.ts.map +1 -1
- package/dist/renderer-symbolic-overlays.js +33 -13
- package/dist/renderer-symbolic-overlays.js.map +1 -1
- package/dist/renderer-viewport.d.ts +45 -0
- package/dist/renderer-viewport.d.ts.map +1 -1
- package/dist/renderer-viewport.js +44 -0
- package/dist/renderer-viewport.js.map +1 -1
- package/dist/rte-clip-space.d.ts +12 -0
- package/dist/rte-clip-space.d.ts.map +1 -0
- package/dist/rte-clip-space.js +22 -0
- package/dist/rte-clip-space.js.map +1 -0
- package/dist/rte-frustum.d.ts +24 -0
- package/dist/rte-frustum.d.ts.map +1 -0
- package/dist/rte-frustum.js +45 -0
- package/dist/rte-frustum.js.map +1 -0
- package/dist/scene-batch-upload.d.ts.map +1 -1
- package/dist/scene-batch-upload.js +14 -38
- package/dist/scene-batch-upload.js.map +1 -1
- package/dist/scene-device-recovery.d.ts.map +1 -1
- package/dist/scene-device-recovery.js +5 -9
- package/dist/scene-device-recovery.js.map +1 -1
- package/dist/scene-finalize-regroup.d.ts +54 -0
- package/dist/scene-finalize-regroup.d.ts.map +1 -0
- package/dist/scene-finalize-regroup.js +136 -0
- package/dist/scene-finalize-regroup.js.map +1 -0
- package/dist/scene-instance-bounds.d.ts +12 -0
- package/dist/scene-instance-bounds.d.ts.map +1 -0
- package/dist/scene-instance-bounds.js +48 -0
- package/dist/scene-instance-bounds.js.map +1 -0
- package/dist/scene-instance-materialization.d.ts +4 -1
- package/dist/scene-instance-materialization.d.ts.map +1 -1
- package/dist/scene-instance-materialization.js +21 -6
- package/dist/scene-instance-materialization.js.map +1 -1
- package/dist/scene-instance-translation.d.ts +17 -0
- package/dist/scene-instance-translation.d.ts.map +1 -0
- package/dist/scene-instance-translation.js +50 -0
- package/dist/scene-instance-translation.js.map +1 -0
- package/dist/scene-instance-types.d.ts +6 -0
- package/dist/scene-instance-types.d.ts.map +1 -1
- package/dist/scene-model-translation.d.ts +2 -0
- package/dist/scene-model-translation.d.ts.map +1 -1
- package/dist/scene-model-translation.js +1 -1
- package/dist/scene-model-translation.js.map +1 -1
- package/dist/scene-rect-select.d.ts +11 -1
- package/dist/scene-rect-select.d.ts.map +1 -1
- package/dist/scene-rect-select.js +7 -4
- package/dist/scene-rect-select.js.map +1 -1
- package/dist/scene.d.ts +27 -20
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +109 -238
- package/dist/scene.js.map +1 -1
- package/dist/section-2d-lift.d.ts +10 -2
- package/dist/section-2d-lift.d.ts.map +1 -1
- package/dist/section-2d-lift.js +14 -6
- package/dist/section-2d-lift.js.map +1 -1
- package/dist/section-2d-line-buffer.d.ts +12 -4
- package/dist/section-2d-line-buffer.d.ts.map +1 -1
- package/dist/section-2d-line-buffer.js +59 -33
- package/dist/section-2d-line-buffer.js.map +1 -1
- package/dist/section-2d-overlay.d.ts +18 -72
- package/dist/section-2d-overlay.d.ts.map +1 -1
- package/dist/section-2d-overlay.js +72 -103
- package/dist/section-2d-overlay.js.map +1 -1
- package/dist/section-2d-types.d.ts +38 -0
- package/dist/section-2d-types.d.ts.map +1 -0
- package/dist/section-2d-types.js +6 -0
- package/dist/section-2d-types.js.map +1 -0
- package/dist/section-cap-pipelines.d.ts +6 -0
- package/dist/section-cap-pipelines.d.ts.map +1 -0
- package/dist/section-cap-pipelines.js +87 -0
- package/dist/section-cap-pipelines.js.map +1 -0
- package/dist/section-plane-geometry.d.ts +24 -0
- package/dist/section-plane-geometry.d.ts.map +1 -0
- package/dist/section-plane-geometry.js +93 -0
- package/dist/section-plane-geometry.js.map +1 -0
- package/dist/section-plane.d.ts +26 -24
- package/dist/section-plane.d.ts.map +1 -1
- package/dist/section-plane.js +57 -182
- package/dist/section-plane.js.map +1 -1
- package/dist/shaders/ao.wgsl.d.ts +2 -0
- package/dist/shaders/ao.wgsl.d.ts.map +1 -0
- package/dist/shaders/ao.wgsl.js +234 -0
- package/dist/shaders/ao.wgsl.js.map +1 -0
- package/dist/shaders/color-transfer.wgsl.d.ts +28 -0
- package/dist/shaders/color-transfer.wgsl.d.ts.map +1 -0
- package/dist/shaders/color-transfer.wgsl.js +55 -0
- package/dist/shaders/color-transfer.wgsl.js.map +1 -0
- package/dist/shaders/depth-reconstruct.wgsl.d.ts +16 -0
- package/dist/shaders/depth-reconstruct.wgsl.d.ts.map +1 -0
- package/dist/shaders/depth-reconstruct.wgsl.js +69 -0
- package/dist/shaders/depth-reconstruct.wgsl.js.map +1 -0
- package/dist/shaders/edges.wgsl.d.ts +2 -0
- package/dist/shaders/edges.wgsl.d.ts.map +1 -0
- package/dist/shaders/edges.wgsl.js +158 -0
- package/dist/shaders/edges.wgsl.js.map +1 -0
- package/dist/shaders/main-rte-shadow.wgsl.d.ts +4 -0
- package/dist/shaders/main-rte-shadow.wgsl.d.ts.map +1 -0
- package/dist/shaders/main-rte-shadow.wgsl.js +54 -0
- package/dist/shaders/main-rte-shadow.wgsl.js.map +1 -0
- package/dist/shaders/main.wgsl.d.ts +1 -6
- package/dist/shaders/main.wgsl.d.ts.map +1 -1
- package/dist/shaders/main.wgsl.js +183 -228
- package/dist/shaders/main.wgsl.js.map +1 -1
- package/dist/shaders/relative-to-eye.wgsl.d.ts +12 -0
- package/dist/shaders/relative-to-eye.wgsl.d.ts.map +1 -0
- package/dist/shaders/relative-to-eye.wgsl.js +40 -0
- package/dist/shaders/relative-to-eye.wgsl.js.map +1 -0
- package/dist/shaders/section-2d-overlay.wgsl.d.ts +28 -12
- package/dist/shaders/section-2d-overlay.wgsl.d.ts.map +1 -1
- package/dist/shaders/section-2d-overlay.wgsl.js +40 -13
- package/dist/shaders/section-2d-overlay.wgsl.js.map +1 -1
- package/dist/shaders/shadow.wgsl.d.ts +1 -1
- package/dist/shaders/shadow.wgsl.d.ts.map +1 -1
- package/dist/shaders/shadow.wgsl.js +25 -7
- package/dist/shaders/shadow.wgsl.js.map +1 -1
- package/dist/shaders/sky.wgsl.d.ts +1 -11
- package/dist/shaders/sky.wgsl.d.ts.map +1 -1
- package/dist/shaders/sky.wgsl.js +17 -19
- package/dist/shaders/sky.wgsl.js.map +1 -1
- package/dist/shaders/specular.wgsl.d.ts +34 -0
- package/dist/shaders/specular.wgsl.d.ts.map +1 -0
- package/dist/shaders/specular.wgsl.js +134 -0
- package/dist/shaders/specular.wgsl.js.map +1 -0
- package/dist/shaders/symbolic-overlay.wgsl.d.ts +2 -9
- package/dist/shaders/symbolic-overlay.wgsl.d.ts.map +1 -1
- package/dist/shaders/symbolic-overlay.wgsl.js +88 -17
- package/dist/shaders/symbolic-overlay.wgsl.js.map +1 -1
- package/dist/shaders/textured.wgsl.d.ts.map +1 -1
- package/dist/shaders/textured.wgsl.js +11 -9
- package/dist/shaders/textured.wgsl.js.map +1 -1
- package/dist/shadow-light-matrix.d.ts +7 -0
- package/dist/shadow-light-matrix.d.ts.map +1 -1
- package/dist/shadow-light-matrix.js +11 -0
- package/dist/shadow-light-matrix.js.map +1 -1
- package/dist/shadow-occluder-batches.d.ts +10 -0
- package/dist/shadow-occluder-batches.d.ts.map +1 -0
- package/dist/shadow-occluder-batches.js +39 -0
- package/dist/shadow-occluder-batches.js.map +1 -0
- package/dist/shadow-occluders.d.ts.map +1 -1
- package/dist/shadow-occluders.js +4 -0
- package/dist/shadow-occluders.js.map +1 -1
- package/dist/shadow-pass.d.ts +5 -51
- package/dist/shadow-pass.d.ts.map +1 -1
- package/dist/shadow-pass.js +49 -45
- package/dist/shadow-pass.js.map +1 -1
- package/dist/shadow-types.d.ts +39 -0
- package/dist/shadow-types.d.ts.map +1 -0
- package/dist/shadow-types.js +15 -0
- package/dist/shadow-types.js.map +1 -0
- package/dist/symbolic-overlay-geometry.d.ts +7 -0
- package/dist/symbolic-overlay-geometry.d.ts.map +1 -0
- package/dist/symbolic-overlay-geometry.js +43 -0
- package/dist/symbolic-overlay-geometry.js.map +1 -0
- package/dist/symbolic-overlay-pipelines.d.ts +24 -36
- package/dist/symbolic-overlay-pipelines.d.ts.map +1 -1
- package/dist/symbolic-overlay-pipelines.js +175 -182
- package/dist/symbolic-overlay-pipelines.js.map +1 -1
- package/dist/symbolic-text-atlas.d.ts +21 -0
- package/dist/symbolic-text-atlas.d.ts.map +1 -1
- package/dist/symbolic-text-atlas.js +29 -1
- package/dist/symbolic-text-atlas.js.map +1 -1
- package/dist/types.d.ts +20 -26
- package/dist/types.d.ts.map +1 -1
- package/dist/visual-enhancement.d.ts +30 -1
- package/dist/visual-enhancement.d.ts.map +1 -1
- package/dist/visual-enhancement.js +44 -12
- package/dist/visual-enhancement.js.map +1 -1
- package/package.json +3 -3
- package/dist/post-processor.d.ts +0 -60
- package/dist/post-processor.d.ts.map +0 -1
- package/dist/post-processor.js +0 -353
- package/dist/post-processor.js.map +0 -1
|
@@ -12,6 +12,8 @@ export interface ModelRange {
|
|
|
12
12
|
modelId: string;
|
|
13
13
|
offset: number;
|
|
14
14
|
maxExpressId: number;
|
|
15
|
+
reservedMaxExpressId: number;
|
|
16
|
+
publishedStart: number | null;
|
|
15
17
|
}
|
|
16
18
|
export interface GlobalIdLookup {
|
|
17
19
|
modelId: string;
|
|
@@ -34,6 +36,19 @@ export declare class FederationRegistry {
|
|
|
34
36
|
* @returns The offset to add to all expressIds for this model
|
|
35
37
|
*/
|
|
36
38
|
registerModel(modelId: string, maxExpressId: number): number;
|
|
39
|
+
/** Reserve a fixed local-ID envelope before progressive publication. */
|
|
40
|
+
reserveModel(modelId: string, reservedMaxExpressId: number): number;
|
|
41
|
+
/** Publish the next contiguous owned local range inside a reservation. */
|
|
42
|
+
publishRange(modelId: string, start: number, end: number): void;
|
|
43
|
+
/** Publish derived/overlay IDs from the separately reserved headroom. */
|
|
44
|
+
publishOverlayRange(modelId: string, start: number, end: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve an owned overlay range while it is still detached from its
|
|
47
|
+
* mutation transaction. This validates the exact range that will be
|
|
48
|
+
* publishable, but deliberately does not make it pickable or owned yet.
|
|
49
|
+
* Callers must publish it only after the backing records commit.
|
|
50
|
+
*/
|
|
51
|
+
previewOverlayGlobalId(modelId: string, start: number, end: number, expressId: number): number;
|
|
37
52
|
/**
|
|
38
53
|
* Unregister a model (when removed from viewer)
|
|
39
54
|
* Note: The offset space is NOT reclaimed to avoid invalidating any
|
|
@@ -88,6 +103,7 @@ export declare class FederationRegistry {
|
|
|
88
103
|
* Clear all registrations (for full reset)
|
|
89
104
|
*/
|
|
90
105
|
clear(): void;
|
|
106
|
+
private isPublished;
|
|
91
107
|
/**
|
|
92
108
|
* Binary search to find the range that could contain a globalId
|
|
93
109
|
* Returns the range with the largest offset that is <= globalId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federation-registry.d.ts","sourceRoot":"","sources":["../src/federation-registry.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"federation-registry.d.ts","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,GAAG,cAAc,GAAG,IAAI;IAwBrD;;;OAGG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKpD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIzC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIlC;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE;IAIvB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAUxE;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAOrD;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,WAAW;IAOnB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAsB1B;AAID,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|
|
@@ -36,12 +36,21 @@ export class FederationRegistry {
|
|
|
36
36
|
* @returns The offset to add to all expressIds for this model
|
|
37
37
|
*/
|
|
38
38
|
registerModel(modelId, maxExpressId) {
|
|
39
|
+
const existing = this.modelRanges.get(modelId);
|
|
40
|
+
if (existing)
|
|
41
|
+
return existing.offset;
|
|
42
|
+
const offset = this.reserveModel(modelId, maxExpressId);
|
|
43
|
+
this.publishRange(modelId, 0, maxExpressId);
|
|
44
|
+
return offset;
|
|
45
|
+
}
|
|
46
|
+
/** Reserve a fixed local-ID envelope before progressive publication. */
|
|
47
|
+
reserveModel(modelId, reservedMaxExpressId) {
|
|
39
48
|
// Validate inputs
|
|
40
49
|
if (!modelId || typeof modelId !== 'string') {
|
|
41
50
|
throw new Error(`[FederationRegistry] Invalid modelId: ${modelId}`);
|
|
42
51
|
}
|
|
43
|
-
if (typeof
|
|
44
|
-
throw new Error(`[FederationRegistry] Invalid
|
|
52
|
+
if (typeof reservedMaxExpressId !== 'number' || !Number.isFinite(reservedMaxExpressId) || reservedMaxExpressId < 0) {
|
|
53
|
+
throw new Error(`[FederationRegistry] Invalid reservedMaxExpressId: ${reservedMaxExpressId} for model ${modelId}`);
|
|
45
54
|
}
|
|
46
55
|
// Check for duplicate registration
|
|
47
56
|
if (this.modelRanges.has(modelId)) {
|
|
@@ -50,13 +59,13 @@ export class FederationRegistry {
|
|
|
50
59
|
return existing.offset;
|
|
51
60
|
}
|
|
52
61
|
// Check for overflow
|
|
53
|
-
if (this.nextOffset +
|
|
62
|
+
if (this.nextOffset + reservedMaxExpressId > MAX_SAFE_OFFSET) {
|
|
54
63
|
throw new Error(`[FederationRegistry] Cannot register model: would exceed safe ID limit. ` +
|
|
55
|
-
`Current offset: ${this.nextOffset}, model max ID: ${
|
|
64
|
+
`Current offset: ${this.nextOffset}, reserved model max ID: ${reservedMaxExpressId}. ` +
|
|
56
65
|
`Please unload some models first.`);
|
|
57
66
|
}
|
|
58
67
|
const offset = this.nextOffset;
|
|
59
|
-
const range = { modelId, offset, maxExpressId };
|
|
68
|
+
const range = { modelId, offset, maxExpressId: -1, reservedMaxExpressId, publishedStart: null };
|
|
60
69
|
this.modelRanges.set(modelId, range);
|
|
61
70
|
this.sortedRanges.push(range);
|
|
62
71
|
// Keep sorted by offset for binary search
|
|
@@ -64,9 +73,60 @@ export class FederationRegistry {
|
|
|
64
73
|
// Next model starts after this model's range (+1 gap for safety), plus
|
|
65
74
|
// reserved headroom for mutation-overlay ids allocated into this model's
|
|
66
75
|
// own space after load (see OVERLAY_ID_HEADROOM above).
|
|
67
|
-
this.nextOffset = offset +
|
|
76
|
+
this.nextOffset = offset + reservedMaxExpressId + 1 + OVERLAY_ID_HEADROOM;
|
|
68
77
|
return offset;
|
|
69
78
|
}
|
|
79
|
+
/** Publish the next contiguous owned local range inside a reservation. */
|
|
80
|
+
publishRange(modelId, start, end) {
|
|
81
|
+
const range = this.modelRanges.get(modelId);
|
|
82
|
+
if (!range)
|
|
83
|
+
throw new Error(`[FederationRegistry] Cannot publish unknown model ${modelId}`);
|
|
84
|
+
if (!Number.isInteger(start) || !Number.isInteger(end) || start < 0 || end < start || end > range.reservedMaxExpressId) {
|
|
85
|
+
throw new Error(`[FederationRegistry] Invalid published range ${start}..${end} for ${modelId}`);
|
|
86
|
+
}
|
|
87
|
+
if (range.publishedStart === null) {
|
|
88
|
+
range.publishedStart = start;
|
|
89
|
+
}
|
|
90
|
+
else if (start !== range.maxExpressId + 1) {
|
|
91
|
+
throw new Error(`[FederationRegistry] Published IDs for ${modelId} must be contiguous and source ordered`);
|
|
92
|
+
}
|
|
93
|
+
range.maxExpressId = end;
|
|
94
|
+
}
|
|
95
|
+
/** Publish derived/overlay IDs from the separately reserved headroom. */
|
|
96
|
+
publishOverlayRange(modelId, start, end) {
|
|
97
|
+
const range = this.modelRanges.get(modelId);
|
|
98
|
+
if (!range)
|
|
99
|
+
throw new Error(`[FederationRegistry] Cannot publish unknown model ${modelId}`);
|
|
100
|
+
const overlayEnd = range.reservedMaxExpressId + OVERLAY_ID_HEADROOM;
|
|
101
|
+
if (!Number.isInteger(start) || !Number.isInteger(end) || start < range.reservedMaxExpressId + 1 || end < start || end > overlayEnd) {
|
|
102
|
+
throw new Error(`[FederationRegistry] Invalid overlay range ${start}..${end} for ${modelId}`);
|
|
103
|
+
}
|
|
104
|
+
if (start !== range.maxExpressId + 1) {
|
|
105
|
+
throw new Error(`[FederationRegistry] Overlay IDs for ${modelId} must extend published ownership contiguously`);
|
|
106
|
+
}
|
|
107
|
+
range.maxExpressId = end;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Resolve an owned overlay range while it is still detached from its
|
|
111
|
+
* mutation transaction. This validates the exact range that will be
|
|
112
|
+
* publishable, but deliberately does not make it pickable or owned yet.
|
|
113
|
+
* Callers must publish it only after the backing records commit.
|
|
114
|
+
*/
|
|
115
|
+
previewOverlayGlobalId(modelId, start, end, expressId) {
|
|
116
|
+
const range = this.modelRanges.get(modelId);
|
|
117
|
+
if (!range)
|
|
118
|
+
throw new Error(`[FederationRegistry] Cannot preview unknown model ${modelId}`);
|
|
119
|
+
const overlayEnd = range.reservedMaxExpressId + OVERLAY_ID_HEADROOM;
|
|
120
|
+
if (!Number.isInteger(start) || !Number.isInteger(end) || !Number.isInteger(expressId)
|
|
121
|
+
|| start < range.reservedMaxExpressId + 1 || end < start || end > overlayEnd
|
|
122
|
+
|| expressId < start || expressId > end) {
|
|
123
|
+
throw new Error(`[FederationRegistry] Invalid overlay preview ${start}..${end} for ${modelId}`);
|
|
124
|
+
}
|
|
125
|
+
if (start !== range.maxExpressId + 1) {
|
|
126
|
+
throw new Error(`[FederationRegistry] Overlay preview for ${modelId} must extend published ownership contiguously`);
|
|
127
|
+
}
|
|
128
|
+
return range.offset + expressId;
|
|
129
|
+
}
|
|
70
130
|
/**
|
|
71
131
|
* Unregister a model (when removed from viewer)
|
|
72
132
|
* Note: The offset space is NOT reclaimed to avoid invalidating any
|
|
@@ -91,6 +151,9 @@ export class FederationRegistry {
|
|
|
91
151
|
if (!range) {
|
|
92
152
|
return expressId;
|
|
93
153
|
}
|
|
154
|
+
if (!this.isPublished(range, expressId)) {
|
|
155
|
+
throw new Error(`[FederationRegistry] Local ID ${expressId} is not published for model ${modelId}`);
|
|
156
|
+
}
|
|
94
157
|
return expressId + range.offset;
|
|
95
158
|
}
|
|
96
159
|
/**
|
|
@@ -108,7 +171,7 @@ export class FederationRegistry {
|
|
|
108
171
|
}
|
|
109
172
|
// Verify the globalId is actually within this model's range
|
|
110
173
|
const localId = globalId - range.offset;
|
|
111
|
-
if (
|
|
174
|
+
if (!this.isPublished(range, localId)) {
|
|
112
175
|
// globalId is in the gap between models
|
|
113
176
|
return null;
|
|
114
177
|
}
|
|
@@ -157,8 +220,10 @@ export class FederationRegistry {
|
|
|
157
220
|
const range = this.modelRanges.get(modelId);
|
|
158
221
|
if (!range)
|
|
159
222
|
return null;
|
|
223
|
+
if (range.publishedStart === null)
|
|
224
|
+
return null;
|
|
160
225
|
return {
|
|
161
|
-
start: range.offset,
|
|
226
|
+
start: range.offset + range.publishedStart,
|
|
162
227
|
end: range.offset + range.maxExpressId,
|
|
163
228
|
};
|
|
164
229
|
}
|
|
@@ -171,7 +236,7 @@ export class FederationRegistry {
|
|
|
171
236
|
if (!range)
|
|
172
237
|
return false;
|
|
173
238
|
const localId = globalId - range.offset;
|
|
174
|
-
return
|
|
239
|
+
return this.isPublished(range, localId);
|
|
175
240
|
}
|
|
176
241
|
/**
|
|
177
242
|
* Clear all registrations (for full reset)
|
|
@@ -181,6 +246,12 @@ export class FederationRegistry {
|
|
|
181
246
|
this.sortedRanges = [];
|
|
182
247
|
this.nextOffset = 0;
|
|
183
248
|
}
|
|
249
|
+
isPublished(range, localId) {
|
|
250
|
+
return range.publishedStart !== null
|
|
251
|
+
&& Number.isInteger(localId)
|
|
252
|
+
&& localId >= range.publishedStart
|
|
253
|
+
&& localId <= range.maxExpressId;
|
|
254
|
+
}
|
|
184
255
|
/**
|
|
185
256
|
* Binary search to find the range that could contain a globalId
|
|
186
257
|
* Returns the range with the largest offset that is <= globalId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federation-registry.js","sourceRoot":"","sources":["../src/federation-registry.ts"],"names":[],"mappings":"AAAA;;+DAE+D;
|
|
1
|
+
{"version":3,"file":"federation-registry.js","sourceRoot":"","sources":["../src/federation-registry.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0B/D,sDAAsD;AACtD,kDAAkD;AAClD,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC,6EAA6E;AAC7E,qDAAqD;AACrD,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,wEAAwE;AACxE,6EAA6E;AAC7E,qEAAqE;AACrE,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,mEAAm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YACf,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;CACF;AAED,yCAAyC;AACzC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE way the renderer creates a GPU buffer pre-filled with static
|
|
3
|
+
* geometry (vertex, index and per-instance data) — issue #5429.
|
|
4
|
+
*
|
|
5
|
+
* Why `queue.writeBuffer` and never `createBuffer({ mappedAtCreation: true })`:
|
|
6
|
+
* on Chromium (Chrome / Edge / WebView2, D3D12), a mapped-at-creation buffer
|
|
7
|
+
* keeps a shared-memory copy of its FULL contents mapped into both the
|
|
8
|
+
* renderer and the GPU process for as long as the buffer lives, even after
|
|
9
|
+
* `unmap()`. That region is charged to system commit but appears in neither
|
|
10
|
+
* process's private bytes, so a loaded scene carried an invisible second copy
|
|
11
|
+
* of all its resident geometry (≈1.1 GB per 1 GiB uploaded in the issue's
|
|
12
|
+
* standalone repro; ~6 GB for a 50-file federation). `writeBuffer` into a
|
|
13
|
+
* plain `COPY_DST` buffer stages through a transient transfer allocation and
|
|
14
|
+
* keeps nothing alive afterwards.
|
|
15
|
+
*
|
|
16
|
+
* It also removes this path's synchronous `RangeError` ("createBuffer failed,
|
|
17
|
+
* size (…) is too large for the implementation when mappedAtCreation ==
|
|
18
|
+
* true"): Chromium throws that only when it cannot back the mapping, and a
|
|
19
|
+
* buffer created without `mappedAtCreation` has no mapping to back. A real
|
|
20
|
+
* GPU out-of-memory still reports the way it always did for the device-side
|
|
21
|
+
* allocation — asynchronously, as a `GPUOutOfMemoryError` through the
|
|
22
|
+
* device's error scopes / `uncapturederror`.
|
|
23
|
+
*
|
|
24
|
+
* Alignment is this helper's job, not the caller's. `writeBuffer` throws an
|
|
25
|
+
* `OperationError` DOMException when the byte count is not a multiple of 4,
|
|
26
|
+
* and `gpu-upload-guard.ts`'s `isDeviceLossThrow` classifies EVERY
|
|
27
|
+
* DOMException as a device loss — so one odd-length upload (a u16 index list
|
|
28
|
+
* with an odd count, say) would falsely latch the whole session as lost.
|
|
29
|
+
* The buffer size is therefore rounded up to 4 bytes (minimum 4), and an
|
|
30
|
+
* unaligned payload is copied into a zero-padded staging array first. The
|
|
31
|
+
* padding lies past every `indexCount` / vertex count the caller draws with,
|
|
32
|
+
* so it is never read.
|
|
33
|
+
*
|
|
34
|
+
* `writeBuffer` copies `data` before it returns (WebGPU spec: the contents
|
|
35
|
+
* are captured at call time), so callers may reuse or drop their CPU array
|
|
36
|
+
* immediately, exactly as they could after `unmap()`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createStaticGpuBuffer(device: GPUDevice, data: ArrayBufferView | ArrayBuffer, usage: GPUBufferUsageFlags): GPUBuffer;
|
|
39
|
+
//# sourceMappingURL=gpu-static-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu-static-upload.d.ts","sourceRoot":"","sources":["../src/gpu-static-upload.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,eAAe,GAAG,WAAW,EACnC,KAAK,EAAE,mBAAmB,GACzB,SAAS,CAiBX"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* The ONE way the renderer creates a GPU buffer pre-filled with static
|
|
6
|
+
* geometry (vertex, index and per-instance data) — issue #5429.
|
|
7
|
+
*
|
|
8
|
+
* Why `queue.writeBuffer` and never `createBuffer({ mappedAtCreation: true })`:
|
|
9
|
+
* on Chromium (Chrome / Edge / WebView2, D3D12), a mapped-at-creation buffer
|
|
10
|
+
* keeps a shared-memory copy of its FULL contents mapped into both the
|
|
11
|
+
* renderer and the GPU process for as long as the buffer lives, even after
|
|
12
|
+
* `unmap()`. That region is charged to system commit but appears in neither
|
|
13
|
+
* process's private bytes, so a loaded scene carried an invisible second copy
|
|
14
|
+
* of all its resident geometry (≈1.1 GB per 1 GiB uploaded in the issue's
|
|
15
|
+
* standalone repro; ~6 GB for a 50-file federation). `writeBuffer` into a
|
|
16
|
+
* plain `COPY_DST` buffer stages through a transient transfer allocation and
|
|
17
|
+
* keeps nothing alive afterwards.
|
|
18
|
+
*
|
|
19
|
+
* It also removes this path's synchronous `RangeError` ("createBuffer failed,
|
|
20
|
+
* size (…) is too large for the implementation when mappedAtCreation ==
|
|
21
|
+
* true"): Chromium throws that only when it cannot back the mapping, and a
|
|
22
|
+
* buffer created without `mappedAtCreation` has no mapping to back. A real
|
|
23
|
+
* GPU out-of-memory still reports the way it always did for the device-side
|
|
24
|
+
* allocation — asynchronously, as a `GPUOutOfMemoryError` through the
|
|
25
|
+
* device's error scopes / `uncapturederror`.
|
|
26
|
+
*
|
|
27
|
+
* Alignment is this helper's job, not the caller's. `writeBuffer` throws an
|
|
28
|
+
* `OperationError` DOMException when the byte count is not a multiple of 4,
|
|
29
|
+
* and `gpu-upload-guard.ts`'s `isDeviceLossThrow` classifies EVERY
|
|
30
|
+
* DOMException as a device loss — so one odd-length upload (a u16 index list
|
|
31
|
+
* with an odd count, say) would falsely latch the whole session as lost.
|
|
32
|
+
* The buffer size is therefore rounded up to 4 bytes (minimum 4), and an
|
|
33
|
+
* unaligned payload is copied into a zero-padded staging array first. The
|
|
34
|
+
* padding lies past every `indexCount` / vertex count the caller draws with,
|
|
35
|
+
* so it is never read.
|
|
36
|
+
*
|
|
37
|
+
* `writeBuffer` copies `data` before it returns (WebGPU spec: the contents
|
|
38
|
+
* are captured at call time), so callers may reuse or drop their CPU array
|
|
39
|
+
* immediately, exactly as they could after `unmap()`.
|
|
40
|
+
*/
|
|
41
|
+
export function createStaticGpuBuffer(device, data, usage) {
|
|
42
|
+
const bytes = ArrayBuffer.isView(data)
|
|
43
|
+
? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)
|
|
44
|
+
: new Uint8Array(data);
|
|
45
|
+
const size = alignedUploadSize(bytes.byteLength);
|
|
46
|
+
const buffer = device.createBuffer({ size, usage: usage | GPUBufferUsage.COPY_DST });
|
|
47
|
+
if (bytes.byteLength === 0)
|
|
48
|
+
return buffer;
|
|
49
|
+
try {
|
|
50
|
+
const payload = bytes.byteLength === size ? bytes : padTo(bytes, size);
|
|
51
|
+
device.queue.writeBuffer(buffer, 0, payload);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
// Never orphan the allocation: the caller only learns about buffers this
|
|
55
|
+
// function RETURNS, so one that failed to fill is ours to release.
|
|
56
|
+
buffer.destroy();
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
return buffer;
|
|
60
|
+
}
|
|
61
|
+
/** Byte size allocated for a payload of `byteLength`: 4-aligned, never 0. */
|
|
62
|
+
function alignedUploadSize(byteLength) {
|
|
63
|
+
return Math.max(4, Math.ceil(byteLength / 4) * 4);
|
|
64
|
+
}
|
|
65
|
+
function padTo(bytes, size) {
|
|
66
|
+
const padded = new Uint8Array(size);
|
|
67
|
+
padded.set(bytes);
|
|
68
|
+
return padded;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=gpu-static-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu-static-upload.js","sourceRoot":"","sources":["../src/gpu-static-upload.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAiB,EACjB,IAAmC,EACnC,KAA0B;IAE1B,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,IAA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-21,15 +21,22 @@
|
|
|
21
21
|
* draws exactly that line:
|
|
22
22
|
* - a call on a dead / invalid-state device throws a `DOMException`
|
|
23
23
|
* (`InvalidStateError` in Safari 26.5 — the whole of issue #2229);
|
|
24
|
-
* -
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* - host memory pressure on a HEALTHY device throws a plain `RangeError` —
|
|
25
|
+
* today from the CPU side of an upload (typed-array allocation while
|
|
26
|
+
* merging geometry: "Array buffer allocation failed"). Until #5429 the
|
|
27
|
+
* upload's own `createBuffer({ mappedAtCreation: true })` was a second
|
|
28
|
+
* source ("createBuffer failed, size (…) is too large … when
|
|
29
|
+
* mappedAtCreation == true", at sizes as small as 672 B); static geometry
|
|
30
|
+
* now uploads through `gpu-static-upload.ts`'s `createStaticGpuBuffer`,
|
|
31
|
+
* which never maps at creation and so cannot raise it.
|
|
28
32
|
*
|
|
29
33
|
* Treating the second as a device loss is a false positive that costs the
|
|
30
34
|
* whole session — see `runGuardedGpuUpload`'s doc for how a caught RangeError
|
|
31
35
|
* is instead checked against `isDeviceLost()`, not this classifier, to tell
|
|
32
|
-
* loss fallout from real memory pressure.
|
|
36
|
+
* loss fallout from real memory pressure. The one healthy-device
|
|
37
|
+
* `DOMException` an upload could raise — `writeBuffer`'s `OperationError` for
|
|
38
|
+
* a byte count that is not a multiple of 4 — is ruled out by construction:
|
|
39
|
+
* `createStaticGpuBuffer` pads every payload.
|
|
33
40
|
*
|
|
34
41
|
* Shared by `index.ts`'s frame-level `containFrameThrow` (the ONE throw class
|
|
35
42
|
* that latches mid-frame) and this module's `runGuardedGpuUpload` (the same
|
|
@@ -64,24 +71,6 @@ export type GpuUploadOutcome<T> = {
|
|
|
64
71
|
error: unknown;
|
|
65
72
|
deviceLostAtTime: boolean;
|
|
66
73
|
};
|
|
67
|
-
/**
|
|
68
|
-
* Chromium's wording for a `createBuffer({ mappedAtCreation: true })` the
|
|
69
|
-
* host could not back:
|
|
70
|
-
*
|
|
71
|
-
* RangeError: Failed to execute 'createBuffer' on 'GPUDevice': createBuffer
|
|
72
|
-
* failed, size (672) is too large for the implementation when
|
|
73
|
-
* mappedAtCreation == true
|
|
74
|
-
*
|
|
75
|
-
* — at sizes (672 B, 5.5 KB, 15 KB) nowhere near any real device limit. This
|
|
76
|
-
* is the same string `packages/renderer/src/index.ts`'s `isDeviceLossThrow`
|
|
77
|
-
* deliberately does NOT latch on inside a frame (see that function's doc: a
|
|
78
|
-
* RangeError there is genuine, frame-scoped memory pressure on a device that
|
|
79
|
-
* IS still alive). This matcher answers a different question for a DIFFERENT
|
|
80
|
-
* caller — one that sits outside the frame's own containment and wants to
|
|
81
|
-
* know whether a RangeError it just caught is fallout from a loss that has
|
|
82
|
-
* already happened, not a fresh probe of a healthy device.
|
|
83
|
-
*/
|
|
84
|
-
export declare function isMappedCreateBufferOverflow(error: unknown): boolean;
|
|
85
74
|
/**
|
|
86
75
|
* Run one GPU upload, gated on device loss.
|
|
87
76
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-upload-guard.d.ts","sourceRoot":"","sources":["../src/gpu-upload-guard.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH
|
|
1
|
+
{"version":3,"file":"gpu-upload-guard.d.ts","sourceRoot":"","sources":["../src/gpu-upload-guard.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED,8CAA8C;AAC9C,MAAM,MAAM,gBAAgB,CAAC,CAAC,IACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE;AACxB,mEAAmE;GACjE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE;AACtC;;;;;;;GAOG;GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACjC,YAAY,EAAE,MAAM,OAAO,EAC3B,GAAG,EAAE,MAAM,CAAC,EACZ,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAC1C,gBAAgB,CAAC,CAAC,CAAC,CAUrB"}
|
package/dist/gpu-upload-guard.js
CHANGED
|
@@ -24,15 +24,22 @@
|
|
|
24
24
|
* draws exactly that line:
|
|
25
25
|
* - a call on a dead / invalid-state device throws a `DOMException`
|
|
26
26
|
* (`InvalidStateError` in Safari 26.5 — the whole of issue #2229);
|
|
27
|
-
* -
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* - host memory pressure on a HEALTHY device throws a plain `RangeError` —
|
|
28
|
+
* today from the CPU side of an upload (typed-array allocation while
|
|
29
|
+
* merging geometry: "Array buffer allocation failed"). Until #5429 the
|
|
30
|
+
* upload's own `createBuffer({ mappedAtCreation: true })` was a second
|
|
31
|
+
* source ("createBuffer failed, size (…) is too large … when
|
|
32
|
+
* mappedAtCreation == true", at sizes as small as 672 B); static geometry
|
|
33
|
+
* now uploads through `gpu-static-upload.ts`'s `createStaticGpuBuffer`,
|
|
34
|
+
* which never maps at creation and so cannot raise it.
|
|
31
35
|
*
|
|
32
36
|
* Treating the second as a device loss is a false positive that costs the
|
|
33
37
|
* whole session — see `runGuardedGpuUpload`'s doc for how a caught RangeError
|
|
34
38
|
* is instead checked against `isDeviceLost()`, not this classifier, to tell
|
|
35
|
-
* loss fallout from real memory pressure.
|
|
39
|
+
* loss fallout from real memory pressure. The one healthy-device
|
|
40
|
+
* `DOMException` an upload could raise — `writeBuffer`'s `OperationError` for
|
|
41
|
+
* a byte count that is not a multiple of 4 — is ruled out by construction:
|
|
42
|
+
* `createStaticGpuBuffer` pads every payload.
|
|
36
43
|
*
|
|
37
44
|
* Shared by `index.ts`'s frame-level `containFrameThrow` (the ONE throw class
|
|
38
45
|
* that latches mid-frame) and this module's `runGuardedGpuUpload` (the same
|
|
@@ -45,27 +52,6 @@
|
|
|
45
52
|
export function isDeviceLossThrow(error) {
|
|
46
53
|
return typeof DOMException !== 'undefined' && error instanceof DOMException;
|
|
47
54
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Chromium's wording for a `createBuffer({ mappedAtCreation: true })` the
|
|
50
|
-
* host could not back:
|
|
51
|
-
*
|
|
52
|
-
* RangeError: Failed to execute 'createBuffer' on 'GPUDevice': createBuffer
|
|
53
|
-
* failed, size (672) is too large for the implementation when
|
|
54
|
-
* mappedAtCreation == true
|
|
55
|
-
*
|
|
56
|
-
* — at sizes (672 B, 5.5 KB, 15 KB) nowhere near any real device limit. This
|
|
57
|
-
* is the same string `packages/renderer/src/index.ts`'s `isDeviceLossThrow`
|
|
58
|
-
* deliberately does NOT latch on inside a frame (see that function's doc: a
|
|
59
|
-
* RangeError there is genuine, frame-scoped memory pressure on a device that
|
|
60
|
-
* IS still alive). This matcher answers a different question for a DIFFERENT
|
|
61
|
-
* caller — one that sits outside the frame's own containment and wants to
|
|
62
|
-
* know whether a RangeError it just caught is fallout from a loss that has
|
|
63
|
-
* already happened, not a fresh probe of a healthy device.
|
|
64
|
-
*/
|
|
65
|
-
export function isMappedCreateBufferOverflow(error) {
|
|
66
|
-
return error instanceof RangeError
|
|
67
|
-
&& /createbuffer failed.*mappedatcreation/i.test(error.message);
|
|
68
|
-
}
|
|
69
55
|
/**
|
|
70
56
|
* Run one GPU upload, gated on device loss.
|
|
71
57
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-upload-guard.js","sourceRoot":"","sources":["../src/gpu-upload-guard.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH
|
|
1
|
+
{"version":3,"file":"gpu-upload-guard.js","sourceRoot":"","sources":["../src/gpu-upload-guard.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC5C,OAAO,OAAO,YAAY,KAAK,WAAW,IAAI,KAAK,YAAY,YAAY,CAAC;AAChF,CAAC;AAiBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CAC/B,YAA2B,EAC3B,GAAY,EACZ,cAAyC;IAEzC,IAAI,YAAY,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IAChD,CAAC;IACD,IAAI,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,iBAAiB,CAAC,KAAK,CAAC;YAAE,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC;QACtD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,EAAE,CAAC;IACnF,CAAC;AACL,CAAC"}
|