@luma.gl/graph 10.0.0-alpha.9 → 10.0.0-beta.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.
- package/LICENSE +4 -4
- package/THIRD-PARTY-NOTICES.md +19 -0
- package/dist/arrow/arrow-colors.cjs +99 -18
- package/dist/arrow/arrow-colors.d.ts +27 -10
- package/dist/arrow/arrow-colors.d.ts.map +1 -1
- package/dist/arrow/arrow-colors.js +107 -24
- package/dist/arrow/arrow-colors.js.map +1 -1
- package/dist/arrow/arrow-utils/arrow-paths.cjs +4 -3
- package/dist/arrow/arrow-utils/arrow-paths.d.ts.map +1 -1
- package/dist/arrow/arrow-utils/arrow-paths.js +5 -4
- package/dist/arrow/arrow-utils/arrow-paths.js.map +1 -1
- package/dist/arrow/cpu/arrow-coordinate-projection.cjs +30 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.d.ts +5 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.js +9 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.js.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.cjs +31 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts +2 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.js +5 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.js.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.cjs +99 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts +9 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.js +100 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.js.map +1 -0
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.cjs +9 -371
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts +8 -28
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js +4 -381
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.cjs +11 -11
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts +2 -0
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js +4 -4
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js.map +1 -1
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.cjs +2 -2
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.js +1 -1
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.js.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.cjs +27 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts +11 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.js +33 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +68 -3
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +9 -2
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +76 -3
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.cjs +8 -6
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts +1 -0
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js +17 -7
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +35 -5
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +6 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +40 -5
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +19 -2
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +5 -2
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +4 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/arrow/internal.cjs.map +2 -2
- package/dist/dist.dev.js +3820 -1646
- package/dist/dist.min.js +450 -136
- package/dist/experimental/index.cjs.map +1 -1
- package/dist/experimental/simulation/index.cjs.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.cjs +2 -15
- package/dist/geospatial/gpu-point-spatial-query.d.ts.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.js +2 -15
- package/dist/geospatial/gpu-point-spatial-query.js.map +1 -1
- package/dist/geospatial/index.cjs.map +2 -2
- package/dist/gpu-a5/index.cjs.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.cjs +47 -0
- package/dist/gpu-core/compiled-gpu-graph.d.ts +5 -0
- package/dist/gpu-core/compiled-gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.js +54 -1
- package/dist/gpu-core/compiled-gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.cjs +11 -2
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts +2 -1
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.js +13 -2
- package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts +16 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph.cjs +34 -11
- package/dist/gpu-core/gpu-command-graph.d.ts +17 -8
- package/dist/gpu-core/gpu-command-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph.js +39 -11
- package/dist/gpu-core/gpu-command-graph.js.map +1 -1
- package/dist/gpu-core/gpu-cpu-execution.cjs +279 -0
- package/dist/gpu-core/gpu-cpu-execution.d.ts +22 -0
- package/dist/gpu-core/gpu-cpu-execution.d.ts.map +1 -0
- package/dist/gpu-core/gpu-cpu-execution.js +294 -0
- package/dist/gpu-core/gpu-cpu-execution.js.map +1 -0
- package/dist/gpu-core/gpu-cpu-operation.cjs +54 -0
- package/dist/gpu-core/gpu-cpu-operation.d.ts +40 -0
- package/dist/gpu-core/gpu-cpu-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-cpu-operation.js +35 -0
- package/dist/gpu-core/gpu-cpu-operation.js.map +1 -0
- package/dist/gpu-core/gpu-dispatch-utils.cjs +7 -3
- package/dist/gpu-core/gpu-dispatch-utils.d.ts +2 -0
- package/dist/gpu-core/gpu-dispatch-utils.d.ts.map +1 -1
- package/dist/gpu-core/gpu-dispatch-utils.js +4 -1
- package/dist/gpu-core/gpu-dispatch-utils.js.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.cjs +2 -2
- package/dist/gpu-core/gpu-expression-operation.d.ts +1 -1
- package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.js +1 -1
- package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.cjs +5 -1
- package/dist/gpu-core/gpu-expression-plan.d.ts +3 -2
- package/dist/gpu-core/gpu-expression-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.js +7 -1
- package/dist/gpu-core/gpu-expression-plan.js.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.cjs +48 -0
- package/dist/gpu-core/gpu-graph-compiler.d.ts +1 -0
- package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.js +50 -0
- package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-graph.d.ts +2 -2
- package/dist/gpu-core/gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.cjs +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.js +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.cjs +2 -5
- package/dist/gpu-core/gpu-grid-binning.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.js +2 -5
- package/dist/gpu-core/gpu-grid-binning.js.map +1 -1
- package/dist/gpu-core/gpu-grid-coordinate.cjs +41 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts +7 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts.map +1 -0
- package/dist/gpu-core/gpu-grid-coordinate.js +24 -0
- package/dist/gpu-core/gpu-grid-coordinate.js.map +1 -0
- package/dist/gpu-core/gpu-grid-index-internals.cjs +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-internals.js +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.js.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.cjs +2 -16
- package/dist/gpu-core/gpu-grid-index-query.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.js +2 -16
- package/dist/gpu-core/gpu-grid-index-query.js.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.cjs +7 -15
- package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.js +7 -18
- package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-operation.d.ts +4 -4
- package/dist/gpu-core/gpu-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-operation.js.map +1 -1
- package/dist/gpu-core/gpu-reduction.cjs +6 -14
- package/dist/gpu-core/gpu-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-reduction.js +6 -15
- package/dist/gpu-core/gpu-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-render-operation.cjs +39 -0
- package/dist/gpu-core/gpu-render-operation.d.ts +21 -0
- package/dist/gpu-core/gpu-render-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-render-operation.js +22 -0
- package/dist/gpu-core/gpu-render-operation.js.map +1 -0
- package/dist/gpu-core/gpu-scan.cjs +46 -32
- package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-scan.js +56 -44
- package/dist/gpu-core/gpu-scan.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.cjs +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.d.ts +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.js +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.cjs +73 -16
- package/dist/gpu-core/gpu-segmented-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.js +73 -16
- package/dist/gpu-core/gpu-segmented-scan.js.map +1 -1
- package/dist/gpu-core/gpu-semantic-aggregation-operation.cjs +112 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts +71 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.js +92 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.js.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.cjs +267 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.d.ts +29 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.d.ts.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.js +260 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.js.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-operation.cjs +85 -0
- package/dist/gpu-core/gpu-shader-pass-operation.d.ts +32 -0
- package/dist/gpu-core/gpu-shader-pass-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-operation.js +74 -0
- package/dist/gpu-core/gpu-shader-pass-operation.js.map +1 -0
- package/dist/gpu-core/gpu-texture-plan.d.ts +3 -2
- package/dist/gpu-core/gpu-texture-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-texture-plan.js.map +1 -1
- package/dist/gpu-core/index.cjs +32 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +21 -1
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +10 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-data/color-conversion.cjs +105 -0
- package/dist/gpu-data/color-conversion.d.ts +30 -0
- package/dist/gpu-data/color-conversion.d.ts.map +1 -0
- package/dist/gpu-data/color-conversion.js +109 -0
- package/dist/gpu-data/color-conversion.js.map +1 -0
- package/dist/gpu-data/cpu-data.cjs +60 -0
- package/dist/gpu-data/cpu-data.d.ts +28 -0
- package/dist/gpu-data/cpu-data.d.ts.map +1 -0
- package/dist/gpu-data/cpu-data.js +41 -0
- package/dist/gpu-data/cpu-data.js.map +1 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.cjs +98 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts +9 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts.map +1 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.js +85 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.js.map +1 -0
- package/dist/gpu-data/cpu-vector.cjs +42 -0
- package/dist/gpu-data/cpu-vector.d.ts +17 -0
- package/dist/gpu-data/cpu-vector.d.ts.map +1 -0
- package/dist/gpu-data/cpu-vector.js +21 -0
- package/dist/gpu-data/cpu-vector.js.map +1 -0
- package/dist/gpu-data/gpu-data-buffer-props.cjs +41 -0
- package/dist/gpu-data/gpu-data-buffer-props.d.ts +5 -0
- package/dist/gpu-data/gpu-data-buffer-props.d.ts.map +1 -0
- package/dist/gpu-data/gpu-data-buffer-props.js +19 -0
- package/dist/gpu-data/gpu-data-buffer-props.js.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.cjs +50 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts +41 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js +45 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js.map +1 -0
- package/dist/gpu-data/index.cjs +21 -2
- package/dist/gpu-data/index.cjs.map +3 -3
- package/dist/gpu-data/index.d.ts +6 -0
- package/dist/gpu-data/index.d.ts.map +1 -1
- package/dist/gpu-data/index.js +5 -0
- package/dist/gpu-data/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +1 -16
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +1 -23
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +91 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts +37 -0
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +106 -0
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +12 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +4 -0
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +2 -0
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +103 -0
- package/dist/gpu-dataframe/portable-expression.d.ts +19 -0
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -0
- package/dist/gpu-dataframe/portable-expression.js +98 -0
- package/dist/gpu-dataframe/portable-expression.js.map +1 -0
- package/dist/gpu-dggs/benchmarks.cjs.map +1 -1
- package/dist/gpu-dggs/index.cjs.map +1 -1
- package/dist/gpu-geometry/index.cjs.map +1 -1
- package/dist/gpu-graph/index.cjs +8 -0
- package/dist/gpu-graph/index.cjs.map +3 -3
- package/dist/gpu-graph/index.d.ts +4 -0
- package/dist/gpu-graph/index.d.ts.map +1 -1
- package/dist/gpu-graph/index.js +2 -0
- package/dist/gpu-graph/index.js.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.cjs +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js.map +1 -1
- package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
- package/dist/gpu-h3/index.cjs.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +162 -2
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +25 -0
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +181 -2
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs.map +2 -2
- package/dist/gpu-physics/index.d.ts +1 -0
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +24 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.js +28 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +2 -2
- package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.js +2 -2
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.cjs +90 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +35 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-vehicle.js +66 -0
- package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -0
- package/dist/gpu-pointcloud/index.cjs.map +1 -1
- package/dist/gpu-project/benchmarks.cjs.map +2 -2
- package/dist/gpu-project/coordinate-projection-graph.cjs +59 -0
- package/dist/gpu-project/coordinate-projection-graph.d.ts +23 -0
- package/dist/gpu-project/coordinate-projection-graph.d.ts.map +1 -0
- package/dist/gpu-project/coordinate-projection-graph.js +40 -0
- package/dist/gpu-project/coordinate-projection-graph.js.map +1 -0
- package/dist/gpu-project/cpu-geoarrow.cjs +112 -0
- package/dist/gpu-project/cpu-geoarrow.d.ts +10 -0
- package/dist/gpu-project/cpu-geoarrow.d.ts.map +1 -0
- package/dist/gpu-project/cpu-geoarrow.js +103 -0
- package/dist/gpu-project/cpu-geoarrow.js.map +1 -0
- package/dist/gpu-project/cpu-geometry-pipelines.cjs +134 -0
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts +19 -0
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts.map +1 -0
- package/dist/gpu-project/cpu-geometry-pipelines.js +114 -0
- package/dist/gpu-project/cpu-geometry-pipelines.js.map +1 -0
- package/dist/gpu-project/cpu-projection-operation.cjs +54 -0
- package/dist/gpu-project/cpu-projection-operation.d.ts +14 -0
- package/dist/gpu-project/cpu-projection-operation.d.ts.map +1 -0
- package/dist/gpu-project/cpu-projection-operation.js +37 -0
- package/dist/gpu-project/cpu-projection-operation.js.map +1 -0
- package/dist/gpu-project/crs.cjs.map +2 -2
- package/dist/gpu-project/geoarrow.cjs +36 -0
- package/dist/gpu-project/geoarrow.cjs.map +6 -0
- package/dist/gpu-project/geoarrow.d.ts +3 -0
- package/dist/gpu-project/geoarrow.d.ts.map +1 -0
- package/dist/gpu-project/geoarrow.js +7 -0
- package/dist/gpu-project/geoarrow.js.map +1 -0
- package/dist/gpu-project/graph.cjs +27 -0
- package/dist/gpu-project/graph.cjs.map +6 -0
- package/dist/gpu-project/graph.d.ts +2 -0
- package/dist/gpu-project/graph.d.ts.map +1 -0
- package/dist/gpu-project/graph.js +6 -0
- package/dist/gpu-project/graph.js.map +1 -0
- package/dist/gpu-project/index.cjs +3 -0
- package/dist/gpu-project/index.cjs.map +3 -3
- package/dist/gpu-project/index.d.ts +1 -0
- package/dist/gpu-project/index.d.ts.map +1 -1
- package/dist/gpu-project/index.js +1 -0
- package/dist/gpu-project/index.js.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.cjs +75 -5
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts +5 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js +86 -6
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.cjs +9 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts +2 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js +10 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.cjs +126 -10
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts +36 -11
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.js +137 -12
- package/dist/gpu-simple-graph/gpu-simple-graph.js.map +1 -1
- package/dist/gpu-simple-graph/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/index.d.ts +1 -1
- package/dist/gpu-simple-graph/index.d.ts.map +1 -1
- package/dist/gpu-simple-graph/index.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.cjs +25 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +6 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js +28 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.cjs +7 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts +2 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js +7 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.cjs +6 -6
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts +5 -1
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.js +12 -7
- package/dist/gpu-simple-graph/operations/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.cjs +16 -33
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js +22 -35
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgl/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.cjs +31 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js +42 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/index.cjs.map +1 -1
- package/dist/gpu-sql/gpu-sql.cjs +157 -280
- package/dist/gpu-sql/gpu-sql.d.ts +1 -1
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +168 -291
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-tables/index.cjs.map +2 -2
- package/dist/gpu-tables/table/gpu-table.cjs +2 -2
- package/dist/gpu-tables/table/gpu-table.d.ts.map +1 -1
- package/dist/gpu-tables/table/gpu-table.js +2 -2
- package/dist/gpu-tables/table/gpu-table.js.map +1 -1
- package/dist/gpu-timeseries/index.cjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +21 -7
- package/src/arrow/arrow-colors.ts +194 -33
- package/src/arrow/arrow-utils/arrow-paths.ts +5 -3
- package/src/arrow/cpu/arrow-coordinate-projection.ts +18 -0
- package/src/arrow/cpu/arrow-cpu-pipelines.ts +9 -0
- package/src/arrow/cpu/arrow-cpu-vector-adapters.ts +153 -0
- package/src/arrow/geoarrow/arrow-geoarrow-adapter.ts +21 -493
- package/src/arrow/geoarrow/arrow-geoarrow-conversion.ts +7 -5
- package/src/arrow/geoarrow/arrow-polygon-tessellation.ts +1 -1
- package/src/arrow/gpu/arrow-column-gpu-vector.ts +67 -14
- package/src/arrow/gpu/arrow-gpu-table-conversion.ts +96 -4
- package/src/arrow/gpu/arrow-gpu-vector-adapters.ts +20 -7
- package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +49 -6
- package/src/arrow/index.ts +14 -0
- package/src/geospatial/gpu-point-spatial-query.ts +2 -15
- package/src/gpu-core/compiled-gpu-graph.ts +73 -1
- package/src/gpu-core/gpu-command-graph-compiler.ts +25 -2
- package/src/gpu-core/gpu-command-graph-types.ts +20 -0
- package/src/gpu-core/gpu-command-graph.ts +48 -11
- package/src/gpu-core/gpu-cpu-execution.ts +345 -0
- package/src/gpu-core/gpu-cpu-operation.ts +65 -0
- package/src/gpu-core/gpu-dispatch-utils.ts +13 -1
- package/src/gpu-core/gpu-expression-operation.ts +1 -1
- package/src/gpu-core/gpu-expression-plan.ts +11 -3
- package/src/gpu-core/gpu-graph-compiler.ts +61 -0
- package/src/gpu-core/gpu-graph.ts +3 -3
- package/src/gpu-core/gpu-grid-aggregation.ts +2 -5
- package/src/gpu-core/gpu-grid-binning.ts +2 -5
- package/src/gpu-core/gpu-grid-coordinate.ts +24 -0
- package/src/gpu-core/gpu-grid-index-internals.ts +2 -15
- package/src/gpu-core/gpu-grid-index-query.ts +2 -16
- package/src/gpu-core/gpu-group-aggregation.ts +38 -50
- package/src/gpu-core/gpu-operation.ts +9 -7
- package/src/gpu-core/gpu-reduction.ts +32 -42
- package/src/gpu-core/gpu-render-operation.ts +42 -0
- package/src/gpu-core/gpu-scan.ts +59 -45
- package/src/gpu-core/gpu-segmented-reduction.ts +20 -10
- package/src/gpu-core/gpu-segmented-scan.ts +82 -17
- package/src/gpu-core/gpu-semantic-aggregation-operation.ts +150 -0
- package/src/gpu-core/gpu-shader-pass-kernel.ts +307 -0
- package/src/gpu-core/gpu-shader-pass-operation.ts +103 -0
- package/src/gpu-core/gpu-texture-plan.ts +3 -2
- package/src/gpu-core/index.ts +39 -0
- package/src/gpu-data/color-conversion.ts +158 -0
- package/src/gpu-data/cpu-data.ts +62 -0
- package/src/gpu-data/cpu-gpu-vector-transfer.ts +110 -0
- package/src/gpu-data/cpu-vector.ts +31 -0
- package/src/gpu-data/gpu-data-buffer-props.ts +25 -0
- package/src/gpu-data/gpu-vector-wgsl-layout.ts +79 -0
- package/src/gpu-data/index.ts +15 -0
- package/src/gpu-dataframe/gpu-data-frame-query.ts +6 -26
- package/src/gpu-dataframe/gpu-expression.ts +135 -0
- package/src/gpu-dataframe/index.ts +11 -0
- package/src/gpu-dataframe/portable-expression.ts +117 -0
- package/src/gpu-graph/index.ts +17 -0
- package/src/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.ts +2 -15
- package/src/gpu-physics/gpu-rigid-body-world.ts +227 -2
- package/src/gpu-physics/index.ts +1 -0
- package/src/gpu-physics/rigid-body-parallel-shaders.ts +32 -9
- package/src/gpu-physics/rigid-body-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-vehicle.ts +99 -0
- package/src/gpu-project/coordinate-projection-graph.ts +59 -0
- package/src/gpu-project/cpu-geoarrow.ts +135 -0
- package/src/gpu-project/cpu-geometry-pipelines.ts +159 -0
- package/src/gpu-project/cpu-projection-operation.ts +49 -0
- package/src/gpu-project/geoarrow.ts +11 -0
- package/src/gpu-project/graph.ts +10 -0
- package/src/gpu-project/index.ts +2 -0
- package/src/gpu-simple-graph/compiled-gpu-expression-graph.ts +97 -6
- package/src/gpu-simple-graph/gpu-simple-graph-lowering.ts +11 -0
- package/src/gpu-simple-graph/gpu-simple-graph.ts +163 -19
- package/src/gpu-simple-graph/index.ts +1 -0
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +24 -0
- package/src/gpu-simple-graph/operation/gpu-vector-evaluator.ts +7 -0
- package/src/gpu-simple-graph/operations/convert-colors.ts +22 -7
- package/src/gpu-simple-graph/operations/cpu/convert-colors.ts +31 -48
- package/src/gpu-simple-graph/operations/webgpu/convert-colors.ts +47 -13
- package/src/gpu-sql/gpu-sql.ts +179 -293
- package/src/gpu-tables/table/gpu-table.ts +2 -1
- package/src/index.ts +21 -0
|
@@ -76,6 +76,8 @@ import {
|
|
|
76
76
|
import {addRigidBodyPosePublication, type GPURigidBodyBounds} from './rigid-body-publication';
|
|
77
77
|
import {getRigidBodyShader} from './rigid-body-shaders';
|
|
78
78
|
|
|
79
|
+
import {VEHICLE_SHADER, type GPURigidBodyVehicle} from './rigid-body-vehicle';
|
|
80
|
+
|
|
79
81
|
type Vector3 = readonly [number, number, number];
|
|
80
82
|
import {
|
|
81
83
|
decodeRigidBodyContactEvents,
|
|
@@ -128,6 +130,8 @@ export type GPURigidBodyWorldProps = {
|
|
|
128
130
|
/** Up to 64 joints. Parallel solving supports static-anchored distance joints only. */
|
|
129
131
|
joints?: readonly GPURigidBodyJoint[];
|
|
130
132
|
gravity?: Vector3;
|
|
133
|
+
/** Optional four-wheel suspension evaluated against static terrain each fixed step. */
|
|
134
|
+
vehicle?: GPURigidBodyVehicle;
|
|
131
135
|
timeStep?: number;
|
|
132
136
|
iterations?: number;
|
|
133
137
|
contactSlop?: number;
|
|
@@ -139,6 +143,10 @@ export type GPURigidBodyWorldProps = {
|
|
|
139
143
|
maximumRecoverySpeed?: number;
|
|
140
144
|
/** Additional under-relaxation for the parallel solver, in (0, 1]. Default 1. */
|
|
141
145
|
parallelRelaxation?: number;
|
|
146
|
+
/** Contact scheduling within a parallel manifold. Block uses two local sweeps before gathering.
|
|
147
|
+
* Default scalar preserves the original per-contact relaxation path.
|
|
148
|
+
*/
|
|
149
|
+
parallelContactSolver?: 'scalar' | 'block';
|
|
142
150
|
/** Small worlds retain the all-pairs numerical oracle; larger worlds use sparse discovery. */
|
|
143
151
|
/** Independent equal collider blocks; currently excludes joints, CCD and authored triggers. */
|
|
144
152
|
collisionPartitionSize?: number;
|
|
@@ -224,6 +232,7 @@ export class GPURigidBodyWorld {
|
|
|
224
232
|
private eventRead: Promise<GPURigidBodyContactBatch> | null = null;
|
|
225
233
|
private queryComputation: BoundKernel | null = null;
|
|
226
234
|
private queryReduction: BoundKernel | null = null;
|
|
235
|
+
private vehicleBuffer: Buffer | null = null;
|
|
227
236
|
private querySettings: Buffer | null = null;
|
|
228
237
|
private querySelection: Buffer | null = null;
|
|
229
238
|
private queryOutput: Buffer | null = null;
|
|
@@ -271,6 +280,8 @@ export class GPURigidBodyWorld {
|
|
|
271
280
|
this.solver = props.solver ?? 'ordered';
|
|
272
281
|
if (!['ordered', 'parallel'].includes(this.solver))
|
|
273
282
|
throw new Error('Invalid rigid-body solver');
|
|
283
|
+
if (!['scalar', 'block'].includes(props.parallelContactSolver ?? 'scalar'))
|
|
284
|
+
throw new Error('Invalid parallel contact solver');
|
|
274
285
|
validateRigidBodyJoints(props.joints ?? [], props.bodies, this.solver);
|
|
275
286
|
const colliderCount = props.bodies.reduce(
|
|
276
287
|
(sum, body) => sum + (body.colliders?.length ?? 1),
|
|
@@ -499,8 +510,35 @@ export class GPURigidBodyWorld {
|
|
|
499
510
|
}
|
|
500
511
|
// Clone together so collider edits preserve geometry identity in captured body definitions.
|
|
501
512
|
const definitions = structuredClone({colliders, props});
|
|
502
|
-
this.colliders = definitions.colliders;
|
|
503
513
|
this.props = definitions.props;
|
|
514
|
+
this.colliders = definitions.colliders;
|
|
515
|
+
const vehicle = this.props.vehicle;
|
|
516
|
+
if (vehicle) {
|
|
517
|
+
const terrain = this.colliders[vehicle.terrainCollider];
|
|
518
|
+
const chassis = this.props.bodies[vehicle.chassis];
|
|
519
|
+
const ground = terrain && this.props.bodies[terrain.body];
|
|
520
|
+
if (
|
|
521
|
+
!chassis ||
|
|
522
|
+
!ground ||
|
|
523
|
+
vehicle.chassis === terrain.body ||
|
|
524
|
+
(chassis.mode ?? (chassis.mass === 0 ? 'static' : 'dynamic')) !== 'dynamic' ||
|
|
525
|
+
(ground.mode ?? (ground.mass === 0 ? 'static' : 'dynamic')) !== 'static' ||
|
|
526
|
+
vehicle.wheels.length !== 4 ||
|
|
527
|
+
this.props.failurePolicy === 'rollback' ||
|
|
528
|
+
this.props.ensembleBodiesPerInstance ||
|
|
529
|
+
![vehicle.radius, vehicle.travel, vehicle.springRate, vehicle.wheelInertia].every(
|
|
530
|
+
value => Number.isFinite(value) && value > 0
|
|
531
|
+
) ||
|
|
532
|
+
![vehicle.damping, vehicle.grip, vehicle.motorTorque, vehicle.brakeTorque].every(
|
|
533
|
+
value => Number.isFinite(value) && value >= 0
|
|
534
|
+
) ||
|
|
535
|
+
vehicle.wheels.some(
|
|
536
|
+
wheel => wheel.mount.length !== 3 || !wheel.mount.every(Number.isFinite)
|
|
537
|
+
)
|
|
538
|
+
)
|
|
539
|
+
throw new Error('Invalid vehicle configuration');
|
|
540
|
+
}
|
|
541
|
+
|
|
504
542
|
if (props.ensembleBodiesPerInstance)
|
|
505
543
|
this.initialEnsembleBodies = this.props.bodies.slice(0, props.ensembleBodiesPerInstance);
|
|
506
544
|
}
|
|
@@ -535,6 +573,8 @@ export class GPURigidBodyWorld {
|
|
|
535
573
|
this.props.ensembleBodiesPerInstance ? this.count / this.props.ensembleBodiesPerInstance : 0
|
|
536
574
|
)
|
|
537
575
|
};
|
|
576
|
+
if (this.props.vehicle)
|
|
577
|
+
storage.buffers.push({name: 'vehicle', byteLength: 512, uniform: false});
|
|
538
578
|
if (this.props.continuous?.mode === 'convex') {
|
|
539
579
|
storage.buffers = storage.buffers.filter(buffer => buffer.name !== 'continuous-previous');
|
|
540
580
|
storage.buffers.push({name: 'continuous-dispatch', byteLength: 16, uniform: false});
|
|
@@ -1043,7 +1083,8 @@ export class GPURigidBodyWorld {
|
|
|
1043
1083
|
this.props.joints?.length ?? 0,
|
|
1044
1084
|
this.props.compactContacts ?? true,
|
|
1045
1085
|
this.props.collisionPartitionSize,
|
|
1046
|
-
this.props.ensembleBodiesPerInstance
|
|
1086
|
+
this.props.ensembleBodiesPerInstance,
|
|
1087
|
+
this.props.parallelContactSolver === 'block'
|
|
1047
1088
|
);
|
|
1048
1089
|
const parallelBindings: Record<string, readonly string[]> = {
|
|
1049
1090
|
parallelReset: ['parallelState'],
|
|
@@ -1228,6 +1269,120 @@ export class GPURigidBodyWorld {
|
|
|
1228
1269
|
parallelMarkSleep: 'Identify islands whose bodies are quiet enough to sleep.',
|
|
1229
1270
|
parallelSleep: 'Put quiet constraint islands to sleep.'
|
|
1230
1271
|
};
|
|
1272
|
+
const vehicle = this.props.vehicle;
|
|
1273
|
+
if (vehicle) {
|
|
1274
|
+
const data = new Float32Array(128);
|
|
1275
|
+
data.set(
|
|
1276
|
+
[
|
|
1277
|
+
vehicle.radius,
|
|
1278
|
+
vehicle.travel,
|
|
1279
|
+
vehicle.springRate,
|
|
1280
|
+
vehicle.damping,
|
|
1281
|
+
vehicle.grip,
|
|
1282
|
+
vehicle.motorTorque,
|
|
1283
|
+
vehicle.brakeTorque,
|
|
1284
|
+
vehicle.wheelInertia
|
|
1285
|
+
],
|
|
1286
|
+
4
|
|
1287
|
+
);
|
|
1288
|
+
new Uint32Array(data.buffer).set([vehicle.chassis, vehicle.terrainCollider], 12);
|
|
1289
|
+
vehicle.wheels.forEach((wheel, index) => {
|
|
1290
|
+
const offset = 16 + index * 12;
|
|
1291
|
+
data.set(wheel.mount, offset);
|
|
1292
|
+
data.set([Number(Boolean(wheel.steer)), Number(Boolean(wheel.drive))], offset + 4);
|
|
1293
|
+
data[offset + 10] = vehicle.travel;
|
|
1294
|
+
data.set(
|
|
1295
|
+
[
|
|
1296
|
+
1,
|
|
1297
|
+
0,
|
|
1298
|
+
0,
|
|
1299
|
+
0,
|
|
1300
|
+
0,
|
|
1301
|
+
1,
|
|
1302
|
+
0,
|
|
1303
|
+
0,
|
|
1304
|
+
0,
|
|
1305
|
+
0,
|
|
1306
|
+
1,
|
|
1307
|
+
0,
|
|
1308
|
+
wheel.mount[0],
|
|
1309
|
+
wheel.mount[1],
|
|
1310
|
+
wheel.mount[2] - vehicle.travel,
|
|
1311
|
+
1
|
|
1312
|
+
],
|
|
1313
|
+
64 + 16 * index
|
|
1314
|
+
);
|
|
1315
|
+
});
|
|
1316
|
+
this.vehicleBuffer = allocate('vehicle', data);
|
|
1317
|
+
const vehicleBindings = [
|
|
1318
|
+
...bindings.filter(binding =>
|
|
1319
|
+
[
|
|
1320
|
+
'settings',
|
|
1321
|
+
'positions',
|
|
1322
|
+
'orientations',
|
|
1323
|
+
'velocities',
|
|
1324
|
+
'angularVelocities',
|
|
1325
|
+
'bodies',
|
|
1326
|
+
'sleepStates'
|
|
1327
|
+
].includes(binding.name)
|
|
1328
|
+
),
|
|
1329
|
+
{
|
|
1330
|
+
name: 'vehicle',
|
|
1331
|
+
location: 12,
|
|
1332
|
+
buffer: this.vehicleBuffer,
|
|
1333
|
+
resource: graph.importBuffer(
|
|
1334
|
+
{id: this.id + '-vehicle', byteLength: data.byteLength, usage: Buffer.STORAGE},
|
|
1335
|
+
this.vehicleBuffer
|
|
1336
|
+
)
|
|
1337
|
+
}
|
|
1338
|
+
];
|
|
1339
|
+
const properties: BoundKernelProps = {
|
|
1340
|
+
id: this.id + '-suspension',
|
|
1341
|
+
source: source + RIGID_BODY_QUERY_GEOMETRY_SHADER + VEHICLE_SHADER,
|
|
1342
|
+
entryPoint: 'advanceVehicle',
|
|
1343
|
+
shaderLayout: {
|
|
1344
|
+
bindings: vehicleBindings.map(
|
|
1345
|
+
({name, location}): BindingDeclaration =>
|
|
1346
|
+
name === 'settings'
|
|
1347
|
+
? {name, location, group: 0, type: 'uniform'}
|
|
1348
|
+
: {
|
|
1349
|
+
name,
|
|
1350
|
+
location,
|
|
1351
|
+
group: 0,
|
|
1352
|
+
type: name === 'bodies' ? 'read-only-storage' : 'storage'
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
const executable = (
|
|
1358
|
+
computation: BoundKernel
|
|
1359
|
+
): GPUCommandGraphComputeExecutable<Parameters> => ({
|
|
1360
|
+
encode: ({computePass, getBuffer}) => {
|
|
1361
|
+
Object.assign(
|
|
1362
|
+
computation.bindings,
|
|
1363
|
+
Object.fromEntries(
|
|
1364
|
+
vehicleBindings.map(binding => [binding.name, getBuffer(binding.resource)])
|
|
1365
|
+
)
|
|
1366
|
+
);
|
|
1367
|
+
computation.kernel.dispatch(computePass, {bindings: computation.bindings, x: 1});
|
|
1368
|
+
},
|
|
1369
|
+
destroy: () => computation.kernel.destroy()
|
|
1370
|
+
});
|
|
1371
|
+
graph.addComputePass({
|
|
1372
|
+
id: properties.id!,
|
|
1373
|
+
resources: vehicleBindings.map(binding => ({
|
|
1374
|
+
buffer: binding.resource,
|
|
1375
|
+
usage:
|
|
1376
|
+
binding.name === 'settings'
|
|
1377
|
+
? 'uniform'
|
|
1378
|
+
: binding.name === 'bodies'
|
|
1379
|
+
? 'storage-read'
|
|
1380
|
+
: 'storage-read-write'
|
|
1381
|
+
})),
|
|
1382
|
+
compile: () => executable(createBoundKernel(graph.device, properties)),
|
|
1383
|
+
compileAsync: async () => executable(await createBoundKernelAsync(graph.device, properties))
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1231
1386
|
for (const entryPoint of [
|
|
1232
1387
|
...(this.ensembleBuffer
|
|
1233
1388
|
? ['ensembleClear', 'ensembleMark', 'ensembleCompact', 'ensembleDispatch']
|
|
@@ -1981,6 +2136,76 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1981
2136
|
: undefined;
|
|
1982
2137
|
}
|
|
1983
2138
|
|
|
2139
|
+
/** Set signed throttle, steering angle in radians and brake fraction for upcoming substeps. */
|
|
2140
|
+
setVehicleControls(throttle: number, steering: number, brake: number): void {
|
|
2141
|
+
if (
|
|
2142
|
+
!this.vehicleBuffer ||
|
|
2143
|
+
this.destroyed ||
|
|
2144
|
+
![throttle, steering, brake].every(Number.isFinite)
|
|
2145
|
+
)
|
|
2146
|
+
throw new Error('Invalid vehicle controls');
|
|
2147
|
+
this.vehicleBuffer.write(
|
|
2148
|
+
new Float32Array([
|
|
2149
|
+
Math.max(-1, Math.min(1, throttle)),
|
|
2150
|
+
steering,
|
|
2151
|
+
Math.max(0, Math.min(1, brake)),
|
|
2152
|
+
0
|
|
2153
|
+
])
|
|
2154
|
+
);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/** Borrow four column-major wheel transforms relative to the chassis node, ordered by mount. */
|
|
2158
|
+
get vehicleWheelPoses() {
|
|
2159
|
+
return this.vehicleBuffer && !this.destroyed
|
|
2160
|
+
? {buffer: this.vehicleBuffer, byteOffset: 256, byteLength: 256}
|
|
2161
|
+
: null;
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
/** Transfer wheel motion between rebuilt worlds for wheels with matching chassis-local mounts. */
|
|
2165
|
+
copyVehicleMotionFrom(previous: GPURigidBodyWorld): void {
|
|
2166
|
+
const sourceBuffer = previous.vehicleBuffer;
|
|
2167
|
+
const destinationBuffer = this.vehicleBuffer;
|
|
2168
|
+
const previousVehicle = previous.props.vehicle;
|
|
2169
|
+
if (!this.device || !sourceBuffer || !destinationBuffer || !previousVehicle) return;
|
|
2170
|
+
const encoder = this.device.createCommandEncoder();
|
|
2171
|
+
this.props.vehicle?.wheels.forEach((wheel, index) => {
|
|
2172
|
+
const sourceIndex = previousVehicle.wheels.findIndex(source =>
|
|
2173
|
+
source.mount.every((coordinate, axis) => coordinate === wheel.mount[axis])
|
|
2174
|
+
);
|
|
2175
|
+
if (sourceIndex < 0) return;
|
|
2176
|
+
encoder.copyBufferToBuffer({
|
|
2177
|
+
sourceBuffer,
|
|
2178
|
+
destinationBuffer,
|
|
2179
|
+
sourceOffset: 96 + sourceIndex * 48,
|
|
2180
|
+
destinationOffset: 96 + index * 48,
|
|
2181
|
+
size: 16
|
|
2182
|
+
});
|
|
2183
|
+
encoder.copyBufferToBuffer({
|
|
2184
|
+
sourceBuffer,
|
|
2185
|
+
destinationBuffer,
|
|
2186
|
+
sourceOffset: 256 + sourceIndex * 64,
|
|
2187
|
+
destinationOffset: 256 + index * 64,
|
|
2188
|
+
size: 64
|
|
2189
|
+
});
|
|
2190
|
+
});
|
|
2191
|
+
this.device.submit(encoder.finish());
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
/** Read wheel spin, angle, suspension length and normal load after submitted steps. */
|
|
2195
|
+
async readVehicleWheels() {
|
|
2196
|
+
if (!this.vehicleBuffer || this.destroyed) throw new Error('Vehicle unavailable');
|
|
2197
|
+
const values = new Float32Array((await this.vehicleBuffer.readAsync(0, 256)).buffer);
|
|
2198
|
+
return Array.from({length: 4}, (_, index) => {
|
|
2199
|
+
const offset = 24 + index * 12;
|
|
2200
|
+
return {
|
|
2201
|
+
speed: values[offset],
|
|
2202
|
+
angle: values[offset + 1],
|
|
2203
|
+
length: values[offset + 2],
|
|
2204
|
+
load: values[offset + 3]
|
|
2205
|
+
};
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
|
|
1984
2209
|
/** Submit an impulse at a world-space point, or the current GPU center of mass when omitted. */
|
|
1985
2210
|
applyImpulse(body: number, impulse: Vector3, point?: Vector3): void {
|
|
1986
2211
|
if (
|
package/src/gpu-physics/index.ts
CHANGED
|
@@ -116,3 +116,4 @@ export type {GPURigidBodyJointLimit, GPURigidBodyJointDrive} from './joint-types
|
|
|
116
116
|
|
|
117
117
|
export {rotateRigidBodyVector, normalizeRigidBodyRotation} from './rigid-body-properties';
|
|
118
118
|
export type {GPURigidBodyGeneralConstraint} from './rigid-body-general-joints';
|
|
119
|
+
export type {GPURigidBodyVehicle} from './rigid-body-vehicle';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
/** Sparse contact adjacency and block-Jacobi impulses; each dispatch has exclusive output owners. */
|
|
6
|
-
export function getRigidBodyParallelShader(ensemble: boolean): string {
|
|
6
|
+
export function getRigidBodyParallelShader(ensemble: boolean, blockContacts = false): string {
|
|
7
7
|
return /* wgsl */ `
|
|
8
8
|
struct ParallelState {
|
|
9
9
|
diagnostics:array<atomic<u32>,4>,
|
|
@@ -173,32 +173,55 @@ fn writePairDeltas(pair:u32,first:u32,second:u32,impulse:vec3f,firstTorque:vec3f
|
|
|
173
173
|
let relaxation=settings.stability.w/f32(max(1u,max(atomicLoad(¶llelState.degrees[first]),atomicLoad(¶llelState.degrees[second]))));
|
|
174
174
|
var firstLinear=velocities[first].xyz;var secondLinear=velocities[second].xyz;
|
|
175
175
|
var firstAngular=angularVelocities[first].xyz;var secondAngular=angularVelocities[second].xyz;
|
|
176
|
+
${
|
|
177
|
+
blockContacts
|
|
178
|
+
? `
|
|
179
|
+
// Solve the contact patch locally, then relax the whole block once. No extra dispatches.
|
|
180
|
+
var contacts:array<Contact,4>;
|
|
181
|
+
for(var slot=0u;slot<manifolds[pair].count;slot++){contacts[slot]=manifolds[pair].contacts[slot];}
|
|
182
|
+
for(var sweep=0u;sweep<2u;sweep++){
|
|
183
|
+
`
|
|
184
|
+
: ''
|
|
185
|
+
}
|
|
176
186
|
for(var slot=0u;slot<manifolds[pair].count;slot++){
|
|
177
|
-
var contact
|
|
187
|
+
var contact=${blockContacts ? 'contacts[slot]' : 'manifolds[pair].contacts[slot]'};let point=contact.point.xyz;let normal=contact.normal.xyz;
|
|
178
188
|
let firstLever=point-positions[first].xyz;let secondLever=point-positions[second].xyz;
|
|
179
189
|
let relative=secondLinear+cross(secondAngular,secondLever)-firstLinear-cross(firstAngular,firstLever);
|
|
180
190
|
let normalMass=effectiveMass(first,second,point,normal);if(normalMass<=0.0){continue;}
|
|
181
191
|
let bias=min(settings.stability.z,settings.stability.y*max(0.0,contact.point.w-settings.solver.x)/settings.gravity.w);
|
|
182
192
|
let desiredImpulse=max(0.0,contact.impulse.x+(max(bias,contact.normal.w)-dot(relative,normal))/normalMass);
|
|
183
|
-
let change=(desiredImpulse-contact.impulse.x)
|
|
193
|
+
let change=(desiredImpulse-contact.impulse.x)*${blockContacts ? '1.0' : 'relaxation'};contact.impulse.x+=change;
|
|
184
194
|
var impulse=normal*change;
|
|
185
195
|
if(dynamic(first)){firstLinear-=impulse*velocities[first].w;firstAngular-=inverseInertia(first,cross(firstLever,impulse));}
|
|
186
196
|
if(dynamic(second)){secondLinear+=impulse*velocities[second].w;secondAngular+=inverseInertia(second,cross(secondLever,impulse));}
|
|
187
197
|
let after=secondLinear+cross(secondAngular,secondLever)-firstLinear-cross(firstAngular,firstLever);
|
|
188
198
|
let tangent=solveFriction(firstCollider,secondCollider,contact,after);
|
|
189
|
-
var relaxedTangent=contact.tangent.xyz+(tangent-contact.tangent.xyz)
|
|
199
|
+
var relaxedTangent=contact.tangent.xyz+(tangent-contact.tangent.xyz)*${blockContacts ? '1.0' : 'relaxation'};
|
|
190
200
|
// A falling normal impulse must shrink the cone even when under-relaxing.
|
|
191
201
|
let staticLimit=frictionCoefficient(firstCollider,secondCollider,false)*contact.impulse.x;
|
|
192
202
|
if(length(relaxedTangent)>staticLimit){relaxedTangent*=staticLimit/max(1e-30,length(relaxedTangent));}
|
|
193
203
|
impulse=relaxedTangent-contact.tangent.xyz;contact.tangent=vec4f(relaxedTangent,0);
|
|
194
204
|
if(dynamic(first)){firstLinear-=impulse*velocities[first].w;firstAngular-=inverseInertia(first,cross(firstLever,impulse));}
|
|
195
205
|
if(dynamic(second)){secondLinear+=impulse*velocities[second].w;secondAngular+=inverseInertia(second,cross(secondLever,impulse));}
|
|
196
|
-
manifolds[pair].contacts[slot]=contact;
|
|
206
|
+
${blockContacts ? 'contacts[slot]' : 'manifolds[pair].contacts[slot]'}=contact;
|
|
207
|
+
}
|
|
208
|
+
${
|
|
209
|
+
blockContacts
|
|
210
|
+
? `
|
|
211
|
+
}
|
|
212
|
+
// Interpolation of feasible impulses preserves the friction cone, including unloading.
|
|
213
|
+
for(var slot=0u;slot<manifolds[pair].count;slot++){
|
|
214
|
+
let previous=manifolds[pair].contacts[slot];
|
|
215
|
+
manifolds[pair].contacts[slot].impulse.x=mix(previous.impulse.x,contacts[slot].impulse.x,relaxation);
|
|
216
|
+
manifolds[pair].contacts[slot].tangent=mix(previous.tangent,contacts[slot].tangent,relaxation);
|
|
217
|
+
}
|
|
218
|
+
`
|
|
219
|
+
: ''
|
|
197
220
|
}
|
|
198
|
-
parallelState.deltas[pair*4u]=vec4f(firstLinear-velocities[first].xyz,0);
|
|
199
|
-
parallelState.deltas[pair*4u+1u]=vec4f(firstAngular-angularVelocities[first].xyz,0);
|
|
200
|
-
parallelState.deltas[pair*4u+2u]=vec4f(secondLinear-velocities[second].xyz,0);
|
|
201
|
-
parallelState.deltas[pair*4u+3u]=vec4f(secondAngular-angularVelocities[second].xyz,0);
|
|
221
|
+
parallelState.deltas[pair*4u]=vec4f((firstLinear-velocities[first].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
222
|
+
parallelState.deltas[pair*4u+1u]=vec4f((firstAngular-angularVelocities[first].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
223
|
+
parallelState.deltas[pair*4u+2u]=vec4f((secondLinear-velocities[second].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
224
|
+
parallelState.deltas[pair*4u+3u]=vec4f((secondAngular-angularVelocities[second].xyz)*${blockContacts ? 'relaxation' : '1.0'},0);
|
|
202
225
|
}
|
|
203
226
|
@compute @workgroup_size(64) fn parallelGather(@builtin(global_invocation_id) invocation:vec3u){
|
|
204
227
|
var body=invocation.x;
|
|
@@ -29,7 +29,8 @@ export function getRigidBodyShader(
|
|
|
29
29
|
jointCount = 0,
|
|
30
30
|
compactContacts = true,
|
|
31
31
|
collisionPartitionSize?: number,
|
|
32
|
-
ensembleBodiesPerInstance?: number
|
|
32
|
+
ensembleBodiesPerInstance?: number,
|
|
33
|
+
blockContacts = false
|
|
33
34
|
): string {
|
|
34
35
|
return /* wgsl */ `
|
|
35
36
|
const COMPACT_CONTACTS:bool=${compactContacts};
|
|
@@ -390,7 +391,7 @@ ${
|
|
|
390
391
|
}
|
|
391
392
|
manifolds[pair].count=contactCount;
|
|
392
393
|
}
|
|
393
|
-
${parallel ? getRigidBodyParallelShader(Boolean(ensembleBodiesPerInstance)) : ''}
|
|
394
|
+
${parallel ? getRigidBodyParallelShader(Boolean(ensembleBodiesPerInstance), blockContacts) : ''}
|
|
394
395
|
${(parallel || hasJoints) && extended ? '@compute @workgroup_size(1) fn meshCollect(){collectMeshContacts();}' : ''}
|
|
395
396
|
${jointShader}
|
|
396
397
|
${parallel && hasJoints ? '@compute @workgroup_size(1) fn parallelJointWarm(){solveJoints(true);} @compute @workgroup_size(1) fn parallelJointSolve(){solveJoints(false);}' : ''}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** Four independently sprung wheels in a chassis frame with +X forward and +Z up. */
|
|
6
|
+
export type GPURigidBodyVehicle = {
|
|
7
|
+
/** Index of the dynamic chassis body. */
|
|
8
|
+
chassis: number;
|
|
9
|
+
/** Index of the static collider sampled by all wheels. */
|
|
10
|
+
terrainCollider: number;
|
|
11
|
+
/** Four independently suspended wheels, in rendering and telemetry order. */
|
|
12
|
+
wheels: readonly {
|
|
13
|
+
/** At full compression the wheel center is here, in chassis node coordinates (meters). */
|
|
14
|
+
mount: readonly [number, number, number];
|
|
15
|
+
/** Turn this wheel about chassis +Z by the commanded steering angle. */
|
|
16
|
+
steer?: boolean;
|
|
17
|
+
/** Apply the commanded drive torque to this wheel. */
|
|
18
|
+
drive?: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
/** Wheel contact sphere radius in meters. */
|
|
21
|
+
radius: number;
|
|
22
|
+
/** Maximum downward distance of the wheel center from its mount in meters. */
|
|
23
|
+
travel: number;
|
|
24
|
+
/** Per-wheel spring stiffness in newtons per meter. */
|
|
25
|
+
springRate: number;
|
|
26
|
+
/** Per-wheel damping coefficient in newton seconds per meter. */
|
|
27
|
+
damping: number;
|
|
28
|
+
/** Dimensionless tire friction coefficient limiting combined longitudinal and lateral force. */
|
|
29
|
+
grip: number;
|
|
30
|
+
/** Torque per driven wheel in N m. */
|
|
31
|
+
motorTorque: number;
|
|
32
|
+
/** Maximum braking torque per wheel in newton meters. */
|
|
33
|
+
brakeTorque: number;
|
|
34
|
+
/** Rotational inertia of one wheel in kilogram meters squared. */
|
|
35
|
+
wheelInertia: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** One invocation owns the chassis. All wheels sample the same pre-step velocity. */
|
|
39
|
+
export const VEHICLE_SHADER = /* wgsl */ `
|
|
40
|
+
struct Wheel { mount:vec4f, flags:vec4f, state:vec4f }
|
|
41
|
+
struct Vehicle { controls:vec4f, geometry:vec4f, tire:vec4f, indices:vec4u, wheels:array<Wheel,4>, poses:array<mat4x4f,4> }
|
|
42
|
+
@group(0) @binding(12) var<storage,read_write> vehicle:Vehicle;
|
|
43
|
+
@compute @workgroup_size(1) fn advanceVehicle() {
|
|
44
|
+
let chassis=vehicle.indices.x;
|
|
45
|
+
let terrain=vehicle.indices.y;
|
|
46
|
+
let rotation=orientations[chassis];
|
|
47
|
+
let center=positions[chassis].xyz;
|
|
48
|
+
let down=rotate(rotation,vec3f(0,0,-1));
|
|
49
|
+
let radius=vehicle.geometry.x;
|
|
50
|
+
let travel=vehicle.geometry.y;
|
|
51
|
+
let timestep=settings.gravity.w;
|
|
52
|
+
var impulse=vec3f(0);
|
|
53
|
+
var torque=vec3f(0);
|
|
54
|
+
for(var index=0u;index<4u;index++){
|
|
55
|
+
let wheel=vehicle.wheels[index];
|
|
56
|
+
let mount=center+rotate(rotation,wheel.mount.xyz-bodyCenter(chassis));
|
|
57
|
+
let hit=sweepSphere(terrain,colliderLocal(terrain,mount-colliderPosition(terrain)),colliderLocal(terrain,down),travel,radius,false);
|
|
58
|
+
var speed=wheel.state.x+vehicle.controls.x*vehicle.tire.y*wheel.flags.y*timestep/vehicle.tire.w;
|
|
59
|
+
speed-=sign(speed)*min(abs(speed),vehicle.controls.z*vehicle.tire.z*timestep/vehicle.tire.w);
|
|
60
|
+
let steering=vehicle.controls.y*wheel.flags.x;
|
|
61
|
+
var lengthNow=travel;
|
|
62
|
+
var load=0.0;
|
|
63
|
+
if(hit.hit!=0u && hit.complete!=0u){
|
|
64
|
+
let normal=rotate(colliderRotation(terrain),hit.normal);
|
|
65
|
+
let support=dot(normal,-down);
|
|
66
|
+
if(support>0.15){
|
|
67
|
+
lengthNow=hit.distance;
|
|
68
|
+
let lever=colliderPosition(terrain)+rotate(colliderRotation(terrain),hit.point)-center;
|
|
69
|
+
let velocity=velocities[chassis].xyz+cross(angularVelocities[chassis].xyz,lever);
|
|
70
|
+
load=max(0.0,(travel-lengthNow)*vehicle.geometry.z-vehicle.geometry.w*dot(velocity,normal)/support);
|
|
71
|
+
let heading=rotate(rotation,vec3f(cos(steering),sin(steering),0));
|
|
72
|
+
let side=normalize(cross(normal,heading));
|
|
73
|
+
let forward=cross(side,normal);
|
|
74
|
+
let slip=vec2f(speed*radius-dot(velocity,forward),-dot(velocity,side));
|
|
75
|
+
let demand=slip*load*vec2f(1.1,1.5);
|
|
76
|
+
var friction=demand*min(1.0,vehicle.tire.x*load/max(length(demand),0.0001));
|
|
77
|
+
// Bound tire feedback so a light wheel cannot overshoot rolling speed in one step.
|
|
78
|
+
let longitudinalLimit=abs(slip.x)*vehicle.tire.w/(radius*radius*timestep);
|
|
79
|
+
friction.x=clamp(friction.x,-longitudinalLimit,longitudinalLimit);
|
|
80
|
+
let change=(normal*load+forward*friction.x+side*friction.y)*timestep;
|
|
81
|
+
impulse+=change;
|
|
82
|
+
torque+=cross(lever,change);
|
|
83
|
+
speed-=friction.x*radius*timestep/vehicle.tire.w;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
let angle=wheel.state.y+speed*timestep;
|
|
87
|
+
vehicle.wheels[index].state=vec4f(speed,angle,lengthNow,load);
|
|
88
|
+
let heading=vec3f(cos(steering),sin(steering),0);
|
|
89
|
+
let axle=vec3f(-sin(steering),cos(steering),0);
|
|
90
|
+
let vertical=vec3f(0,0,1);
|
|
91
|
+
let hub=wheel.mount.xyz-vertical*lengthNow;
|
|
92
|
+
vehicle.poses[index]=mat4x4f(vec4f(heading*cos(angle)-vertical*sin(angle),0),
|
|
93
|
+
vec4f(axle,0),vec4f(heading*sin(angle)+vertical*cos(angle),0),vec4f(hub,1));
|
|
94
|
+
}
|
|
95
|
+
velocities[chassis]=vec4f(velocities[chassis].xyz+impulse*velocities[chassis].w,velocities[chassis].w);
|
|
96
|
+
angularVelocities[chassis]=vec4f(angularVelocities[chassis].xyz+inverseInertia(chassis,torque),0);
|
|
97
|
+
sleepStates[chassis]=vec4f(0);
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
// SPDX-FileComment: Independently implemented for WebGPU; inspired by NVIDIA RAPIDS cuProj.
|
|
5
|
+
|
|
6
|
+
import {assert, type Device} from '@luma.gl/core';
|
|
7
|
+
import {CPUVector, GPUVector} from '@luma.gl/graph/gpu-data';
|
|
8
|
+
import {GPUSimpleGraph} from '../gpu-simple-graph/gpu-simple-graph';
|
|
9
|
+
import {GPUGraph} from '../gpu-core/gpu-graph';
|
|
10
|
+
import type {CompiledGPUGraph} from '../gpu-core/compiled-gpu-graph';
|
|
11
|
+
import type {CompiledGPUSimpleExpressionGraph} from '../gpu-simple-graph/compiled-gpu-expression-graph';
|
|
12
|
+
import {gpuGraph} from '../gpu-core/gpu-graph-value';
|
|
13
|
+
import {CPUProjectionOperation, type CPUProjectionOperationProps} from './cpu-projection-operation';
|
|
14
|
+
|
|
15
|
+
export type CoordinateProjectionGraphProps = {
|
|
16
|
+
format: 'float32x2' | 'float32x3';
|
|
17
|
+
projection: CPUProjectionOperationProps['projection'];
|
|
18
|
+
};
|
|
19
|
+
export type ProjectedCoordinateResult = {
|
|
20
|
+
positions: GPUVector;
|
|
21
|
+
/** Release this invocation's GPU result after downstream consumers finish. */
|
|
22
|
+
destroy(): void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Reusable layer-facing point-coordinate pipeline. Projection loading remains caller-owned. */
|
|
26
|
+
export class CoordinateProjectionGraph {
|
|
27
|
+
private readonly graph: CompiledGPUGraph | CompiledGPUSimpleExpressionGraph;
|
|
28
|
+
readonly format: CoordinateProjectionGraphProps['format'];
|
|
29
|
+
|
|
30
|
+
constructor(device: Device, props: CoordinateProjectionGraphProps) {
|
|
31
|
+
this.format = props.format;
|
|
32
|
+
const graph = device.type === 'webgpu' ? new GPUGraph() : new GPUSimpleGraph();
|
|
33
|
+
graph.addInput('source', gpuGraph.vector(props.format));
|
|
34
|
+
graph.add(
|
|
35
|
+
new CPUProjectionOperation({
|
|
36
|
+
id: 'project-coordinates',
|
|
37
|
+
input: 'source',
|
|
38
|
+
output: 'positions',
|
|
39
|
+
format: props.format,
|
|
40
|
+
projection: props.projection
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
this.graph = graph.compile(device, {outputs: ['positions']});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Borrow input storage and preserve row/chunk boundaries; each result owns independent storage. */
|
|
47
|
+
async run(source: CPUVector | GPUVector): Promise<ProjectedCoordinateResult> {
|
|
48
|
+
assert(source.format === this.format);
|
|
49
|
+
// Point layers must handle null filtering before this numeric projection boundary.
|
|
50
|
+
assert(source.data.every(chunk => !chunk.nullBitmap && !chunk.valueOffsets));
|
|
51
|
+
const {positions} = await this.graph.run({inputs: {source}});
|
|
52
|
+
return {positions, destroy: () => positions.destroy()};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Destroy the compiled pipeline. Previously returned results remain caller-owned. */
|
|
56
|
+
destroy(): void {
|
|
57
|
+
this.graph.destroy();
|
|
58
|
+
}
|
|
59
|
+
}
|