@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
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert, type Device} from '@luma.gl/core';
|
|
6
|
+
import {CPUData, CPUVector, GPUVector, getGPUVectorFormatInfo} from '@luma.gl/graph/gpu-data';
|
|
7
|
+
import {GPUGraph} from './gpu-graph';
|
|
8
|
+
import {gpuGraph} from './gpu-graph-value';
|
|
9
|
+
import {GPUCPUOperation, type GPUCPUVector, type GPUCPUArray} from './gpu-cpu-operation';
|
|
10
|
+
import {GPUExpressionProgram, type GPUGraphRunBindings} from './gpu-expression-plan';
|
|
11
|
+
import {GPUUploadOperation} from './gpu-transfer-operation';
|
|
12
|
+
import type {GPUGraphExecutionBindings} from './gpu-expression-plan';
|
|
13
|
+
|
|
14
|
+
/** Backend-specific GPU stage; CPU scheduling is shared by both graph executors. */
|
|
15
|
+
export type GPUCPUStage = {
|
|
16
|
+
run(bindings: GPUGraphExecutionBindings): Promise<Record<string, GPUVector>>;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
};
|
|
19
|
+
export type GPUCPUStageCompiler = (source: GPUGraph, outputs?: readonly string[]) => GPUCPUStage;
|
|
20
|
+
|
|
21
|
+
/** Submission boundaries around CPU callbacks; each GPU stage resolves its shapes independently. */
|
|
22
|
+
export class GPUCPUExecution {
|
|
23
|
+
private readonly stages: (
|
|
24
|
+
| GPUCPUOperation
|
|
25
|
+
| {
|
|
26
|
+
graph: GPUCPUStage;
|
|
27
|
+
inputs: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
)[] = [];
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
readonly device: Device,
|
|
33
|
+
readonly program: GPUExpressionProgram,
|
|
34
|
+
private readonly compileStage: GPUCPUStageCompiler
|
|
35
|
+
) {
|
|
36
|
+
// Initial support is for pure numeric, operation-owned results.
|
|
37
|
+
assert(!program.textures.length && !program.vectors.some(value => value.role === 'state'));
|
|
38
|
+
const declarations = [...program.scalars, ...program.vectors];
|
|
39
|
+
const addInput = (graph: GPUGraph, name: string) => {
|
|
40
|
+
const declaration = declarations.find(value => value.id === name)!;
|
|
41
|
+
assert(declaration);
|
|
42
|
+
const vector = program.vectors.find(value => value.id === name);
|
|
43
|
+
if (vector)
|
|
44
|
+
graph.addInput(
|
|
45
|
+
name,
|
|
46
|
+
gpuGraph.vector(vector.format, {
|
|
47
|
+
length: vector.length,
|
|
48
|
+
chunkLengths: vector.chunkLengths
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
else
|
|
52
|
+
graph.addInput(
|
|
53
|
+
name,
|
|
54
|
+
gpuGraph.scalar(program.scalars.find(value => value.id === name)!.format)
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
try {
|
|
58
|
+
for (const operation of program.operations) {
|
|
59
|
+
if (operation instanceof GPUCPUOperation) {
|
|
60
|
+
this.stages.push(operation);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
assert('contract' in operation && operation.contract);
|
|
64
|
+
const inputs = operation.contract.values
|
|
65
|
+
.filter(use => use.access !== 'write')
|
|
66
|
+
.map(use => (typeof use.value === 'string' ? use.value : use.value.id));
|
|
67
|
+
const outputs = operation.contract.values
|
|
68
|
+
.filter(use => use.access !== 'read')
|
|
69
|
+
.map(use => (typeof use.value === 'string' ? use.value : use.value.id));
|
|
70
|
+
const graph = new GPUGraph();
|
|
71
|
+
for (const name of new Set(inputs)) addInput(graph, name);
|
|
72
|
+
for (const name of new Set(outputs)) {
|
|
73
|
+
const vector = program.vectors.find(value => value.id === name);
|
|
74
|
+
if (vector)
|
|
75
|
+
graph.addDeclaration(
|
|
76
|
+
name,
|
|
77
|
+
gpuGraph.vector(vector.format, {
|
|
78
|
+
length: vector.length,
|
|
79
|
+
chunkLengths: vector.chunkLengths
|
|
80
|
+
}),
|
|
81
|
+
'value'
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
graph.add(operation);
|
|
85
|
+
this.stages.push({
|
|
86
|
+
graph: compileStage(graph, outputs),
|
|
87
|
+
inputs
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
this.destroy();
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async run(
|
|
97
|
+
bindings: GPUGraphRunBindings,
|
|
98
|
+
locations: Readonly<Record<string, 'cpu' | 'gpu'>> = {}
|
|
99
|
+
): Promise<Record<string, GPUVector | CPUVector>> {
|
|
100
|
+
for (const [name, location] of Object.entries(locations))
|
|
101
|
+
assert(this.program.outputs.includes(name) && (location === 'cpu' || location === 'gpu'));
|
|
102
|
+
const cpu = new Map<string, CPUVector>();
|
|
103
|
+
for (const declaration of [...this.program.vectors, ...this.program.scalars].filter(
|
|
104
|
+
value => value.role === 'input'
|
|
105
|
+
)) {
|
|
106
|
+
const value = bindings[declaration.id];
|
|
107
|
+
assert(value !== undefined);
|
|
108
|
+
if (!(value instanceof CPUVector)) {
|
|
109
|
+
const graph = new GPUGraph();
|
|
110
|
+
const vector = this.program.vectors.find(vector => vector.id === declaration.id);
|
|
111
|
+
if (vector)
|
|
112
|
+
graph.addInput(
|
|
113
|
+
declaration.id,
|
|
114
|
+
gpuGraph.vector(vector.format, {
|
|
115
|
+
length: vector.length,
|
|
116
|
+
chunkLengths: vector.chunkLengths
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
else
|
|
120
|
+
graph.addInput(
|
|
121
|
+
declaration.id,
|
|
122
|
+
gpuGraph.scalar(
|
|
123
|
+
this.program.scalars.find(scalar => scalar.id === declaration.id)!.format
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
new GPUExpressionProgram(graph, {outputs: []})
|
|
127
|
+
.prepare(this.device, {[declaration.id]: value})
|
|
128
|
+
.finish();
|
|
129
|
+
}
|
|
130
|
+
if (value instanceof CPUVector) {
|
|
131
|
+
// List and validity metadata cannot be represented by portable callback rows yet.
|
|
132
|
+
assert(value.data.every(chunk => !chunk.nullBitmap && !chunk.valueOffsets));
|
|
133
|
+
assert(value.format === declaration.format);
|
|
134
|
+
const vector = this.program.vectors.find(vector => vector.id === declaration.id);
|
|
135
|
+
assert(vector && (vector.length === undefined || vector.length === value.length));
|
|
136
|
+
assert(
|
|
137
|
+
!vector.chunkLengths ||
|
|
138
|
+
(vector.chunkLengths.length === value.data.length &&
|
|
139
|
+
vector.chunkLengths.every((length, index) => length === value.data[index].length))
|
|
140
|
+
);
|
|
141
|
+
cpu.set(declaration.id, value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const values: Record<string, GPUGraphRunBindings[string]> = {...bindings};
|
|
145
|
+
const owned = new Set<GPUVector>();
|
|
146
|
+
const ensureCPU = async (name: string): Promise<GPUCPUVector> => {
|
|
147
|
+
let value = cpu.get(name);
|
|
148
|
+
if (!value) {
|
|
149
|
+
const gpu = values[name];
|
|
150
|
+
assert(gpu instanceof GPUVector);
|
|
151
|
+
const read = await readCPUVector(gpu);
|
|
152
|
+
value = makeCPUVector(
|
|
153
|
+
read.format,
|
|
154
|
+
read.chunks.map(chunk => chunk.values)
|
|
155
|
+
);
|
|
156
|
+
cpu.set(name, value);
|
|
157
|
+
}
|
|
158
|
+
return getCPUView(value);
|
|
159
|
+
};
|
|
160
|
+
const ensureGPU = async (name: string): Promise<GPUVector> => {
|
|
161
|
+
const existing = values[name];
|
|
162
|
+
if (existing instanceof GPUVector) return existing;
|
|
163
|
+
const view = await ensureCPU(name);
|
|
164
|
+
const graph = new GPUGraph();
|
|
165
|
+
graph.add(
|
|
166
|
+
new GPUUploadOperation({
|
|
167
|
+
output: name,
|
|
168
|
+
format: view.format,
|
|
169
|
+
data: view.chunks.map(chunk => chunk.values)
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
const compiled = this.compileStage(graph);
|
|
173
|
+
try {
|
|
174
|
+
const result = (await compiled.run({}))[name];
|
|
175
|
+
owned.add(result);
|
|
176
|
+
values[name] = result;
|
|
177
|
+
return result;
|
|
178
|
+
} finally {
|
|
179
|
+
compiled.destroy();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
try {
|
|
183
|
+
for (const stage of this.stages) {
|
|
184
|
+
let results: Record<string, GPUVector>;
|
|
185
|
+
if (stage instanceof GPUCPUOperation) {
|
|
186
|
+
const inputs: Record<string, GPUCPUVector | number> = Object.create(null);
|
|
187
|
+
for (const [localName, name] of Object.entries(stage.inputs)) {
|
|
188
|
+
const value = values[name];
|
|
189
|
+
const cpuValue = typeof value === 'number' ? value : await ensureCPU(name);
|
|
190
|
+
inputs[localName] =
|
|
191
|
+
typeof cpuValue !== 'number' &&
|
|
192
|
+
this.program.scalars.some(scalar => scalar.id === name)
|
|
193
|
+
? cpuValue.pack()[0]
|
|
194
|
+
: cpuValue;
|
|
195
|
+
}
|
|
196
|
+
const outputs = await stage.execute({inputs});
|
|
197
|
+
assert(Object.keys(outputs).length === Object.keys(stage.outputs).length);
|
|
198
|
+
for (const name of Object.keys(stage.outputs)) {
|
|
199
|
+
// The resolved declaration includes constraints supplied through graph.vector().
|
|
200
|
+
const descriptor = this.program.vectors.find(vector => vector.id === name)!;
|
|
201
|
+
const result = outputs[name];
|
|
202
|
+
assert(result);
|
|
203
|
+
const arrays = 'chunks' in result ? result.chunks.map(chunk => chunk.values) : [result];
|
|
204
|
+
const upload = new GPUUploadOperation({
|
|
205
|
+
output: name,
|
|
206
|
+
format: descriptor.format,
|
|
207
|
+
data: arrays
|
|
208
|
+
});
|
|
209
|
+
const length = upload.chunkLengths.reduce((total, count) => total + count, 0);
|
|
210
|
+
// Returned rows must satisfy any declared fixed shape.
|
|
211
|
+
assert(descriptor.length === undefined || descriptor.length === length);
|
|
212
|
+
assert(
|
|
213
|
+
!descriptor.chunkLengths ||
|
|
214
|
+
(descriptor.chunkLengths.length === arrays.length &&
|
|
215
|
+
descriptor.chunkLengths.every(
|
|
216
|
+
(count, index) => count === upload.chunkLengths[index]
|
|
217
|
+
))
|
|
218
|
+
);
|
|
219
|
+
cpu.set(name, makeCPUVector(descriptor.format, arrays));
|
|
220
|
+
delete values[name];
|
|
221
|
+
}
|
|
222
|
+
continue;
|
|
223
|
+
} else {
|
|
224
|
+
const inputs: Record<string, GPUGraphRunBindings[string]> = Object.create(null);
|
|
225
|
+
for (const name of stage.inputs) {
|
|
226
|
+
const value = values[name];
|
|
227
|
+
// Stage scalar inputs are host numbers, including results produced by an earlier GPU stage.
|
|
228
|
+
inputs[name] = this.program.scalars.some(scalar => scalar.id === name)
|
|
229
|
+
? typeof value === 'number'
|
|
230
|
+
? value
|
|
231
|
+
: (await ensureCPU(name)).pack()[0]
|
|
232
|
+
: await ensureGPU(name);
|
|
233
|
+
}
|
|
234
|
+
results = await stage.graph.run({inputs});
|
|
235
|
+
}
|
|
236
|
+
for (const [name, value] of Object.entries(results)) {
|
|
237
|
+
cpu.delete(name);
|
|
238
|
+
values[name] = value;
|
|
239
|
+
owned.add(value);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const outputs: Record<string, GPUVector | CPUVector> = Object.create(null);
|
|
243
|
+
for (const name of this.program.outputs) {
|
|
244
|
+
if (locations[name] === 'cpu') {
|
|
245
|
+
await ensureCPU(name);
|
|
246
|
+
outputs[name] = cpu.get(name)!;
|
|
247
|
+
} else outputs[name] = await ensureGPU(name);
|
|
248
|
+
}
|
|
249
|
+
for (const value of Object.values(outputs))
|
|
250
|
+
if (value instanceof GPUVector) owned.delete(value);
|
|
251
|
+
return outputs;
|
|
252
|
+
} finally {
|
|
253
|
+
for (const value of owned) value.destroy();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
destroy(): void {
|
|
258
|
+
for (const stage of this.stages) if (!(stage instanceof GPUCPUOperation)) stage.graph.destroy();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async function readCPUVector(vector: GPUVector): Promise<GPUCPUVector> {
|
|
263
|
+
assert(vector.format);
|
|
264
|
+
const info = getGPUVectorFormatInfo(vector.format);
|
|
265
|
+
const ValueType =
|
|
266
|
+
info.signedDataType === 'float32'
|
|
267
|
+
? Float32Array
|
|
268
|
+
: info.signedDataType === 'uint32'
|
|
269
|
+
? Uint32Array
|
|
270
|
+
: Int32Array;
|
|
271
|
+
const chunks: {values: GPUCPUArray; length: number}[] = [];
|
|
272
|
+
for (const chunk of vector.data) {
|
|
273
|
+
const values = new ValueType((chunk.length * info.byteLength) / 4);
|
|
274
|
+
if (chunk.length) {
|
|
275
|
+
const bytes = await chunk.buffer.readAsync(
|
|
276
|
+
chunk.byteOffset,
|
|
277
|
+
(chunk.length - 1) * chunk.byteStride + info.byteLength
|
|
278
|
+
);
|
|
279
|
+
const packed = new Uint8Array(values.buffer);
|
|
280
|
+
for (let row = 0; row < chunk.length; row++)
|
|
281
|
+
packed.set(
|
|
282
|
+
bytes.subarray(row * chunk.byteStride, row * chunk.byteStride + info.byteLength),
|
|
283
|
+
row * info.byteLength
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
chunks.push({values, length: chunk.length});
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
format: vector.format as GPUCPUVector['format'],
|
|
290
|
+
length: vector.length,
|
|
291
|
+
chunks,
|
|
292
|
+
pack() {
|
|
293
|
+
const packed = new ValueType(chunks.reduce((total, chunk) => total + chunk.values.length, 0));
|
|
294
|
+
let offset = 0;
|
|
295
|
+
for (const chunk of chunks) {
|
|
296
|
+
packed.set(chunk.values, offset);
|
|
297
|
+
offset += chunk.values.length;
|
|
298
|
+
}
|
|
299
|
+
return packed;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function makeCPUVector(format: GPUCPUVector['format'], arrays: readonly GPUCPUArray[]): CPUVector {
|
|
305
|
+
const width = getGPUVectorFormatInfo(format).byteLength;
|
|
306
|
+
return new CPUVector({
|
|
307
|
+
format,
|
|
308
|
+
data: arrays.map(buffer => new CPUData({buffer, format, length: buffer.byteLength / width}))
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function getCPUView(vector: CPUVector): GPUCPUVector {
|
|
312
|
+
const format = vector.format as GPUCPUVector['format'];
|
|
313
|
+
assert(/^(float32|sint32|uint32)(x[234])?$/.test(format));
|
|
314
|
+
const info = getGPUVectorFormatInfo(format);
|
|
315
|
+
const ValueType =
|
|
316
|
+
info.signedDataType === 'float32'
|
|
317
|
+
? Float32Array
|
|
318
|
+
: info.signedDataType === 'uint32'
|
|
319
|
+
? Uint32Array
|
|
320
|
+
: Int32Array;
|
|
321
|
+
const chunks = vector.data.map(chunk => {
|
|
322
|
+
const values = new ValueType(chunk.length * info.components);
|
|
323
|
+
const bytes = new Uint8Array(values.buffer);
|
|
324
|
+
for (let row = 0; row < chunk.length; row++)
|
|
325
|
+
bytes.set(
|
|
326
|
+
new Uint8Array(chunk.buffer, chunk.byteOffset + row * chunk.byteStride, info.byteLength),
|
|
327
|
+
row * info.byteLength
|
|
328
|
+
);
|
|
329
|
+
return {values, length: chunk.length};
|
|
330
|
+
});
|
|
331
|
+
return {
|
|
332
|
+
format,
|
|
333
|
+
length: vector.length,
|
|
334
|
+
chunks,
|
|
335
|
+
pack() {
|
|
336
|
+
const values = new ValueType(vector.length * info.components);
|
|
337
|
+
let offset = 0;
|
|
338
|
+
for (const chunk of chunks) {
|
|
339
|
+
values.set(chunk.values, offset);
|
|
340
|
+
offset += chunk.values.length;
|
|
341
|
+
}
|
|
342
|
+
return values;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {GPUOperation} from './gpu-operation';
|
|
6
|
+
import type {GPUOperationContract} from './gpu-operation-contract';
|
|
7
|
+
import type {GPUGraphVectorDescriptor, GPUGraphVectorFormat} from './gpu-graph-value';
|
|
8
|
+
|
|
9
|
+
/** Packed numeric rows supported by portable graph operations. */
|
|
10
|
+
export type GPUCPUArray = Float32Array | Int32Array | Uint32Array;
|
|
11
|
+
export type GPUCPUVector = {
|
|
12
|
+
readonly format: GPUGraphVectorFormat;
|
|
13
|
+
readonly length: number;
|
|
14
|
+
readonly chunks: readonly {readonly values: GPUCPUArray; readonly length: number}[];
|
|
15
|
+
/** Explicitly combine the source chunks into a new packed array. */
|
|
16
|
+
pack(): GPUCPUArray;
|
|
17
|
+
};
|
|
18
|
+
export type GPUCPUResult = GPUCPUArray | {chunks: readonly {values: GPUCPUArray}[]};
|
|
19
|
+
export type GPUCPUOperationProps = {
|
|
20
|
+
id: string;
|
|
21
|
+
inputs: Readonly<Record<string, string>>;
|
|
22
|
+
outputs: Readonly<Record<string, GPUGraphVectorDescriptor>>;
|
|
23
|
+
/** Input arrays are borrowed read-only snapshots. Do not mutate returned arrays until run settles. */
|
|
24
|
+
execute(context: {
|
|
25
|
+
inputs: Readonly<Record<string, GPUCPUVector | number>>;
|
|
26
|
+
}): Record<string, GPUCPUResult> | Promise<Record<string, GPUCPUResult>>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** Shared CPU operation intent. Executed by reusable, unscoped GPUGraph and GPUSimpleGraph. */
|
|
30
|
+
export class GPUCPUOperation implements GPUOperation {
|
|
31
|
+
readonly type = 'cpu';
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly inputs: GPUCPUOperationProps['inputs'];
|
|
34
|
+
readonly outputs: GPUCPUOperationProps['outputs'];
|
|
35
|
+
readonly execute: GPUCPUOperationProps['execute'];
|
|
36
|
+
|
|
37
|
+
constructor(props: GPUCPUOperationProps) {
|
|
38
|
+
this.id = props.id;
|
|
39
|
+
this.inputs = Object.freeze({...props.inputs});
|
|
40
|
+
this.outputs = Object.freeze(
|
|
41
|
+
Object.fromEntries(
|
|
42
|
+
Object.entries(props.outputs).map(([name, descriptor]) => [
|
|
43
|
+
name,
|
|
44
|
+
Object.freeze({
|
|
45
|
+
...descriptor,
|
|
46
|
+
...(descriptor.chunkLengths
|
|
47
|
+
? {chunkLengths: Object.freeze([...descriptor.chunkLengths])}
|
|
48
|
+
: {})
|
|
49
|
+
})
|
|
50
|
+
])
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
this.execute = props.execute;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get contract(): GPUOperationContract {
|
|
57
|
+
return {
|
|
58
|
+
outputs: this.outputs,
|
|
59
|
+
values: [
|
|
60
|
+
...Object.values(this.inputs).map(value => ({value, access: 'read' as const})),
|
|
61
|
+
...Object.keys(this.outputs).map(value => ({value, access: 'write' as const}))
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -23,12 +23,24 @@ export function getBoundedDispatchLayout(
|
|
|
23
23
|
throw new Error(`${operationName} element count must be a non-negative uint32`);
|
|
24
24
|
}
|
|
25
25
|
validateWorkgroupSize(operationName, workgroupSize);
|
|
26
|
+
return getBoundedWorkgroupLayout(
|
|
27
|
+
operationName,
|
|
28
|
+
Math.max(1, Math.ceil(elementCount / workgroupSize)),
|
|
29
|
+
maxComputeWorkgroupsPerDimension
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Plans a bounded dispatch for kernels that index their work directly by workgroup. Requires a positive count. @internal */
|
|
34
|
+
export function getBoundedWorkgroupLayout(
|
|
35
|
+
operationName: string,
|
|
36
|
+
workgroupCount: number,
|
|
37
|
+
maxComputeWorkgroupsPerDimension: number
|
|
38
|
+
): GPUBoundedDispatchLayout {
|
|
26
39
|
const maximum = Math.floor(maxComputeWorkgroupsPerDimension);
|
|
27
40
|
if (!Number.isSafeInteger(maximum) || maximum < 1) {
|
|
28
41
|
throw new Error('maxComputeWorkgroupsPerDimension must be a positive integer');
|
|
29
42
|
}
|
|
30
43
|
|
|
31
|
-
const workgroupCount = Math.max(1, Math.ceil(elementCount / workgroupSize));
|
|
32
44
|
const x = Math.min(workgroupCount, maximum);
|
|
33
45
|
const y = Math.min(Math.ceil(workgroupCount / x), maximum);
|
|
34
46
|
const z = Math.ceil(workgroupCount / x / y);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {parse, type Expression} from '@math.gl/
|
|
5
|
+
import {parse, type Expression} from '@math.gl/sql/expressions';
|
|
6
6
|
import {getGPUVectorFormatInfo} from '@luma.gl/graph/gpu-data';
|
|
7
7
|
import {gpuGraph, type GPUGraphVectorFormat} from './gpu-graph-value';
|
|
8
8
|
import type {GPUOperationContract} from './gpu-operation-contract';
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Buffer, Texture, TextureView, type Device} from '@luma.gl/core';
|
|
6
|
-
import {GPUData, GPUVector, getGPUVectorFormatInfo} from '@luma.gl/graph/gpu-data';
|
|
6
|
+
import {CPUVector, GPUData, GPUVector, getGPUVectorFormatInfo} from '@luma.gl/graph/gpu-data';
|
|
7
7
|
import type {GPUGraph} from './gpu-graph';
|
|
8
8
|
import {GPUCopyOperation} from './gpu-transfer-operation';
|
|
9
|
+
import {GPUShaderPassOperation} from './gpu-shader-pass-operation';
|
|
9
10
|
import {validateTextureCopy} from './gpu-texture-copy';
|
|
10
11
|
import {
|
|
11
12
|
GPUTextureInvocation,
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
} from './gpu-operation-contract';
|
|
38
39
|
|
|
39
40
|
export type GPUGraphRunBindings = Readonly<
|
|
40
|
-
Record<string, GPUVector | number | GPUGraphTextureBinding>
|
|
41
|
+
Record<string, GPUVector | CPUVector | number | GPUGraphTextureBinding>
|
|
41
42
|
>;
|
|
42
43
|
export type GPUGraphExecutionBindings = {
|
|
43
44
|
inputs?: GPUGraphRunBindings;
|
|
@@ -46,6 +47,7 @@ export type GPUGraphExecutionBindings = {
|
|
|
46
47
|
};
|
|
47
48
|
export type GPUGraphCompileOptions = {
|
|
48
49
|
outputs?: readonly string[];
|
|
50
|
+
outputLocations?: Readonly<Record<string, 'cpu' | 'gpu'>>;
|
|
49
51
|
lowerings?: readonly GPUOperationLowering[];
|
|
50
52
|
};
|
|
51
53
|
export type GPUGraphRunOptions = {outputTargets?: Readonly<Record<string, GPUGraphOutput>>};
|
|
@@ -88,6 +90,11 @@ export class GPUExpressionProgram {
|
|
|
88
90
|
operation.operations.forEach(flatten);
|
|
89
91
|
else {
|
|
90
92
|
if (operation instanceof GPUCompositeOperation) {
|
|
93
|
+
const containsShaderPass = (child: GPUGraphOperation): boolean =>
|
|
94
|
+
child instanceof GPUShaderPassOperation ||
|
|
95
|
+
(child instanceof GPUCompositeOperation && child.operations.some(containsShaderPass));
|
|
96
|
+
if (operation.operations.some(containsShaderPass))
|
|
97
|
+
throw new Error('Shader-pass operations inside control flow are not supported');
|
|
91
98
|
const containsExpression = (child: GPUGraphOperation): boolean =>
|
|
92
99
|
child instanceof GPUExpressionOperation ||
|
|
93
100
|
(child instanceof GPUCompositeOperation && child.operations.some(containsExpression));
|
|
@@ -259,6 +266,7 @@ export class GPUExpressionProgram {
|
|
|
259
266
|
value !== undefined &&
|
|
260
267
|
typeof value === 'object' &&
|
|
261
268
|
!(value instanceof GPUVector) &&
|
|
269
|
+
!(value instanceof CPUVector) &&
|
|
262
270
|
!(value instanceof Texture) &&
|
|
263
271
|
!(value instanceof TextureView)
|
|
264
272
|
);
|
|
@@ -272,7 +280,7 @@ export class GPUExpressionProgram {
|
|
|
272
280
|
if (!['inputs', 'state', 'outputTargets'].includes(name))
|
|
273
281
|
throw new Error(`Unknown execution option ${name}`);
|
|
274
282
|
const execution = supplied as GPUGraphExecutionBindings;
|
|
275
|
-
const bindings: Record<string, GPUVector | number | GPUGraphTextureBinding> =
|
|
283
|
+
const bindings: Record<string, GPUVector | CPUVector | number | GPUGraphTextureBinding> =
|
|
276
284
|
Object.create(null);
|
|
277
285
|
for (const [role, group] of [
|
|
278
286
|
['input', execution.inputs],
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import {lowerGPUUpload, lowerGPUCopy, lowerGPUTextureCopy} from './gpu-transfer-lowering';
|
|
6
6
|
import {GPUUploadOperation, GPUCopyOperation} from './gpu-transfer-operation';
|
|
7
7
|
import {GPUCompactionOperation} from './gpu-compaction-operation';
|
|
8
|
+
import {GPUGraphGroupAggregation, GPUGraphReduction} from './gpu-semantic-aggregation-operation';
|
|
9
|
+
import {GPUGroupAggregation} from './gpu-group-aggregation';
|
|
10
|
+
import {GPUReduction} from './gpu-reduction';
|
|
8
11
|
import {GPUCompaction} from './gpu-compaction';
|
|
9
12
|
|
|
10
13
|
import type {TextureFormat} from '@luma.gl/core';
|
|
@@ -108,6 +111,7 @@ export class GPUGraphCompiler<Parameters = void> {
|
|
|
108
111
|
readonly capabilities: GPUGraphBackendCapabilities;
|
|
109
112
|
readonly lowerings: readonly GPUOperationLowering<Parameters>[];
|
|
110
113
|
private compactionIndex = 0;
|
|
114
|
+
private aggregationIndex = 0;
|
|
111
115
|
constructor(device: Device, lowerings: readonly GPUOperationLowering<Parameters>[] = []) {
|
|
112
116
|
this.device = device;
|
|
113
117
|
this.capabilities = Object.freeze({
|
|
@@ -131,6 +135,7 @@ export class GPUGraphCompiler<Parameters = void> {
|
|
|
131
135
|
}
|
|
132
136
|
compile(program: GPUGraph, bindings: GPUGraphBindings = {}): GPUGraphCompilation<Parameters> {
|
|
133
137
|
this.compactionIndex = 0;
|
|
138
|
+
this.aggregationIndex = 0;
|
|
134
139
|
// Bound external partitions must be available when resolving shape-inheriting results.
|
|
135
140
|
program = program.clone();
|
|
136
141
|
for (const vector of program.vectors) {
|
|
@@ -336,6 +341,54 @@ export class GPUGraphCompiler<Parameters = void> {
|
|
|
336
341
|
return [
|
|
337
342
|
{type: 'vector-upload', lower: lowerGPUUpload},
|
|
338
343
|
{type: 'vector-copy', lower: lowerGPUCopy},
|
|
344
|
+
{
|
|
345
|
+
type: 'group-aggregation',
|
|
346
|
+
lower: (operation: GPUGraphGroupAggregation, context) => {
|
|
347
|
+
const {props} = operation;
|
|
348
|
+
const id = `${operation.id}-${this.aggregationIndex++}`;
|
|
349
|
+
const keys = context.resolveVector<'uint32'>(props.keys);
|
|
350
|
+
const mask = props.mask ? context.resolveVector<'uint32'>(props.mask) : undefined;
|
|
351
|
+
if (props.operation === 'count') {
|
|
352
|
+
context.graph.add(
|
|
353
|
+
new GPUGroupAggregation({
|
|
354
|
+
id,
|
|
355
|
+
keys,
|
|
356
|
+
mask,
|
|
357
|
+
operation: 'count',
|
|
358
|
+
output: getAggregationOutput(context.resolveVector<'uint32'>(props.output))
|
|
359
|
+
})
|
|
360
|
+
);
|
|
361
|
+
} else {
|
|
362
|
+
context.graph.add(
|
|
363
|
+
new GPUGroupAggregation({
|
|
364
|
+
id,
|
|
365
|
+
keys,
|
|
366
|
+
mask,
|
|
367
|
+
operation: props.operation,
|
|
368
|
+
values: context.resolveVector<'float32'>(props.values),
|
|
369
|
+
output: getAggregationOutput(context.resolveVector<'float32'>(props.output))
|
|
370
|
+
})
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
type: 'reduction',
|
|
377
|
+
lower: (operation: GPUGraphReduction, context) => {
|
|
378
|
+
const {props} = operation;
|
|
379
|
+
context.graph.add(
|
|
380
|
+
new GPUReduction({
|
|
381
|
+
id: `${operation.id}-${this.aggregationIndex++}`,
|
|
382
|
+
input: context.resolveVector<'uint32' | 'sint32' | 'float32'>(props.input),
|
|
383
|
+
mask: props.mask ? context.resolveVector<'uint32'>(props.mask) : undefined,
|
|
384
|
+
operation: props.operation,
|
|
385
|
+
output: getAggregationOutput(
|
|
386
|
+
context.resolveVector<'uint32' | 'sint32' | 'float32'>(props.output)
|
|
387
|
+
)
|
|
388
|
+
})
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
},
|
|
339
392
|
{
|
|
340
393
|
type: 'compaction',
|
|
341
394
|
lower: (operation: GPUCompactionOperation, context) => {
|
|
@@ -760,3 +813,11 @@ function getTransientChunkLengths(
|
|
|
760
813
|
}
|
|
761
814
|
return lengths;
|
|
762
815
|
}
|
|
816
|
+
|
|
817
|
+
// These reduction kernels write one packed destination, never just the first of several chunks.
|
|
818
|
+
function getAggregationOutput<Format extends 'uint32' | 'sint32' | 'float32'>(
|
|
819
|
+
output: GraphVectorView<Format>
|
|
820
|
+
) {
|
|
821
|
+
assert(output.data.length === 1);
|
|
822
|
+
return output.data[0];
|
|
823
|
+
}
|
|
@@ -222,9 +222,9 @@ export class GPUGraph {
|
|
|
222
222
|
throw new Error(`${this.id} accepts GPU operations only`);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
export function composite(
|
|
226
|
-
operations: readonly
|
|
225
|
+
export function composite<Operation extends GPUGraphOperation>(
|
|
226
|
+
operations: readonly Operation[],
|
|
227
227
|
props: {id?: string} = {}
|
|
228
|
-
): GPUCompositeOperation {
|
|
228
|
+
): GPUCompositeOperation<Operation> {
|
|
229
229
|
return new GPUCompositeOperation({id: props.id, operations});
|
|
230
230
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import {GPU_GRID_COORDINATE_WGSL} from './gpu-grid-coordinate';
|
|
5
6
|
import type {GPUCommandNode} from './gpu-command-node';
|
|
6
7
|
import {
|
|
7
8
|
GPUCommandGraph,
|
|
@@ -346,11 +347,7 @@ ${boundsBinding}
|
|
|
346
347
|
@group(0) @binding(${outputBinding}) var<storage, read_write> outputValues: array<atomic<u32>>;
|
|
347
348
|
${countsBinding}
|
|
348
349
|
|
|
349
|
-
|
|
350
|
-
if (maximum == minimum || value == minimum) { return 0u; }
|
|
351
|
-
if (value == maximum) { return size - 1u; }
|
|
352
|
-
return min(u32((value - minimum) / (maximum - minimum) * f32(size)), size - 1u);
|
|
353
|
-
}
|
|
350
|
+
${GPU_GRID_COORDINATE_WGSL}
|
|
354
351
|
|
|
355
352
|
${getAggregationFunction(aggregation.operation)}
|
|
356
353
|
${useSubgroups ? getSubgroupBallotHelpersWGSL() : ''}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import {GPU_GRID_COORDINATE_WGSL} from './gpu-grid-coordinate';
|
|
5
6
|
import type {GPUCommandNode} from './gpu-command-node';
|
|
6
7
|
import {
|
|
7
8
|
GPUCommandGraph,
|
|
@@ -291,11 +292,7 @@ ${boundsBinding}
|
|
|
291
292
|
${local ? `var<workgroup> localCounts: array<atomic<u32>, ${binning.output.length}>;` : ''}
|
|
292
293
|
${useSubgroups ? getSubgroupBallotHelpersWGSL() : ''}
|
|
293
294
|
|
|
294
|
-
|
|
295
|
-
if (maximum == minimum || value == minimum) { return 0u; }
|
|
296
|
-
if (value == maximum) { return size - 1u; }
|
|
297
|
-
return min(u32((value - minimum) / (maximum - minimum) * f32(size)), size - 1u);
|
|
298
|
-
}
|
|
295
|
+
${GPU_GRID_COORDINATE_WGSL}
|
|
299
296
|
|
|
300
297
|
@compute @workgroup_size(${GRID_WORKGROUP_SIZE}) fn main(
|
|
301
298
|
@builtin(workgroup_id) workgroupId: vec3<u32>,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WGSL `getCoordinate(value, minimum, maximum, size)` for grids.
|
|
7
|
+
* Supply a finite value, inclusive bounds, and a positive cell count.
|
|
8
|
+
* Coordinates outside the bounds clamp to the first or last cell.
|
|
9
|
+
*/
|
|
10
|
+
export const GPU_GRID_COORDINATE_WGSL = `fn getCoordinate(value: f32, minimum: f32, maximum: f32, size: u32) -> u32 {
|
|
11
|
+
if (maximum == minimum || value <= minimum) { return 0u; }
|
|
12
|
+
if (value >= maximum) { return size - 1u; }
|
|
13
|
+
if (minimum < 0.0 && maximum > 3.402823466e+38 + minimum) {
|
|
14
|
+
let scale = max(abs(minimum), abs(maximum));
|
|
15
|
+
let scaledValue = value / scale;
|
|
16
|
+
let scaledMinimum = minimum / scale;
|
|
17
|
+
let scaledMaximum = maximum / scale;
|
|
18
|
+
return min(
|
|
19
|
+
u32((scaledValue - scaledMinimum) / (scaledMaximum - scaledMinimum) * f32(size)),
|
|
20
|
+
size - 1u
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return min(u32((value - minimum) / (maximum - minimum) * f32(size)), size - 1u);
|
|
24
|
+
}`;
|