@luma.gl/graph 10.0.0-beta.2 → 10.0.0-beta.4
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 +82 -23
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +16 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +98 -24
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +7 -0
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +2 -0
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +14 -0
- package/dist/arrow/gpu/arrow-gpu-vector-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/arrow/vectors/arrow-temporal-gpu-vector.cjs +1 -2
- package/dist/arrow/vectors/arrow-temporal-gpu-vector.js +2 -2
- package/dist/arrow/vectors/arrow-temporal-gpu-vector.js.map +1 -1
- package/dist/dist.dev.js +62 -27
- package/dist/dist.min.js +48 -47
- 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-budget-controller.cjs +10 -2
- package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts +4 -0
- package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-budget-controller.js +10 -2
- package/dist/gpu-core/gpu-command-graph-budget-controller.js.map +1 -1
- 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/gpu-group-aggregation.cjs +45 -21
- package/dist/gpu-core/gpu-group-aggregation.d.ts +4 -0
- package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.js +58 -24
- package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
- 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 +55 -14
- 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 +58 -17
- 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 +94 -44
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts +8 -5
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.js +110 -47
- package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +14 -8
- package/dist/gpu-dataframe/gpu-expression.d.ts +12 -1
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +11 -6
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +8 -4
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts +2 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +10 -4
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
- 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 +6 -2
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +156 -124
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +12 -2
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +160 -128
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +366 -53
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +26 -4
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +378 -47
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +20 -9
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts +15 -2
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.js +22 -8
- package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.cjs +61 -8
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts +10 -2
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +60 -7
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +61 -11
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +5 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +61 -10
- package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +4 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +1 -1
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +1 -1
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-graph/index.cjs.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.cjs +182 -62
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts +29 -2
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js +200 -64
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.cjs +135 -9
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts +55 -8
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js +145 -14
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js.map +1 -1
- package/dist/gpu-graph-algorithms/index.cjs.map +3 -3
- package/dist/gpu-physics/articulation-tree-shader.cjs +177 -0
- package/dist/gpu-physics/articulation-tree-shader.d.ts +3 -0
- package/dist/gpu-physics/articulation-tree-shader.d.ts.map +1 -0
- package/dist/gpu-physics/articulation-tree-shader.js +159 -0
- package/dist/gpu-physics/articulation-tree-shader.js.map +1 -0
- package/dist/gpu-physics/gpu-articulation-tree.cjs +203 -0
- package/dist/gpu-physics/gpu-articulation-tree.d.ts +81 -0
- package/dist/gpu-physics/gpu-articulation-tree.d.ts.map +1 -0
- package/dist/gpu-physics/gpu-articulation-tree.js +205 -0
- package/dist/gpu-physics/gpu-articulation-tree.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.cjs +9 -4
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts +10 -1
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.js +11 -4
- package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +323 -68
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +59 -2
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +400 -75
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs +3 -0
- package/dist/gpu-physics/index.cjs.map +3 -3
- package/dist/gpu-physics/index.d.ts +3 -1
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/index.js +1 -0
- package/dist/gpu-physics/index.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-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 +11 -9
- 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 +13 -9
- 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 +21 -11
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +2 -2
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js +28 -12
- 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-joints.cjs +8 -3
- package/dist/gpu-physics/rigid-body-joints.d.ts +2 -0
- 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-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-shaders.cjs +3 -3
- 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 +3 -3
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.cjs +53 -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 +55 -15
- package/dist/gpu-physics/rigid-body-triggers.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/crs.cjs.map +2 -2
- package/dist/gpu-project/graph.cjs.map +2 -2
- package/dist/gpu-project/index.cjs.map +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-simple-graph/index.cjs.map +2 -2
- package/dist/gpu-sql/gpu-sql.cjs +345 -81
- package/dist/gpu-sql/gpu-sql.d.ts +42 -2
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +393 -90
- 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/index.cjs.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 +8 -8
- 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 +130 -31
- package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +19 -0
- package/src/arrow/index.ts +1 -0
- package/src/arrow/vectors/arrow-temporal-gpu-vector.ts +2 -2
- package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
- package/src/gpu-core/gpu-command-graph-budget-controller.ts +22 -2
- package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
- package/src/gpu-core/gpu-group-aggregation.ts +68 -30
- 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 +106 -25
- package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
- package/src/gpu-dataframe/gpu-expression-shader.ts +172 -58
- package/src/gpu-dataframe/gpu-expression.ts +62 -9
- package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +15 -4
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +12 -3
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +231 -156
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +645 -61
- package/src/gpu-dataframe/gpu-group-by-query.ts +51 -14
- package/src/gpu-dataframe/gpu-join-compiler.ts +87 -6
- package/src/gpu-dataframe/gpu-query-compiler.ts +100 -18
- package/src/gpu-dataframe/index.ts +1 -1
- package/src/gpu-graph-algorithms/README.md +4 -2
- package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts +248 -66
- package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts +218 -20
- package/src/gpu-physics/articulation-tree-shader.ts +169 -0
- package/src/gpu-physics/gpu-articulation-tree.ts +279 -0
- package/src/gpu-physics/gpu-physics-batch.ts +19 -13
- package/src/gpu-physics/gpu-physics-ensemble.ts +20 -4
- package/src/gpu-physics/gpu-rigid-body-world.ts +510 -93
- package/src/gpu-physics/index.ts +16 -0
- 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-ensemble-layout.ts +6 -2
- package/src/gpu-physics/rigid-body-ensemble-reset.ts +21 -9
- package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
- package/src/gpu-physics/rigid-body-ensemble-transaction.ts +31 -13
- 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-joints.ts +11 -11
- package/src/gpu-physics/rigid-body-queries.ts +202 -14
- package/src/gpu-physics/rigid-body-shaders.ts +4 -3
- package/src/gpu-physics/rigid-body-triggers.ts +64 -20
- package/src/gpu-physics/sphere-world-shaders.ts +53 -21
- package/src/gpu-project/projection-program.ts +1 -9
- package/src/gpu-sql/gpu-sql.ts +629 -124
- package/src/gpu-sql/index.ts +1 -1
- package/src/utils/float32.ts +16 -0
package/src/gpu-physics/index.ts
CHANGED
|
@@ -94,6 +94,8 @@ export type {
|
|
|
94
94
|
GPURigidBodySphereCastQuery,
|
|
95
95
|
GPURigidBodyOverlapQuery,
|
|
96
96
|
GPURigidBodyQueryFilter,
|
|
97
|
+
GPURigidBodyBatchCast,
|
|
98
|
+
GPURigidBodyBatchCastOptions,
|
|
97
99
|
GPURigidBodyQueryHit,
|
|
98
100
|
GPURigidBodyQueryResult
|
|
99
101
|
} from './rigid-body-queries';
|
|
@@ -105,6 +107,13 @@ export type {
|
|
|
105
107
|
GPURigidBodyTriggerEvent,
|
|
106
108
|
GPURigidBodyTriggerBatch
|
|
107
109
|
} from './rigid-body-triggers';
|
|
110
|
+
export type {
|
|
111
|
+
GPURigidBodyActiveContact,
|
|
112
|
+
GPURigidBodyActiveTrigger,
|
|
113
|
+
GPURigidBodyContactSnapshot,
|
|
114
|
+
GPURigidBodyEventSnapshot,
|
|
115
|
+
GPURigidBodyTriggerSnapshot
|
|
116
|
+
} from './rigid-body-event-snapshot';
|
|
108
117
|
export {decodeRigidBodyTriggerEvents} from './rigid-body-triggers';
|
|
109
118
|
|
|
110
119
|
export type {GPURigidBodyJoint, GPURigidBodyJointFrame} from './rigid-body-joints';
|
|
@@ -154,3 +163,10 @@ export type {GPURigidBodyJointLimit, GPURigidBodyJointDrive} from './joint-types
|
|
|
154
163
|
export {rotateRigidBodyVector, normalizeRigidBodyRotation} from './rigid-body-properties';
|
|
155
164
|
export type {GPURigidBodyGeneralConstraint} from './rigid-body-general-joints';
|
|
156
165
|
export type {GPURigidBodyVehicle} from './rigid-body-vehicle';
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
GPUArticulationTree,
|
|
169
|
+
type GPUArticulationLink,
|
|
170
|
+
type GPUArticulationContact,
|
|
171
|
+
type GPUArticulationDrive
|
|
172
|
+
} from './gpu-articulation-tree';
|
|
@@ -8,10 +8,15 @@ export type RigidBodySparseShaderLayout = {
|
|
|
8
8
|
diagnosticOffset: number;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
/** Build sparse cache ownership and optional partition-local overflow reporting. */
|
|
11
12
|
export function getRigidBodyCacheShader(
|
|
12
13
|
layout: RigidBodySparseShaderLayout,
|
|
13
|
-
ensemble = false
|
|
14
|
+
ensemble = false,
|
|
15
|
+
pairsPerInstance?: number
|
|
14
16
|
): string {
|
|
17
|
+
// Disjoint ranges ensure a sibling cannot claim an address that a failed instance must restore.
|
|
18
|
+
/** Use the selected capacity as a power-of-two mask within the owning cache range. */
|
|
19
|
+
const capacity = pairsPerInstance ? `${pairsPerInstance}u` : 'PAIR_CAPACITY';
|
|
15
20
|
let source = /* wgsl */ `
|
|
16
21
|
const EMPTY_PAIR:u32=0u;
|
|
17
22
|
const DELETED_PAIR:u32=0xffffffffu;
|
|
@@ -24,11 +29,12 @@ fn claimManifold(first:u32,second:u32)->u32{
|
|
|
24
29
|
let key=((first<<16u)|second)+1u;
|
|
25
30
|
var mixed=(key^(key>>16u))*2246822519u;
|
|
26
31
|
mixed=(mixed^(mixed>>13u))*3266489917u;
|
|
27
|
-
let
|
|
32
|
+
${pairsPerInstance ? `let instanceIndex=first/INSTANCE_COLLIDERS;let base=instanceIndex*${capacity};` : 'let base=0u;'}
|
|
33
|
+
let origin=(mixed^(mixed>>16u))&(${capacity}-1u);
|
|
28
34
|
for(var attempt=0u;attempt<8u;attempt++){
|
|
29
35
|
var reusable=DELETED_PAIR;var observed=DELETED_PAIR;
|
|
30
|
-
for(var probe=0u;probe<min(
|
|
31
|
-
let slot=(origin+probe)&(
|
|
36
|
+
for(var probe=0u;probe<min(${capacity},128u);probe++){
|
|
37
|
+
let slot=base+((origin+probe)&(${capacity}-1u));let stored=atomicLoad(&targets.keys[slot].key);
|
|
32
38
|
if(stored==key){targets.keys[slot].epoch=targets.frame;manifolds[slot].first=first;manifolds[slot].second=second;return slot;}
|
|
33
39
|
if(stored==DELETED_PAIR&&reusable==DELETED_PAIR){reusable=slot;observed=DELETED_PAIR;}
|
|
34
40
|
if(stored==EMPTY_PAIR){if(reusable==DELETED_PAIR){reusable=slot;observed=EMPTY_PAIR;}break;}
|
|
@@ -40,7 +46,12 @@ fn claimManifold(first:u32,second:u32)->u32{
|
|
|
40
46
|
manifolds[reusable].first=first;manifolds[reusable].second=second;return reusable;
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
|
-
|
|
49
|
+
${
|
|
50
|
+
pairsPerInstance
|
|
51
|
+
? 'atomicStore(&targets.instanceFailures[instanceIndex],1u);atomicStore(&targets.instanceFailures[INSTANCE_COUNT],1u);'
|
|
52
|
+
: 'atomicAdd(&targets.cacheDropped,1u);'
|
|
53
|
+
}
|
|
54
|
+
return DELETED_PAIR;
|
|
44
55
|
}
|
|
45
56
|
var<workgroup> cacheEpoch:u32;
|
|
46
57
|
@compute @workgroup_size(64) fn prepare(@builtin(local_invocation_index) invocation:u32){
|
|
@@ -86,11 +97,12 @@ fn journalManifold(pair:u32,key:u32){
|
|
|
86
97
|
let count=atomicLoad(&targets.reserved0);
|
|
87
98
|
for(var index=invocation;index<count;index+=64u){targets.journalMarks[targets.journalSlots[index]]=0u;}
|
|
88
99
|
storageBarrier();
|
|
89
|
-
if(invocation==0u){targets.frame++;atomicStore(&targets.reserved0,0u);atomicStore(&targets.reserved1,0u);atomicStore(&targets.reserved2,0u);atomicStore(&targets.cacheDropped,0u);}
|
|
100
|
+
if(invocation==0u){targets.frame++;atomicStore(&targets.reserved0,0u);atomicStore(&targets.reserved1,0u);atomicStore(&targets.reserved2,0u);atomicStore(&targets.cacheDropped,0u);${pairsPerInstance ? 'atomicStore(&targets.instanceFailures[INSTANCE_COUNT],0u);' : ''}}
|
|
90
101
|
}
|
|
91
102
|
@compute @workgroup_size(64) fn prepare(@builtin(global_invocation_id) invocation:vec3u){
|
|
92
103
|
let work=invocation.x;if(work>=atomicLoad(&ensemble[0])){return;}
|
|
93
104
|
let instance=atomicLoad(&ensemble[INSTANCE_QUEUE+work]);
|
|
105
|
+
${pairsPerInstance ? 'atomicStore(&targets.instanceFailures[instance],0u);' : ''}
|
|
94
106
|
targets.instanceFrames[instance]++;let epoch=targets.instanceFrames[instance];
|
|
95
107
|
var previous=0u;var link=atomicLoad(&targets.instanceHeads[instance]);
|
|
96
108
|
loop{
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import {getEnsembleContactLayout} from './rigid-body-ensemble-layout';
|
|
2
|
-
import {RIGID_BODY_JOINT_STATE_BYTES} from './rigid-body-joints';
|
|
3
1
|
// luma.gl
|
|
4
2
|
// SPDX-License-Identifier: MIT
|
|
5
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
6
4
|
|
|
5
|
+
import {RIGID_BODY_CAST_COMMAND_BYTES, RIGID_BODY_BATCH_RESULT_BYTES} from './rigid-body-queries';
|
|
6
|
+
import {getEnsembleContactLayout} from './rigid-body-ensemble-layout';
|
|
7
|
+
import {RIGID_BODY_JOINT_STATE_BYTES} from './rigid-body-joints';
|
|
8
|
+
|
|
7
9
|
export type GPURigidBodyCapacityInfo = {
|
|
8
10
|
bodyCount: number;
|
|
9
11
|
colliderCount: number;
|
|
10
12
|
maximumPairs: number;
|
|
11
13
|
/** World-owned buffers only; excludes graph scratch, pipelines and driver allocation overhead. */
|
|
12
14
|
ownedBufferBytes: number;
|
|
15
|
+
/** Private cast index scratch. Upper bound before attachment, physical allocation afterward. */
|
|
16
|
+
queryIndexScratchBytes: number;
|
|
13
17
|
buffers: {name: string; byteLength: number; uniform: boolean}[];
|
|
14
18
|
pairWorkgroups: number;
|
|
15
19
|
};
|
|
@@ -28,7 +32,9 @@ export function getRigidBodyStorageLayout(
|
|
|
28
32
|
rollback = false,
|
|
29
33
|
continuous = false,
|
|
30
34
|
jointCount = 0,
|
|
31
|
-
ensembleInstances = 0
|
|
35
|
+
ensembleInstances = 0,
|
|
36
|
+
independentRecovery = false,
|
|
37
|
+
queryBatchCapacity = 0
|
|
32
38
|
) {
|
|
33
39
|
const geometryOffset = Math.ceil((bodyCount * 12 + colliderCount * 26) / 4) * 4;
|
|
34
40
|
const pairOffset = Math.ceil((geometryOffset + geometryWords) / 64) * 64;
|
|
@@ -49,7 +55,8 @@ export function getRigidBodyStorageLayout(
|
|
|
49
55
|
{
|
|
50
56
|
name: 'targets',
|
|
51
57
|
byteLength: ensembleInstances
|
|
52
|
-
? getEnsembleContactLayout(bodyCount, ensembleInstances, maximumPairs)
|
|
58
|
+
? getEnsembleContactLayout(bodyCount, ensembleInstances, maximumPairs, independentRecovery)
|
|
59
|
+
.byteLength
|
|
53
60
|
: Math.ceil((bodyCount * 32 + (sparse ? 32 + maximumPairs * 8 : 16)) / 16) * 16 +
|
|
54
61
|
jointCount * RIGID_BODY_JOINT_STATE_BYTES,
|
|
55
62
|
uniform: false
|
|
@@ -76,6 +83,20 @@ export function getRigidBodyStorageLayout(
|
|
|
76
83
|
{name: 'query-output', byteLength: 16 + Math.max(1, colliderCount) * 48, uniform: false}
|
|
77
84
|
]
|
|
78
85
|
: []),
|
|
86
|
+
...(queryBatchCapacity
|
|
87
|
+
? [
|
|
88
|
+
{
|
|
89
|
+
name: 'query-batch-commands',
|
|
90
|
+
byteLength: queryBatchCapacity * RIGID_BODY_CAST_COMMAND_BYTES,
|
|
91
|
+
uniform: false
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'query-batch-results',
|
|
95
|
+
byteLength: queryBatchCapacity * RIGID_BODY_BATCH_RESULT_BYTES,
|
|
96
|
+
uniform: false
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
: []),
|
|
79
100
|
...(extended ? [{name: 'mesh-tasks', byteLength: 16 + 65536 * 48, uniform: false}] : []),
|
|
80
101
|
...(parallel
|
|
81
102
|
? [
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Buffer, type BindingDeclaration, type Device} from '@luma.gl/core';
|
|
6
|
+
import {GPUBVH} from '../gpu-core/gpu-bvh';
|
|
7
|
+
import {
|
|
8
|
+
GPUCommandGraph,
|
|
9
|
+
type CompiledGPUCommandGraph,
|
|
10
|
+
type GraphBufferHandle
|
|
11
|
+
} from '../gpu-core/gpu-command-graph';
|
|
12
|
+
import {Kernel} from '../execution/compute/kernel';
|
|
13
|
+
import {getRigidBodyBatchCastShader} from './rigid-body-queries';
|
|
14
|
+
import {
|
|
15
|
+
normalizeRigidBodyRotation,
|
|
16
|
+
rotateRigidBodyVector,
|
|
17
|
+
type GPURigidBody,
|
|
18
|
+
type GPURigidBodyCollider
|
|
19
|
+
} from './rigid-body-properties';
|
|
20
|
+
|
|
21
|
+
/** Authored locality and stable query identities for a refittable index. */
|
|
22
|
+
export type RigidBodyCastOrder = {
|
|
23
|
+
/** Collider IDs, with indexed primitives first. */
|
|
24
|
+
indices: Uint32Array;
|
|
25
|
+
/** Inverse permutation for sorting small explicit selections. */
|
|
26
|
+
ranks: Uint32Array;
|
|
27
|
+
/** Sphere and box count in the indexed prefix. */
|
|
28
|
+
indexedCount: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Index colliders whose exact intersection does not use a traversal budget. */
|
|
32
|
+
export function canIndexRigidBodyCastCollider(collider: GPURigidBodyCollider): boolean {
|
|
33
|
+
return collider.shape.type === 'sphere' || collider.shape.type === 'box';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Size the implicit complete binary tree, including padded leaves. */
|
|
37
|
+
function getCastIndexShape(indexedCount: number) {
|
|
38
|
+
/** Zero primitives require no private query graph. */
|
|
39
|
+
const leafCapacity = indexedCount ? 2 ** Math.ceil(Math.log2(indexedCount)) : 0;
|
|
40
|
+
return {leafCapacity, nodeCount: Math.max(0, leafCapacity * 2 - 1)};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Bound scratch before compilation and transient buffer aliasing. */
|
|
44
|
+
export function estimateRigidBodyCastIndexBytes(indexedCount: number): number {
|
|
45
|
+
if (!indexedCount) return 0;
|
|
46
|
+
/** Source and node bounds have two float32x3 rows. Node children add two words. */
|
|
47
|
+
const {leafCapacity, nodeCount} = getCastIndexShape(indexedCount);
|
|
48
|
+
return indexedCount * 24 + nodeCount * 32 + leafCapacity * 4 + 8;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Sort primitive leaves by position once. GPU refits preserve this order as bodies move. */
|
|
52
|
+
export function getRigidBodyCastOrder(
|
|
53
|
+
colliders: readonly (GPURigidBodyCollider & {body: number})[],
|
|
54
|
+
bodies: readonly GPURigidBody[]
|
|
55
|
+
): RigidBodyCastOrder {
|
|
56
|
+
/** Separate the primitives whose exact intersection has no traversal budget. */
|
|
57
|
+
const primitives: {index: number; center: number[]; key: number}[] = [];
|
|
58
|
+
/** Retain direct traversal for extended shapes to preserve their completion status. */
|
|
59
|
+
const extended: number[] = [];
|
|
60
|
+
/** Authored center range for quantization. */
|
|
61
|
+
const lower = [Infinity, Infinity, Infinity];
|
|
62
|
+
/** Authored center range for quantization. */
|
|
63
|
+
const upper = [-Infinity, -Infinity, -Infinity];
|
|
64
|
+
for (const [index, collider] of colliders.entries()) {
|
|
65
|
+
if (!canIndexRigidBodyCastCollider(collider)) {
|
|
66
|
+
extended.push(index);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
/** Map compound offsets out of the authored body frame before ordering the leaves. */
|
|
70
|
+
const body = bodies[collider.body];
|
|
71
|
+
/** Collider translation relative to the authored body origin in world axes. */
|
|
72
|
+
const offset = collider.position
|
|
73
|
+
? rotateRigidBodyVector(normalizeRigidBodyRotation(body.orientation), collider.position)
|
|
74
|
+
: [0, 0, 0];
|
|
75
|
+
/** Include each collider center even when one body owns several separated primitives. */
|
|
76
|
+
const center = body.position.map((value, coordinate) => value + offset[coordinate]);
|
|
77
|
+
for (let coordinate = 0; coordinate < 3; coordinate++) {
|
|
78
|
+
lower[coordinate] = Math.min(lower[coordinate], center[coordinate]);
|
|
79
|
+
upper[coordinate] = Math.max(upper[coordinate], center[coordinate]);
|
|
80
|
+
}
|
|
81
|
+
primitives.push({index, center, key: 0});
|
|
82
|
+
}
|
|
83
|
+
for (const primitive of primitives) {
|
|
84
|
+
for (let coordinate = 0; coordinate < 3; coordinate++) {
|
|
85
|
+
/** Ten bits per axis keep the Morton key inside a uint32. */
|
|
86
|
+
const span = upper[coordinate] - lower[coordinate];
|
|
87
|
+
/** Clamp the endpoint and handle a flat axis without dividing by zero. */
|
|
88
|
+
const quantized =
|
|
89
|
+
span > 0
|
|
90
|
+
? Math.floor(((primitive.center[coordinate] - lower[coordinate]) / span) * 1023)
|
|
91
|
+
: 0;
|
|
92
|
+
for (let bit = 0; bit < 10; bit++) {
|
|
93
|
+
primitive.key |= ((quantized >> bit) & 1) << (3 * bit + coordinate);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
primitives.sort((first, second) => first.key - second.key);
|
|
98
|
+
/** Restore caller-facing collider identities after traversal. */
|
|
99
|
+
const indices = Uint32Array.from([...primitives.map(primitive => primitive.index), ...extended]);
|
|
100
|
+
/** Use the same topology when an application passes a subset in a different order. */
|
|
101
|
+
const ranks = new Uint32Array(indices.length);
|
|
102
|
+
for (const [rank, index] of indices.entries()) ranks[index] = rank;
|
|
103
|
+
return {indices, ranks, indexedCount: primitives.length};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Gather conservative world-space bounds for the selected primitive prefix. */
|
|
107
|
+
function getGatherCastBoundsShader(indexedCount: number): string {
|
|
108
|
+
return /* wgsl */ `
|
|
109
|
+
@group(0) @binding(24) var<storage,read_write> sourceMinima:array<f32>;
|
|
110
|
+
@group(0) @binding(25) var<storage,read_write> sourceMaxima:array<f32>;
|
|
111
|
+
@group(0) @binding(30) var<storage,read> batchCommands:array<Query>;
|
|
112
|
+
|
|
113
|
+
@compute @workgroup_size(64) fn gatherCastBounds(@builtin(global_invocation_id) invocation:vec3u){
|
|
114
|
+
let row=invocation.x;
|
|
115
|
+
if(row>=${indexedCount}u){return;}
|
|
116
|
+
let largest=0x1.fffffep127f;
|
|
117
|
+
var lower=vec3f(largest);
|
|
118
|
+
var upper=vec3f(-largest);
|
|
119
|
+
if(row<batchCommands[0].settings.y){
|
|
120
|
+
let collider=querySelection[row];
|
|
121
|
+
let center=colliderPosition(collider);
|
|
122
|
+
let shape=bodies.colliders[collider].shape;
|
|
123
|
+
var extent=vec3f(shape.x);
|
|
124
|
+
if(shape.w==1.0){extent=shapeWorldExtent(collider);}
|
|
125
|
+
// Cover float32 pose and slab arithmetic, including the narrow phase's
|
|
126
|
+
// near-tangent sphere sweep tolerance.
|
|
127
|
+
let padding=max(vec3f(1e-7),(abs(center)+extent)*2e-6);
|
|
128
|
+
lower=center-extent-padding;
|
|
129
|
+
upper=center+extent+padding;
|
|
130
|
+
if(!all(abs(lower)<=vec3f(largest))||!all(abs(upper)<=vec3f(largest))){
|
|
131
|
+
lower=vec3f(-largest);
|
|
132
|
+
upper=vec3f(largest);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for(var coordinate=0u;coordinate<3u;coordinate++){
|
|
136
|
+
sourceMinima[row*3u+coordinate]=lower[coordinate];
|
|
137
|
+
sourceMaxima[row*3u+coordinate]=upper[coordinate];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Index construction and traversal inputs borrowed from the rigid-body world. */
|
|
144
|
+
type RigidBodyCastIndexProps = {
|
|
145
|
+
/** Prefix for graph resources and passes. */
|
|
146
|
+
id: string;
|
|
147
|
+
/** WGSL containing shared geometry and cast declarations. */
|
|
148
|
+
source: string;
|
|
149
|
+
/** Binding declarations for the shared batch cast shader. */
|
|
150
|
+
layout: readonly BindingDeclaration[];
|
|
151
|
+
/** Borrowed world buffers and batch staging. */
|
|
152
|
+
buffers: {
|
|
153
|
+
positions: Buffer;
|
|
154
|
+
orientations: Buffer;
|
|
155
|
+
bodies: Buffer;
|
|
156
|
+
querySelection: Buffer;
|
|
157
|
+
batchCommands: Buffer;
|
|
158
|
+
batchResults: Buffer;
|
|
159
|
+
};
|
|
160
|
+
/** Maximum number of indexed leaves. */
|
|
161
|
+
indexedCount: number;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** Compile one private query graph. Holds no ownership of world state or query staging. */
|
|
165
|
+
export function createRigidBodyCastIndex(
|
|
166
|
+
device: Device,
|
|
167
|
+
{id, source, layout, buffers, indexedCount}: RigidBodyCastIndexProps
|
|
168
|
+
): CompiledGPUCommandGraph<number> {
|
|
169
|
+
/** Keep refits separate from the application simulation graph. */
|
|
170
|
+
const graph = new GPUCommandGraph<number>(device, {id});
|
|
171
|
+
/** Import each world buffer once so graph dependencies track the same handles. */
|
|
172
|
+
const resources = Object.fromEntries(
|
|
173
|
+
Object.entries(buffers).map(([name, buffer]) => [
|
|
174
|
+
name,
|
|
175
|
+
graph.importBuffer({id: name, byteLength: buffer.byteLength, usage: buffer.usage}, buffer)
|
|
176
|
+
])
|
|
177
|
+
);
|
|
178
|
+
/** Every internal and leaf row uses the same packed bounds format. */
|
|
179
|
+
const {leafCapacity, nodeCount} = getCastIndexShape(indexedCount);
|
|
180
|
+
/** Allocate a packed scratch view owned by the query graph. */
|
|
181
|
+
function createView<Format extends 'float32x3' | 'uint32x2' | 'uint32'>(
|
|
182
|
+
name: string,
|
|
183
|
+
format: Format,
|
|
184
|
+
length: number
|
|
185
|
+
) {
|
|
186
|
+
/** Three floats for bounds or one or two words for topology. */
|
|
187
|
+
const rowBytes = format === 'float32x3' ? 12 : format === 'uint32x2' ? 8 : 4;
|
|
188
|
+
return graph.createDataView(
|
|
189
|
+
graph.createTransientBuffer({id: name, byteLength: length * rowBytes, usage: Buffer.STORAGE}),
|
|
190
|
+
{format, length}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Shared BVH primitive publishes stable implicit leaves and refits from the current poses. */
|
|
195
|
+
const hierarchy = new GPUBVH({
|
|
196
|
+
id,
|
|
197
|
+
leafCapacity,
|
|
198
|
+
minima: createView('source-minima', 'float32x3', indexedCount),
|
|
199
|
+
maxima: createView('source-maxima', 'float32x3', indexedCount),
|
|
200
|
+
nodeMinima: createView('node-minima', 'float32x3', nodeCount),
|
|
201
|
+
nodeMaxima: createView('node-maxima', 'float32x3', nodeCount),
|
|
202
|
+
nodeChildren: createView('children', 'uint32x2', nodeCount),
|
|
203
|
+
leafIds: createView('leaf-ids', 'uint32', leafCapacity),
|
|
204
|
+
count: createView('count', 'uint32', 1),
|
|
205
|
+
overflow: createView('overflow', 'uint32', 1)
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
/** Add one compute node with explicit hazards for the external world and tree scratch. */
|
|
209
|
+
function addPass(
|
|
210
|
+
entryPoint: string,
|
|
211
|
+
shaderSource: string,
|
|
212
|
+
bindings: Record<string, GraphBufferHandle>,
|
|
213
|
+
writes: readonly string[],
|
|
214
|
+
workgroups?: number
|
|
215
|
+
): void {
|
|
216
|
+
/** The shader shares declarations with the unindexed pipeline. */
|
|
217
|
+
const bindingLayout = [
|
|
218
|
+
...layout,
|
|
219
|
+
{name: 'sourceMinima', group: 0, location: 24, type: 'storage' as const},
|
|
220
|
+
{name: 'sourceMaxima', group: 0, location: 25, type: 'storage' as const},
|
|
221
|
+
{name: 'nodeMinima', group: 0, location: 26, type: 'read-only-storage' as const},
|
|
222
|
+
{name: 'nodeMaxima', group: 0, location: 27, type: 'read-only-storage' as const}
|
|
223
|
+
].filter(binding => binding.name in bindings);
|
|
224
|
+
graph.addComputePass({
|
|
225
|
+
id: `${id}-${entryPoint}`,
|
|
226
|
+
resources: Object.entries(bindings).map(([name, buffer]) => ({
|
|
227
|
+
buffer,
|
|
228
|
+
usage: writes.includes(name) ? 'storage-read-write' : 'storage-read'
|
|
229
|
+
})),
|
|
230
|
+
compile: () => {
|
|
231
|
+
/** Compile once and resolve graph-owned temporary buffers at encode time. */
|
|
232
|
+
const kernel = new Kernel(device, {
|
|
233
|
+
id: `${id}-${entryPoint}`,
|
|
234
|
+
source: shaderSource,
|
|
235
|
+
entryPoint,
|
|
236
|
+
shaderLayout: {bindings: bindingLayout}
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
encode: ({computePass, getBuffer, parameters}) =>
|
|
240
|
+
kernel.dispatch(computePass, {
|
|
241
|
+
bindings: Object.fromEntries(
|
|
242
|
+
Object.entries(bindings).map(([name, handle]) => [name, getBuffer(handle)])
|
|
243
|
+
),
|
|
244
|
+
x: workgroups ?? parameters
|
|
245
|
+
}),
|
|
246
|
+
destroy: () => kernel.destroy()
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** The shared geometry source defines the command struct and collider pose helpers. */
|
|
253
|
+
const {batchResults, ...inputs} = resources;
|
|
254
|
+
addPass(
|
|
255
|
+
'gatherCastBounds',
|
|
256
|
+
source + getGatherCastBoundsShader(indexedCount),
|
|
257
|
+
{
|
|
258
|
+
...inputs,
|
|
259
|
+
sourceMinima: hierarchy.minima.buffer,
|
|
260
|
+
sourceMaxima: hierarchy.maxima.buffer
|
|
261
|
+
},
|
|
262
|
+
['sourceMinima', 'sourceMaxima'],
|
|
263
|
+
Math.ceil(indexedCount / 64)
|
|
264
|
+
);
|
|
265
|
+
graph.add(hierarchy);
|
|
266
|
+
addPass(
|
|
267
|
+
'castBatch',
|
|
268
|
+
source + getRigidBodyBatchCastShader(leafCapacity),
|
|
269
|
+
{
|
|
270
|
+
...resources,
|
|
271
|
+
nodeMinima: hierarchy.nodeMinima.buffer,
|
|
272
|
+
nodeMaxima: hierarchy.nodeMaxima.buffer
|
|
273
|
+
},
|
|
274
|
+
['batchResults']
|
|
275
|
+
);
|
|
276
|
+
return graph.compile();
|
|
277
|
+
}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
export function getEnsembleContactLayout(
|
|
7
7
|
bodyCount: number,
|
|
8
8
|
instances: number,
|
|
9
|
-
maximumPairs: number
|
|
9
|
+
maximumPairs: number,
|
|
10
|
+
independentRecovery = false
|
|
10
11
|
) {
|
|
11
12
|
const keyOffset = bodyCount * 8 + 8;
|
|
12
13
|
const headOffset = keyOffset + maximumPairs * 2;
|
|
@@ -20,6 +21,8 @@ export function getEnsembleContactLayout(
|
|
|
20
21
|
const savedFrameOffset = savedHeadOffset + instances;
|
|
21
22
|
const savedHeaderOffset = savedFrameOffset + instances;
|
|
22
23
|
const savedManifoldOffset = Math.ceil((savedHeaderOffset + 8) / 4) * 4;
|
|
24
|
+
/** Local fault words and one aggregate flag follow the journal payloads. */
|
|
25
|
+
const failureOffset = savedManifoldOffset + maximumPairs * 104;
|
|
23
26
|
return {
|
|
24
27
|
keyOffset,
|
|
25
28
|
headOffset,
|
|
@@ -33,6 +36,7 @@ export function getEnsembleContactLayout(
|
|
|
33
36
|
savedFrameOffset,
|
|
34
37
|
savedHeaderOffset,
|
|
35
38
|
savedManifoldOffset,
|
|
36
|
-
|
|
39
|
+
failureOffset,
|
|
40
|
+
byteLength: (failureOffset + (independentRecovery ? Math.ceil((instances + 1) / 4) * 4 : 0)) * 4
|
|
37
41
|
};
|
|
38
42
|
}
|
|
@@ -16,7 +16,8 @@ export function makeEnsembleReset(
|
|
|
16
16
|
collidersPerInstance: number,
|
|
17
17
|
maximumPairs: number,
|
|
18
18
|
vehiclesPerInstance: number,
|
|
19
|
-
terrainSlots: ReadonlySet<number
|
|
19
|
+
terrainSlots: ReadonlySet<number>,
|
|
20
|
+
pairsPerInstance?: number
|
|
20
21
|
) {
|
|
21
22
|
const find = (name: string) => buffers.find(buffer => buffer.id === `${id}-${name}`)!;
|
|
22
23
|
// A streamed collider row contains a private atlas address, revision and placement.
|
|
@@ -104,15 +105,21 @@ ${vehicle ? '@group(0) @binding(7) var<storage,read_write> vehicle:array<u32>;'
|
|
|
104
105
|
}`
|
|
105
106
|
: ''
|
|
106
107
|
}
|
|
107
|
-
if(index>=${maximumPairs}u){return;}
|
|
108
|
-
|
|
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];
|
|
109
114
|
if(key==0u||key==0xffffffffu){return;}
|
|
110
|
-
let
|
|
111
|
-
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;
|
|
112
119
|
for(var word=0u;word<104u;word++){manifolds[address+word]=0u;}
|
|
113
|
-
targets[${bodyCount * 8 + 8}u+
|
|
114
|
-
targets[${bodyCount * 8 + 9}u+
|
|
115
|
-
${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;}' : ''}
|
|
116
123
|
}`,
|
|
117
124
|
shaderLayout: {
|
|
118
125
|
bindings: [
|
|
@@ -162,7 +169,12 @@ ${vehicle ? '@group(0) @binding(7) var<storage,read_write> vehicle:array<u32>;'
|
|
|
162
169
|
});
|
|
163
170
|
const pass = encoder.beginComputePass();
|
|
164
171
|
const groups = Math.ceil(
|
|
165
|
-
Math.max(
|
|
172
|
+
Math.max(
|
|
173
|
+
pairsPerInstance ?? maximumPairs,
|
|
174
|
+
collidersPerInstance,
|
|
175
|
+
bodiesPerInstance,
|
|
176
|
+
vehiclesPerInstance
|
|
177
|
+
) / 64
|
|
166
178
|
);
|
|
167
179
|
computation!.kernel.dispatch(pass, {
|
|
168
180
|
bindings: computation!.bindings,
|
|
@@ -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))
|