@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
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Buffer, type ShaderLayout, type Binding, type BindingDeclaration} from '@luma.gl/core';
|
|
6
|
+
import type {GPUCommandGraph, GraphBufferUse} from '../gpu-core/gpu-command-graph';
|
|
7
|
+
import type {GPUCommandGraphComputeExecutable} from '../gpu-core/gpu-command-graph-types';
|
|
8
|
+
import {
|
|
9
|
+
createBoundKernel,
|
|
10
|
+
createBoundKernelAsync,
|
|
11
|
+
type BoundKernel
|
|
12
|
+
} from '../gpu-core/utils/bound-kernel';
|
|
13
|
+
import {getArticulationTreeShader} from './articulation-tree-shader';
|
|
14
|
+
|
|
15
|
+
type Vector = readonly [number, number, number];
|
|
16
|
+
/** Link origins are centers of mass. Both anchor offsets use their respective local frames. */
|
|
17
|
+
export type GPUArticulationLink = {
|
|
18
|
+
id: string;
|
|
19
|
+
/** Parent link index, or -1 for the fixed base. Parents precede children. */
|
|
20
|
+
parent: number;
|
|
21
|
+
parentAnchor: Vector;
|
|
22
|
+
childAnchor: Vector;
|
|
23
|
+
/** Unit revolute axis in the parent frame. Omit for a welded attachment. */
|
|
24
|
+
axis?: Vector;
|
|
25
|
+
/** Child-to-parent orientation at zero angle. */
|
|
26
|
+
restOrientation?: readonly [number, number, number, number];
|
|
27
|
+
mass: number;
|
|
28
|
+
/** Principal moments about the COM in the child frame. */
|
|
29
|
+
inertia: Vector;
|
|
30
|
+
angle?: number;
|
|
31
|
+
speed?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Position control in radians, N·m/rad, N·m·s/rad and N·m respectively. */
|
|
35
|
+
export type GPUArticulationDrive = {
|
|
36
|
+
angle: number;
|
|
37
|
+
stiffness: number;
|
|
38
|
+
damping: number;
|
|
39
|
+
maximumTorque: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** Frictionless unilateral contact between a link-centered sphere and a static world-space box. */
|
|
43
|
+
export type GPUArticulationContact = {
|
|
44
|
+
link: string;
|
|
45
|
+
radius: number;
|
|
46
|
+
center: Vector;
|
|
47
|
+
halfExtents: Vector;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** Small fixed-base trees. The graph owns the kernel and the tree owns the buffers. */
|
|
51
|
+
export class GPUArticulationTree {
|
|
52
|
+
readonly timeStep: number;
|
|
53
|
+
readonly id: string;
|
|
54
|
+
private readonly links: GPUArticulationLink[];
|
|
55
|
+
private readonly indices = new Map<string, number>();
|
|
56
|
+
private readonly buffers: Buffer[] = [];
|
|
57
|
+
private readonly base: Vector;
|
|
58
|
+
private readonly gravity: Vector;
|
|
59
|
+
private readonly contact?: GPUArticulationContact;
|
|
60
|
+
private readonly publishMatrices: boolean;
|
|
61
|
+
/** Column-major world transforms in link order, available after registration with publishMatrices. */
|
|
62
|
+
get poseMatrices() {
|
|
63
|
+
return this.buffers[6] ?? null;
|
|
64
|
+
}
|
|
65
|
+
private destroyed = false;
|
|
66
|
+
|
|
67
|
+
constructor(props: {
|
|
68
|
+
id?: string;
|
|
69
|
+
links: readonly GPUArticulationLink[];
|
|
70
|
+
base?: Vector;
|
|
71
|
+
gravity?: Vector;
|
|
72
|
+
timeStep?: number;
|
|
73
|
+
contact?: GPUArticulationContact;
|
|
74
|
+
publishMatrices?: boolean;
|
|
75
|
+
}) {
|
|
76
|
+
this.id = props.id ?? 'articulation-tree';
|
|
77
|
+
this.timeStep = props.timeStep ?? 1 / 120;
|
|
78
|
+
this.contact = structuredClone(props.contact);
|
|
79
|
+
this.publishMatrices = Boolean(props.publishMatrices);
|
|
80
|
+
this.links = structuredClone([...props.links]);
|
|
81
|
+
this.base = [...(props.base ?? [0, 0, 0])];
|
|
82
|
+
this.gravity = [...(props.gravity ?? [0, 0, -9.81])];
|
|
83
|
+
const finite = (x: number) => Number.isFinite(Math.fround(x));
|
|
84
|
+
if (
|
|
85
|
+
!this.links.length ||
|
|
86
|
+
this.links.length > 16 ||
|
|
87
|
+
!finite(this.timeStep) ||
|
|
88
|
+
Math.fround(this.timeStep) <= 0 ||
|
|
89
|
+
![...this.base, ...this.gravity].every(finite)
|
|
90
|
+
)
|
|
91
|
+
throw new Error('Invalid articulation settings');
|
|
92
|
+
for (const [index, link] of this.links.entries()) {
|
|
93
|
+
if (
|
|
94
|
+
!link.id ||
|
|
95
|
+
this.indices.has(link.id) ||
|
|
96
|
+
!Number.isInteger(link.parent) ||
|
|
97
|
+
link.parent < -1 ||
|
|
98
|
+
link.parent >= index ||
|
|
99
|
+
!finite(link.mass) ||
|
|
100
|
+
Math.fround(link.mass) <= 0 ||
|
|
101
|
+
!link.inertia.every(value => finite(value) && Math.fround(value) > 0) ||
|
|
102
|
+
![...link.parentAnchor, ...link.childAnchor, link.angle ?? 0, link.speed ?? 0].every(
|
|
103
|
+
finite
|
|
104
|
+
) ||
|
|
105
|
+
(link.axis
|
|
106
|
+
? !(Math.abs(Math.hypot(...link.axis) - 1) < 1e-6)
|
|
107
|
+
: Boolean(link.angle || link.speed)) ||
|
|
108
|
+
(link.restOrientation && !(Math.abs(Math.hypot(...link.restOrientation) - 1) < 1e-6))
|
|
109
|
+
)
|
|
110
|
+
throw new Error('Invalid articulation link');
|
|
111
|
+
this.indices.set(link.id, index);
|
|
112
|
+
}
|
|
113
|
+
const contact = this.contact;
|
|
114
|
+
if (
|
|
115
|
+
contact &&
|
|
116
|
+
(!this.indices.has(contact.link) ||
|
|
117
|
+
!contact.center.every(finite) ||
|
|
118
|
+
![contact.radius, ...contact.halfExtents].every(
|
|
119
|
+
value => finite(value) && Math.fround(value) > 0
|
|
120
|
+
))
|
|
121
|
+
)
|
|
122
|
+
throw new Error('Invalid articulation contact');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Register one simulation step. The output pose buffer uses four vec4s per link: COM, quaternion, velocity, spin. */
|
|
126
|
+
addToGraph<P>(graph: GPUCommandGraph<P>) {
|
|
127
|
+
if (this.destroyed || this.buffers.length)
|
|
128
|
+
throw new Error('Inactive or already registered articulation');
|
|
129
|
+
const names = ['links', 'drives', 'coordinates', 'poses', 'counters', 'settings'];
|
|
130
|
+
const data = [
|
|
131
|
+
new Float32Array(
|
|
132
|
+
this.links.flatMap(link => [
|
|
133
|
+
...link.parentAnchor,
|
|
134
|
+
link.parent,
|
|
135
|
+
...link.childAnchor,
|
|
136
|
+
0,
|
|
137
|
+
...(link.axis ?? [0, 0, 0]),
|
|
138
|
+
link.mass,
|
|
139
|
+
...link.inertia,
|
|
140
|
+
0,
|
|
141
|
+
...(link.restOrientation ?? [0, 0, 0, 1])
|
|
142
|
+
])
|
|
143
|
+
),
|
|
144
|
+
new Float32Array(this.links.length * 4),
|
|
145
|
+
new Float32Array(this.links.flatMap(link => [link.angle ?? 0, link.speed ?? 0, 0, 0])),
|
|
146
|
+
new Float32Array(this.links.length * 16),
|
|
147
|
+
new Uint32Array(4),
|
|
148
|
+
new Float32Array([
|
|
149
|
+
...this.base,
|
|
150
|
+
0,
|
|
151
|
+
...this.gravity,
|
|
152
|
+
this.timeStep,
|
|
153
|
+
...(this.contact?.center ?? [0, 0, 0]),
|
|
154
|
+
this.contact?.radius ?? 0,
|
|
155
|
+
...(this.contact?.halfExtents ?? [0, 0, 0]),
|
|
156
|
+
this.contact ? this.indices.get(this.contact.link)! : 0
|
|
157
|
+
])
|
|
158
|
+
];
|
|
159
|
+
if (this.publishMatrices) {
|
|
160
|
+
names.push('matrices');
|
|
161
|
+
data.push(new Float32Array(this.links.length * 16));
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
const handles = data.map((values, index) => {
|
|
165
|
+
const usage =
|
|
166
|
+
(index === 5 ? Buffer.UNIFORM : Buffer.STORAGE) | Buffer.COPY_SRC | Buffer.COPY_DST;
|
|
167
|
+
const buffer = graph.device.createBuffer({
|
|
168
|
+
id: this.id + '-' + names[index],
|
|
169
|
+
data: values,
|
|
170
|
+
usage
|
|
171
|
+
});
|
|
172
|
+
this.buffers.push(buffer);
|
|
173
|
+
return graph.importBuffer({id: buffer.id, byteLength: buffer.byteLength, usage}, buffer);
|
|
174
|
+
});
|
|
175
|
+
const resources: GraphBufferUse[] = handles.map((buffer, index) => ({
|
|
176
|
+
buffer,
|
|
177
|
+
usage: index === 5 ? 'uniform' : index < 2 ? 'storage-read' : 'storage-read-write'
|
|
178
|
+
}));
|
|
179
|
+
const shaderLayout: ShaderLayout = {
|
|
180
|
+
attributes: [],
|
|
181
|
+
bindings: names.map(
|
|
182
|
+
(name, location): BindingDeclaration =>
|
|
183
|
+
location === 5
|
|
184
|
+
? {name, location, group: 0, type: 'uniform'}
|
|
185
|
+
: {name, location, group: 0, type: location < 2 ? 'read-only-storage' : 'storage'}
|
|
186
|
+
)
|
|
187
|
+
};
|
|
188
|
+
const props = {
|
|
189
|
+
source: getArticulationTreeShader(
|
|
190
|
+
this.links.length,
|
|
191
|
+
Boolean(this.contact),
|
|
192
|
+
this.publishMatrices
|
|
193
|
+
),
|
|
194
|
+
shaderLayout
|
|
195
|
+
};
|
|
196
|
+
const executable = (bound: BoundKernel): GPUCommandGraphComputeExecutable<P> => ({
|
|
197
|
+
encode: ({computePass, getBuffer}) => {
|
|
198
|
+
const bindings: Record<string, Binding> = {};
|
|
199
|
+
names.forEach((name, index) => {
|
|
200
|
+
bindings[name] = getBuffer(handles[index]);
|
|
201
|
+
});
|
|
202
|
+
bound.kernel.dispatch(computePass, {bindings, x: 1});
|
|
203
|
+
},
|
|
204
|
+
destroy: () => bound.kernel.destroy()
|
|
205
|
+
});
|
|
206
|
+
graph.addComputePass({
|
|
207
|
+
id: handles[0].id + '-joint-space',
|
|
208
|
+
description: 'Integrate joint-space dynamics and publish articulated link poses.',
|
|
209
|
+
resources,
|
|
210
|
+
compile: ({device}) => executable(createBoundKernel(device, props)),
|
|
211
|
+
compileAsync: async ({device}) => executable(await createBoundKernelAsync(device, props))
|
|
212
|
+
});
|
|
213
|
+
return handles[3];
|
|
214
|
+
} catch (error) {
|
|
215
|
+
this.destroy();
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
private driveIndex(id: string) {
|
|
221
|
+
const index = this.indices.get(id);
|
|
222
|
+
if (this.destroyed || !this.buffers.length || index === undefined || !this.links[index].axis)
|
|
223
|
+
throw new Error('Inactive or missing revolute drive');
|
|
224
|
+
return index;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Update the named revolute drive between submitted steps. */
|
|
228
|
+
setDrive(id: string, drive: GPUArticulationDrive) {
|
|
229
|
+
const index = this.driveIndex(id);
|
|
230
|
+
const values = new Float32Array([
|
|
231
|
+
drive.angle,
|
|
232
|
+
drive.stiffness,
|
|
233
|
+
drive.damping,
|
|
234
|
+
drive.maximumTorque
|
|
235
|
+
]);
|
|
236
|
+
if (!values.every(Number.isFinite) || values.slice(1).some(value => value < 0))
|
|
237
|
+
throw new Error('Invalid articulation drive');
|
|
238
|
+
this.buffers[1].write(values, index * 16);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Signed motor torque during the most recently accepted step. */
|
|
242
|
+
async readTorque(id: string) {
|
|
243
|
+
const index = this.driveIndex(id);
|
|
244
|
+
const bytes = await this.buffers[2].readAsync(index * 16 + 8, 4);
|
|
245
|
+
return new DataView(bytes.buffer, bytes.byteOffset, 4).getFloat32(0, true);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Read COM poses and world-space velocities in link order after stepping. */
|
|
249
|
+
async readState() {
|
|
250
|
+
const bytes = await this.buffers[3].readAsync();
|
|
251
|
+
const values = new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
|
|
252
|
+
return this.links.map((_, index) => {
|
|
253
|
+
const start = index * 16;
|
|
254
|
+
return {
|
|
255
|
+
position: Array.from(values.subarray(start, start + 3)),
|
|
256
|
+
orientation: Array.from(values.subarray(start + 4, start + 8)),
|
|
257
|
+
velocity: Array.from(values.subarray(start + 8, start + 11)),
|
|
258
|
+
angularVelocity: Array.from(values.subarray(start + 12, start + 15))
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/** Numerical failure latches and preserves the last accepted state. */
|
|
263
|
+
async readSimulationDiagnostics() {
|
|
264
|
+
const bytes = await this.buffers[4].readAsync();
|
|
265
|
+
const values = new Uint32Array(bytes.buffer, bytes.byteOffset, 2);
|
|
266
|
+
return {
|
|
267
|
+
steps: values[0],
|
|
268
|
+
complete: values[1] === 0,
|
|
269
|
+
...(this.contact
|
|
270
|
+
? {normalForce: new DataView(bytes.buffer, bytes.byteOffset).getFloat32(8, true)}
|
|
271
|
+
: {})
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
destroy() {
|
|
275
|
+
this.destroyed = true;
|
|
276
|
+
for (const buffer of this.buffers) buffer.destroy();
|
|
277
|
+
this.buffers.length = 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type GPURigidBodyCapture,
|
|
15
15
|
type GPURigidBodyWorldProps
|
|
16
16
|
} from './gpu-rigid-body-world';
|
|
17
|
+
import type {GPURigidBodyCapacityInfo} from './rigid-body-capacity';
|
|
17
18
|
|
|
18
19
|
export type GPUPhysicsWorldHandle = Readonly<{id: string; generation: number}>;
|
|
19
20
|
export type GPUPhysicsBatchProps = {
|
|
@@ -34,6 +35,8 @@ type Slot = {
|
|
|
34
35
|
checkpoint: GPURigidBodyGPUCheckpoint;
|
|
35
36
|
bytes: number;
|
|
36
37
|
worldBytes: number;
|
|
38
|
+
/** Physical scratch for the simulation graph and the world's private query graph. */
|
|
39
|
+
graphBytes: number;
|
|
37
40
|
handle: GPUPhysicsWorldHandle | null;
|
|
38
41
|
origin: [number, number, number];
|
|
39
42
|
active: boolean;
|
|
@@ -72,7 +75,7 @@ export class GPUPhysicsBatch {
|
|
|
72
75
|
const definition = structuredClone(props);
|
|
73
76
|
const probe = new GPURigidBodyWorld(definition);
|
|
74
77
|
try {
|
|
75
|
-
if (this.estimateResidentBytes(probe) > this.props.maximumResidentBytes)
|
|
78
|
+
if (this.estimateResidentBytes(probe.getCapacityInfo()) > this.props.maximumResidentBytes)
|
|
76
79
|
throw new Error('World and reset snapshot exceed residency budget');
|
|
77
80
|
this.templates.set(id, definition);
|
|
78
81
|
} finally {
|
|
@@ -115,13 +118,18 @@ export class GPUPhysicsBatch {
|
|
|
115
118
|
let graph: CompiledGPUCommandGraph<undefined> | undefined;
|
|
116
119
|
let checkpoint: GPURigidBodyGPUCheckpoint | undefined;
|
|
117
120
|
try {
|
|
118
|
-
|
|
119
|
-
const expectedBytes = this.estimateResidentBytes(world);
|
|
120
|
-
this.makeRoom(expectedBytes);
|
|
121
|
+
this.makeRoom(this.estimateResidentBytes(world.getCapacityInfo()));
|
|
121
122
|
const commands = new GPUCommandGraph<undefined>(this.props.device);
|
|
122
123
|
world.addToGraph(commands);
|
|
123
124
|
graph = await commands.compileAsync();
|
|
124
|
-
|
|
125
|
+
/** Attachment resolves scratch aliasing in the private cast index. */
|
|
126
|
+
const capacity = world.getCapacityInfo();
|
|
127
|
+
/** Graph scratch is resident, but is not copied to the reset snapshot. */
|
|
128
|
+
const graphBytes =
|
|
129
|
+
graph.stats.physicalTransientResourceBytes + capacity.queryIndexScratchBytes;
|
|
130
|
+
/** The admission estimate includes the private graph once. */
|
|
131
|
+
const bytes =
|
|
132
|
+
this.estimateResidentBytes(capacity) + graph.stats.physicalTransientResourceBytes;
|
|
125
133
|
this.makeRoom(bytes);
|
|
126
134
|
checkpoint = world.createGPUCheckpoint({includeRollbackScratch: false});
|
|
127
135
|
checkpoint.save();
|
|
@@ -131,7 +139,8 @@ export class GPUPhysicsBatch {
|
|
|
131
139
|
graph,
|
|
132
140
|
checkpoint,
|
|
133
141
|
bytes,
|
|
134
|
-
worldBytes,
|
|
142
|
+
worldBytes: capacity.ownedBufferBytes,
|
|
143
|
+
graphBytes,
|
|
135
144
|
handle: null,
|
|
136
145
|
origin: [0, 0, 0],
|
|
137
146
|
active: true,
|
|
@@ -290,10 +299,7 @@ export class GPUPhysicsBatch {
|
|
|
290
299
|
residentBytes: this.slots.reduce((sum, slot) => sum + slot.bytes, 0),
|
|
291
300
|
worldBufferBytes: this.slots.reduce((sum, slot) => sum + slot.worldBytes, 0),
|
|
292
301
|
checkpointBytes: this.slots.reduce((sum, slot) => sum + slot.checkpoint.byteLength, 0),
|
|
293
|
-
graphTransientBytes: this.slots.reduce(
|
|
294
|
-
(sum, slot) => sum + slot.graph.stats.physicalTransientResourceBytes,
|
|
295
|
-
0
|
|
296
|
-
),
|
|
302
|
+
graphTransientBytes: this.slots.reduce((sum, slot) => sum + slot.graphBytes, 0),
|
|
297
303
|
createdSlots: this.createdSlots,
|
|
298
304
|
reusedSlots: this.reusedSlots,
|
|
299
305
|
evictedSlots: this.evictedSlots
|
|
@@ -313,12 +319,12 @@ export class GPUPhysicsBatch {
|
|
|
313
319
|
this.destroyed = true;
|
|
314
320
|
}
|
|
315
321
|
|
|
316
|
-
|
|
317
|
-
|
|
322
|
+
/** Account for one reset copy of owned buffers and one copy of query scratch. */
|
|
323
|
+
private estimateResidentBytes(capacity: GPURigidBodyCapacityInfo): number {
|
|
318
324
|
const rollbackScratchBytes = capacity.buffers
|
|
319
325
|
.filter(buffer => buffer.name.startsWith('checkpoint-'))
|
|
320
326
|
.reduce((sum, buffer) => sum + buffer.byteLength, 0);
|
|
321
|
-
return capacity.ownedBufferBytes * 2 - rollbackScratchBytes;
|
|
327
|
+
return capacity.ownedBufferBytes * 2 - rollbackScratchBytes + capacity.queryIndexScratchBytes;
|
|
322
328
|
}
|
|
323
329
|
|
|
324
330
|
private makeRoom(bytes: number): void {
|
|
@@ -27,6 +27,7 @@ export type GPUPhysicsEnsembleProps = {
|
|
|
27
27
|
| 'continuous'
|
|
28
28
|
| 'collisionPartitionSize'
|
|
29
29
|
| 'ensembleBodiesPerInstance'
|
|
30
|
+
| 'ensemblePairsPerInstance'
|
|
30
31
|
| 'ensembleTerrainSlots'
|
|
31
32
|
| 'ensembleTerrainAtlas'
|
|
32
33
|
| 'maximumPairs'
|
|
@@ -38,6 +39,12 @@ export type GPUPhysicsEnsembleProps = {
|
|
|
38
39
|
terrainAtlas?: readonly GPUPhysicsTerrainAtlasPool[];
|
|
39
40
|
/** Shared power-of-two contact capacity. Overflow rejects the entire ensemble step. */
|
|
40
41
|
maximumPairs: number;
|
|
42
|
+
/**
|
|
43
|
+
* Optional power-of-two persistent contact budget per instance. Cache exhaustion rolls back
|
|
44
|
+
* and quarantines only that instance until reset. Global discovery and solver faults still
|
|
45
|
+
* reject the shared step. All instance budgets must fit within maximumPairs.
|
|
46
|
+
*/
|
|
47
|
+
maximumPairsPerInstance?: number;
|
|
41
48
|
/** Retained world buffers plus compiled graph scratch; excludes driver and compilation peaks. */
|
|
42
49
|
maximumResidentBytes: number;
|
|
43
50
|
};
|
|
@@ -144,6 +151,7 @@ export class GPUPhysicsEnsemble {
|
|
|
144
151
|
maximumPairs: props.maximumPairs,
|
|
145
152
|
collisionPartitionSize: colliderCount,
|
|
146
153
|
ensembleBodiesPerInstance: this.bodiesPerInstance,
|
|
154
|
+
ensemblePairsPerInstance: props.maximumPairsPerInstance,
|
|
147
155
|
ensembleTerrainAtlas: props.terrainAtlas,
|
|
148
156
|
ensembleTerrainSlots: this.terrainSlots.length
|
|
149
157
|
? Array.from({length: this.instances}, (_, instance) =>
|
|
@@ -161,9 +169,11 @@ export class GPUPhysicsEnsemble {
|
|
|
161
169
|
Math.min(device.limits.maxBufferSize, device.limits.maxStorageBufferBindingSize)
|
|
162
170
|
)
|
|
163
171
|
throw new Error('Ensemble terrain atlas exceeds device limits');
|
|
172
|
+
/** Reserve the private query graph along with the solver's owned buffers. */
|
|
173
|
+
const capacity = ensemble.world.getCapacityInfo();
|
|
164
174
|
if (
|
|
165
175
|
ensemble.minimumTerrainBytes > props.maximumResidentBytes ||
|
|
166
|
-
|
|
176
|
+
capacity.ownedBufferBytes + capacity.queryIndexScratchBytes > props.maximumResidentBytes
|
|
167
177
|
)
|
|
168
178
|
throw new Error('Ensemble residency budget exhausted');
|
|
169
179
|
const commands = new GPUCommandGraph<undefined>(device);
|
|
@@ -276,6 +286,7 @@ export class GPUPhysicsEnsemble {
|
|
|
276
286
|
this.world.wakeEnsembleInstance(instance);
|
|
277
287
|
}
|
|
278
288
|
|
|
289
|
+
/** Restore the template and clear this instance’s quarantine between submissions. */
|
|
279
290
|
async reset(instance: number): Promise<void> {
|
|
280
291
|
this.getBodyIndex(instance, 0);
|
|
281
292
|
this.preparing = true;
|
|
@@ -288,6 +299,7 @@ export class GPUPhysicsEnsemble {
|
|
|
288
299
|
}
|
|
289
300
|
}
|
|
290
301
|
|
|
302
|
+
/** Read the most recent scheduled participation and latched per-instance faults. */
|
|
291
303
|
async readStatus() {
|
|
292
304
|
const state = await this.world.readEnsembleState();
|
|
293
305
|
return {
|
|
@@ -298,7 +310,8 @@ export class GPUPhysicsEnsemble {
|
|
|
298
310
|
active: Boolean(state[17 + instance * 8]),
|
|
299
311
|
acceptedSteps: state[18 + instance * 8],
|
|
300
312
|
rejectedSteps: state[19 + instance * 8],
|
|
301
|
-
sharedFailure: Boolean(state[20 + instance * 8])
|
|
313
|
+
sharedFailure: Boolean(state[20 + instance * 8]),
|
|
314
|
+
failure: state[23 + instance * 8] ? ('contact-cache-capacity' as const) : null
|
|
302
315
|
}))
|
|
303
316
|
};
|
|
304
317
|
}
|
|
@@ -327,8 +340,11 @@ export class GPUPhysicsEnsemble {
|
|
|
327
340
|
}
|
|
328
341
|
|
|
329
342
|
getStats() {
|
|
330
|
-
|
|
331
|
-
const
|
|
343
|
+
/** Include query scratch in the same residency total as solver graph scratch. */
|
|
344
|
+
const {ownedBufferBytes: worldBufferBytes, queryIndexScratchBytes} =
|
|
345
|
+
this.world.getCapacityInfo();
|
|
346
|
+
const graphTransientBytes =
|
|
347
|
+
this.graph.stats.physicalTransientResourceBytes + queryIndexScratchBytes;
|
|
332
348
|
return {
|
|
333
349
|
instances: this.instances,
|
|
334
350
|
bodies: this.world.count,
|