@luma.gl/graph 10.0.0-alpha.8 → 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 +376 -0
- package/dist/gpu-sql/gpu-sql.d.ts +36 -0
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -0
- package/dist/gpu-sql/gpu-sql.js +374 -0
- package/dist/gpu-sql/gpu-sql.js.map +1 -0
- package/dist/gpu-sql/index.cjs +5 -5
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-sql/index.d.ts +2 -2
- package/dist/gpu-sql/index.d.ts.map +1 -1
- package/dist/gpu-sql/index.js +1 -1
- package/dist/gpu-sql/index.js.map +1 -1
- 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/README.md +4 -4
- 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 +494 -0
- package/src/gpu-sql/index.ts +2 -2
- package/src/gpu-tables/table/gpu-table.ts +2 -1
- package/src/index.ts +21 -0
- package/dist/gpu-sql/lu-sql.cjs +0 -499
- package/dist/gpu-sql/lu-sql.d.ts +0 -36
- package/dist/gpu-sql/lu-sql.d.ts.map +0 -1
- package/dist/gpu-sql/lu-sql.js +0 -497
- package/dist/gpu-sql/lu-sql.js.map +0 -1
- package/src/gpu-sql/lu-sql.ts +0 -599
|
@@ -26,6 +26,8 @@ import {type GPUEvaluationScope} from './operation/gpu-evaluation-scope';
|
|
|
26
26
|
import type {GPUVector, GPUVectorFormat} from '@luma.gl/graph/gpu-data';
|
|
27
27
|
|
|
28
28
|
import {
|
|
29
|
+
GPURenderOperation,
|
|
30
|
+
type GPUCommandGraphEncodeOptions,
|
|
29
31
|
GPUCompositeOperation,
|
|
30
32
|
GPUGraphScalarLiteral,
|
|
31
33
|
GPUGraphScalarOperation,
|
|
@@ -48,6 +50,7 @@ import {
|
|
|
48
50
|
} from './gpu-simple-graph-transfer';
|
|
49
51
|
import {GPUSimpleGraphValue, GPUSimpleGraphValueOperation} from './gpu-simple-graph-value';
|
|
50
52
|
import {SimpleGraphLowering, type SimpleOperation} from './gpu-simple-graph-lowering';
|
|
53
|
+
import {GPUCommandGraphBuilder, type CompiledGPUCommandGraph} from '../gpu-core/gpu-command-graph';
|
|
51
54
|
|
|
52
55
|
/** Inspection record for one evaluator in dependency order. */
|
|
53
56
|
export type GPUSimpleGraphNode = {
|
|
@@ -72,7 +75,10 @@ export type GPUSimpleGraphCompileOptions = {
|
|
|
72
75
|
};
|
|
73
76
|
|
|
74
77
|
/** Run options; scopes defer submission until the caller submits or cancels. */
|
|
75
|
-
export type GPUSimpleGraphRunOptions = {
|
|
78
|
+
export type GPUSimpleGraphRunOptions<Parameters = void> = {
|
|
79
|
+
scope?: GPUEvaluationScope;
|
|
80
|
+
} & Pick<GPUCommandGraphEncodeOptions<Parameters>, 'buffers' | 'textures'> &
|
|
81
|
+
([Parameters] extends [void] ? {parameters?: Parameters} : {parameters: Parameters});
|
|
76
82
|
|
|
77
83
|
/**
|
|
78
84
|
* Prototype graph-shaped interface to the existing lazy GPGPU evaluator.
|
|
@@ -80,7 +86,7 @@ export type GPUSimpleGraphRunOptions = {scope?: GPUEvaluationScope};
|
|
|
80
86
|
* Operations, backend selection, fusion, caching, and storage ownership remain with
|
|
81
87
|
* the evaluators. Explicit evaluator inputs are borrowed; semantic lowering owns its adapters.
|
|
82
88
|
*/
|
|
83
|
-
export class GPUSimpleGraph {
|
|
89
|
+
export class GPUSimpleGraph<Parameters = void> {
|
|
84
90
|
private readonly declarations = new GPUGraph();
|
|
85
91
|
readonly device?: Device;
|
|
86
92
|
readonly id: string;
|
|
@@ -88,12 +94,14 @@ export class GPUSimpleGraph {
|
|
|
88
94
|
private readonly evaluatorIds = new Set<string>();
|
|
89
95
|
private readonly programOperations: GPUGraphOperation[] = [];
|
|
90
96
|
private compiled = false;
|
|
97
|
+
private readonly renderOperations: GPURenderOperation<Parameters>[] = [];
|
|
91
98
|
|
|
92
99
|
/** Execution capabilities; evaluators retain control of backend submission. */
|
|
93
100
|
readonly capabilities: Readonly<{
|
|
94
101
|
callerControlledSubmission: boolean;
|
|
95
|
-
dynamicBindings:
|
|
96
|
-
|
|
102
|
+
dynamicBindings: true;
|
|
103
|
+
/** Evaluator render mode uses graph-managed transient resources. */
|
|
104
|
+
transientAllocation: boolean;
|
|
97
105
|
}>;
|
|
98
106
|
|
|
99
107
|
constructor(deviceOrProps?: Device | {id?: string}, props: {id?: string} = {}) {
|
|
@@ -102,8 +110,8 @@ export class GPUSimpleGraph {
|
|
|
102
110
|
this.id = (device ? props.id : deviceOrProps?.id) ?? 'simple-graph';
|
|
103
111
|
this.capabilities = Object.freeze({
|
|
104
112
|
callerControlledSubmission: device?.type === 'webgpu',
|
|
105
|
-
dynamicBindings:
|
|
106
|
-
transientAllocation:
|
|
113
|
+
dynamicBindings: true,
|
|
114
|
+
transientAllocation: Boolean(device)
|
|
107
115
|
});
|
|
108
116
|
}
|
|
109
117
|
|
|
@@ -156,14 +164,24 @@ export class GPUSimpleGraph {
|
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
/** Accepts evaluator operations, semantic composites, and recursively nested arrays. */
|
|
159
|
-
add
|
|
167
|
+
add<Operation extends GPUOperationLike>(
|
|
168
|
+
operation: Operation &
|
|
169
|
+
(true extends HasIncompatibleRenderParameters<NoInfer<Operation>, Parameters>
|
|
170
|
+
? never
|
|
171
|
+
: unknown)
|
|
172
|
+
): this {
|
|
173
|
+
return this.addOperations(operation);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private addOperations(operation: GPUOperationLike): this {
|
|
160
177
|
// Compilation freezes the builder, as it does for GPUCommandGraph.
|
|
161
178
|
assert(!this.compiled);
|
|
162
179
|
if (!this.device || operation instanceof GPUExpressionOperation) {
|
|
163
180
|
this.declarations.add(operation);
|
|
164
181
|
return this;
|
|
165
182
|
}
|
|
166
|
-
const pending: SimpleOperation[] = [];
|
|
183
|
+
const pending: (SimpleOperation | GPURenderOperation<Parameters>)[] = [];
|
|
184
|
+
let hasRenderOperation = this.renderOperations.length > 0;
|
|
167
185
|
const pendingEvaluatorIds = new Set<string>();
|
|
168
186
|
const operations: GPUGraphOperation[] = [];
|
|
169
187
|
const visit = (value: GPUOperationLike): void => {
|
|
@@ -173,7 +191,12 @@ export class GPUSimpleGraph {
|
|
|
173
191
|
// Control-flow composites cannot be executed as unconditional groups.
|
|
174
192
|
assert(value.type === 'composite');
|
|
175
193
|
for (const child of value.operations) visit(child);
|
|
194
|
+
} else if (value instanceof GPURenderOperation) {
|
|
195
|
+
hasRenderOperation = true;
|
|
196
|
+
pending.push(value);
|
|
176
197
|
} else {
|
|
198
|
+
// Evaluator work precedes render work; never silently reorder the authored graph.
|
|
199
|
+
assert(!hasRenderOperation);
|
|
177
200
|
// Only the initial portable semantic subset and explicit evaluator adapters are supported.
|
|
178
201
|
assert(
|
|
179
202
|
value instanceof GPUSimpleGraphValueOperation ||
|
|
@@ -210,7 +233,10 @@ export class GPUSimpleGraph {
|
|
|
210
233
|
};
|
|
211
234
|
visit(operation);
|
|
212
235
|
collect(operation);
|
|
213
|
-
|
|
236
|
+
for (const value of pending) {
|
|
237
|
+
if (value instanceof GPURenderOperation) this.renderOperations.push(value);
|
|
238
|
+
else this.leafOperations.push(value);
|
|
239
|
+
}
|
|
214
240
|
for (const identifier of pendingEvaluatorIds) this.evaluatorIds.add(identifier);
|
|
215
241
|
this.programOperations.push(...operations);
|
|
216
242
|
return this;
|
|
@@ -221,7 +247,7 @@ export class GPUSimpleGraph {
|
|
|
221
247
|
identifier: string,
|
|
222
248
|
value: Value
|
|
223
249
|
): Value {
|
|
224
|
-
this.
|
|
250
|
+
this.addOperations(new GPUSimpleGraphValueOperation({id: identifier, value}));
|
|
225
251
|
return value;
|
|
226
252
|
}
|
|
227
253
|
|
|
@@ -230,10 +256,15 @@ export class GPUSimpleGraph {
|
|
|
230
256
|
identifier: string,
|
|
231
257
|
evaluator: Evaluator
|
|
232
258
|
): Evaluator {
|
|
233
|
-
this.
|
|
259
|
+
this.addOperations(new GPUSimpleGraphOperation({id: identifier, evaluator}));
|
|
234
260
|
return evaluator;
|
|
235
261
|
}
|
|
236
262
|
|
|
263
|
+
/** Appends shared render passes after the evaluator phase. Use the same operation in GPUGraph. */
|
|
264
|
+
addRenderOperation(operation: GPURenderOperation<Parameters>): this {
|
|
265
|
+
return this.addOperations(operation);
|
|
266
|
+
}
|
|
267
|
+
|
|
237
268
|
get operationTree(): readonly GPUOperationTree[] {
|
|
238
269
|
return Object.freeze(
|
|
239
270
|
[...this.programOperations, ...this.declarations.operations].map(getGPUOperationTree)
|
|
@@ -245,13 +276,16 @@ export class GPUSimpleGraph {
|
|
|
245
276
|
device: Device,
|
|
246
277
|
options?: GPUGraphCompileOptions
|
|
247
278
|
): CompiledGPUSimpleExpressionGraph<Outputs>;
|
|
248
|
-
compile(options?: GPUSimpleGraphCompileOptions): CompiledGPUSimpleGraph
|
|
279
|
+
compile(options?: GPUSimpleGraphCompileOptions): CompiledGPUSimpleGraph<Parameters>;
|
|
249
280
|
compile(
|
|
250
281
|
deviceOrOptions: Device | GPUSimpleGraphCompileOptions = {},
|
|
251
282
|
expressionOptions: GPUGraphCompileOptions = {}
|
|
252
|
-
): CompiledGPUSimpleGraph | CompiledGPUSimpleExpressionGraph<GPUGraphOutputs> {
|
|
283
|
+
): CompiledGPUSimpleGraph<Parameters> | CompiledGPUSimpleExpressionGraph<GPUGraphOutputs> {
|
|
253
284
|
if ('type' in deviceOrOptions) {
|
|
254
|
-
|
|
285
|
+
// Reusable expression compilation cannot silently discard evaluator/render recipes.
|
|
286
|
+
assert(
|
|
287
|
+
!this.compiled && this.leafOperations.length === 0 && this.renderOperations.length === 0
|
|
288
|
+
);
|
|
255
289
|
this.compiled = true;
|
|
256
290
|
return new CompiledGPUSimpleExpressionGraph(
|
|
257
291
|
deviceOrOptions,
|
|
@@ -259,7 +293,7 @@ export class GPUSimpleGraph {
|
|
|
259
293
|
expressionOptions
|
|
260
294
|
);
|
|
261
295
|
}
|
|
262
|
-
//
|
|
296
|
+
// Evaluator recipes bind their device in the constructor.
|
|
263
297
|
assert(this.device && this.declarations.operations.length === 0);
|
|
264
298
|
if (
|
|
265
299
|
[
|
|
@@ -274,6 +308,7 @@ export class GPUSimpleGraph {
|
|
|
274
308
|
assert(!this.compiled);
|
|
275
309
|
this.compiled = true;
|
|
276
310
|
const lowering = new SimpleGraphLowering(options.bindings ?? {});
|
|
311
|
+
let renderGraph: CompiledGPUCommandGraph<Parameters> | undefined;
|
|
277
312
|
try {
|
|
278
313
|
for (const operation of this.leafOperations) lowering.lower(operation);
|
|
279
314
|
const evaluators = lowering.outputs;
|
|
@@ -354,15 +389,25 @@ export class GPUSimpleGraph {
|
|
|
354
389
|
});
|
|
355
390
|
}
|
|
356
391
|
}
|
|
392
|
+
if (this.renderOperations.length) {
|
|
393
|
+
const renderBuilder = new GPUCommandGraphBuilder<Parameters>(this.device, {
|
|
394
|
+
id: `${this.id}-render`
|
|
395
|
+
});
|
|
396
|
+
for (const operation of this.renderOperations) renderBuilder.add(operation);
|
|
397
|
+
renderGraph = renderBuilder.compile();
|
|
398
|
+
}
|
|
357
399
|
return new CompiledGPUSimpleGraph(
|
|
358
400
|
this.device,
|
|
359
401
|
nodes,
|
|
360
402
|
roots,
|
|
361
403
|
this.operationTree,
|
|
362
404
|
lowering.owned,
|
|
363
|
-
Object.fromEntries(roots.map(({id, evaluator}) => [id, getIdentifier(evaluator)]))
|
|
405
|
+
Object.fromEntries(roots.map(({id, evaluator}) => [id, getIdentifier(evaluator)])),
|
|
406
|
+
renderGraph,
|
|
407
|
+
lowering.inputs
|
|
364
408
|
);
|
|
365
409
|
} catch (error) {
|
|
410
|
+
renderGraph?.destroy();
|
|
366
411
|
lowering.destroy();
|
|
367
412
|
throw error;
|
|
368
413
|
}
|
|
@@ -370,7 +415,7 @@ export class GPUSimpleGraph {
|
|
|
370
415
|
}
|
|
371
416
|
|
|
372
417
|
/** Snapshot of named evaluator outputs and their reachable dependency plan. */
|
|
373
|
-
export class CompiledGPUSimpleGraph {
|
|
418
|
+
export class CompiledGPUSimpleGraph<Parameters = void> {
|
|
374
419
|
readonly nodes: readonly GPUSimpleGraphNode[];
|
|
375
420
|
readonly outputs: Readonly<Record<string, GPUSimpleGraphEvaluator>>;
|
|
376
421
|
/** Maps every selected output ID, including aliases, to its dependency inspection node. */
|
|
@@ -388,7 +433,10 @@ export class CompiledGPUSimpleGraph {
|
|
|
388
433
|
roots: readonly GPUSimpleGraphOperation[],
|
|
389
434
|
operationTree: readonly GPUOperationTree[],
|
|
390
435
|
private readonly ownedEvaluators: ReadonlySet<GPUSimpleGraphEvaluator> = new Set(),
|
|
391
|
-
outputNodes: Readonly<Record<string, string>> = {}
|
|
436
|
+
outputNodes: Readonly<Record<string, string>> = {},
|
|
437
|
+
/** Shared render executor, including buffer/texture inspection and ownership. */
|
|
438
|
+
readonly renderGraph?: CompiledGPUCommandGraph<Parameters>,
|
|
439
|
+
private readonly inputs: ReadonlyMap<string, GPUSimpleGraphEvaluator> = new Map()
|
|
392
440
|
) {
|
|
393
441
|
this.device = device;
|
|
394
442
|
this.nodes = Object.freeze(
|
|
@@ -404,17 +452,99 @@ export class CompiledGPUSimpleGraph {
|
|
|
404
452
|
);
|
|
405
453
|
}
|
|
406
454
|
|
|
455
|
+
/** Invalidates changed named inputs and their reachable consumers, preserving other channels. */
|
|
456
|
+
invalidate(inputIds: readonly string[]): void {
|
|
457
|
+
assert(!this.running && !this.destroyed && !this.pendingScope);
|
|
458
|
+
const changed = new Set<GPUSimpleGraphEvaluator>();
|
|
459
|
+
for (const identifier of inputIds) {
|
|
460
|
+
const input = this.inputs.get(identifier);
|
|
461
|
+
// Only graph-owned, named leaf inputs can be invalidated through this API.
|
|
462
|
+
assert(input && this.ownedEvaluators.has(input));
|
|
463
|
+
changed.add(input);
|
|
464
|
+
if (input instanceof GPUVectorEvaluator) {
|
|
465
|
+
for (const chunk of input.gpuDataEvaluators) changed.add(chunk);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
const affected = new Map<GPUSimpleGraphEvaluator, boolean>();
|
|
469
|
+
const visit = (evaluator: GPUSimpleGraphEvaluator): boolean => {
|
|
470
|
+
const existing = affected.get(evaluator);
|
|
471
|
+
if (existing !== undefined) return existing;
|
|
472
|
+
// Visit every dependency, even if an earlier dependency is already dirty.
|
|
473
|
+
const dependencies = getDependencies(evaluator).map(visit);
|
|
474
|
+
const dirty = changed.has(evaluator) || dependencies.some(Boolean);
|
|
475
|
+
affected.set(evaluator, dirty);
|
|
476
|
+
return dirty;
|
|
477
|
+
};
|
|
478
|
+
for (const input of changed) visit(input);
|
|
479
|
+
for (const {evaluator} of this.executionPlan) visit(evaluator);
|
|
480
|
+
// Validate the whole change before clearing anything; borrowed evaluator caches stay untouched.
|
|
481
|
+
for (const [evaluator, dirty] of affected) {
|
|
482
|
+
if (dirty) assert(this.ownedEvaluators.has(evaluator));
|
|
483
|
+
}
|
|
484
|
+
for (const [evaluator, dirty] of affected) {
|
|
485
|
+
if (dirty) evaluator.invalidate();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
407
489
|
/** Releases semantic evaluator results, preserving borrowed inputs and wrappers. */
|
|
408
490
|
destroy(): void {
|
|
409
491
|
// Results must no longer be in use; borrowed evaluators and input buffers remain caller-owned.
|
|
410
492
|
assert(!this.running && !this.pendingScope);
|
|
411
493
|
if (this.destroyed) return;
|
|
494
|
+
this.renderGraph?.destroy();
|
|
412
495
|
for (const evaluator of this.ownedEvaluators) evaluator.destroy();
|
|
413
496
|
this.destroyed = true;
|
|
414
497
|
}
|
|
415
498
|
|
|
499
|
+
/** Executes supported synchronous evaluators and render passes on WebGL, without readback. */
|
|
500
|
+
runSync(this: CompiledGPUSimpleGraph<void>): Record<string, GPUVector>;
|
|
501
|
+
runSync(options: GPUSimpleGraphRunOptions<Parameters>): Record<string, GPUVector>;
|
|
502
|
+
runSync(options?: GPUSimpleGraphRunOptions<Parameters>): Record<string, GPUVector> {
|
|
503
|
+
assert(this.device.type === 'webgl' && !options?.scope);
|
|
504
|
+
assert(!this.running && !this.destroyed && !this.pendingScope);
|
|
505
|
+
this.running = true;
|
|
506
|
+
try {
|
|
507
|
+
const results: Record<string, GPUVector> = {};
|
|
508
|
+
const evaluated = new Set<GPUSimpleGraphEvaluator>();
|
|
509
|
+
const evaluate = (evaluator: GPUSimpleGraphEvaluator): void => {
|
|
510
|
+
if (evaluated.has(evaluator)) return;
|
|
511
|
+
for (const dependency of getDependencies(evaluator)) evaluate(dependency);
|
|
512
|
+
evaluator.evaluateSync(this.device);
|
|
513
|
+
evaluated.add(evaluator);
|
|
514
|
+
};
|
|
515
|
+
for (const {id, evaluator} of this.executionPlan) {
|
|
516
|
+
evaluate(evaluator);
|
|
517
|
+
results[id] = evaluator.gpuVector;
|
|
518
|
+
}
|
|
519
|
+
this.encodeRenderPasses(options);
|
|
520
|
+
return results;
|
|
521
|
+
} finally {
|
|
522
|
+
this.running = false;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
private encodeRenderPasses(options?: GPUSimpleGraphRunOptions<Parameters>): void {
|
|
527
|
+
const scope = options?.scope;
|
|
528
|
+
if (!this.renderGraph) return;
|
|
529
|
+
const commandEncoder = scope?.commandEncoder ?? this.device.createCommandEncoder();
|
|
530
|
+
try {
|
|
531
|
+
this.renderGraph.encode(commandEncoder, {
|
|
532
|
+
buffers: options?.buffers,
|
|
533
|
+
textures: options?.textures,
|
|
534
|
+
// The public overload requires parameters unless Parameters is void.
|
|
535
|
+
parameters: options?.parameters as Parameters
|
|
536
|
+
});
|
|
537
|
+
if (!scope) this.device.submit(commandEncoder.finish());
|
|
538
|
+
} finally {
|
|
539
|
+
if (!scope) commandEncoder.destroy();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
416
543
|
/** Materializes selected outputs without CPU readback. Semantic results live until destroy(). */
|
|
417
|
-
|
|
544
|
+
run(this: CompiledGPUSimpleGraph<void>): Promise<Record<string, GPUVector>>;
|
|
545
|
+
run(options: GPUSimpleGraphRunOptions<Parameters>): Promise<Record<string, GPUVector>>;
|
|
546
|
+
async run(options?: GPUSimpleGraphRunOptions<Parameters>): Promise<Record<string, GPUVector>> {
|
|
547
|
+
const scope = options?.scope;
|
|
418
548
|
// The underlying evaluators do not support concurrent evaluation of shared outputs.
|
|
419
549
|
assert(!this.running && !this.destroyed && !this.pendingScope);
|
|
420
550
|
if (scope) {
|
|
@@ -444,6 +574,7 @@ export class CompiledGPUSimpleGraph {
|
|
|
444
574
|
else await evaluateDependencies(evaluator);
|
|
445
575
|
results.push([id, evaluator.gpuVector]);
|
|
446
576
|
}
|
|
577
|
+
this.encodeRenderPasses(options);
|
|
447
578
|
return Object.fromEntries(results);
|
|
448
579
|
} catch (error) {
|
|
449
580
|
scope?.cancel();
|
|
@@ -459,3 +590,16 @@ function getDependencies(evaluator: GPUSimpleGraphEvaluator): readonly GPUSimple
|
|
|
459
590
|
if (evaluator.source instanceof GPUDataEvaluator) return [evaluator.source];
|
|
460
591
|
return evaluator.source?.dependencies ?? [];
|
|
461
592
|
}
|
|
593
|
+
|
|
594
|
+
/** Preserve render parameter requirements without expanding the recursive GPUOperationLike type. */
|
|
595
|
+
type HasIncompatibleRenderParameters<Operation, Parameters> = GPUOperationLike extends Operation
|
|
596
|
+
? false
|
|
597
|
+
: Operation extends GPURenderOperation<infer RequiredParameters>
|
|
598
|
+
? [Parameters] extends [RequiredParameters]
|
|
599
|
+
? false
|
|
600
|
+
: true
|
|
601
|
+
: Operation extends GPUCompositeOperation<infer Child>
|
|
602
|
+
? HasIncompatibleRenderParameters<Child, Parameters>
|
|
603
|
+
: Operation extends readonly (infer Child)[]
|
|
604
|
+
? HasIncompatibleRenderParameters<Child, Parameters>
|
|
605
|
+
: false;
|
|
@@ -721,6 +721,28 @@ export class GPUDataEvaluator {
|
|
|
721
721
|
return this._id ?? this.source?.toString() ?? this.constructor.name;
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
+
/**
|
|
725
|
+
* Clears cached results after an input changes, without changing its fixed layout.
|
|
726
|
+
* Does not propagate to consumers. Caller-owned input/target buffers remain borrowed.
|
|
727
|
+
* Call only when no evaluation or readback is in flight.
|
|
728
|
+
*/
|
|
729
|
+
invalidate(): void {
|
|
730
|
+
this.assertScopeAccess();
|
|
731
|
+
if (this._destroyed) throw new Error('Cannot invalidate a destroyed evaluator');
|
|
732
|
+
if (this.source || this._bufferOwnership === 'borrowed') this._value = undefined;
|
|
733
|
+
// A buffer-backed leaf keeps its source buffer. Only its readback cache is stale.
|
|
734
|
+
if (!this.source && this._bufferOwnership === 'borrowed') return;
|
|
735
|
+
if (this._gpuVector) {
|
|
736
|
+
const buffer = getBufferFromGPUVector(this._gpuVector);
|
|
737
|
+
if (this._bufferOwnership === 'owned') bufferPool.recycle(buffer);
|
|
738
|
+
else if (!(this.source instanceof GPUDataEvaluator)) {
|
|
739
|
+
// Preserve the explicit borrowed destination and its layout on the next evaluation.
|
|
740
|
+
this._targetBuffer = {buffer, byteOffset: this.offset, byteStride: this.stride};
|
|
741
|
+
}
|
|
742
|
+
this._gpuVector = undefined;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
724
746
|
/** Releases cached GPU storage owned by this evaluator and prevents future evaluation. */
|
|
725
747
|
destroy(): void {
|
|
726
748
|
this.assertScopeAccess();
|
|
@@ -907,6 +929,8 @@ function getVertexFormat(
|
|
|
907
929
|
if (size < 1 || size > 4) {
|
|
908
930
|
throw new Error(`Cannot synthesize a GPUVector vertex format with ${size} components`);
|
|
909
931
|
}
|
|
932
|
+
// Binary16 RGB has no vertex format; retain byte-identical packed storage for compute readers.
|
|
933
|
+
if (type === 'float16' && size === 3 && !normalized) return 'uint16x3-webgl';
|
|
910
934
|
let baseFormat: string = type;
|
|
911
935
|
if (normalized) {
|
|
912
936
|
switch (type) {
|
|
@@ -243,6 +243,13 @@ export class GPUVectorEvaluator {
|
|
|
243
243
|
return this._gpuVector;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
/** Clears only the collected vector view. Invalidate changed children separately. */
|
|
247
|
+
invalidate(): void {
|
|
248
|
+
this.assertScopeAccess();
|
|
249
|
+
if (this._destroyed) throw new Error('Cannot invalidate a destroyed evaluator');
|
|
250
|
+
this._gpuVector = undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
246
253
|
/** Releases cached GPU resources owned through child `GPUDataEvaluator` instances. */
|
|
247
254
|
destroy(): void {
|
|
248
255
|
this.assertScopeAccess();
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type GPUDataEvaluatorInput
|
|
9
9
|
} from '../operation/gpu-data-evaluator';
|
|
10
10
|
import {Operation} from '../operation/operation';
|
|
11
|
+
import type {ColorOutputFormat} from '../../gpu-data/color-conversion';
|
|
11
12
|
|
|
12
13
|
export type ColorInputFormat =
|
|
13
14
|
| 'uint8x3'
|
|
@@ -17,13 +18,17 @@ export type ColorInputFormat =
|
|
|
17
18
|
| 'float32x3'
|
|
18
19
|
| 'float32x4';
|
|
19
20
|
|
|
21
|
+
export type {ColorOutputFormat} from '../../gpu-data/color-conversion';
|
|
22
|
+
|
|
20
23
|
export type ConvertColorsProps = {
|
|
24
|
+
format?: ColorOutputFormat;
|
|
21
25
|
inputFormat?: ColorInputFormat;
|
|
22
26
|
};
|
|
23
27
|
|
|
24
28
|
export type ConvertColorsInputs = {
|
|
25
29
|
source: GPUDataEvaluator;
|
|
26
30
|
inputFormat: ColorInputFormat;
|
|
31
|
+
outputFormat: ColorOutputFormat;
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
class ConvertColorsOperation extends Operation<ConvertColorsInputs> {
|
|
@@ -31,15 +36,24 @@ class ConvertColorsOperation extends Operation<ConvertColorsInputs> {
|
|
|
31
36
|
|
|
32
37
|
output: GPUDataEvaluator;
|
|
33
38
|
|
|
34
|
-
constructor(
|
|
35
|
-
|
|
39
|
+
constructor(
|
|
40
|
+
source: GPUDataEvaluator,
|
|
41
|
+
inputFormat: ColorInputFormat,
|
|
42
|
+
outputFormat: ColorOutputFormat
|
|
43
|
+
) {
|
|
44
|
+
super({source, inputFormat, outputFormat});
|
|
36
45
|
|
|
37
46
|
this.output = new GPUDataEvaluator({
|
|
38
47
|
id: `convertColors(${source})`,
|
|
39
|
-
type:
|
|
48
|
+
type:
|
|
49
|
+
outputFormat === 'unorm8x4'
|
|
50
|
+
? 'uint8'
|
|
51
|
+
: outputFormat === 'float16x4'
|
|
52
|
+
? 'float16'
|
|
53
|
+
: 'float32',
|
|
40
54
|
size: 4,
|
|
41
|
-
normalized:
|
|
42
|
-
format:
|
|
55
|
+
normalized: outputFormat === 'unorm8x4',
|
|
56
|
+
format: outputFormat,
|
|
43
57
|
length: source.length,
|
|
44
58
|
source: this
|
|
45
59
|
});
|
|
@@ -50,14 +64,15 @@ class ConvertColorsOperation extends Operation<ConvertColorsInputs> {
|
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
66
|
|
|
53
|
-
/** Converts one fixed-width
|
|
67
|
+
/** Converts one fixed-width color range to RGBA8, binary16 or binary32 RGBA storage. */
|
|
54
68
|
export function convertColorData(
|
|
55
69
|
source: GPUDataEvaluatorInput,
|
|
56
70
|
props: ConvertColorsProps = {}
|
|
57
71
|
): GPUDataEvaluator {
|
|
58
72
|
const sourceEvaluator = getGPUDataEvaluator(source);
|
|
59
73
|
const inputFormat = props.inputFormat ?? getColorInputFormat(sourceEvaluator);
|
|
60
|
-
return new ConvertColorsOperation(sourceEvaluator, inputFormat)
|
|
74
|
+
return new ConvertColorsOperation(sourceEvaluator, inputFormat, props.format ?? 'unorm8x4')
|
|
75
|
+
.output;
|
|
61
76
|
}
|
|
62
77
|
|
|
63
78
|
function getColorInputFormat(source: GPUDataEvaluator): ColorInputFormat {
|
|
@@ -2,55 +2,38 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import {CPUData} from '../../../gpu-data/cpu-data';
|
|
6
|
+
import {convertCPUColorData} from '../../../gpu-data/color-conversion';
|
|
7
7
|
import type {OperationHandler} from '../../operation/operation';
|
|
8
8
|
import type {ConvertColorsInputs} from '../convert-colors';
|
|
9
9
|
|
|
10
|
-
export const convertColors: OperationHandler<ConvertColorsInputs> = async ({
|
|
11
|
-
inputs
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
export const convertColors: OperationHandler<ConvertColorsInputs> = async ({inputs, target}) => {
|
|
11
|
+
const {source, inputFormat, outputFormat} = inputs;
|
|
12
|
+
const values = await source.ensureCPUValue();
|
|
13
|
+
const format =
|
|
14
|
+
source.format ??
|
|
15
|
+
(inputFormat === 'uint8x3'
|
|
16
|
+
? 'uint8x3-webgl'
|
|
17
|
+
: inputFormat === 'float16x3'
|
|
18
|
+
? 'uint16x3-webgl'
|
|
19
|
+
: inputFormat);
|
|
20
|
+
const converted = convertCPUColorData(
|
|
21
|
+
new CPUData({
|
|
22
|
+
buffer: values,
|
|
23
|
+
format,
|
|
24
|
+
length: source.length,
|
|
25
|
+
byteOffset: source.offset,
|
|
26
|
+
byteStride: source.stride
|
|
27
|
+
}),
|
|
28
|
+
outputFormat,
|
|
29
|
+
inputFormat
|
|
30
|
+
);
|
|
31
|
+
const bytes = new Uint8Array(
|
|
32
|
+
converted.buffer,
|
|
33
|
+
converted.byteOffset,
|
|
34
|
+
converted.length * converted.byteStride
|
|
35
|
+
);
|
|
36
|
+
target.write(bytes);
|
|
37
|
+
// Let the evaluator decode the target in its own Float16Array/Uint16Array representation.
|
|
38
|
+
return {success: true};
|
|
35
39
|
};
|
|
36
|
-
|
|
37
|
-
function convertColorChannel(values: TypedArray, index: number, inputFormat: string): number {
|
|
38
|
-
if (inputFormat.startsWith('uint8')) {
|
|
39
|
-
return values[index];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const value = inputFormat.startsWith('float16') ? getFloat16Value(values, index) : values[index];
|
|
43
|
-
return Math.round(Math.min(Math.max(value, 0), 1) * 255);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getFloat16Value(values: TypedArray, index: number): number {
|
|
47
|
-
const Float16ArrayConstructor = getNativeFloat16ArrayConstructor();
|
|
48
|
-
if (Float16ArrayConstructor && values.constructor === Float16ArrayConstructor) {
|
|
49
|
-
return values[index];
|
|
50
|
-
}
|
|
51
|
-
return fromHalfFloat(values[index]);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function getNativeFloat16ArrayConstructor(): unknown {
|
|
55
|
-
return (globalThis as typeof globalThis & {Float16Array?: unknown}).Float16Array;
|
|
56
|
-
}
|
|
@@ -13,11 +13,19 @@ const COMPUTATION_RUNS = 'Computation Runs';
|
|
|
13
13
|
export const convertColors: OperationHandler<ConvertColorsInputs> = async ({
|
|
14
14
|
inputs,
|
|
15
15
|
output,
|
|
16
|
-
target
|
|
16
|
+
target,
|
|
17
|
+
scope
|
|
17
18
|
}) => {
|
|
18
19
|
const {source, inputFormat} = inputs;
|
|
20
|
+
if (output.length === 0) return {success: true};
|
|
19
21
|
const kernel = new Kernel(target.device, {
|
|
20
|
-
source: getConvertColorsWGSL(
|
|
22
|
+
source: getConvertColorsWGSL(
|
|
23
|
+
inputFormat,
|
|
24
|
+
source.offset,
|
|
25
|
+
source.stride,
|
|
26
|
+
output.length,
|
|
27
|
+
inputs.outputFormat
|
|
28
|
+
),
|
|
21
29
|
shaderLayout: {
|
|
22
30
|
bindings: [
|
|
23
31
|
{name: 'source', type: 'storage' as const, group: 0, location: 0},
|
|
@@ -31,23 +39,38 @@ export const convertColors: OperationHandler<ConvertColorsInputs> = async ({
|
|
|
31
39
|
result: target
|
|
32
40
|
};
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if (scope) scope.retain(() => kernel.destroy());
|
|
43
|
+
try {
|
|
44
|
+
const computePass = scope
|
|
45
|
+
? scope.commandEncoder.beginComputePass({})
|
|
46
|
+
: target.device.beginComputePass({});
|
|
47
|
+
try {
|
|
48
|
+
target.device.statsManager
|
|
49
|
+
.getStats(GPGPU_OPERATION_STATS)
|
|
50
|
+
.get(COMPUTATION_RUNS)
|
|
51
|
+
.incrementCount();
|
|
52
|
+
kernel.dispatch(computePass, {
|
|
53
|
+
bindings: kernelBindings,
|
|
54
|
+
x: Math.ceil(output.length / WORKGROUP_SIZE)
|
|
55
|
+
});
|
|
56
|
+
} finally {
|
|
57
|
+
computePass.end();
|
|
58
|
+
}
|
|
59
|
+
if (!scope) target.device.submit();
|
|
60
|
+
} finally {
|
|
61
|
+
if (!scope) kernel.destroy();
|
|
62
|
+
}
|
|
63
|
+
|
|
43
64
|
return {success: true};
|
|
44
65
|
};
|
|
66
|
+
convertColors.supportsEvaluationScope = true;
|
|
45
67
|
|
|
46
68
|
function getConvertColorsWGSL(
|
|
47
69
|
inputFormat: ConvertColorsInputs['inputFormat'],
|
|
48
70
|
byteOffset: number,
|
|
49
71
|
byteStride: number,
|
|
50
|
-
length: number
|
|
72
|
+
length: number,
|
|
73
|
+
outputFormat: ConvertColorsInputs['outputFormat']
|
|
51
74
|
): string {
|
|
52
75
|
return /* wgsl */ `\
|
|
53
76
|
@group(0) @binding(0) var<storage, read> source: array<u32>;
|
|
@@ -90,7 +113,18 @@ ${getReadColorWGSL(inputFormat)}
|
|
|
90
113
|
return;
|
|
91
114
|
}
|
|
92
115
|
|
|
93
|
-
|
|
116
|
+
let color = readColor(rowIndex);
|
|
117
|
+
${
|
|
118
|
+
outputFormat === 'unorm8x4'
|
|
119
|
+
? ' result[rowIndex] = pack4x8unorm(color);'
|
|
120
|
+
: outputFormat === 'float16x4'
|
|
121
|
+
? ` result[rowIndex * 2u] = pack2x16float(color.xy);
|
|
122
|
+
result[rowIndex * 2u + 1u] = pack2x16float(color.zw);`
|
|
123
|
+
: ` result[rowIndex * 4u] = bitcast<u32>(color.x);
|
|
124
|
+
result[rowIndex * 4u + 1u] = bitcast<u32>(color.y);
|
|
125
|
+
result[rowIndex * 4u + 2u] = bitcast<u32>(color.z);
|
|
126
|
+
result[rowIndex * 4u + 3u] = bitcast<u32>(color.w);`
|
|
127
|
+
}
|
|
94
128
|
}
|
|
95
129
|
`;
|
|
96
130
|
}
|