@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,103 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert, type SamplerProps, type TextureFormatColor} from '@luma.gl/core';
|
|
6
|
+
import {gpuGraph, type GPUGraphTextureDescriptor} from './gpu-graph-value';
|
|
7
|
+
import type {GPUOperation} from './gpu-operation';
|
|
8
|
+
import type {GPUOperationContract} from './gpu-operation-contract';
|
|
9
|
+
|
|
10
|
+
export type GPUShaderPassOperationProps = {
|
|
11
|
+
id?: string;
|
|
12
|
+
/** WGSL defining fn shade(textureCoordinates: vec2<f32>) -> vec4<f32>. */
|
|
13
|
+
fragmentSource: string;
|
|
14
|
+
/** Shader texture binding names mapped to logical graph texture names. */
|
|
15
|
+
inputs: Readonly<Record<string, string>>;
|
|
16
|
+
/** Explicit, immutable color sampler descriptions, keyed by shader binding name. */
|
|
17
|
+
samplers?: Readonly<Record<string, SamplerProps>>;
|
|
18
|
+
/** Fields of the generated parameters uniform, mapped to graph scalar names. */
|
|
19
|
+
parameters?: Readonly<Record<string, string>>;
|
|
20
|
+
output: string;
|
|
21
|
+
/** Single-sampled 2D color result with an explicit fixed or inherited extent. */
|
|
22
|
+
outputDescriptor: GPUGraphTextureDescriptor<TextureFormatColor>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** One fullscreen WGSL draw, shared by GPUGraph and WebGPU SimpleGraph. */
|
|
26
|
+
export class GPUShaderPassOperation implements GPUOperation {
|
|
27
|
+
readonly type = 'shader-pass';
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly fragmentSource: string;
|
|
30
|
+
readonly inputs: Readonly<Record<string, string>>;
|
|
31
|
+
readonly samplers: Readonly<Record<string, Readonly<SamplerProps>>>;
|
|
32
|
+
readonly parameters: Readonly<Record<string, string>>;
|
|
33
|
+
readonly output: string;
|
|
34
|
+
readonly outputDescriptor: GPUGraphTextureDescriptor<TextureFormatColor>;
|
|
35
|
+
|
|
36
|
+
constructor(props: GPUShaderPassOperationProps) {
|
|
37
|
+
this.id = props.id ?? `${props.output}-shader-pass`;
|
|
38
|
+
this.fragmentSource = props.fragmentSource;
|
|
39
|
+
this.inputs = Object.freeze({...props.inputs});
|
|
40
|
+
this.parameters = Object.freeze({...props.parameters});
|
|
41
|
+
this.samplers = Object.freeze(
|
|
42
|
+
Object.fromEntries(
|
|
43
|
+
Object.entries(props.samplers ?? {}).map(([name, sampler]) => [
|
|
44
|
+
name,
|
|
45
|
+
Object.freeze({...sampler})
|
|
46
|
+
])
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
this.output = props.output;
|
|
50
|
+
const descriptor = props.outputDescriptor;
|
|
51
|
+
// This operation writes one complete 2D color attachment, without mip generation or MSAA.
|
|
52
|
+
assert(
|
|
53
|
+
descriptor.extent &&
|
|
54
|
+
(descriptor.dimension ?? '2d') === '2d' &&
|
|
55
|
+
(descriptor.mipLevels ?? 1) === 1 &&
|
|
56
|
+
(descriptor.samples ?? 1) === 1
|
|
57
|
+
);
|
|
58
|
+
this.outputDescriptor = gpuGraph.texture({
|
|
59
|
+
...descriptor,
|
|
60
|
+
dimension: '2d',
|
|
61
|
+
mipLevels: 1,
|
|
62
|
+
samples: 1
|
|
63
|
+
});
|
|
64
|
+
const bindings = [...Object.keys(this.inputs), ...Object.keys(this.samplers)];
|
|
65
|
+
// Binding names are WGSL identifiers; reserve the generated uniform and entry-point names.
|
|
66
|
+
assert(new Set(bindings).size === bindings.length);
|
|
67
|
+
for (const name of [...bindings, ...Object.keys(this.parameters)])
|
|
68
|
+
assert(
|
|
69
|
+
/^[A-Za-z][A-Za-z0-9_]*$/.test(name) &&
|
|
70
|
+
!['parameters', 'shade', 'vertexMain', 'fragmentMain'].includes(name) &&
|
|
71
|
+
!name.startsWith('GraphShaderPass')
|
|
72
|
+
);
|
|
73
|
+
for (const sampler of Object.values(this.samplers))
|
|
74
|
+
assert((sampler.type ?? 'color-sampler') === 'color-sampler');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get contract(): GPUOperationContract {
|
|
78
|
+
return {
|
|
79
|
+
values: [
|
|
80
|
+
...Object.values(this.inputs).map(value => ({
|
|
81
|
+
value,
|
|
82
|
+
access: 'read' as const,
|
|
83
|
+
textureUsage: 'sampled' as const
|
|
84
|
+
})),
|
|
85
|
+
...Object.values(this.parameters).map(value => ({value, access: 'read' as const})),
|
|
86
|
+
{value: this.output, access: 'write', textureUsage: 'render-attachment'}
|
|
87
|
+
],
|
|
88
|
+
outputs: ({getValue}) => {
|
|
89
|
+
for (const name of Object.values(this.inputs)) {
|
|
90
|
+
const input = getValue(name);
|
|
91
|
+
// Texture views may select one layer of an array, but the logical input is 2D.
|
|
92
|
+
assert(
|
|
93
|
+
input.type === 'texture' &&
|
|
94
|
+
(input.dimension ?? '2d') === '2d' &&
|
|
95
|
+
(input.samples ?? 1) === 1
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
for (const name of Object.values(this.parameters)) assert(getValue(name).type === 'scalar');
|
|
99
|
+
return {[this.output]: this.outputDescriptor};
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import type {CPUVector} from '../gpu-data/cpu-vector';
|
|
5
6
|
import {assert, Texture, TextureView, type Device, type TextureViewProps} from '@luma.gl/core';
|
|
6
7
|
import type {GPUVector} from '@luma.gl/graph/gpu-data';
|
|
7
8
|
import type {GPUGraphTexture, GPUGraphTextureDescriptor} from './gpu-graph-value';
|
|
@@ -10,7 +11,7 @@ import {getGPUOperationValueName} from './gpu-operation-contract';
|
|
|
10
11
|
import type {GraphTextureUsage, GraphTextureViewProps} from './gpu-command-graph';
|
|
11
12
|
|
|
12
13
|
export type GPUGraphTextureBinding = Texture | TextureView;
|
|
13
|
-
export type GPUGraphOutput = GPUVector | GPUGraphTextureBinding;
|
|
14
|
+
export type GPUGraphOutput = CPUVector | GPUVector | GPUGraphTextureBinding;
|
|
14
15
|
export type GPUGraphOutputs = Record<string, GPUGraphOutput>;
|
|
15
16
|
|
|
16
17
|
/** Selected view geometry, without creating another view. @internal */
|
|
@@ -109,7 +110,7 @@ export class GPUTextureInvocation {
|
|
|
109
110
|
device: Device,
|
|
110
111
|
declarations: readonly GPUGraphTexture[],
|
|
111
112
|
contracts: readonly GPUOperationContract[],
|
|
112
|
-
bindings: Readonly<Record<string, GPUVector | number | GPUGraphTextureBinding>>,
|
|
113
|
+
bindings: Readonly<Record<string, GPUVector | CPUVector | number | GPUGraphTextureBinding>>,
|
|
113
114
|
targets: Readonly<Record<string, GPUGraphOutput>>
|
|
114
115
|
) {
|
|
115
116
|
const usages = new Map<string, number>();
|
package/src/gpu-core/index.ts
CHANGED
|
@@ -46,6 +46,8 @@ export type {
|
|
|
46
46
|
GPUCommandGraphNodeTiming,
|
|
47
47
|
GPUCommandGraphNodeType,
|
|
48
48
|
GPUCommandGraphNodePreflight,
|
|
49
|
+
GPUCommandGraphCompileOptions,
|
|
50
|
+
GPUCommandGraphKernelMetadata,
|
|
49
51
|
GPUCommandGraphResourceSummary,
|
|
50
52
|
GPUCommandGraphNodePublication,
|
|
51
53
|
GPUCommandGraphNodeWorkloadEstimate,
|
|
@@ -140,6 +142,8 @@ export {GPUByteRangeGather} from './gpu-byte-range-gather';
|
|
|
140
142
|
export type {GPUByteRangeGatherProps} from './gpu-byte-range-gather';
|
|
141
143
|
export {GPUGather} from './gpu-gather';
|
|
142
144
|
export type {GPUGatherFormat, GPUGatherProps} from './gpu-gather';
|
|
145
|
+
export {GPUScatter} from './gpu-scatter';
|
|
146
|
+
export type {GPUScatterFormat, GPUScatterProps} from './gpu-scatter';
|
|
143
147
|
export {
|
|
144
148
|
GPULZByteDecompressor,
|
|
145
149
|
GPU_LZ_BYTE_DESCRIPTOR_WORDS,
|
|
@@ -177,6 +181,15 @@ export type {
|
|
|
177
181
|
GPUWorkgroupReductionBenchmarkReport,
|
|
178
182
|
GPUWorkgroupReductionBenchmarkStrategy
|
|
179
183
|
} from './gpu-workgroup-reduction-benchmark';
|
|
184
|
+
export {GPUSegmentedScan} from './gpu-segmented-scan';
|
|
185
|
+
export type {GPUSegmentedScanMode, GPUSegmentedScanProps} from './gpu-segmented-scan';
|
|
186
|
+
|
|
187
|
+
export {GPUSegmentedReduction} from './gpu-segmented-reduction';
|
|
188
|
+
export type {
|
|
189
|
+
GPUSegmentedReductionOperation,
|
|
190
|
+
GPUSegmentedReductionProps
|
|
191
|
+
} from './gpu-segmented-reduction';
|
|
192
|
+
|
|
180
193
|
export {GPUSegmentedSort} from './gpu-segmented-sort';
|
|
181
194
|
export type {GPUSegmentedSortProps, GPUSortSegment} from './gpu-segmented-sort';
|
|
182
195
|
export {GPUCompaction} from './gpu-compaction';
|
|
@@ -392,6 +405,8 @@ export type {
|
|
|
392
405
|
GPUHistogramProps
|
|
393
406
|
} from './gpu-histogram';
|
|
394
407
|
|
|
408
|
+
export {GPU_GRID_COORDINATE_WGSL} from './gpu-grid-coordinate';
|
|
409
|
+
|
|
395
410
|
export {GPUGridBinning} from './gpu-grid-binning';
|
|
396
411
|
export type {
|
|
397
412
|
GPUGridBinningBounds,
|
|
@@ -637,6 +652,12 @@ export {GPUGraphDotProduct, GPUGraphVectorMADD} from './gpu-semantic-vector-oper
|
|
|
637
652
|
export {GPUGraphCSRMatrix, GPUGraphSpMV} from './gpu-semantic-spmv';
|
|
638
653
|
export {createGPUConjugateGradientGraph} from './gpu-conjugate-gradient-program';
|
|
639
654
|
|
|
655
|
+
export {GPUAdaptiveSpMV} from './gpu-adaptive-spmv';
|
|
656
|
+
export type {GPUAdaptiveSpMVProps} from './gpu-adaptive-spmv';
|
|
657
|
+
export type {GPUSpMVRowStatistics, GPUSpMVStrategyId} from './gpu-spmv-strategy';
|
|
658
|
+
export {GPUJacobiPCG} from './gpu-pcg';
|
|
659
|
+
export type {GPUJacobiPCGProps, GPUJacobiPCGResult} from './gpu-pcg';
|
|
660
|
+
|
|
640
661
|
export {GPUCOOToCSR} from './gpu-coo-to-csr';
|
|
641
662
|
export type {GPUCOOToCSRProps} from './gpu-coo-to-csr';
|
|
642
663
|
export {GPURunLengthEncode, GPUUnique} from './gpu-run-length-encode';
|
|
@@ -653,6 +674,8 @@ export type {
|
|
|
653
674
|
export type {GPUResourcePreview} from './gpu-resource-preview';
|
|
654
675
|
|
|
655
676
|
export type {GPUIndexPickInfo} from './gpu-index-picking-target';
|
|
677
|
+
export {GPURenderOperation} from './gpu-render-operation';
|
|
678
|
+
export type {GPURenderOperationResources} from './gpu-render-operation';
|
|
656
679
|
|
|
657
680
|
export {GPUExpressionOperation} from './gpu-expression-operation';
|
|
658
681
|
export type {GPUExpressionOperationProps, GPUExpressionAST} from './gpu-expression-operation';
|
|
@@ -684,9 +707,25 @@ export type {
|
|
|
684
707
|
} from './gpu-operation-contract';
|
|
685
708
|
|
|
686
709
|
export {GPUUploadOperation, GPUCopyOperation} from './gpu-transfer-operation';
|
|
710
|
+
export {GPUShaderPassOperation} from './gpu-shader-pass-operation';
|
|
711
|
+
export type {GPUShaderPassOperationProps} from './gpu-shader-pass-operation';
|
|
687
712
|
export type {GPUUploadOperationProps, GPUCopyOperationProps} from './gpu-transfer-operation';
|
|
688
713
|
export {GPUCompactionOperation} from './gpu-compaction-operation';
|
|
689
714
|
export type {GPUCompactionOperationProps} from './gpu-compaction-operation';
|
|
690
715
|
|
|
691
716
|
export type {GPUGraphTextureDescriptor, GPUGraphTextureExtent} from './gpu-graph-value';
|
|
692
717
|
export type {GPUGraphTextureBinding, GPUGraphOutput, GPUGraphOutputs} from './gpu-texture-plan';
|
|
718
|
+
|
|
719
|
+
export {GPUCPUOperation} from './gpu-cpu-operation';
|
|
720
|
+
export type {
|
|
721
|
+
GPUCPUOperationProps,
|
|
722
|
+
GPUCPUArray,
|
|
723
|
+
GPUCPUVector,
|
|
724
|
+
GPUCPUResult
|
|
725
|
+
} from './gpu-cpu-operation';
|
|
726
|
+
|
|
727
|
+
export {GPUGraphGroupAggregation, GPUGraphReduction} from './gpu-semantic-aggregation-operation';
|
|
728
|
+
export type {
|
|
729
|
+
GPUGraphGroupAggregationProps,
|
|
730
|
+
GPUGraphReductionProps
|
|
731
|
+
} from './gpu-semantic-aggregation-operation';
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert} from '@luma.gl/core';
|
|
6
|
+
import {fromHalfFloat} from '@luma.gl/shaders';
|
|
7
|
+
import {CPUData} from './cpu-data';
|
|
8
|
+
import {CPUVector} from './cpu-vector';
|
|
9
|
+
import {getGPUVectorFormatInfo, type GPUVectorFormat} from './gpu-vector-format';
|
|
10
|
+
|
|
11
|
+
export type ColorOutputFormat = 'unorm8x4' | 'float16x4' | 'float32x4';
|
|
12
|
+
export type ColorConversionOptions = {
|
|
13
|
+
/** Default RGBA8; preserve keeps source precision while expanding RGB to RGBA. */
|
|
14
|
+
format?: ColorOutputFormat | 'preserve';
|
|
15
|
+
/** Consumer capabilities; never silently select a lossy fallback. */
|
|
16
|
+
acceptedFormats?: readonly ColorOutputFormat[];
|
|
17
|
+
fallbackFormat?: ColorOutputFormat;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Resolve color storage independently from the device and conversion backend. */
|
|
21
|
+
export function resolveColorOutputFormat(
|
|
22
|
+
sourceFormat: GPUVectorFormat,
|
|
23
|
+
options: ColorConversionOptions = {}
|
|
24
|
+
): ColorOutputFormat {
|
|
25
|
+
const info = getGPUVectorFormatInfo(sourceFormat);
|
|
26
|
+
// Only fixed-width byte/IEEE RGB or RGBA rows have color semantics here.
|
|
27
|
+
assert(
|
|
28
|
+
!info.vertexList &&
|
|
29
|
+
!info.valueList &&
|
|
30
|
+
!info.fixedSizeList &&
|
|
31
|
+
(info.components === 3 || info.components === 4) &&
|
|
32
|
+
['uint8', 'float16', 'float32'].includes(info.signedDataType)
|
|
33
|
+
);
|
|
34
|
+
const preserved =
|
|
35
|
+
info.signedDataType === 'float32'
|
|
36
|
+
? 'float32x4'
|
|
37
|
+
: info.signedDataType === 'float16'
|
|
38
|
+
? 'float16x4'
|
|
39
|
+
: 'unorm8x4';
|
|
40
|
+
let format = options.format === 'preserve' ? preserved : (options.format ?? 'unorm8x4');
|
|
41
|
+
if (options.acceptedFormats && !options.acceptedFormats.includes(format)) {
|
|
42
|
+
if (
|
|
43
|
+
options.format === 'preserve' &&
|
|
44
|
+
options.fallbackFormat &&
|
|
45
|
+
options.acceptedFormats.includes(options.fallbackFormat)
|
|
46
|
+
)
|
|
47
|
+
format = options.fallbackFormat;
|
|
48
|
+
else throw new Error('Requested color format is not accepted by the consumer');
|
|
49
|
+
}
|
|
50
|
+
return format;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** CPU storage interpretation, independent of output format negotiation. */
|
|
54
|
+
type CPUColorConversionOptions = ColorConversionOptions & {
|
|
55
|
+
/** Interpret packed Float16 RGB stored using the uint16x3-webgl alias. */
|
|
56
|
+
inputFormat?: 'float16x3';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** Convert CPU color chunks without uploading or combining chunks. Input storage is borrowed. */
|
|
60
|
+
export function convertCPUColors(
|
|
61
|
+
source: CPUVector,
|
|
62
|
+
options?: CPUColorConversionOptions & {format?: 'unorm8x4'}
|
|
63
|
+
): CPUVector<'unorm8x4'>;
|
|
64
|
+
export function convertCPUColors<T extends ColorOutputFormat>(
|
|
65
|
+
source: CPUVector,
|
|
66
|
+
options: CPUColorConversionOptions & {format: T}
|
|
67
|
+
): CPUVector<T>;
|
|
68
|
+
export function convertCPUColors(
|
|
69
|
+
source: CPUVector,
|
|
70
|
+
options: CPUColorConversionOptions
|
|
71
|
+
): CPUVector<ColorOutputFormat>;
|
|
72
|
+
export function convertCPUColors(
|
|
73
|
+
source: CPUVector,
|
|
74
|
+
options: CPUColorConversionOptions = {}
|
|
75
|
+
): CPUVector<ColorOutputFormat> {
|
|
76
|
+
const format = resolveColorOutputFormat(
|
|
77
|
+
options.inputFormat ? 'float16x4' : source.format,
|
|
78
|
+
options
|
|
79
|
+
);
|
|
80
|
+
if (options.format === 'preserve' && source.format === format)
|
|
81
|
+
return new CPUVector({
|
|
82
|
+
name: source.name,
|
|
83
|
+
format,
|
|
84
|
+
data: source.data as readonly CPUData<ColorOutputFormat>[]
|
|
85
|
+
});
|
|
86
|
+
return new CPUVector({
|
|
87
|
+
name: source.name,
|
|
88
|
+
format,
|
|
89
|
+
data: source.data.map(chunk => convertCPUColorData(chunk, format, options.inputFormat))
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** @internal Shared CPU backend implementation, including offsets, strides and validity. */
|
|
94
|
+
export function convertCPUColorData(
|
|
95
|
+
source: CPUData,
|
|
96
|
+
format: ColorOutputFormat,
|
|
97
|
+
inputFormat?: string
|
|
98
|
+
): CPUData<ColorOutputFormat> {
|
|
99
|
+
const info = getGPUVectorFormatInfo(source.format);
|
|
100
|
+
const type = inputFormat?.startsWith('float16') ? 'float16' : info.signedDataType;
|
|
101
|
+
const components = inputFormat?.endsWith('x3') ? 3 : info.components;
|
|
102
|
+
// Color rows contain only byte channels or IEEE floats and three or four components.
|
|
103
|
+
assert((components === 3 || components === 4) && ['uint8', 'float16', 'float32'].includes(type));
|
|
104
|
+
const bytes = type === 'uint8' ? 1 : type === 'float16' ? 2 : 4;
|
|
105
|
+
const input = new DataView(source.buffer, source.byteOffset);
|
|
106
|
+
const output =
|
|
107
|
+
format === 'unorm8x4'
|
|
108
|
+
? new Uint8Array(source.length * 4)
|
|
109
|
+
: format === 'float16x4'
|
|
110
|
+
? new Uint16Array(source.length * 4)
|
|
111
|
+
: new Float32Array(source.length * 4);
|
|
112
|
+
const scratch = new DataView(new ArrayBuffer(4));
|
|
113
|
+
for (let rowIndex = 0; rowIndex < source.length; rowIndex++) {
|
|
114
|
+
for (let componentIndex = 0; componentIndex < 4; componentIndex++) {
|
|
115
|
+
const offset = rowIndex * source.byteStride + componentIndex * bytes;
|
|
116
|
+
const value =
|
|
117
|
+
componentIndex >= components
|
|
118
|
+
? 1
|
|
119
|
+
: type === 'uint8'
|
|
120
|
+
? input.getUint8(offset) / 255
|
|
121
|
+
: type === 'float16'
|
|
122
|
+
? fromHalfFloat(input.getUint16(offset, true))
|
|
123
|
+
: input.getFloat32(offset, true);
|
|
124
|
+
output[rowIndex * 4 + componentIndex] =
|
|
125
|
+
format === 'unorm8x4'
|
|
126
|
+
? Math.round(Math.min(Math.max(value, 0), 1) * 255)
|
|
127
|
+
: format === 'float16x4'
|
|
128
|
+
? encodeHalfFloat(value, scratch)
|
|
129
|
+
: value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return new CPUData({
|
|
133
|
+
buffer: output,
|
|
134
|
+
format,
|
|
135
|
+
length: source.length,
|
|
136
|
+
nullBitmap: source.nullBitmap && new Uint8Array(source.nullBitmap)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** IEEE binary16 round-to-nearest-even, matching pack2x16float (no display-range clamp). */
|
|
141
|
+
function encodeHalfFloat(value: number, scratch: DataView): number {
|
|
142
|
+
scratch.setFloat32(0, value, true);
|
|
143
|
+
const bits = scratch.getUint32(0, true);
|
|
144
|
+
const sign = (bits >>> 16) & 0x8000;
|
|
145
|
+
const exponent = (bits >>> 23) & 255;
|
|
146
|
+
const mantissa = bits & 0x7fffff;
|
|
147
|
+
if (exponent === 255) return sign | 0x7c00 | (mantissa ? 0x200 : 0);
|
|
148
|
+
if (exponent > 142) return sign | 0x7c00;
|
|
149
|
+
if (exponent < 102) return sign;
|
|
150
|
+
const shift = exponent < 113 ? 126 - exponent : 13;
|
|
151
|
+
const significand = exponent < 113 ? mantissa | 0x800000 : mantissa;
|
|
152
|
+
const divisor = 2 ** shift;
|
|
153
|
+
const quotient = Math.floor(significand / divisor);
|
|
154
|
+
const remainder = significand % divisor;
|
|
155
|
+
const rounded =
|
|
156
|
+
quotient + (remainder > divisor / 2 || (remainder === divisor / 2 && quotient % 2) ? 1 : 0);
|
|
157
|
+
return sign | ((exponent < 113 ? 0 : (exponent - 112) * 1024) + rounded);
|
|
158
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert} from '@luma.gl/core';
|
|
6
|
+
import {getGPUVectorFormatInfo, type GPUVectorFormat} from './gpu-vector-format';
|
|
7
|
+
|
|
8
|
+
export type CPUDataProps<T extends GPUVectorFormat = GPUVectorFormat> = {
|
|
9
|
+
buffer: ArrayBuffer | ArrayBufferView;
|
|
10
|
+
format: T;
|
|
11
|
+
length: number;
|
|
12
|
+
valueLength?: number;
|
|
13
|
+
/** Byte offset relative to the supplied buffer or view. */
|
|
14
|
+
byteOffset?: number;
|
|
15
|
+
byteStride?: number;
|
|
16
|
+
rowByteLength?: number;
|
|
17
|
+
valueOffsets?: Int32Array;
|
|
18
|
+
nullBitmap?: Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Borrowed CPU storage for fixed rows or one level of list elements. No allocation or copying. */
|
|
22
|
+
export class CPUData<T extends GPUVectorFormat = GPUVectorFormat> {
|
|
23
|
+
readonly buffer: ArrayBufferLike;
|
|
24
|
+
readonly format: T;
|
|
25
|
+
readonly length: number;
|
|
26
|
+
readonly valueLength: number;
|
|
27
|
+
/** Absolute offset into buffer. */
|
|
28
|
+
readonly byteOffset: number;
|
|
29
|
+
readonly byteStride: number;
|
|
30
|
+
readonly rowByteLength: number;
|
|
31
|
+
readonly valueOffsets?: Int32Array;
|
|
32
|
+
readonly nullBitmap?: Uint8Array;
|
|
33
|
+
|
|
34
|
+
constructor(props: CPUDataProps<T>) {
|
|
35
|
+
const info = getGPUVectorFormatInfo(props.format);
|
|
36
|
+
const view = ArrayBuffer.isView(props.buffer) ? props.buffer : undefined;
|
|
37
|
+
this.buffer = view ? view.buffer : (props.buffer as ArrayBuffer);
|
|
38
|
+
this.format = props.format;
|
|
39
|
+
this.length = props.length;
|
|
40
|
+
this.valueLength = props.valueLength ?? props.length * (info.listSize ?? 1);
|
|
41
|
+
const offset = props.byteOffset ?? 0;
|
|
42
|
+
this.byteOffset = (view?.byteOffset ?? 0) + offset;
|
|
43
|
+
this.rowByteLength = props.rowByteLength ?? info.byteLength;
|
|
44
|
+
this.byteStride = props.byteStride ?? this.rowByteLength;
|
|
45
|
+
this.valueOffsets = props.valueOffsets;
|
|
46
|
+
this.nullBitmap = props.nullBitmap;
|
|
47
|
+
const variable = info.vertexList || info.valueList;
|
|
48
|
+
const count = variable ? this.valueLength : this.length;
|
|
49
|
+
// Layouts must describe complete rows within the supplied view, including empty ranges.
|
|
50
|
+
assert(
|
|
51
|
+
[this.length, this.valueLength, offset, this.rowByteLength, this.byteStride].every(
|
|
52
|
+
value => Number.isSafeInteger(value) && value >= 0
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
assert(this.rowByteLength >= info.byteLength && this.byteStride >= this.rowByteLength);
|
|
56
|
+
assert(variable || this.valueLength === this.length * (info.listSize ?? 1));
|
|
57
|
+
assert(
|
|
58
|
+
offset + (count ? (count - 1) * this.byteStride + this.rowByteLength : 0) <=
|
|
59
|
+
props.buffer.byteLength
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert, Buffer, type Device, type BufferProps} from '@luma.gl/core';
|
|
6
|
+
import {CPUData} from './cpu-data';
|
|
7
|
+
import {CPUVector} from './cpu-vector';
|
|
8
|
+
import {GPUData} from './gpu-data';
|
|
9
|
+
import {getGPUDataBufferProps, PORTABLE_GPU_DATA_USAGE} from './gpu-data-buffer-props';
|
|
10
|
+
import {GPUVector} from './gpu-vector';
|
|
11
|
+
import {getGPUVectorFormatInfo, type GPUVectorFormat} from './gpu-vector-format';
|
|
12
|
+
|
|
13
|
+
/** Explicit upload preserving chunk-local list offsets and validity metadata. */
|
|
14
|
+
export function makeGPUVectorFromCPUVector<T extends GPUVectorFormat>(
|
|
15
|
+
device: Device,
|
|
16
|
+
vector: CPUVector<T>,
|
|
17
|
+
options: Pick<BufferProps, 'usage' | 'indexType'> = {}
|
|
18
|
+
): GPUVector<T> {
|
|
19
|
+
const data: GPUData<T>[] = [];
|
|
20
|
+
try {
|
|
21
|
+
for (const chunk of vector.data) {
|
|
22
|
+
const info = getGPUVectorFormatInfo(vector.format);
|
|
23
|
+
const inferredIndexType =
|
|
24
|
+
info.elementFormat === 'uint32'
|
|
25
|
+
? 'uint32'
|
|
26
|
+
: info.elementFormat === 'uint16'
|
|
27
|
+
? 'uint16'
|
|
28
|
+
: undefined;
|
|
29
|
+
// Index usage must match stored elements; raw bytes must never trigger device conversion.
|
|
30
|
+
if ((options.usage ?? 0) & Buffer.INDEX)
|
|
31
|
+
assert(
|
|
32
|
+
inferredIndexType && (!options.indexType || options.indexType === inferredIndexType)
|
|
33
|
+
);
|
|
34
|
+
const defaults =
|
|
35
|
+
options.usage === undefined
|
|
36
|
+
? getGPUDataBufferProps(device, inferredIndexType)
|
|
37
|
+
: {
|
|
38
|
+
usage: PORTABLE_GPU_DATA_USAGE,
|
|
39
|
+
indexType: undefined
|
|
40
|
+
};
|
|
41
|
+
const count = info.vertexList || info.valueList ? chunk.valueLength : chunk.length;
|
|
42
|
+
const bytes = new Uint8Array(count * info.byteLength);
|
|
43
|
+
for (let index = 0; index < count; index++)
|
|
44
|
+
bytes.set(
|
|
45
|
+
new Uint8Array(
|
|
46
|
+
chunk.buffer,
|
|
47
|
+
chunk.byteOffset + index * chunk.byteStride,
|
|
48
|
+
info.byteLength
|
|
49
|
+
),
|
|
50
|
+
index * info.byteLength
|
|
51
|
+
);
|
|
52
|
+
data.push(
|
|
53
|
+
new GPUData({
|
|
54
|
+
buffer: device.createBuffer({
|
|
55
|
+
data: bytes.length ? bytes : new Uint8Array(4),
|
|
56
|
+
usage: (defaults.usage ?? 0) | (options.usage ?? 0),
|
|
57
|
+
indexType:
|
|
58
|
+
options.indexType ??
|
|
59
|
+
((options.usage ?? 0) & Buffer.INDEX ? inferredIndexType : defaults.indexType)
|
|
60
|
+
}),
|
|
61
|
+
format: vector.format,
|
|
62
|
+
length: chunk.length,
|
|
63
|
+
valueLength: chunk.valueLength,
|
|
64
|
+
valueOffsets: chunk.valueOffsets?.slice(),
|
|
65
|
+
nullBitmap: chunk.nullBitmap?.slice(),
|
|
66
|
+
ownsBuffer: true
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return new GPUVector({
|
|
71
|
+
type: 'data',
|
|
72
|
+
name: vector.name,
|
|
73
|
+
format: vector.format,
|
|
74
|
+
data,
|
|
75
|
+
ownsData: true
|
|
76
|
+
});
|
|
77
|
+
} catch (error) {
|
|
78
|
+
for (const chunk of data) chunk.destroy();
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Explicit asynchronous readback preserving physical formats, chunks, lists and parent validity. */
|
|
84
|
+
export async function makeCPUVectorFromGPUVector<T extends GPUVectorFormat>(
|
|
85
|
+
vector: GPUVector<T>
|
|
86
|
+
): Promise<CPUVector<T>> {
|
|
87
|
+
const data: CPUData<T>[] = [];
|
|
88
|
+
for (const chunk of vector.data) {
|
|
89
|
+
const info = getGPUVectorFormatInfo(vector.format!);
|
|
90
|
+
const count = info.vertexList || info.valueList ? chunk.valueLength : chunk.length;
|
|
91
|
+
const bytes = count
|
|
92
|
+
? await chunk.buffer.readAsync(
|
|
93
|
+
chunk.byteOffset,
|
|
94
|
+
(count - 1) * chunk.byteStride + info.byteLength
|
|
95
|
+
)
|
|
96
|
+
: new Uint8Array(0);
|
|
97
|
+
data.push(
|
|
98
|
+
new CPUData({
|
|
99
|
+
buffer: bytes,
|
|
100
|
+
format: vector.format!,
|
|
101
|
+
length: chunk.length,
|
|
102
|
+
valueLength: chunk.valueLength,
|
|
103
|
+
byteStride: chunk.byteStride,
|
|
104
|
+
valueOffsets: chunk.valueOffsets?.slice(),
|
|
105
|
+
nullBitmap: chunk.nullBitmap?.slice()
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return new CPUVector({name: vector.name, format: vector.format!, data});
|
|
110
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert} from '@luma.gl/core';
|
|
6
|
+
import {CPUData} from './cpu-data';
|
|
7
|
+
import type {GPUVectorFormat} from './gpu-vector-format';
|
|
8
|
+
|
|
9
|
+
export type CPUVectorProps<T extends GPUVectorFormat = GPUVectorFormat> = {
|
|
10
|
+
name?: string;
|
|
11
|
+
format: T;
|
|
12
|
+
data: readonly CPUData<T>[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Ordered borrowed CPU chunks. Construction preserves buffers and chunk boundaries. */
|
|
16
|
+
export class CPUVector<T extends GPUVectorFormat = GPUVectorFormat> {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly format: T;
|
|
19
|
+
readonly data: readonly CPUData<T>[];
|
|
20
|
+
readonly length: number;
|
|
21
|
+
readonly valueLength: number;
|
|
22
|
+
|
|
23
|
+
constructor(props: CPUVectorProps<T>) {
|
|
24
|
+
assert(props.data.every(chunk => chunk.format === props.format));
|
|
25
|
+
this.name = props.name ?? '';
|
|
26
|
+
this.format = props.format;
|
|
27
|
+
this.data = Object.freeze([...props.data]);
|
|
28
|
+
this.length = this.data.reduce((total, chunk) => total + chunk.length, 0);
|
|
29
|
+
this.valueLength = this.data.reduce((total, chunk) => total + chunk.valueLength, 0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Buffer, type BufferProps, type Device} from '@luma.gl/core';
|
|
6
|
+
|
|
7
|
+
export const PORTABLE_GPU_DATA_USAGE =
|
|
8
|
+
Buffer.STORAGE | Buffer.VERTEX | Buffer.COPY_SRC | Buffer.COPY_DST;
|
|
9
|
+
|
|
10
|
+
/** Usage defaults for general-purpose GPUData backing storage. */
|
|
11
|
+
export function getGPUDataBufferProps(
|
|
12
|
+
device: Device,
|
|
13
|
+
indexType: BufferProps['indexType'] = 'uint32'
|
|
14
|
+
): Pick<BufferProps, 'usage' | 'indexType'> {
|
|
15
|
+
const usage = PORTABLE_GPU_DATA_USAGE;
|
|
16
|
+
if (device.type !== 'webgpu') {
|
|
17
|
+
// WebGL fixes the buffer target on first bind, so INDEX would prevent vertex use.
|
|
18
|
+
return {usage};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
usage: usage | Buffer.INDEX | Buffer.UNIFORM | Buffer.INDIRECT | Buffer.QUERY_RESOLVE,
|
|
22
|
+
// Explicit index metadata prevents Device from widening raw Uint8Array uploads.
|
|
23
|
+
indexType
|
|
24
|
+
};
|
|
25
|
+
}
|