@luma.gl/graph 10.0.0-beta.1 → 10.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.cjs +22 -9
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts +11 -2
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js +27 -10
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.cjs +24 -13
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts +9 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.js +41 -14
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +24 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +10 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +29 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +2 -0
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +1 -1
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +1 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/experimental-models.cjs +21 -0
- package/dist/experimental-models.d.ts +2 -0
- package/dist/experimental-models.d.ts.map +1 -0
- package/dist/experimental-models.js +5 -0
- package/dist/experimental-models.js.map +1 -0
- package/dist/experimental-simulation.cjs +21 -0
- package/dist/experimental-simulation.d.ts +2 -0
- package/dist/experimental-simulation.d.ts.map +1 -0
- package/dist/experimental-simulation.js +5 -0
- package/dist/experimental-simulation.js.map +1 -0
- package/dist/gpu-core/gpu-bvh-bounds.cjs +63 -0
- package/dist/gpu-core/gpu-bvh-bounds.d.ts +32 -0
- package/dist/gpu-core/gpu-bvh-bounds.d.ts.map +1 -0
- package/dist/gpu-core/gpu-bvh-bounds.js +56 -0
- package/dist/gpu-core/gpu-bvh-bounds.js.map +1 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.cjs +92 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts +41 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts.map +1 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.js +85 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.js.map +1 -0
- package/dist/gpu-core/index.cjs +6 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +4 -0
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +2 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.cjs +6 -6
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js +6 -6
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +60 -15
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts +13 -2
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +69 -18
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame.cjs +1 -3
- package/dist/gpu-dataframe/gpu-data-frame.d.ts +10 -0
- package/dist/gpu-dataframe/gpu-data-frame.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame.js +1 -3
- package/dist/gpu-dataframe/gpu-data-frame.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.cjs +157 -25
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts +9 -5
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.js +184 -25
- package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +100 -8
- package/dist/gpu-dataframe/gpu-expression.d.ts +35 -3
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +92 -6
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +2 -3
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +4 -3
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +4 -4
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts +5 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js +11 -5
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +136 -99
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +7 -2
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +135 -97
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +286 -49
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +17 -2
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +290 -40
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +10 -8
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts +7 -1
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.js +14 -8
- package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.cjs +8 -8
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +9 -9
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +38 -10
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +3 -2
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +37 -9
- package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-query.cjs +13 -5
- package/dist/gpu-dataframe/gpu-sort-query.d.ts +4 -1
- package/dist/gpu-dataframe/gpu-sort-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-query.js +14 -5
- package/dist/gpu-dataframe/gpu-sort-query.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 +3 -3
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +2 -2
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +68 -4
- package/dist/gpu-dataframe/portable-expression.d.ts +3 -1
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/portable-expression.js +69 -5
- package/dist/gpu-dataframe/portable-expression.js.map +1 -1
- package/dist/gpu-dggs-benchmarks.cjs +21 -0
- package/dist/gpu-dggs-benchmarks.d.ts +2 -0
- package/dist/gpu-dggs-benchmarks.d.ts.map +1 -0
- package/dist/gpu-dggs-benchmarks.js +5 -0
- package/dist/gpu-dggs-benchmarks.js.map +1 -0
- package/dist/gpu-graph-algorithms-benchmarks.cjs +21 -0
- package/dist/gpu-graph-algorithms-benchmarks.d.ts +2 -0
- package/dist/gpu-graph-algorithms-benchmarks.d.ts.map +1 -0
- package/dist/gpu-graph-algorithms-benchmarks.js +5 -0
- package/dist/gpu-graph-algorithms-benchmarks.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-batch.cjs +11 -10
- package/dist/gpu-physics/gpu-physics-batch.d.ts +1 -0
- package/dist/gpu-physics/gpu-physics-batch.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-batch.js +14 -10
- package/dist/gpu-physics/gpu-physics-batch.js.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble.cjs +105 -8
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts +40 -2
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.js +109 -6
- package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +737 -213
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +111 -5
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +842 -231
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs +23 -2
- package/dist/gpu-physics/index.cjs.map +3 -3
- package/dist/gpu-physics/index.d.ts +10 -3
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/index.js +6 -1
- package/dist/gpu-physics/index.js.map +1 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.cjs +21 -8
- package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.js +15 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.cjs +10 -6
- package/dist/gpu-physics/rigid-body-cache-shaders.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.js +15 -6
- package/dist/gpu-physics/rigid-body-cache-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-capacity.cjs +15 -2
- package/dist/gpu-physics/rigid-body-capacity.d.ts +3 -1
- package/dist/gpu-physics/rigid-body-capacity.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-capacity.js +21 -2
- package/dist/gpu-physics/rigid-body-capacity.js.map +1 -1
- package/dist/gpu-physics/rigid-body-cast-index.cjs +192 -0
- package/dist/gpu-physics/rigid-body-cast-index.d.ts +44 -0
- package/dist/gpu-physics/rigid-body-cast-index.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-cast-index.js +194 -0
- package/dist/gpu-physics/rigid-body-cast-index.js.map +1 -0
- package/dist/gpu-physics/rigid-body-convex-shaders.cjs +3 -2
- package/dist/gpu-physics/rigid-body-convex-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.js +3 -2
- package/dist/gpu-physics/rigid-body-convex-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.cjs +4 -2
- package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.js +5 -2
- package/dist/gpu-physics/rigid-body-ensemble-layout.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +45 -14
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.js +53 -14
- package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-shaders.cjs +14 -7
- package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts +5 -0
- package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-shaders.js +17 -7
- package/dist/gpu-physics/rigid-body-ensemble-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +40 -8
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +5 -2
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js +49 -9
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
- package/dist/gpu-physics/rigid-body-event-compaction.cjs +184 -0
- package/dist/gpu-physics/rigid-body-event-compaction.d.ts +35 -0
- package/dist/gpu-physics/rigid-body-event-compaction.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-event-compaction.js +168 -0
- package/dist/gpu-physics/rigid-body-event-compaction.js.map +1 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.cjs +51 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.d.ts +33 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.js +34 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.js.map +1 -0
- package/dist/gpu-physics/rigid-body-events.cjs +57 -25
- package/dist/gpu-physics/rigid-body-events.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-events.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-events.js +60 -25
- package/dist/gpu-physics/rigid-body-events.js.map +1 -1
- package/dist/gpu-physics/rigid-body-geometry.cjs +41 -4
- package/dist/gpu-physics/rigid-body-geometry.d.ts +10 -1
- package/dist/gpu-physics/rigid-body-geometry.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-geometry.js +44 -3
- package/dist/gpu-physics/rigid-body-geometry.js.map +1 -1
- package/dist/gpu-physics/rigid-body-height-field-shader.cjs +80 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.d.ts +3 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.js +56 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.js.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field.cjs +166 -0
- package/dist/gpu-physics/rigid-body-height-field.d.ts +55 -0
- package/dist/gpu-physics/rigid-body-height-field.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field.js +184 -0
- package/dist/gpu-physics/rigid-body-height-field.js.map +1 -0
- package/dist/gpu-physics/rigid-body-joints.cjs +8 -3
- package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-joints.js +10 -6
- package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.cjs +4 -2
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.js +4 -2
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh.cjs +72 -17
- package/dist/gpu-physics/rigid-body-mesh.d.ts +3 -0
- package/dist/gpu-physics/rigid-body-mesh.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh.js +76 -20
- package/dist/gpu-physics/rigid-body-mesh.js.map +1 -1
- package/dist/gpu-physics/rigid-body-properties.cjs +4 -4
- package/dist/gpu-physics/rigid-body-properties.d.ts +6 -0
- package/dist/gpu-physics/rigid-body-properties.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-properties.js +1 -1
- package/dist/gpu-physics/rigid-body-properties.js.map +1 -1
- package/dist/gpu-physics/rigid-body-publication.cjs +2 -2
- package/dist/gpu-physics/rigid-body-publication.js +1 -1
- package/dist/gpu-physics/rigid-body-publication.js.map +1 -1
- package/dist/gpu-physics/rigid-body-queries.cjs +159 -16
- package/dist/gpu-physics/rigid-body-queries.d.ts +24 -1
- package/dist/gpu-physics/rigid-body-queries.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-queries.js +166 -14
- package/dist/gpu-physics/rigid-body-queries.js.map +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.cjs +22 -4
- package/dist/gpu-physics/rigid-body-query-geometry.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.js +22 -4
- package/dist/gpu-physics/rigid-body-query-geometry.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +13 -7
- 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 +16 -8
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shape-properties.cjs +2 -0
- package/dist/gpu-physics/rigid-body-shape-properties.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shape-properties.js +2 -0
- package/dist/gpu-physics/rigid-body-shape-properties.js.map +1 -1
- package/dist/gpu-physics/rigid-body-terrain-atlas.cjs +287 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts +87 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.js +275 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.cjs +240 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.d.ts +76 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.js +247 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.cjs +215 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts +25 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.js +218 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.cjs +263 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.d.ts +97 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.js +250 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.js.map +1 -0
- package/dist/gpu-physics/rigid-body-triggers.cjs +54 -15
- package/dist/gpu-physics/rigid-body-triggers.d.ts +1 -0
- package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.js +56 -15
- package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.cjs +99 -44
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +15 -3
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.js +93 -40
- package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -1
- package/dist/gpu-physics/sphere-world-shaders.cjs +48 -20
- package/dist/gpu-physics/sphere-world-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/sphere-world-shaders.js +51 -21
- package/dist/gpu-physics/sphere-world-shaders.js.map +1 -1
- package/dist/gpu-project/benchmarks.cjs.map +2 -2
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts +1 -1
- package/dist/gpu-project/cpu-projection-operation.d.ts +1 -1
- package/dist/gpu-project/crs.cjs.map +3 -3
- package/dist/gpu-project/crs.d.ts +1 -1
- package/dist/gpu-project/index.cjs.map +2 -2
- package/dist/gpu-project/projection-crs-benchmark.cjs +2 -2
- package/dist/gpu-project/projection-crs-benchmark.d.ts +1 -1
- package/dist/gpu-project/projection-crs-benchmark.js +1 -1
- package/dist/gpu-project/projection-crs-input.cjs +7 -7
- package/dist/gpu-project/projection-crs-input.d.ts +1 -1
- package/dist/gpu-project/projection-crs-input.js +4 -4
- package/dist/gpu-project/projection-engine.d.ts +2 -2
- package/dist/gpu-project/projection-program.cjs +2 -9
- package/dist/gpu-project/projection-program.d.ts.map +1 -1
- package/dist/gpu-project/projection-program.js +1 -8
- package/dist/gpu-project/projection-program.js.map +1 -1
- package/dist/gpu-project-benchmarks.cjs +21 -0
- package/dist/gpu-project-benchmarks.d.ts +2 -0
- package/dist/gpu-project-benchmarks.d.ts.map +1 -0
- package/dist/gpu-project-benchmarks.js +5 -0
- package/dist/gpu-project-benchmarks.js.map +1 -0
- package/dist/gpu-project-crs.cjs +21 -0
- package/dist/gpu-project-crs.d.ts +2 -0
- package/dist/gpu-project-crs.d.ts.map +1 -0
- package/dist/gpu-project-crs.js +5 -0
- package/dist/gpu-project-crs.js.map +1 -0
- package/dist/gpu-project-geoarrow.cjs +21 -0
- package/dist/gpu-project-geoarrow.d.ts +2 -0
- package/dist/gpu-project-geoarrow.d.ts.map +1 -0
- package/dist/gpu-project-geoarrow.js +5 -0
- package/dist/gpu-project-geoarrow.js.map +1 -0
- package/dist/gpu-project-graph.cjs +21 -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 +5 -0
- package/dist/gpu-project-graph.js.map +1 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/operation.d.ts +1 -1
- package/dist/gpu-simple-graph/operation/operation.d.ts.map +1 -1
- package/dist/gpu-simple-graph-cpu.cjs +21 -0
- package/dist/gpu-simple-graph-cpu.d.ts +2 -0
- package/dist/gpu-simple-graph-cpu.d.ts.map +1 -0
- package/dist/gpu-simple-graph-cpu.js +5 -0
- package/dist/gpu-simple-graph-cpu.js.map +1 -0
- package/dist/gpu-simple-graph-webgl.cjs +21 -0
- package/dist/gpu-simple-graph-webgl.d.ts +2 -0
- package/dist/gpu-simple-graph-webgl.d.ts.map +1 -0
- package/dist/gpu-simple-graph-webgl.js +5 -0
- package/dist/gpu-simple-graph-webgl.js.map +1 -0
- package/dist/gpu-simple-graph-webgpu.cjs +21 -0
- package/dist/gpu-simple-graph-webgpu.d.ts +2 -0
- package/dist/gpu-simple-graph-webgpu.d.ts.map +1 -0
- package/dist/gpu-simple-graph-webgpu.js +5 -0
- package/dist/gpu-simple-graph-webgpu.js.map +1 -0
- package/dist/gpu-sql/gpu-sql.cjs +269 -171
- package/dist/gpu-sql/gpu-sql.d.ts +36 -1
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +313 -181
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-sql/index.d.ts +1 -1
- package/dist/gpu-sql/index.d.ts.map +1 -1
- package/dist/utils/float32.cjs +35 -0
- package/dist/utils/float32.d.ts +3 -0
- package/dist/utils/float32.d.ts.map +1 -0
- package/dist/utils/float32.js +16 -0
- package/dist/utils/float32.js.map +1 -0
- package/package.json +19 -19
- package/src/arrow/gpu/arrow-gpu-analytics-adapters.ts +77 -25
- package/src/arrow/gpu/arrow-gpu-analytics-readback.ts +52 -16
- package/src/arrow/gpu/arrow-gpu-table-conversion.ts +46 -1
- package/src/arrow/index.ts +1 -0
- package/src/experimental-models.ts +5 -0
- package/src/experimental-simulation.ts +5 -0
- package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
- package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
- package/src/gpu-core/index.ts +5 -0
- package/src/gpu-dataframe/gpu-analytics-compiler-utils.ts +7 -10
- package/src/gpu-dataframe/gpu-data-frame-query.ts +119 -25
- package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
- package/src/gpu-dataframe/gpu-expression-shader.ts +267 -32
- package/src/gpu-dataframe/gpu-expression.ts +186 -10
- package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +6 -3
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +17 -6
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +177 -105
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +469 -53
- package/src/gpu-dataframe/gpu-group-by-query.ts +29 -13
- package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-join-compiler.ts +12 -8
- package/src/gpu-dataframe/gpu-query-compiler.ts +61 -19
- package/src/gpu-dataframe/gpu-sort-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-sort-query.ts +31 -5
- package/src/gpu-dataframe/index.ts +16 -3
- package/src/gpu-dataframe/portable-expression.ts +81 -4
- package/src/gpu-dggs-benchmarks.ts +5 -0
- package/src/gpu-graph-algorithms-benchmarks.ts +5 -0
- package/src/gpu-physics/gpu-physics-batch.ts +19 -13
- package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
- package/src/gpu-physics/gpu-physics-ensemble.ts +166 -7
- package/src/gpu-physics/gpu-rigid-body-world.ts +1085 -287
- package/src/gpu-physics/index.ts +46 -0
- package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
- package/src/gpu-physics/rigid-body-cache-shaders.ts +18 -6
- package/src/gpu-physics/rigid-body-capacity.ts +25 -4
- package/src/gpu-physics/rigid-body-cast-index.ts +277 -0
- package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-ensemble-layout.ts +6 -2
- package/src/gpu-physics/rigid-body-ensemble-reset.ts +67 -15
- package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
- package/src/gpu-physics/rigid-body-ensemble-transaction.ts +61 -10
- package/src/gpu-physics/rigid-body-event-compaction.ts +252 -0
- package/src/gpu-physics/rigid-body-event-snapshot.ts +76 -0
- package/src/gpu-physics/rigid-body-events.ts +63 -25
- package/src/gpu-physics/rigid-body-geometry.ts +49 -4
- package/src/gpu-physics/rigid-body-height-field-shader.ts +56 -0
- package/src/gpu-physics/rigid-body-height-field.ts +257 -0
- package/src/gpu-physics/rigid-body-joints.ts +9 -11
- package/src/gpu-physics/rigid-body-mesh-query-shaders.ts +4 -2
- package/src/gpu-physics/rigid-body-mesh.ts +97 -26
- package/src/gpu-physics/rigid-body-properties.ts +5 -2
- package/src/gpu-physics/rigid-body-publication.ts +1 -1
- package/src/gpu-physics/rigid-body-queries.ts +202 -14
- package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
- package/src/gpu-physics/rigid-body-shaders.ts +20 -8
- package/src/gpu-physics/rigid-body-shape-properties.ts +2 -0
- package/src/gpu-physics/rigid-body-terrain-atlas.ts +378 -0
- package/src/gpu-physics/rigid-body-terrain-lod.ts +332 -0
- package/src/gpu-physics/rigid-body-terrain-stitch.ts +286 -0
- package/src/gpu-physics/rigid-body-terrain-stream.ts +323 -0
- package/src/gpu-physics/rigid-body-triggers.ts +65 -20
- package/src/gpu-physics/rigid-body-vehicle.ts +108 -41
- package/src/gpu-physics/sphere-world-shaders.ts +53 -21
- package/src/gpu-project/README.md +2 -2
- package/src/gpu-project/cpu-geometry-pipelines.ts +1 -1
- package/src/gpu-project/cpu-projection-operation.ts +1 -1
- package/src/gpu-project/crs.ts +2 -2
- package/src/gpu-project/projection-crs-benchmark.ts +2 -2
- package/src/gpu-project/projection-crs-input.ts +4 -4
- package/src/gpu-project/projection-engine.ts +2 -2
- package/src/gpu-project/projection-program.ts +1 -9
- package/src/gpu-project-benchmarks.ts +5 -0
- package/src/gpu-project-crs.ts +5 -0
- package/src/gpu-project-geoarrow.ts +5 -0
- package/src/gpu-project-graph.ts +5 -0
- package/src/gpu-simple-graph/gpu-simple-graph-transfer.ts +1 -1
- package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +1 -1
- package/src/gpu-simple-graph/operation/operation.ts +1 -1
- package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
- package/src/gpu-simple-graph-cpu.ts +5 -0
- package/src/gpu-simple-graph-webgl.ts +5 -0
- package/src/gpu-simple-graph-webgpu.ts +5 -0
- package/src/gpu-sql/gpu-sql.ts +535 -223
- package/src/gpu-sql/index.ts +1 -1
- package/src/utils/float32.ts +16 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** Storage shared by the float and bit views. */
|
|
5
|
+
const float = new Float32Array(1);
|
|
6
|
+
/** IEEE 754 encoding of the same scalar. */
|
|
7
|
+
const bits = new Uint32Array(float.buffer);
|
|
8
|
+
/** Step a finite binary32 value by one representable value in the requested direction. */
|
|
9
|
+
export function nextFloat32(value, increase) {
|
|
10
|
+
if (value === 0)
|
|
11
|
+
return increase ? 2 ** -149 : -(2 ** -149);
|
|
12
|
+
float[0] = value;
|
|
13
|
+
bits[0] += value > 0 === increase ? 1 : -1;
|
|
14
|
+
return float[0];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=float32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"float32.js","sourceRoot":"","sources":["../../src/utils/float32.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,iDAAiD;AACjD,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAClC,4CAA4C;AAC5C,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3C,0FAA0F;AAC1F,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,QAAiB;IAC1D,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACjB,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "10.0.0-beta.
|
|
6
|
+
"version": "10.0.0-beta.3",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"import": "./dist/gpu-graph/index.js",
|
|
61
61
|
"require": "./dist/gpu-graph/index.cjs"
|
|
62
62
|
},
|
|
63
|
-
"./gpu-graph-algorithms
|
|
63
|
+
"./gpu-graph-algorithms-benchmarks": {
|
|
64
64
|
"types": "./dist/gpu-graph-algorithms/benchmarks.d.ts",
|
|
65
65
|
"import": "./dist/gpu-graph-algorithms/benchmarks.js",
|
|
66
66
|
"require": "./dist/gpu-graph-algorithms/benchmarks.cjs"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"import": "./dist/gpu-dggs/index.js",
|
|
76
76
|
"require": "./dist/gpu-dggs/index.cjs"
|
|
77
77
|
},
|
|
78
|
-
"./gpu-dggs
|
|
78
|
+
"./gpu-dggs-benchmarks": {
|
|
79
79
|
"types": "./dist/gpu-dggs/benchmarks.d.ts",
|
|
80
80
|
"import": "./dist/gpu-dggs/benchmarks.js",
|
|
81
81
|
"require": "./dist/gpu-dggs/benchmarks.cjs"
|
|
@@ -135,22 +135,22 @@
|
|
|
135
135
|
"import": "./dist/gpu-project/index.js",
|
|
136
136
|
"require": "./dist/gpu-project/index.cjs"
|
|
137
137
|
},
|
|
138
|
-
"./gpu-project
|
|
138
|
+
"./gpu-project-benchmarks": {
|
|
139
139
|
"types": "./dist/gpu-project/benchmarks.d.ts",
|
|
140
140
|
"import": "./dist/gpu-project/benchmarks.js",
|
|
141
141
|
"require": "./dist/gpu-project/benchmarks.cjs"
|
|
142
142
|
},
|
|
143
|
-
"./gpu-project
|
|
143
|
+
"./gpu-project-geoarrow": {
|
|
144
144
|
"types": "./dist/gpu-project/geoarrow.d.ts",
|
|
145
145
|
"import": "./dist/gpu-project/geoarrow.js",
|
|
146
146
|
"require": "./dist/gpu-project/geoarrow.cjs"
|
|
147
147
|
},
|
|
148
|
-
"./gpu-project
|
|
148
|
+
"./gpu-project-graph": {
|
|
149
149
|
"types": "./dist/gpu-project/graph.d.ts",
|
|
150
150
|
"import": "./dist/gpu-project/graph.js",
|
|
151
151
|
"require": "./dist/gpu-project/graph.cjs"
|
|
152
152
|
},
|
|
153
|
-
"./gpu-project
|
|
153
|
+
"./gpu-project-crs": {
|
|
154
154
|
"types": "./dist/gpu-project/crs.d.ts",
|
|
155
155
|
"import": "./dist/gpu-project/crs.js",
|
|
156
156
|
"require": "./dist/gpu-project/crs.cjs"
|
|
@@ -190,12 +190,12 @@
|
|
|
190
190
|
"import": "./dist/gpu-simple-graph/index.js",
|
|
191
191
|
"require": "./dist/gpu-simple-graph/index.cjs"
|
|
192
192
|
},
|
|
193
|
-
"./experimental
|
|
193
|
+
"./experimental-simulation": {
|
|
194
194
|
"types": "./dist/experimental/simulation/index.d.ts",
|
|
195
195
|
"import": "./dist/experimental/simulation/index.js",
|
|
196
196
|
"require": "./dist/experimental/simulation/index.cjs"
|
|
197
197
|
},
|
|
198
|
-
"./experimental
|
|
198
|
+
"./experimental-models": {
|
|
199
199
|
"types": "./dist/experimental/models/index.d.ts",
|
|
200
200
|
"import": "./dist/experimental/models/index.js",
|
|
201
201
|
"require": "./dist/experimental/models/index.cjs"
|
|
@@ -225,25 +225,25 @@
|
|
|
225
225
|
"import": "./dist/execution/*.js",
|
|
226
226
|
"require": "./dist/execution/*.cjs"
|
|
227
227
|
},
|
|
228
|
-
"./gpu-simple-graph
|
|
228
|
+
"./gpu-simple-graph-cpu": {
|
|
229
229
|
"types": "./dist/gpu-simple-graph/operations/cpu/index.d.ts",
|
|
230
230
|
"import": "./dist/gpu-simple-graph/operations/cpu/index.js",
|
|
231
231
|
"require": "./dist/gpu-simple-graph/operations/cpu/index.cjs"
|
|
232
232
|
},
|
|
233
|
-
"./gpu-simple-graph
|
|
233
|
+
"./gpu-simple-graph-webgl": {
|
|
234
234
|
"types": "./dist/gpu-simple-graph/operations/webgl/index.d.ts",
|
|
235
235
|
"import": "./dist/gpu-simple-graph/operations/webgl/index.js",
|
|
236
236
|
"require": "./dist/gpu-simple-graph/operations/webgl/index.cjs"
|
|
237
237
|
},
|
|
238
|
-
"./gpu-simple-graph
|
|
238
|
+
"./gpu-simple-graph-webgpu": {
|
|
239
239
|
"types": "./dist/gpu-simple-graph/operations/webgpu/index.d.ts",
|
|
240
240
|
"import": "./dist/gpu-simple-graph/operations/webgpu/index.js",
|
|
241
241
|
"require": "./dist/gpu-simple-graph/operations/webgpu/index.cjs"
|
|
242
242
|
}
|
|
243
243
|
},
|
|
244
244
|
"peerDependencies": {
|
|
245
|
-
"@luma.gl/core": "~10.0.0-beta.
|
|
246
|
-
"@luma.gl/shaders": "~10.0.0-beta.
|
|
245
|
+
"@luma.gl/core": "~10.0.0-beta.3",
|
|
246
|
+
"@luma.gl/shaders": "~10.0.0-beta.3",
|
|
247
247
|
"apache-arrow": ">=17.0.0"
|
|
248
248
|
},
|
|
249
249
|
"peerDependenciesMeta": {
|
|
@@ -252,11 +252,11 @@
|
|
|
252
252
|
}
|
|
253
253
|
},
|
|
254
254
|
"dependencies": {
|
|
255
|
-
"@math.gl/core": "
|
|
256
|
-
"@math.gl/geometry": "
|
|
257
|
-
"@math.gl/geospatial": "
|
|
258
|
-
"@math.gl/sql": "
|
|
255
|
+
"@math.gl/core": "^5.0.0",
|
|
256
|
+
"@math.gl/geometry": "^5.0.0",
|
|
257
|
+
"@math.gl/geospatial": "^5.0.0",
|
|
258
|
+
"@math.gl/sql": "^5.0.0",
|
|
259
259
|
"probe.gl": "^5.0.0"
|
|
260
260
|
},
|
|
261
|
-
"gitHead": "
|
|
261
|
+
"gitHead": "21e41bd5c8d6ec9db96ccae6a466381b1c052c18"
|
|
262
262
|
}
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Buffer, type Device} from '@luma.gl/core';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
GPUData,
|
|
8
|
+
GPUVector,
|
|
9
|
+
getGPUVectorFormatInfo,
|
|
10
|
+
type GPUVectorBufferProps
|
|
11
|
+
} from '@luma.gl/graph/gpu-data';
|
|
7
12
|
import {
|
|
8
13
|
GPURecordBatch,
|
|
9
14
|
GPUTable,
|
|
@@ -14,6 +19,7 @@ import {
|
|
|
14
19
|
import {
|
|
15
20
|
DataType,
|
|
16
21
|
Dictionary,
|
|
22
|
+
type FixedSizeList,
|
|
17
23
|
Precision,
|
|
18
24
|
type Data,
|
|
19
25
|
type Field,
|
|
@@ -24,26 +30,41 @@ import {
|
|
|
24
30
|
type Uint32,
|
|
25
31
|
type Utf8
|
|
26
32
|
} from 'apache-arrow';
|
|
33
|
+
import {getArrowFixedSizeListRowValidity} from './arrow-gpu-data';
|
|
27
34
|
import {makeGPUDataFromArrowData} from '@luma.gl/graph/arrow';
|
|
28
35
|
|
|
29
|
-
/** Supported
|
|
30
|
-
type
|
|
36
|
+
/** Supported scalar and categorical index formats. */
|
|
37
|
+
type GPUAnalyticsScalarFormat = 'float32' | 'sint32' | 'uint32';
|
|
38
|
+
/** Packed scalar and fixed-width numeric row formats accepted by the Arrow adapter. */
|
|
39
|
+
type GPUAnalyticsVectorFormat =
|
|
40
|
+
| GPUAnalyticsScalarFormat
|
|
41
|
+
| `${GPUAnalyticsScalarFormat}x${2 | 3 | 4}`;
|
|
42
|
+
/** Maps supported Arrow child types to the format of one packed component. */
|
|
43
|
+
type GPUAnalyticsListFormat<T> = T extends Float32
|
|
44
|
+
? 'float32'
|
|
45
|
+
: T extends Int32
|
|
46
|
+
? 'sint32'
|
|
47
|
+
: T extends Uint32
|
|
48
|
+
? 'uint32'
|
|
49
|
+
: never;
|
|
31
50
|
|
|
32
51
|
/** Maps a typed Arrow schema to its exact portable GPU analytics column formats. */
|
|
33
52
|
export type GPUAnalyticsTypeMapForArrow<T extends TypeMap> = {
|
|
34
|
-
[Name in keyof T & string]: T[Name] extends
|
|
35
|
-
?
|
|
36
|
-
: T[Name] extends
|
|
37
|
-
? '
|
|
38
|
-
: T[Name] extends
|
|
39
|
-
? '
|
|
40
|
-
: T[Name] extends
|
|
41
|
-
?
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
? '
|
|
45
|
-
:
|
|
46
|
-
|
|
53
|
+
[Name in keyof T & string]: T[Name] extends FixedSizeList<infer Child>
|
|
54
|
+
? `${GPUAnalyticsListFormat<Child>}x${2 | 3 | 4}`
|
|
55
|
+
: T[Name] extends Float32
|
|
56
|
+
? 'float32'
|
|
57
|
+
: T[Name] extends Int32
|
|
58
|
+
? 'sint32'
|
|
59
|
+
: T[Name] extends Uint32
|
|
60
|
+
? 'uint32'
|
|
61
|
+
: T[Name] extends Dictionary<Utf8, infer IndexType>
|
|
62
|
+
? IndexType extends Int32
|
|
63
|
+
? 'sint32'
|
|
64
|
+
: IndexType extends Uint32
|
|
65
|
+
? 'uint32'
|
|
66
|
+
: never
|
|
67
|
+
: never;
|
|
47
68
|
};
|
|
48
69
|
|
|
49
70
|
/** CPU-owned category labels associated with one GPU-resident dictionary-index column. */
|
|
@@ -77,6 +98,7 @@ export type GPUAnalyticsTableFromArrowTableResult<T extends GPUTypeMap = GPUType
|
|
|
77
98
|
/** Fully validated source metadata collected before allocating any GPU resources. */
|
|
78
99
|
type PreparedGPUAnalyticsColumn = {
|
|
79
100
|
field: Field;
|
|
101
|
+
nullable: boolean;
|
|
80
102
|
format: GPUAnalyticsVectorFormat;
|
|
81
103
|
chunks: Data[];
|
|
82
104
|
validity: Uint32Array[];
|
|
@@ -93,6 +115,12 @@ const GPU_ANALYTICS_BUFFER_USAGE =
|
|
|
93
115
|
* Numeric values and dictionary indices stay in existing `GPUData`, `GPURecordBatch`, `GPUVector`,
|
|
94
116
|
* and `GPUTable` objects. Nullable rows receive separate batch-aligned uint32 validity vectors,
|
|
95
117
|
* while dictionary labels and source null counts remain explicit adapter-owned metadata.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const uploaded = makeGPUAnalyticsTableFromArrowTable(device, arrowTable);
|
|
122
|
+
* const frame = new GPUDataFrame({...uploaded, ownership: 'owned'});
|
|
123
|
+
* ```
|
|
96
124
|
*/
|
|
97
125
|
export function makeGPUAnalyticsTableFromArrowTable<T extends TypeMap>(
|
|
98
126
|
device: Device,
|
|
@@ -166,7 +194,7 @@ export function makeGPUAnalyticsTableFromArrowTable<T extends GPUTypeMap = GPUTy
|
|
|
166
194
|
bufferLayout: columns.map(column => ({
|
|
167
195
|
name: column.field.name,
|
|
168
196
|
format: column.format,
|
|
169
|
-
byteStride:
|
|
197
|
+
byteStride: getGPUVectorFormatInfo(column.format).byteLength
|
|
170
198
|
}))
|
|
171
199
|
});
|
|
172
200
|
|
|
@@ -180,7 +208,7 @@ export function makeGPUAnalyticsTableFromArrowTable<T extends GPUTypeMap = GPUTy
|
|
|
180
208
|
}
|
|
181
209
|
|
|
182
210
|
for (const column of columns) {
|
|
183
|
-
if (!column.
|
|
211
|
+
if (!column.nullable || batches.length === 0) {
|
|
184
212
|
continue;
|
|
185
213
|
}
|
|
186
214
|
|
|
@@ -258,6 +286,8 @@ function prepareGPUAnalyticsColumns(
|
|
|
258
286
|
|
|
259
287
|
const column: PreparedGPUAnalyticsColumn = {
|
|
260
288
|
field,
|
|
289
|
+
nullable:
|
|
290
|
+
field.nullable || (DataType.isFixedSizeList(field.type) && field.type.children[0].nullable),
|
|
261
291
|
format: getGPUAnalyticsVectorFormat(field.type, columnName),
|
|
262
292
|
chunks: [],
|
|
263
293
|
validity: [],
|
|
@@ -277,7 +307,18 @@ function prepareGPUAnalyticsColumns(
|
|
|
277
307
|
throw new Error(`GPU analytics column "${columnName}" changes type between batches`);
|
|
278
308
|
}
|
|
279
309
|
|
|
280
|
-
const
|
|
310
|
+
const parentValidity = getGPUAnalyticsValidity(data, field.nullable, columnName);
|
|
311
|
+
const validity = DataType.isFixedSizeList(field.type)
|
|
312
|
+
? (getArrowFixedSizeListRowValidity(
|
|
313
|
+
data as Data<FixedSizeList<Float32 | Int32 | Uint32>>
|
|
314
|
+
) ?? parentValidity)
|
|
315
|
+
: parentValidity;
|
|
316
|
+
const nullCount = validity.reduce((count, valid) => count + Number(!valid), 0);
|
|
317
|
+
if (nullCount && !column.nullable) {
|
|
318
|
+
throw new Error(
|
|
319
|
+
`GPU analytics non-nullable vector "${columnName}" contains null components`
|
|
320
|
+
);
|
|
321
|
+
}
|
|
281
322
|
if (DataType.isDictionary(field.type)) {
|
|
282
323
|
const dictionary = getGPUAnalyticsDictionary(data, columnName);
|
|
283
324
|
if (column.dictionary && !areGPUAnalyticsDictionariesEqual(column.dictionary, dictionary)) {
|
|
@@ -289,7 +330,7 @@ function prepareGPUAnalyticsColumns(
|
|
|
289
330
|
|
|
290
331
|
column.chunks.push(data);
|
|
291
332
|
column.validity.push(validity);
|
|
292
|
-
column.nullCounts.push(
|
|
333
|
+
column.nullCounts.push(nullCount);
|
|
293
334
|
}
|
|
294
335
|
|
|
295
336
|
return column;
|
|
@@ -298,6 +339,18 @@ function prepareGPUAnalyticsColumns(
|
|
|
298
339
|
|
|
299
340
|
/** Maps the intentionally limited portable Arrow analytics surface to canonical GPU formats. */
|
|
300
341
|
function getGPUAnalyticsVectorFormat(type: DataType, columnName: string): GPUAnalyticsVectorFormat {
|
|
342
|
+
if (DataType.isFixedSizeList(type)) {
|
|
343
|
+
const child = type.children[0].type;
|
|
344
|
+
const width = type.listSize;
|
|
345
|
+
if (
|
|
346
|
+
(width === 2 || width === 3 || width === 4) &&
|
|
347
|
+
((DataType.isFloat(child) && child.precision === Precision.SINGLE) ||
|
|
348
|
+
(DataType.isInt(child) && child.bitWidth === 32))
|
|
349
|
+
) {
|
|
350
|
+
const scalar = DataType.isFloat(child) ? 'float32' : child.isSigned ? 'sint32' : 'uint32';
|
|
351
|
+
return `${scalar}x${width}`;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
301
354
|
if (DataType.isFloat(type) && type.precision === Precision.SINGLE) {
|
|
302
355
|
return 'float32';
|
|
303
356
|
}
|
|
@@ -424,15 +477,14 @@ function makeGPUAnalyticsData(
|
|
|
424
477
|
return makeGPUDataFromArrowData(device, source, {...bufferProps, format});
|
|
425
478
|
}
|
|
426
479
|
|
|
427
|
-
const
|
|
480
|
+
const layout = getGPUVectorFormatInfo(format);
|
|
481
|
+
const buffer = device.createBuffer({...bufferProps, byteLength: layout.byteLength});
|
|
428
482
|
try {
|
|
429
483
|
return new GPUData({
|
|
430
484
|
buffer,
|
|
431
485
|
format,
|
|
432
486
|
length: 0,
|
|
433
|
-
|
|
434
|
-
byteStride: 4,
|
|
435
|
-
rowByteLength: 4,
|
|
487
|
+
|
|
436
488
|
dataType: source.type,
|
|
437
489
|
ownsBuffer: true
|
|
438
490
|
});
|
|
@@ -468,7 +520,7 @@ function makeGPUAnalyticsField(column: PreparedGPUAnalyticsColumn): GPUField {
|
|
|
468
520
|
return {
|
|
469
521
|
name: column.field.name,
|
|
470
522
|
format: column.format,
|
|
471
|
-
nullable: column.
|
|
523
|
+
nullable: column.nullable,
|
|
472
524
|
metadata: new Map(column.field.metadata)
|
|
473
525
|
};
|
|
474
526
|
}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Buffer} from '@luma.gl/core';
|
|
6
|
-
import type
|
|
6
|
+
import {type GPUData, type GPUVector} from '@luma.gl/graph/gpu-data';
|
|
7
7
|
import type {GPUTable, GPUTypeMap} from '@luma.gl/graph/gpu-tables';
|
|
8
8
|
import {
|
|
9
9
|
Dictionary,
|
|
10
10
|
Field,
|
|
11
11
|
Float32,
|
|
12
|
+
FixedSizeList,
|
|
12
13
|
Int32,
|
|
13
14
|
RecordBatch,
|
|
14
15
|
Schema,
|
|
@@ -51,6 +52,14 @@ type ArrowAnalyticsRow = {batchIndex: number; rowIndex: number};
|
|
|
51
52
|
* Ordinary materialization preserves every source batch, including empty chunks. Optional
|
|
52
53
|
* dataframe selection identities retain those batch boundaries, while explicitly requested global
|
|
53
54
|
* identities produce one intentionally reordered Arrow result batch.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const arrowTable = await makeArrowTableFromGPUAnalyticsTable({
|
|
59
|
+
* table: compiled.table,
|
|
60
|
+
* validity: compiled.validity
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
54
63
|
*/
|
|
55
64
|
export async function makeArrowTableFromGPUAnalyticsTable<T extends GPUTypeMap>(
|
|
56
65
|
props: ArrowTableFromGPUAnalyticsTableProps<T>
|
|
@@ -60,7 +69,7 @@ export async function makeArrowTableFromGPUAnalyticsTable<T extends GPUTypeMap>(
|
|
|
60
69
|
const dictionary = props.dictionaries?.[field.name];
|
|
61
70
|
const type = dictionary
|
|
62
71
|
? makeArrowAnalyticsDictionaryType(props.table, field.name, dictionary, fieldIndex)
|
|
63
|
-
:
|
|
72
|
+
: makeArrowAnalyticsType(field.format);
|
|
64
73
|
return new Field(field.name, type, field.nullable, new Map(field.metadata));
|
|
65
74
|
});
|
|
66
75
|
const schema = new Schema(fields, new Map(props.table.schema.metadata));
|
|
@@ -119,7 +128,7 @@ function validateArrowGPUAnalyticsReadback<T extends GPUTypeMap>(
|
|
|
119
128
|
) {
|
|
120
129
|
throw new Error(`Arrow analytics validity for "${field.name}" must match source batches`);
|
|
121
130
|
}
|
|
122
|
-
|
|
131
|
+
makeArrowAnalyticsType(field.format);
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
134
|
|
|
@@ -189,29 +198,36 @@ async function makeArrowAnalyticsColumn<T extends GPUTypeMap>(
|
|
|
189
198
|
rows: readonly ArrowAnalyticsRow[]
|
|
190
199
|
): Promise<Data> {
|
|
191
200
|
const format = props.table.schema.fields[fieldIndex].format;
|
|
201
|
+
const scalarType = field.type instanceof FixedSizeList ? field.type.valueType : field.type;
|
|
202
|
+
const width = field.type instanceof FixedSizeList ? field.type.listSize : 1;
|
|
203
|
+
const Constructor =
|
|
204
|
+
scalarType instanceof Float32
|
|
205
|
+
? Float32Array
|
|
206
|
+
: format === 'sint32' || scalarType instanceof Int32
|
|
207
|
+
? Int32Array
|
|
208
|
+
: Uint32Array;
|
|
192
209
|
const sourceValues = new Map<number, Float32Array | Int32Array | Uint32Array>();
|
|
193
210
|
const sourceValidity = new Map<number, Uint32Array>();
|
|
194
211
|
await Promise.all(
|
|
195
212
|
Array.from(new Set(rows.map(row => row.batchIndex))).map(async batchIndex => {
|
|
196
213
|
const data = props.table.batches[batchIndex].gpuData[field.name];
|
|
197
|
-
const bytes = await readArrowAnalyticsBytes(data);
|
|
198
|
-
const Constructor =
|
|
199
|
-
format === 'float32' ? Float32Array : format === 'sint32' ? Int32Array : Uint32Array;
|
|
214
|
+
const bytes = await readArrowAnalyticsBytes(data, data.length, width * 4);
|
|
200
215
|
sourceValues.set(
|
|
201
216
|
batchIndex,
|
|
202
|
-
new Constructor(bytes.buffer as ArrayBuffer, bytes.byteOffset, data.length)
|
|
217
|
+
new Constructor(bytes.buffer as ArrayBuffer, bytes.byteOffset, data.length * width)
|
|
203
218
|
);
|
|
204
219
|
const validity = props.validity?.[field.name]?.data[batchIndex];
|
|
205
220
|
if (validity) sourceValidity.set(batchIndex, await readArrowAnalyticsWords(validity));
|
|
206
221
|
})
|
|
207
222
|
);
|
|
208
|
-
const Constructor
|
|
209
|
-
format === 'float32' ? Float32Array : format === 'sint32' ? Int32Array : Uint32Array;
|
|
210
|
-
const values = new Constructor(rows.length);
|
|
223
|
+
const values = new Constructor(rows.length * width);
|
|
211
224
|
const nullBitmap = new Uint8Array(Math.ceil(rows.length / 8));
|
|
212
225
|
let nullCount = 0;
|
|
213
226
|
for (const [outputIndex, row] of rows.entries()) {
|
|
214
|
-
|
|
227
|
+
const source = sourceValues.get(row.batchIndex)!;
|
|
228
|
+
for (let component = 0; component < width; component++) {
|
|
229
|
+
values[outputIndex * width + component] = source[row.rowIndex * width + component];
|
|
230
|
+
}
|
|
215
231
|
const valid = sourceValidity.get(row.batchIndex)?.[row.rowIndex] !== 0;
|
|
216
232
|
if (valid) {
|
|
217
233
|
nullBitmap[outputIndex >> 3] |= 1 << (outputIndex & 7);
|
|
@@ -234,6 +250,10 @@ async function makeArrowAnalyticsColumn<T extends GPUTypeMap>(
|
|
|
234
250
|
nullCount
|
|
235
251
|
});
|
|
236
252
|
}
|
|
253
|
+
if (field.type instanceof FixedSizeList) {
|
|
254
|
+
const child = makeData({type: field.type.valueType, length: values.length, data: values});
|
|
255
|
+
return makeData({type: field.type, length: rows.length, child, nullBitmap, nullCount});
|
|
256
|
+
}
|
|
237
257
|
return makeData({type: field.type, length: rows.length, data: values, nullBitmap, nullCount});
|
|
238
258
|
}
|
|
239
259
|
|
|
@@ -263,7 +283,14 @@ function isArrowAnalyticsDictionary(
|
|
|
263
283
|
return !Array.isArray(value);
|
|
264
284
|
}
|
|
265
285
|
|
|
266
|
-
|
|
286
|
+
/** Maps a GPU analytics scalar or packed vector format to its Arrow type. */
|
|
287
|
+
function makeArrowAnalyticsType(format: string | undefined): DataType {
|
|
288
|
+
const match = /^(float32|sint32|uint32)x([234])$/.exec(format ?? '');
|
|
289
|
+
if (match)
|
|
290
|
+
return new FixedSizeList(
|
|
291
|
+
Number(match[2]),
|
|
292
|
+
new Field('item', makeArrowAnalyticsType(match[1]), false)
|
|
293
|
+
);
|
|
267
294
|
switch (format) {
|
|
268
295
|
case 'float32':
|
|
269
296
|
return new Float32();
|
|
@@ -284,11 +311,20 @@ async function readArrowAnalyticsWords(
|
|
|
284
311
|
return new Uint32Array(bytes.buffer, bytes.byteOffset, length);
|
|
285
312
|
}
|
|
286
313
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
314
|
+
/** Reads tightly packed rows from a GPU data view. */
|
|
315
|
+
async function readArrowAnalyticsBytes(
|
|
316
|
+
data: GPUData,
|
|
317
|
+
length = data.length,
|
|
318
|
+
byteLength = 4
|
|
319
|
+
): Promise<Uint8Array> {
|
|
320
|
+
if (
|
|
321
|
+
data.byteStride !== byteLength ||
|
|
322
|
+
data.rowByteLength !== byteLength ||
|
|
323
|
+
data.byteOffset % 4 !== 0
|
|
324
|
+
) {
|
|
325
|
+
throw new Error('Arrow analytics output requires packed 32-bit GPU numeric data');
|
|
290
326
|
}
|
|
291
327
|
if (length === 0) return new Uint8Array(0);
|
|
292
328
|
const buffer = data.buffer instanceof Buffer ? data.buffer : data.buffer.buffer;
|
|
293
|
-
return buffer.readAsync(data.byteOffset, length *
|
|
329
|
+
return buffer.readAsync(data.byteOffset, length * byteLength);
|
|
294
330
|
}
|
|
@@ -68,6 +68,8 @@ export type ArrowRecordBatchConversionSource =
|
|
|
68
68
|
export type ArrowRecordBatchConversionOptions = {
|
|
69
69
|
/** Stops pending reads and further conversion. Already yielded batches remain caller-owned. */
|
|
70
70
|
signal?: AbortSignal;
|
|
71
|
+
/** Maximum estimated GPU payload bytes per batch. Checked before conversion. */
|
|
72
|
+
maxBatchPayloadBytes?: number;
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
/** One independently owned GPU record batch produced from an Arrow stream. */
|
|
@@ -229,8 +231,14 @@ export async function* convertArrowRecordBatchesToGPURecordBatches(
|
|
|
229
231
|
device: Device,
|
|
230
232
|
source: ArrowRecordBatchConversionSource,
|
|
231
233
|
schema: ArrowGPUTableConversionSchema,
|
|
232
|
-
{signal}: ArrowRecordBatchConversionOptions = {}
|
|
234
|
+
{signal, maxBatchPayloadBytes}: ArrowRecordBatchConversionOptions = {}
|
|
233
235
|
): AsyncGenerator<PreparedArrowGPURecordBatch> {
|
|
236
|
+
if (
|
|
237
|
+
maxBatchPayloadBytes !== undefined &&
|
|
238
|
+
(!Number.isSafeInteger(maxBatchPayloadBytes) || maxBatchPayloadBytes < 0)
|
|
239
|
+
) {
|
|
240
|
+
throw new Error('Arrow GPU stream payload budget must be a nonnegative safe integer');
|
|
241
|
+
}
|
|
234
242
|
const temporalOrigins = new Map<string, number | bigint>();
|
|
235
243
|
const formats = new Map<string, string | undefined>();
|
|
236
244
|
let sourceBatchIndex = 0;
|
|
@@ -245,6 +253,14 @@ export async function* convertArrowRecordBatchesToGPURecordBatches(
|
|
|
245
253
|
: {...column, temporal: {...column.temporal, origin}};
|
|
246
254
|
})
|
|
247
255
|
};
|
|
256
|
+
if (maxBatchPayloadBytes !== undefined) {
|
|
257
|
+
const {cost} = planArrowTableGPUConversion(device, new Table([recordBatch]), batchSchema);
|
|
258
|
+
if (cost.targetByteLength > maxBatchPayloadBytes) {
|
|
259
|
+
throw new Error(
|
|
260
|
+
`Arrow GPU stream batch ${sourceBatchIndex} needs ${cost.targetByteLength} payload bytes, exceeding the ${maxBatchPayloadBytes} byte budget`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
248
264
|
const prepared = await convertArrowRecordBatchToGPURecordBatch(
|
|
249
265
|
device,
|
|
250
266
|
recordBatch,
|
|
@@ -273,6 +289,35 @@ export async function* convertArrowRecordBatchesToGPURecordBatches(
|
|
|
273
289
|
}
|
|
274
290
|
}
|
|
275
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Consumes prepared GPU batches one at a time and releases them before reading the next batch.
|
|
294
|
+
* The callback borrows the batch until its returned promise settles. Await any GPU work that
|
|
295
|
+
* still uses the batch before returning. Cancellation is observed between callbacks and is
|
|
296
|
+
* available to an in-flight callback through the supplied signal.
|
|
297
|
+
*/
|
|
298
|
+
export async function consumeArrowGPURecordBatches(
|
|
299
|
+
device: Device,
|
|
300
|
+
source: ArrowRecordBatchConversionSource,
|
|
301
|
+
schema: ArrowGPUTableConversionSchema,
|
|
302
|
+
consume: (batch: PreparedArrowGPURecordBatch, signal?: AbortSignal) => void | Promise<void>,
|
|
303
|
+
options: ArrowRecordBatchConversionOptions = {}
|
|
304
|
+
): Promise<void> {
|
|
305
|
+
for await (const prepared of convertArrowRecordBatchesToGPURecordBatches(
|
|
306
|
+
device,
|
|
307
|
+
source,
|
|
308
|
+
schema,
|
|
309
|
+
options
|
|
310
|
+
)) {
|
|
311
|
+
try {
|
|
312
|
+
options.signal?.throwIfAborted();
|
|
313
|
+
await consume(prepared, options.signal);
|
|
314
|
+
options.signal?.throwIfAborted();
|
|
315
|
+
} finally {
|
|
316
|
+
prepared.destroy();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
276
321
|
function validateTableConversionSchema(schema: ArrowGPUTableConversionSchema): void {
|
|
277
322
|
if (schema.columns.length === 0) {
|
|
278
323
|
throw new Error('Arrow GPU table conversion schema requires at least one column');
|
package/src/arrow/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export {
|
|
|
28
28
|
type ArrowTableFromGPUAnalyticsTableProps
|
|
29
29
|
} from './gpu/arrow-gpu-analytics-readback';
|
|
30
30
|
export {
|
|
31
|
+
consumeArrowGPURecordBatches,
|
|
31
32
|
convertArrowRecordBatchToGPURecordBatch,
|
|
32
33
|
convertArrowRecordBatchesToGPURecordBatches,
|
|
33
34
|
convertArrowTableToGPUTable,
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {nextFloat32} from '../utils/float32';
|
|
6
|
+
|
|
7
|
+
/** Vertex format for each supported box dimension. */
|
|
8
|
+
const BOUNDS_FORMATS = {2: 'float32x2', 3: 'float32x3'} as const;
|
|
9
|
+
|
|
10
|
+
/** Smallest normal binary32 magnitude, also valid on GPUs that flush subnormals. */
|
|
11
|
+
const MINIMUM_NORMAL = 2 ** -126;
|
|
12
|
+
|
|
13
|
+
/** Interleaved min/max records, compatible with math.gl BoxIndex input. */
|
|
14
|
+
export type GPUBVHBoundsInput<Dimension extends 2 | 3 = 2 | 3> = {
|
|
15
|
+
/** Number of coordinates in each minimum or maximum. */
|
|
16
|
+
dimension: Dimension;
|
|
17
|
+
/** One record per source row, with minimum coordinates followed by maximum coordinates. */
|
|
18
|
+
bounds: ArrayLike<number>;
|
|
19
|
+
/** Optional origin subtracted in number precision before narrowing each coordinate. */
|
|
20
|
+
origin?: ArrayLike<number>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Split bounds ready to upload into two packed GPUBVH source views. */
|
|
24
|
+
export type GPUBVHPackedBounds<Dimension extends 2 | 3 = 2 | 3> = {
|
|
25
|
+
/** GPU format of each minimum and maximum row. */
|
|
26
|
+
format: (typeof BOUNDS_FORMATS)[Dimension];
|
|
27
|
+
/** Source box count, in original row order. */
|
|
28
|
+
length: number;
|
|
29
|
+
/** Packed local lower bounds, rounded outward. */
|
|
30
|
+
minima: Float32Array;
|
|
31
|
+
/** Packed local upper bounds, rounded outward. */
|
|
32
|
+
maxima: Float32Array;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Convert CPU box data shared with math.gl BoxIndex to the split buffers used by GPUBVH.
|
|
37
|
+
* Rows keep their input IDs. With an origin, subsequent GPU queries must use the same local frame.
|
|
38
|
+
*/
|
|
39
|
+
export function packGPUBVHBounds<Dimension extends 2 | 3>({
|
|
40
|
+
bounds,
|
|
41
|
+
dimension,
|
|
42
|
+
origin
|
|
43
|
+
}: GPUBVHBoundsInput<Dimension>): GPUBVHPackedBounds<Dimension> {
|
|
44
|
+
/** Each interleaved row holds one minimum and one maximum. */
|
|
45
|
+
const stride = 2 * dimension;
|
|
46
|
+
if ((dimension !== 2 && dimension !== 3) || bounds.length % stride !== 0)
|
|
47
|
+
throw new Error('Invalid packed BVH bounds layout');
|
|
48
|
+
if (origin && (origin.length !== dimension || !Array.from(origin).every(Number.isFinite)))
|
|
49
|
+
throw new Error('Invalid BVH bounds origin');
|
|
50
|
+
|
|
51
|
+
/** Output rows retain the source order and leave input storage untouched. */
|
|
52
|
+
const length = bounds.length / stride;
|
|
53
|
+
/** Lower bounds occupy one contiguous buffer. */
|
|
54
|
+
const minima = new Float32Array(length * dimension);
|
|
55
|
+
/** Upper bounds occupy a separate contiguous buffer. */
|
|
56
|
+
const maxima = new Float32Array(length * dimension);
|
|
57
|
+
for (let row = 0; row < length; row++) {
|
|
58
|
+
for (let coordinate = 0; coordinate < dimension; coordinate++) {
|
|
59
|
+
/** Compute local coordinates before reducing precision. */
|
|
60
|
+
const shift = origin?.[coordinate] ?? 0;
|
|
61
|
+
/** Check source ordering before subtracting a potentially distant origin. */
|
|
62
|
+
const minimum = bounds[row * stride + coordinate];
|
|
63
|
+
/** Upper bound in the same dimension. */
|
|
64
|
+
const maximum = bounds[row * stride + dimension + coordinate];
|
|
65
|
+
if (minimum > maximum) throw new Error('Invalid BVH bounds order');
|
|
66
|
+
minima[row * dimension + coordinate] = roundBoundsCoordinate(minimum - shift, false);
|
|
67
|
+
maxima[row * dimension + coordinate] = roundBoundsCoordinate(maximum - shift, true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return {format: BOUNDS_FORMATS[dimension], length, minima, maxima};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Keep the float32 bound conservative even when the adapter flushes subnormal values. */
|
|
74
|
+
function roundBoundsCoordinate(value: number, increase: boolean): number {
|
|
75
|
+
if (value === 0) return 0;
|
|
76
|
+
if (Math.abs(value) < MINIMUM_NORMAL)
|
|
77
|
+
return value > 0 === increase ? Math.sign(value) * MINIMUM_NORMAL : 0;
|
|
78
|
+
/** Start with nearest rounding and step outward only if it moved the bound inward. */
|
|
79
|
+
let rounded = Math.fround(value);
|
|
80
|
+
if (Number.isFinite(rounded) && (increase ? rounded < value : rounded > value))
|
|
81
|
+
rounded = nextFloat32(rounded, increase);
|
|
82
|
+
if (!Number.isFinite(rounded)) throw new Error('BVH bounds exceed finite float32 range');
|
|
83
|
+
return rounded;
|
|
84
|
+
}
|