@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
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import {type BoundKernel, createBoundKernel} from '../gpu-core/utils/bound-kernel';
|
|
6
6
|
import {Buffer, type Device} from '@luma.gl/core';
|
|
7
|
+
import {VEHICLE_STRIDE} from './rigid-body-vehicle';
|
|
7
8
|
|
|
8
9
|
/** One template-sized GPU reset image; no per-instance snapshots or pose readback. */
|
|
9
10
|
export function makeEnsembleReset(
|
|
@@ -13,10 +14,28 @@ export function makeEnsembleReset(
|
|
|
13
14
|
bodyCount: number,
|
|
14
15
|
bodiesPerInstance: number,
|
|
15
16
|
collidersPerInstance: number,
|
|
16
|
-
maximumPairs: number
|
|
17
|
+
maximumPairs: number,
|
|
18
|
+
vehiclesPerInstance: number,
|
|
19
|
+
terrainSlots: ReadonlySet<number>,
|
|
20
|
+
pairsPerInstance?: number
|
|
17
21
|
) {
|
|
18
22
|
const find = (name: string) => buffers.find(buffer => buffer.id === `${id}-${name}`)!;
|
|
19
|
-
|
|
23
|
+
// A streamed collider row contains a private atlas address, revision and placement.
|
|
24
|
+
// Snapshot only the template rows that reset with the body state.
|
|
25
|
+
const colliderRanges: {name: string; offset: number; size: number; stride: number}[] = [];
|
|
26
|
+
let first = 0;
|
|
27
|
+
for (let collider = 0; collider <= collidersPerInstance; collider++) {
|
|
28
|
+
if (collider < collidersPerInstance && !terrainSlots.has(collider)) continue;
|
|
29
|
+
if (first < collider)
|
|
30
|
+
colliderRanges.push({
|
|
31
|
+
name: 'bodies',
|
|
32
|
+
offset: bodyCount * 48 + first * 96,
|
|
33
|
+
size: (collider - first) * 96,
|
|
34
|
+
stride: collidersPerInstance * 96
|
|
35
|
+
});
|
|
36
|
+
first = collider + 1;
|
|
37
|
+
}
|
|
38
|
+
const plans: {name: string; offset: number; size: number; stride?: number}[] = [
|
|
20
39
|
...['positions', 'orientations', 'velocities', 'angular-velocities', 'sleep'].map(name => ({
|
|
21
40
|
name,
|
|
22
41
|
offset: 0,
|
|
@@ -24,9 +43,12 @@ export function makeEnsembleReset(
|
|
|
24
43
|
})),
|
|
25
44
|
{name: 'targets', offset: 0, size: bodiesPerInstance * 32},
|
|
26
45
|
{name: 'bodies', offset: 0, size: bodiesPerInstance * 48},
|
|
27
|
-
|
|
46
|
+
...colliderRanges,
|
|
28
47
|
{name: 'object-attributes', offset: 0, size: collidersPerInstance * 4},
|
|
29
|
-
{name: 'pose-metadata', offset: 0, size: bodiesPerInstance * 48}
|
|
48
|
+
{name: 'pose-metadata', offset: 0, size: bodiesPerInstance * 48},
|
|
49
|
+
...(vehiclesPerInstance
|
|
50
|
+
? [{name: 'vehicle', offset: 0, size: vehiclesPerInstance * VEHICLE_STRIDE}]
|
|
51
|
+
: [])
|
|
30
52
|
].filter(plan => find(plan.name));
|
|
31
53
|
const snapshots: Buffer[] = [];
|
|
32
54
|
const settings = device.createBuffer({byteLength: 32, usage: Buffer.UNIFORM | Buffer.COPY_DST});
|
|
@@ -48,6 +70,7 @@ export function makeEnsembleReset(
|
|
|
48
70
|
}
|
|
49
71
|
device.submit(encoder.finish());
|
|
50
72
|
const history = find('contact-history');
|
|
73
|
+
const vehicle = vehiclesPerInstance ? find('vehicle') : null;
|
|
51
74
|
computation = createBoundKernel(device, {
|
|
52
75
|
source: /* wgsl */ `
|
|
53
76
|
@group(0) @binding(0) var<uniform> settings:Settings;
|
|
@@ -58,8 +81,9 @@ struct Settings {selection:vec4u, shift:vec4f}
|
|
|
58
81
|
@group(0) @binding(3) var<storage,read_write> manifolds:array<u32>;
|
|
59
82
|
@group(0) @binding(4) var<storage,read_write> targets:array<u32>;
|
|
60
83
|
${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;' : ''}
|
|
84
|
+
${vehicle ? '@group(0) @binding(7) var<storage,read_write> vehicle:array<u32>;' : ''}
|
|
61
85
|
@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
62
|
-
let index=invocation.x;let selection=settings.selection;
|
|
86
|
+
let index=invocation.x+invocation.y*4194240u;let selection=settings.selection;
|
|
63
87
|
if(index==0u){targets[${bodyCount * 8 + 8 + maximumPairs * 2}u+selection.x/${bodiesPerInstance}u]=0u;}
|
|
64
88
|
if(index<${bodiesPerInstance}u){
|
|
65
89
|
let body=selection.x+index;positions[body]=vec4f(positions[body].xyz-settings.shift.xyz,positions[body].w);
|
|
@@ -67,23 +91,41 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
67
91
|
}
|
|
68
92
|
if(index<${collidersPerInstance}u){
|
|
69
93
|
let collider=selection.y+index;let address=${bodyCount * 12}u+collider*24u+7u;
|
|
94
|
+
${terrainSlots.size ? 'if(!(bitcast<f32>(metadata[address+14u])<0.0&&metadata[address+15u]!=0u)){' : ''}
|
|
70
95
|
metadata[address]=bitcast<u32>(bitcast<f32>(metadata[address])+f32(selection.x));
|
|
96
|
+
${terrainSlots.size ? '}' : ''}
|
|
71
97
|
attributes[collider]=(attributes[collider]&0xffff0000u)|((attributes[collider]&0xffffu)+selection.x);
|
|
72
98
|
}
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
${
|
|
100
|
+
vehicle
|
|
101
|
+
? `if(index<${vehiclesPerInstance}u){
|
|
102
|
+
let address=(selection.x/${bodiesPerInstance}u*${vehiclesPerInstance}u+index)*${VEHICLE_STRIDE / 4}u;
|
|
103
|
+
vehicle[address+12u]+=selection.x;
|
|
104
|
+
vehicle[address+13u]+=selection.y;
|
|
105
|
+
}`
|
|
106
|
+
: ''
|
|
107
|
+
}
|
|
108
|
+
if(index>=${pairsPerInstance ?? maximumPairs}u){return;}
|
|
109
|
+
${
|
|
110
|
+
pairsPerInstance
|
|
111
|
+
? `let pair=(selection.x/${bodiesPerInstance}u)*${pairsPerInstance}u+index;`
|
|
112
|
+
: `let pair=index;
|
|
113
|
+
let key=targets[${bodyCount * 8 + 8}u+pair*2u];
|
|
75
114
|
if(key==0u||key==0xffffffffu){return;}
|
|
76
|
-
let
|
|
77
|
-
if(collider<selection.y||collider>=selection.y+${collidersPerInstance}u){return;}
|
|
115
|
+
let collider=manifolds[pair*104u+97u];
|
|
116
|
+
if(collider<selection.y||collider>=selection.y+${collidersPerInstance}u){return;}`
|
|
117
|
+
}
|
|
118
|
+
let address=pair*104u;
|
|
78
119
|
for(var word=0u;word<104u;word++){manifolds[address+word]=0u;}
|
|
79
|
-
targets[${bodyCount * 8 + 8}u+
|
|
80
|
-
targets[${bodyCount * 8 + 9}u+
|
|
81
|
-
${history ? 'for(var word=0u;word<4u;word++){history[
|
|
120
|
+
targets[${bodyCount * 8 + 8}u+pair*2u]=${pairsPerInstance ? '0u' : '0xffffffffu'};
|
|
121
|
+
targets[${bodyCount * 8 + 9}u+pair*2u]=0u;
|
|
122
|
+
${history ? 'for(var word=0u;word<4u;word++){history[pair*4u+word]=0u;}' : ''}
|
|
82
123
|
}`,
|
|
83
124
|
shaderLayout: {
|
|
84
125
|
bindings: [
|
|
85
126
|
{name: 'settings', group: 0, location: 0, type: 'uniform'},
|
|
86
127
|
{name: 'positions', group: 0, location: 6, type: 'storage'},
|
|
128
|
+
...(vehicle ? [{name: 'vehicle', group: 0, location: 7, type: 'storage' as const}] : []),
|
|
87
129
|
...[
|
|
88
130
|
'metadata',
|
|
89
131
|
'attributes',
|
|
@@ -100,7 +142,8 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
100
142
|
attributes: find('object-attributes'),
|
|
101
143
|
manifolds: find('manifolds'),
|
|
102
144
|
targets: find('targets'),
|
|
103
|
-
...(history ? {history} : {})
|
|
145
|
+
...(history ? {history} : {}),
|
|
146
|
+
...(vehicle ? {vehicle} : {})
|
|
104
147
|
}
|
|
105
148
|
});
|
|
106
149
|
} catch (error) {
|
|
@@ -121,13 +164,22 @@ ${history ? '@group(0) @binding(5) var<storage,read_write> history:array<u32>;'
|
|
|
121
164
|
encoder.copyBufferToBuffer({
|
|
122
165
|
sourceBuffer: snapshots[index],
|
|
123
166
|
destinationBuffer: find(plan.name),
|
|
124
|
-
destinationOffset: plan.offset + instance * plan.size,
|
|
167
|
+
destinationOffset: plan.offset + instance * (plan.stride ?? plan.size),
|
|
125
168
|
size: plan.size
|
|
126
169
|
});
|
|
127
170
|
const pass = encoder.beginComputePass();
|
|
171
|
+
const groups = Math.ceil(
|
|
172
|
+
Math.max(
|
|
173
|
+
pairsPerInstance ?? maximumPairs,
|
|
174
|
+
collidersPerInstance,
|
|
175
|
+
bodiesPerInstance,
|
|
176
|
+
vehiclesPerInstance
|
|
177
|
+
) / 64
|
|
178
|
+
);
|
|
128
179
|
computation!.kernel.dispatch(pass, {
|
|
129
180
|
bindings: computation!.bindings,
|
|
130
|
-
x: Math.
|
|
181
|
+
x: Math.min(65535, groups),
|
|
182
|
+
y: Math.ceil(groups / 65535)
|
|
131
183
|
});
|
|
132
184
|
pass.end();
|
|
133
185
|
device.submit(encoder.finish());
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
GPUCommandGraphComputeExecutable
|
|
17
17
|
} from '../gpu-core/gpu-command-graph';
|
|
18
18
|
|
|
19
|
+
/** Schedule only enabled, awake instances that have no latched local failure. */
|
|
19
20
|
export function getEnsembleShader(
|
|
20
21
|
bodyCount: number,
|
|
21
22
|
bodiesPerInstance?: number,
|
|
@@ -54,7 +55,7 @@ fn scheduledCollider(index:u32)->u32{return atomicLoad(&ensemble[INSTANCE_QUEUE+
|
|
|
54
55
|
let instance=invocation.x;if(instance>=INSTANCE_COUNT){return;}let offset=16u+instance*8u;
|
|
55
56
|
// Controls must remain pending across disabled steps after the shared wake flag is consumed.
|
|
56
57
|
if(atomicLoad(&ensemble[1])!=0u){atomicStore(&ensemble[offset+6u],1u);}
|
|
57
|
-
if(atomicLoad(&ensemble[offset])==0u){return;}
|
|
58
|
+
if(atomicLoad(&ensemble[offset])==0u||atomicLoad(&ensemble[offset+7u])!=0u){return;}
|
|
58
59
|
if(atomicLoad(&ensemble[offset+5u])!=0u||atomicLoad(&ensemble[offset+6u])!=0u||atomicLoad(&ensemble[1])!=0u){
|
|
59
60
|
atomicStore(&ensemble[offset+1u],1u);atomicStore(&ensemble[offset+6u],0u);
|
|
60
61
|
}
|
|
@@ -94,21 +95,26 @@ export function addEnsembleStatus<Parameters>(
|
|
|
94
95
|
bodies: {buffer: Buffer; resource: GraphBufferHandle},
|
|
95
96
|
sleepStates: {buffer: Buffer; resource: GraphBufferHandle},
|
|
96
97
|
ensemble: {buffer: Buffer; resource: GraphBufferHandle},
|
|
97
|
-
statistics: {buffer: Buffer; resource: GraphBufferHandle}
|
|
98
|
+
statistics: {buffer: Buffer; resource: GraphBufferHandle},
|
|
99
|
+
failureSource?: {buffer: Buffer; resource: GraphBufferHandle; wordOffset: number}
|
|
98
100
|
) {
|
|
99
101
|
const properties = {
|
|
100
102
|
id: `${id}-ensemble-status`,
|
|
101
103
|
source: `
|
|
102
104
|
@group(0) @binding(0) var<storage,read_write> ensemble:array<u32>;
|
|
103
105
|
@group(0) @binding(1) var<storage,read> statistics:array<u32>;
|
|
106
|
+
${failureSource ? '@group(0) @binding(4) var<storage,read> targets:array<u32>;' : ''}
|
|
104
107
|
struct Body {inertia:vec4f,inertiaOrientation:vec4f,motion:vec4f}
|
|
105
108
|
@group(0) @binding(2) var<storage,read> bodies:array<Body>;
|
|
106
109
|
@group(0) @binding(3) var<storage,read> sleepStates:array<vec4f>;
|
|
107
110
|
@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
108
111
|
let instance=invocation.x;if(instance>=${instances}u){return;}
|
|
109
|
-
let offset=16u+instance*8u;let
|
|
110
|
-
ensemble[offset+4u]=select(0u,1u,
|
|
112
|
+
let offset=16u+instance*8u;let sharedFault=statistics[1]!=0u||statistics[15]!=0u;
|
|
113
|
+
ensemble[offset+4u]=select(0u,1u,sharedFault);
|
|
111
114
|
if(ensemble[offset+1u]==0u){return;}
|
|
115
|
+
${failureSource ? `let localFailure=targets[${failureSource.wordOffset}u+instance];` : 'let localFailure=0u;'}
|
|
116
|
+
if(localFailure!=0u&&!sharedFault){ensemble[offset+7u]=localFailure;}
|
|
117
|
+
let failed=sharedFault||localFailure!=0u;
|
|
112
118
|
var awake=failed;
|
|
113
119
|
for(var local=0u;local<${bodiesPerInstance}u;local++){
|
|
114
120
|
let body=instance*${bodiesPerInstance}u+local;let motion=bodies[body].motion.x;
|
|
@@ -123,14 +129,18 @@ struct Body {inertia:vec4f,inertiaOrientation:vec4f,motion:vec4f}
|
|
|
123
129
|
{name: 'ensemble', group: 0, location: 0, type: 'storage' as const},
|
|
124
130
|
{name: 'statistics', group: 0, location: 1, type: 'read-only-storage' as const},
|
|
125
131
|
{name: 'bodies', group: 0, location: 2, type: 'read-only-storage' as const},
|
|
126
|
-
{name: 'sleepStates', group: 0, location: 3, type: 'read-only-storage' as const}
|
|
132
|
+
{name: 'sleepStates', group: 0, location: 3, type: 'read-only-storage' as const},
|
|
133
|
+
...(failureSource
|
|
134
|
+
? [{name: 'targets', group: 0, location: 4, type: 'read-only-storage' as const}]
|
|
135
|
+
: [])
|
|
127
136
|
]
|
|
128
137
|
},
|
|
129
138
|
bindings: {
|
|
130
139
|
ensemble: ensemble.buffer,
|
|
131
140
|
statistics: statistics.buffer,
|
|
132
141
|
bodies: bodies.buffer,
|
|
133
|
-
sleepStates: sleepStates.buffer
|
|
142
|
+
sleepStates: sleepStates.buffer,
|
|
143
|
+
...(failureSource ? {targets: failureSource.buffer} : {})
|
|
134
144
|
}
|
|
135
145
|
};
|
|
136
146
|
const executable = (computation: BoundKernel): GPUCommandGraphComputeExecutable<Parameters> => ({
|
|
@@ -149,7 +159,8 @@ struct Body {inertia:vec4f,inertiaOrientation:vec4f,motion:vec4f}
|
|
|
149
159
|
{buffer: ensemble.resource, usage: 'storage-read-write'},
|
|
150
160
|
{buffer: statistics.resource, usage: 'storage-read'},
|
|
151
161
|
{buffer: bodies.resource, usage: 'storage-read'},
|
|
152
|
-
{buffer: sleepStates.resource, usage: 'storage-read'}
|
|
162
|
+
{buffer: sleepStates.resource, usage: 'storage-read'},
|
|
163
|
+
...(failureSource ? [{buffer: failureSource.resource, usage: 'storage-read' as const}] : [])
|
|
153
164
|
],
|
|
154
165
|
compile: ({device}) => executable(createBoundKernel(device, properties)),
|
|
155
166
|
compileAsync: async ({device}) => executable(await createBoundKernelAsync(device, properties))
|
|
@@ -10,12 +10,13 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import {Buffer} from '@luma.gl/core';
|
|
12
12
|
|
|
13
|
+
import {VEHICLE_STRIDE} from './rigid-body-vehicle';
|
|
13
14
|
import {getEnsembleContactLayout} from './rigid-body-ensemble-layout';
|
|
14
15
|
import type {GPUCommandGraph, GraphBufferHandle} from '../gpu-core/gpu-command-graph';
|
|
15
16
|
|
|
16
17
|
type Resource = {buffer: Buffer; resource: GraphBufferHandle};
|
|
17
18
|
|
|
18
|
-
/** Snapshot active bodies and journal contact writes
|
|
19
|
+
/** Snapshot active bodies and journal contact writes and restore failed contact partitions or an entire failed shared step. */
|
|
19
20
|
export function addEnsembleCheckpoint<GraphParameters>(
|
|
20
21
|
graph: GPUCommandGraph<GraphParameters>,
|
|
21
22
|
id: string,
|
|
@@ -25,7 +26,9 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
25
26
|
manifolds: Resource,
|
|
26
27
|
bodiesPerInstance: number,
|
|
27
28
|
maximumPairs: number,
|
|
28
|
-
allocate: (name: string, byteLength: number) => Buffer
|
|
29
|
+
allocate: (name: string, byteLength: number) => Buffer,
|
|
30
|
+
vehicles?: {state: Resource; vehiclesPerInstance: number},
|
|
31
|
+
pairsPerInstance?: number
|
|
29
32
|
) {
|
|
30
33
|
const bodyCount = states[0].buffer.byteLength / 16;
|
|
31
34
|
const instances = bodyCount / bodiesPerInstance;
|
|
@@ -38,8 +41,9 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
38
41
|
savedLinkOffset,
|
|
39
42
|
savedHeadOffset,
|
|
40
43
|
savedHeaderOffset,
|
|
41
|
-
savedManifoldOffset
|
|
42
|
-
|
|
44
|
+
savedManifoldOffset,
|
|
45
|
+
failureOffset
|
|
46
|
+
} = getEnsembleContactLayout(bodyCount, instances, maximumPairs, Boolean(pairsPerInstance));
|
|
43
47
|
const importAllocation = (name: string, byteLength: number): Resource => {
|
|
44
48
|
const buffer = allocate(name, byteLength);
|
|
45
49
|
return {
|
|
@@ -53,6 +57,12 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
53
57
|
const snapshots = states
|
|
54
58
|
.slice(0, 5)
|
|
55
59
|
.map((state, index) => importAllocation(`checkpoint-${index}`, state.buffer.byteLength));
|
|
60
|
+
const vehicleSnapshot =
|
|
61
|
+
vehicles &&
|
|
62
|
+
importAllocation(
|
|
63
|
+
'checkpoint-vehicles',
|
|
64
|
+
instances * vehicles.vehiclesPerInstance * VEHICLE_STRIDE
|
|
65
|
+
);
|
|
56
66
|
const validity = importAllocation('state-validity', bodyCount * 4);
|
|
57
67
|
type Input = Resource & {name: string; writable?: boolean; atomic?: boolean};
|
|
58
68
|
const addCompute = (name: string, inputs: Input[], source: string, indirect = false) => {
|
|
@@ -96,8 +106,43 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
96
106
|
compileAsync: async () => executable(await createBoundKernelAsync(graph.device, properties))
|
|
97
107
|
});
|
|
98
108
|
};
|
|
109
|
+
/** Shared failure is sticky; local overflow applies only to the attempted instance. */
|
|
110
|
+
const sharedFailure = 'statistics[1]!=0u||statistics[15]!=0u';
|
|
111
|
+
/** Fast exit before visiting journal entries when every instance accepted the step. */
|
|
112
|
+
const anyFailure = pairsPerInstance
|
|
113
|
+
? `${sharedFailure}||targets[${failureOffset + instances}u]!=0u`
|
|
114
|
+
: sharedFailure;
|
|
115
|
+
/** Read the local failure word through the already allocated targets buffer. */
|
|
116
|
+
const localFailure = (instance: string) => `targets[${failureOffset}u+${instance}]!=0u`;
|
|
117
|
+
/** Bind local failure words only on recovery passes that need an additional binding. */
|
|
118
|
+
const localFailureInput = pairsPerInstance ? [{...targets, name: 'targets'}] : [];
|
|
99
119
|
const bodyAddress = `let work=invocation.x;if(work>=ensemble[0]*${bodiesPerInstance}u){return;}
|
|
100
120
|
let body=ensemble[${16 + instances * 8}u+work/${bodiesPerInstance}u]*${bodiesPerInstance}u+work%${bodiesPerInstance}u;`;
|
|
121
|
+
/** Journal or restore contiguous vehicle rows for the scheduled instances. */
|
|
122
|
+
const copyVehicleState = (restore: boolean) => {
|
|
123
|
+
if (!vehicles || !vehicleSnapshot) return;
|
|
124
|
+
const count = vehicles.vehiclesPerInstance;
|
|
125
|
+
addCompute(
|
|
126
|
+
restore ? 'rollback-vehicles' : 'checkpoint-vehicles',
|
|
127
|
+
[
|
|
128
|
+
{...vehicles.state, name: 'vehicle', writable: restore},
|
|
129
|
+
{...vehicleSnapshot, name: 'snapshot', writable: !restore},
|
|
130
|
+
{...ensemble, name: 'ensemble'},
|
|
131
|
+
...(restore ? [{...statistics, name: 'statistics'}, ...localFailureInput] : [])
|
|
132
|
+
],
|
|
133
|
+
`@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
134
|
+
${restore ? `if(!(${anyFailure})){return;}` : ''}
|
|
135
|
+
let work=invocation.x;if(work>=ensemble[0]*${count}u){return;}
|
|
136
|
+
let instance=ensemble[${16 + instances * 8}u+work/${count}u];
|
|
137
|
+
${restore && pairsPerInstance ? `if(!(${sharedFailure})&&!(${localFailure('instance')})){return;}` : ''}
|
|
138
|
+
let row=(instance*${count}u+work%${count}u)*${VEHICLE_STRIDE / 4}u;
|
|
139
|
+
for(var word=0u;word<${VEHICLE_STRIDE / 4}u;word++){
|
|
140
|
+
${restore ? 'vehicle[row+word]=snapshot[row+word];' : 'snapshot[row+word]=vehicle[row+word];'}
|
|
141
|
+
}
|
|
142
|
+
}`,
|
|
143
|
+
true
|
|
144
|
+
);
|
|
145
|
+
};
|
|
101
146
|
const save = () => {
|
|
102
147
|
addCompute(
|
|
103
148
|
'checkpoint-metadata',
|
|
@@ -117,6 +162,7 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
117
162
|
}
|
|
118
163
|
}`
|
|
119
164
|
);
|
|
165
|
+
copyVehicleState(false);
|
|
120
166
|
states.slice(0, 5).forEach((state, index) =>
|
|
121
167
|
addCompute(
|
|
122
168
|
`checkpoint-${index}`,
|
|
@@ -144,10 +190,11 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
144
190
|
],
|
|
145
191
|
`
|
|
146
192
|
@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
147
|
-
if(
|
|
193
|
+
if(!(${anyFailure})){return;}
|
|
148
194
|
let count=targets[${bodyCount * 8 + 5}u];
|
|
149
195
|
for(var work=invocation.x;work<count*104u;work+=64u){
|
|
150
196
|
let pair=targets[${journalOffset}u+work/104u];let word=work%104u;
|
|
197
|
+
${pairsPerInstance ? `if(!(${sharedFailure})&&!(${localFailure(`pair/${pairsPerInstance}u`)})){continue;}` : ''}
|
|
151
198
|
manifolds[pair*104u+word]=targets[${savedManifoldOffset}u+pair*104u+word];
|
|
152
199
|
}
|
|
153
200
|
}`
|
|
@@ -161,22 +208,24 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
161
208
|
],
|
|
162
209
|
`
|
|
163
210
|
@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
164
|
-
if(
|
|
211
|
+
if(!(${anyFailure})){return;}
|
|
165
212
|
let count=targets[${bodyCount * 8 + 5}u];
|
|
166
213
|
for(var index=invocation.x;index<count;index+=64u){let pair=targets[${journalOffset}u+index];
|
|
214
|
+
${pairsPerInstance ? `if(!(${sharedFailure})&&!(${localFailure(`pair/${pairsPerInstance}u`)})){continue;}` : ''}
|
|
167
215
|
targets[${bodyCount * 8 + 8}u+pair*2u]=targets[${savedKeyOffset}u+pair*2u];
|
|
168
216
|
targets[${bodyCount * 8 + 9}u+pair*2u]=targets[${savedKeyOffset + 1}u+pair*2u];
|
|
169
217
|
targets[${linkOffset}u+pair]=targets[${savedLinkOffset}u+pair];
|
|
170
218
|
}
|
|
171
219
|
for(var work=invocation.x;work<ensemble[0];work+=64u){let instance=ensemble[${16 + instances * 8}u+work];
|
|
220
|
+
${pairsPerInstance ? `if(!(${sharedFailure})&&!(${localFailure('instance')})){continue;}` : ''}
|
|
172
221
|
targets[${headOffset}u+instance]=targets[${savedHeadOffset}u+instance];
|
|
173
222
|
targets[${headOffset + instances}u+instance]=targets[${savedHeadOffset + instances}u+instance];
|
|
174
223
|
}
|
|
175
|
-
storageBarrier();
|
|
176
224
|
// Preserve the attempted step's journal list and counters so the next prepare can clear its marks.
|
|
177
|
-
if(invocation.x<5u){targets[${bodyCount * 8}u+invocation.x]=targets[${savedHeaderOffset}u+invocation.x];}
|
|
225
|
+
if((${sharedFailure})&&invocation.x<5u){targets[${bodyCount * 8}u+invocation.x]=targets[${savedHeaderOffset}u+invocation.x];}
|
|
178
226
|
}`
|
|
179
227
|
);
|
|
228
|
+
copyVehicleState(true);
|
|
180
229
|
states.slice(0, 5).forEach((state, index) =>
|
|
181
230
|
addCompute(
|
|
182
231
|
`rollback-${index}`,
|
|
@@ -184,11 +233,13 @@ export function addEnsembleCheckpoint<GraphParameters>(
|
|
|
184
233
|
{...state, name: 'state', writable: true},
|
|
185
234
|
{...snapshots[index], name: 'snapshot'},
|
|
186
235
|
{...statistics, name: 'statistics'},
|
|
187
|
-
{...ensemble, name: 'ensemble'}
|
|
236
|
+
{...ensemble, name: 'ensemble'},
|
|
237
|
+
...localFailureInput
|
|
188
238
|
],
|
|
189
239
|
`@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) invocation:vec3u){
|
|
190
|
-
if(
|
|
240
|
+
if(!(${anyFailure})){return;}
|
|
191
241
|
${bodyAddress}
|
|
242
|
+
${pairsPerInstance ? `if(!(${sharedFailure})&&!(${localFailure(`body/${bodiesPerInstance}u`)})){return;}` : ''}
|
|
192
243
|
for(var word=0u;word<4u;word++){state[body*4u+word]=snapshot[body*4u+word];}
|
|
193
244
|
}`,
|
|
194
245
|
true
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Buffer, type BindingDeclaration} from '@luma.gl/core';
|
|
6
|
+
import type {
|
|
7
|
+
GPUCommandGraph,
|
|
8
|
+
GPUCommandGraphComputeExecutable,
|
|
9
|
+
GraphBufferHandle
|
|
10
|
+
} from '../gpu-core/gpu-command-graph';
|
|
11
|
+
import {
|
|
12
|
+
createBoundKernel,
|
|
13
|
+
createBoundKernelAsync,
|
|
14
|
+
type BoundKernel
|
|
15
|
+
} from '../gpu-core/utils/bound-kernel';
|
|
16
|
+
|
|
17
|
+
/** Stable slot tiles also fit default WebGPU workgroup limits. */
|
|
18
|
+
const EVENT_WORKGROUP_SIZE = 64;
|
|
19
|
+
|
|
20
|
+
/** Storage binding shared by the three large-ring publication passes. */
|
|
21
|
+
const EVENT_WORK_LOCATION = 29;
|
|
22
|
+
|
|
23
|
+
/** Optional per-stage visibility for an imported simulation buffer. */
|
|
24
|
+
export type RigidBodyEventBinding = {
|
|
25
|
+
/** WGSL variable name. */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Binding number in group zero. */
|
|
28
|
+
location: number;
|
|
29
|
+
/** Caller-owned simulation resource. */
|
|
30
|
+
resource: GraphBufferHandle;
|
|
31
|
+
/** Whether the underlying declaration is read-only storage. */
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Configure a publication ring and the resources each callback uses. */
|
|
36
|
+
type EventCompactionOptions = {
|
|
37
|
+
/** Prefix for the graph nodes and temporary storage. */
|
|
38
|
+
id: string;
|
|
39
|
+
/** Number of stable pair or trigger slots scanned in a step. */
|
|
40
|
+
rowCount: number;
|
|
41
|
+
/** Maximum number of retained events. */
|
|
42
|
+
capacity: number;
|
|
43
|
+
/** WGSL ring variable shared by the reservation helpers. */
|
|
44
|
+
ring: string;
|
|
45
|
+
/** WGSL declaring eventClassify, eventCount, eventPublish and eventCommit. */
|
|
46
|
+
source: string;
|
|
47
|
+
/** Resources used to determine transition flags. */
|
|
48
|
+
classify: readonly RigidBodyEventBinding[];
|
|
49
|
+
/** Resources read when deciding whether a step committed. */
|
|
50
|
+
commit: readonly RigidBodyEventBinding[];
|
|
51
|
+
/** Resources accessed to publish payloads and update history. */
|
|
52
|
+
publish: readonly RigidBodyEventBinding[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Compact ordered transitions and publish a single coherent step into an existing ring. */
|
|
56
|
+
export function addRigidBodyEventCompaction<Parameters>(
|
|
57
|
+
graph: GPUCommandGraph<Parameters>,
|
|
58
|
+
options: EventCompactionOptions
|
|
59
|
+
): void {
|
|
60
|
+
/** A single workgroup can classify and publish without external scratch. */
|
|
61
|
+
const workgroups = Math.max(1, Math.ceil(options.rowCount / EVENT_WORKGROUP_SIZE));
|
|
62
|
+
/** The shared WGSL preserves identical event sequence and overflow semantics in both paths. */
|
|
63
|
+
const source = options.source + getEventCompactionShader(options, workgroups);
|
|
64
|
+
/** Attach one explicit graph stage and resolve aliased scratch at encode time. */
|
|
65
|
+
function addStage(
|
|
66
|
+
entryPoint: string,
|
|
67
|
+
description: string,
|
|
68
|
+
bindings: readonly RigidBodyEventBinding[],
|
|
69
|
+
count: number
|
|
70
|
+
): void {
|
|
71
|
+
/** A buffer may serve several callbacks in the fused entry point. */
|
|
72
|
+
const unique = [...new Map(bindings.map(binding => [binding.name, binding])).values()];
|
|
73
|
+
/** Bind resources without declaring unused storage at this entry point. */
|
|
74
|
+
const declarations = unique.map(
|
|
75
|
+
({name, location, readOnly}): BindingDeclaration => ({
|
|
76
|
+
name,
|
|
77
|
+
location,
|
|
78
|
+
group: 0,
|
|
79
|
+
type: readOnly ? 'read-only-storage' : 'storage'
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
/** The same bindings serve sync and async pipeline compilation. */
|
|
83
|
+
const properties = {
|
|
84
|
+
id: `${options.id}-${entryPoint}`,
|
|
85
|
+
entryPoint,
|
|
86
|
+
source,
|
|
87
|
+
shaderLayout: {bindings: declarations}
|
|
88
|
+
};
|
|
89
|
+
/** Connect compiler-owned scratch and source views for this dispatch. */
|
|
90
|
+
const executable = (
|
|
91
|
+
computation: BoundKernel
|
|
92
|
+
): GPUCommandGraphComputeExecutable<Parameters> => ({
|
|
93
|
+
encode: ({computePass, getBuffer}) => {
|
|
94
|
+
for (const binding of unique)
|
|
95
|
+
computation.bindings[binding.name] = getBuffer(binding.resource);
|
|
96
|
+
computation.kernel.dispatch(computePass, {bindings: computation.bindings, x: count});
|
|
97
|
+
},
|
|
98
|
+
destroy: () => computation.kernel.destroy()
|
|
99
|
+
});
|
|
100
|
+
graph.addComputePass({
|
|
101
|
+
id: properties.id,
|
|
102
|
+
description,
|
|
103
|
+
resources: unique.map(binding => ({
|
|
104
|
+
buffer: binding.resource,
|
|
105
|
+
usage: binding.readOnly ? 'storage-read' : 'storage-read-write'
|
|
106
|
+
})),
|
|
107
|
+
compile: () => executable(createBoundKernel(graph.device, properties)),
|
|
108
|
+
compileAsync: async () => executable(await createBoundKernelAsync(graph.device, properties))
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (workgroups === 1) {
|
|
113
|
+
addStage(
|
|
114
|
+
'publishEventTile',
|
|
115
|
+
'Publish ordered events in one workgroup.',
|
|
116
|
+
[...options.classify, ...options.commit, ...options.publish],
|
|
117
|
+
1
|
|
118
|
+
);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** One flag/offset word per row, one total/offset per tile, and one reservation header. */
|
|
123
|
+
const scratch = graph.createTransientBuffer({
|
|
124
|
+
id: `${options.id}-compaction`,
|
|
125
|
+
usage: Buffer.STORAGE,
|
|
126
|
+
byteLength: (4 + options.rowCount + workgroups) * 4
|
|
127
|
+
});
|
|
128
|
+
/** Scratch is graph-owned and never enters snapshots or the public event ring layout. */
|
|
129
|
+
const work = {name: 'eventWork', location: EVENT_WORK_LOCATION, resource: scratch};
|
|
130
|
+
addStage(
|
|
131
|
+
'classifyEventTiles',
|
|
132
|
+
'Classify transitions and compact one tile per workgroup.',
|
|
133
|
+
[...options.classify, work],
|
|
134
|
+
workgroups
|
|
135
|
+
);
|
|
136
|
+
addStage(
|
|
137
|
+
'reserveEventTiles',
|
|
138
|
+
'Reserve ordered ring positions from tile counts.',
|
|
139
|
+
[...options.commit, work],
|
|
140
|
+
1
|
|
141
|
+
);
|
|
142
|
+
addStage(
|
|
143
|
+
'publishEventTiles',
|
|
144
|
+
'Write retained event records and advance transition history.',
|
|
145
|
+
[...options.publish, work],
|
|
146
|
+
workgroups
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Emit a stable workgroup scan and bounded ring reservation for the two event payloads. */
|
|
151
|
+
function getEventCompactionShader(
|
|
152
|
+
{ring, capacity, rowCount}: EventCompactionOptions,
|
|
153
|
+
workgroups: number
|
|
154
|
+
): string {
|
|
155
|
+
return /* wgsl */ `
|
|
156
|
+
const EVENT_ROWS:u32=${rowCount}u;
|
|
157
|
+
const EVENT_CAPACITY:u32=${capacity}u;
|
|
158
|
+
const EVENT_TILE_SIZE:u32=${EVENT_WORKGROUP_SIZE}u;
|
|
159
|
+
var<workgroup> eventPrefix:array<u32,${EVENT_WORKGROUP_SIZE}>;
|
|
160
|
+
|
|
161
|
+
// Each row emits at most two records, in the order chosen by its publisher.
|
|
162
|
+
fn scanEvents(lane:u32,count:u32)->u32{
|
|
163
|
+
eventPrefix[lane]=count;
|
|
164
|
+
workgroupBarrier();
|
|
165
|
+
for(var stride=1u;stride<EVENT_TILE_SIZE;stride*=2u){
|
|
166
|
+
var prior=0u;
|
|
167
|
+
if(lane>=stride){prior=eventPrefix[lane-stride];}
|
|
168
|
+
workgroupBarrier();
|
|
169
|
+
eventPrefix[lane]+=prior;
|
|
170
|
+
workgroupBarrier();
|
|
171
|
+
}
|
|
172
|
+
return eventPrefix[lane]-count;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Reserve from the old sequence but keep only the newest records that fit the ring.
|
|
176
|
+
// x = base sequence, y = accepted count, z = step (zero for an uncommitted tick).
|
|
177
|
+
fn reserveEvents(total:u32)->vec3u{
|
|
178
|
+
if(!eventCommit()){return vec3u(0);}
|
|
179
|
+
if(${ring}.step==0xffffffffu){${ring}.saturated=1u;return vec3u(0);}
|
|
180
|
+
let base=${ring}.sequence;
|
|
181
|
+
let accepted=min(total,0xffffffffu-base);
|
|
182
|
+
if(accepted<total){${ring}.saturated=1u;}
|
|
183
|
+
${ring}.sequence=base+accepted;
|
|
184
|
+
${ring}.step++;
|
|
185
|
+
return vec3u(base,accepted,${ring}.step);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
fn retainedEventSequence(reservation:vec3u,offset:u32)->u32{
|
|
189
|
+
if(offset>=reservation.y||reservation.y-offset>EVENT_CAPACITY){return 0u;}
|
|
190
|
+
return reservation.x+offset+1u;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
${
|
|
194
|
+
workgroups === 1
|
|
195
|
+
? /* wgsl */ `
|
|
196
|
+
var<workgroup> eventReservation:vec3u;
|
|
197
|
+
@compute @workgroup_size(${EVENT_WORKGROUP_SIZE}) fn publishEventTile(
|
|
198
|
+
@builtin(local_invocation_index) lane:u32
|
|
199
|
+
){
|
|
200
|
+
var flags=0u;
|
|
201
|
+
if(lane<EVENT_ROWS){flags=eventClassify(lane);}
|
|
202
|
+
let offset=scanEvents(lane,eventCount(flags));
|
|
203
|
+
if(lane==0u){eventReservation=reserveEvents(eventPrefix[EVENT_TILE_SIZE-1u]);}
|
|
204
|
+
workgroupBarrier();
|
|
205
|
+
if(lane<EVENT_ROWS&&eventReservation.z!=0u){eventPublish(lane,flags,offset,eventReservation);}
|
|
206
|
+
}
|
|
207
|
+
`
|
|
208
|
+
: /* wgsl */ `
|
|
209
|
+
@group(0) @binding(${EVENT_WORK_LOCATION}) var<storage,read_write> eventWork:array<u32>;
|
|
210
|
+
const EVENT_TILES:u32=${workgroups}u;
|
|
211
|
+
|
|
212
|
+
@compute @workgroup_size(${EVENT_WORKGROUP_SIZE}) fn classifyEventTiles(
|
|
213
|
+
@builtin(global_invocation_id) invocation:vec3u,
|
|
214
|
+
@builtin(local_invocation_index) lane:u32,
|
|
215
|
+
@builtin(workgroup_id) tile:vec3u
|
|
216
|
+
){
|
|
217
|
+
let row=invocation.x;
|
|
218
|
+
var flags=0u;
|
|
219
|
+
if(row<EVENT_ROWS){flags=eventClassify(row);}
|
|
220
|
+
let offset=scanEvents(lane,eventCount(flags));
|
|
221
|
+
// A 64-lane tile uses at most 128 records. Keep flags above the local offset.
|
|
222
|
+
if(row<EVENT_ROWS){eventWork[4u+row]=offset|(flags<<8u);}
|
|
223
|
+
if(lane==0u){eventWork[4u+EVENT_ROWS+tile.x]=eventPrefix[EVENT_TILE_SIZE-1u];}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@compute @workgroup_size(1) fn reserveEventTiles(){
|
|
227
|
+
var total=0u;
|
|
228
|
+
for(var tile=0u;tile<EVENT_TILES;tile++){
|
|
229
|
+
let index=4u+EVENT_ROWS+tile;
|
|
230
|
+
let count=eventWork[index];
|
|
231
|
+
eventWork[index]=total;
|
|
232
|
+
total+=count;
|
|
233
|
+
}
|
|
234
|
+
let reservation=reserveEvents(total);
|
|
235
|
+
eventWork[0]=reservation.x;eventWork[1]=reservation.y;eventWork[2]=reservation.z;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@compute @workgroup_size(${EVENT_WORKGROUP_SIZE}) fn publishEventTiles(
|
|
239
|
+
@builtin(global_invocation_id) invocation:vec3u,
|
|
240
|
+
@builtin(workgroup_id) tile:vec3u
|
|
241
|
+
){
|
|
242
|
+
let row=invocation.x;
|
|
243
|
+
let reservation=vec3u(eventWork[0],eventWork[1],eventWork[2]);
|
|
244
|
+
if(row>=EVENT_ROWS||reservation.z==0u){return;}
|
|
245
|
+
let word=eventWork[4u+row];
|
|
246
|
+
let offset=eventWork[4u+EVENT_ROWS+tile.x]+(word&255u);
|
|
247
|
+
eventPublish(row,word>>8u,offset,reservation);
|
|
248
|
+
}
|
|
249
|
+
`
|
|
250
|
+
}
|
|
251
|
+
`;
|
|
252
|
+
}
|