@luma.gl/graph 10.0.0-alpha.7 → 10.0.0-alpha.9
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/dist.dev.js +5096 -7269
- package/dist/dist.min.js +270 -83
- package/dist/experimental/index.cjs.map +2 -2
- package/dist/experimental/simulation/index.cjs.map +2 -2
- package/dist/gpu-core/compiled-gpu-graph.cjs +99 -14
- package/dist/gpu-core/compiled-gpu-graph.d.ts +26 -4
- package/dist/gpu-core/compiled-gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.js +101 -13
- package/dist/gpu-core/compiled-gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.cjs +35 -3
- package/dist/gpu-core/gpu-command-graph-compiler.js +40 -4
- package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts +2 -0
- package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
- package/dist/gpu-core/gpu-compaction-operation.cjs +56 -0
- package/dist/gpu-core/gpu-compaction-operation.d.ts +20 -0
- package/dist/gpu-core/gpu-compaction-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-compaction-operation.js +36 -0
- package/dist/gpu-core/gpu-compaction-operation.js.map +1 -0
- package/dist/gpu-core/gpu-compaction.cjs +35 -3
- package/dist/gpu-core/gpu-compaction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-compaction.js +38 -3
- package/dist/gpu-core/gpu-compaction.js.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.cjs +18 -2
- package/dist/gpu-core/gpu-expression-operation.d.ts +2 -2
- package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.js +20 -1
- package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.cjs +140 -29
- package/dist/gpu-core/gpu-expression-plan.d.ts +26 -5
- package/dist/gpu-core/gpu-expression-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.js +168 -34
- package/dist/gpu-core/gpu-expression-plan.js.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.cjs +100 -11
- package/dist/gpu-core/gpu-graph-compiler.d.ts +7 -3
- package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.js +109 -9
- package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-graph-declarations.cjs +120 -0
- package/dist/gpu-core/gpu-graph-declarations.d.ts +4 -0
- package/dist/gpu-core/gpu-graph-declarations.d.ts.map +1 -0
- package/dist/gpu-core/gpu-graph-declarations.js +110 -0
- package/dist/gpu-core/gpu-graph-declarations.js.map +1 -0
- package/dist/gpu-core/gpu-graph-validation.cjs +33 -2
- package/dist/gpu-core/gpu-graph-validation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph-validation.js +32 -0
- package/dist/gpu-core/gpu-graph-validation.js.map +1 -1
- package/dist/gpu-core/gpu-graph-value.cjs +38 -3
- package/dist/gpu-core/gpu-graph-value.d.ts +50 -4
- package/dist/gpu-core/gpu-graph-value.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph-value.js +39 -1
- package/dist/gpu-core/gpu-graph-value.js.map +1 -1
- package/dist/gpu-core/gpu-graph.cjs +65 -0
- package/dist/gpu-core/gpu-graph.d.ts +15 -2
- package/dist/gpu-core/gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph.js +70 -0
- package/dist/gpu-core/gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-operation-contract.cjs +5 -0
- package/dist/gpu-core/gpu-operation-contract.d.ts +10 -0
- package/dist/gpu-core/gpu-operation-contract.d.ts.map +1 -1
- package/dist/gpu-core/gpu-operation-contract.js +6 -1
- package/dist/gpu-core/gpu-operation-contract.js.map +1 -1
- package/dist/gpu-core/gpu-scan.cjs +11 -2
- package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-scan.js +11 -2
- package/dist/gpu-core/gpu-scan.js.map +1 -1
- package/dist/gpu-core/gpu-texture-copy.cjs +53 -0
- package/dist/gpu-core/gpu-texture-copy.d.ts +7 -0
- package/dist/gpu-core/gpu-texture-copy.d.ts.map +1 -0
- package/dist/gpu-core/gpu-texture-copy.js +39 -0
- package/dist/gpu-core/gpu-texture-copy.js.map +1 -0
- package/dist/gpu-core/gpu-texture-plan.cjs +181 -0
- package/dist/gpu-core/gpu-texture-plan.d.ts +32 -0
- package/dist/gpu-core/gpu-texture-plan.d.ts.map +1 -0
- package/dist/gpu-core/gpu-texture-plan.js +215 -0
- package/dist/gpu-core/gpu-texture-plan.js.map +1 -0
- package/dist/gpu-core/gpu-transfer-lowering.cjs +109 -0
- package/dist/gpu-core/gpu-transfer-lowering.d.ts +9 -0
- package/dist/gpu-core/gpu-transfer-lowering.d.ts.map +1 -0
- package/dist/gpu-core/gpu-transfer-lowering.js +88 -0
- package/dist/gpu-core/gpu-transfer-lowering.js.map +1 -0
- package/dist/gpu-core/gpu-transfer-operation.cjs +100 -0
- package/dist/gpu-core/gpu-transfer-operation.d.ts +38 -0
- package/dist/gpu-core/gpu-transfer-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-transfer-operation.js +84 -0
- package/dist/gpu-core/gpu-transfer-operation.js.map +1 -0
- package/dist/gpu-core/index.cjs +13 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +11 -1
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +4 -1
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-dggs/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph/index.cjs +8 -0
- package/dist/gpu-graph/index.cjs.map +3 -3
- package/dist/gpu-graph/index.d.ts +5 -0
- package/dist/gpu-graph/index.d.ts.map +1 -1
- package/dist/gpu-graph/index.js +2 -0
- package/dist/gpu-graph/index.js.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +3 -3
- package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +56 -17
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +42 -2
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs.map +2 -2
- package/dist/gpu-physics/rigid-body-joints.cjs +6 -1
- package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-joints.js +9 -1
- package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +4 -2
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.js +4 -2
- package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +1 -0
- package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.js +1 -0
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-pointcloud/index.cjs.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.cjs +54 -7
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts +11 -4
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js +56 -4
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.cjs +16 -0
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts +11 -4
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.js +18 -0
- package/dist/gpu-simple-graph/gpu-simple-graph.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-transfer-execution.cjs +82 -0
- package/dist/gpu-simple-graph/gpu-transfer-execution.d.ts +7 -0
- package/dist/gpu-simple-graph/gpu-transfer-execution.d.ts.map +1 -0
- package/dist/gpu-simple-graph/gpu-transfer-execution.js +64 -0
- package/dist/gpu-simple-graph/gpu-transfer-execution.js.map +1 -0
- package/dist/gpu-simple-graph/index.cjs +3 -0
- package/dist/gpu-simple-graph/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/index.d.ts +3 -0
- package/dist/gpu-simple-graph/index.d.ts.map +1 -1
- package/dist/gpu-simple-graph/index.js +1 -0
- package/dist/gpu-simple-graph/index.js.map +1 -1
- package/dist/gpu-sql/{lu-sql.cjs → gpu-sql.cjs} +68 -68
- package/dist/gpu-sql/{lu-sql.d.ts → gpu-sql.d.ts} +14 -14
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -0
- package/dist/gpu-sql/{lu-sql.js → gpu-sql.js} +68 -68
- package/dist/gpu-sql/gpu-sql.js.map +1 -0
- package/dist/gpu-sql/index.cjs +5 -5
- package/dist/gpu-sql/index.cjs.map +2 -2
- package/dist/gpu-sql/index.d.ts +2 -2
- package/dist/gpu-sql/index.d.ts.map +1 -1
- package/dist/gpu-sql/index.js +1 -1
- package/dist/gpu-sql/index.js.map +1 -1
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
- package/src/gpu-core/compiled-gpu-graph.ts +118 -15
- package/src/gpu-core/gpu-command-graph-compiler.ts +38 -6
- package/src/gpu-core/gpu-command-graph-types.ts +2 -0
- package/src/gpu-core/gpu-compaction-operation.ts +49 -0
- package/src/gpu-core/gpu-compaction.ts +47 -3
- package/src/gpu-core/gpu-expression-operation.ts +23 -2
- package/src/gpu-core/gpu-expression-plan.ts +247 -44
- package/src/gpu-core/gpu-graph-compiler.ts +130 -11
- package/src/gpu-core/gpu-graph-declarations.ts +137 -0
- package/src/gpu-core/gpu-graph-validation.ts +32 -0
- package/src/gpu-core/gpu-graph-value.ts +88 -4
- package/src/gpu-core/gpu-graph.ts +104 -2
- package/src/gpu-core/gpu-operation-contract.ts +18 -0
- package/src/gpu-core/gpu-scan.ts +15 -2
- package/src/gpu-core/gpu-texture-copy.ts +51 -0
- package/src/gpu-core/gpu-texture-plan.ts +248 -0
- package/src/gpu-core/gpu-transfer-lowering.ts +102 -0
- package/src/gpu-core/gpu-transfer-operation.ts +110 -0
- package/src/gpu-core/index.ts +22 -1
- package/src/gpu-graph/index.ts +15 -0
- package/src/gpu-physics/gpu-rigid-body-world.ts +44 -3
- package/src/gpu-physics/rigid-body-joints.ts +11 -2
- package/src/gpu-physics/rigid-body-parallel-shaders.ts +4 -2
- package/src/gpu-physics/rigid-body-shaders.ts +1 -0
- package/src/gpu-project/README.md +4 -4
- package/src/gpu-simple-graph/compiled-gpu-expression-graph.ts +90 -8
- package/src/gpu-simple-graph/gpu-simple-graph.ts +56 -3
- package/src/gpu-simple-graph/gpu-transfer-execution.ts +73 -0
- package/src/gpu-simple-graph/index.ts +9 -0
- package/src/gpu-sql/{lu-sql.ts → gpu-sql.ts} +134 -125
- package/src/gpu-sql/index.ts +2 -2
- package/src/index.ts +29 -1
- package/dist/gpu-sql/lu-sql.d.ts.map +0 -1
- package/dist/gpu-sql/lu-sql.js.map +0 -1
|
@@ -383,7 +383,7 @@ class GPURigidBodyWorld {
|
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
385
|
addToGraph(graph) {
|
|
386
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
386
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
387
387
|
if (this.device || this.destroyed)
|
|
388
388
|
throw new Error("Rigid-body world already attached or destroyed");
|
|
389
389
|
const { packed, sparse, extended, parallel, geometryOffset, pairOffset, diagnosticOffset, metadataLength, parallelByteLength, triggerLayout, buffers: allocationPlan } = this.getStorageLayout();
|
|
@@ -623,6 +623,23 @@ class GPURigidBodyWorld {
|
|
|
623
623
|
parallelSleep: ["velocities", "angularVelocities", "bodies", "sleepStates", "parallelState"]
|
|
624
624
|
};
|
|
625
625
|
parallelBindings["parallelSolve"] = parallelBindings["parallelPairs"];
|
|
626
|
+
if ((_f = this.props.joints) == null ? void 0 : _f.length) {
|
|
627
|
+
const jointBindings = [
|
|
628
|
+
"settings",
|
|
629
|
+
"positions",
|
|
630
|
+
"orientations",
|
|
631
|
+
"velocities",
|
|
632
|
+
"angularVelocities",
|
|
633
|
+
"bodies",
|
|
634
|
+
"sleepStates",
|
|
635
|
+
"targets"
|
|
636
|
+
];
|
|
637
|
+
parallelBindings["parallelJointWarm"] = jointBindings;
|
|
638
|
+
parallelBindings["parallelJointSolve"] = jointBindings;
|
|
639
|
+
parallelBindings["parallelSolve"] = [
|
|
640
|
+
.../* @__PURE__ */ new Set([...parallelBindings["parallelSolve"], ...jointBindings])
|
|
641
|
+
];
|
|
642
|
+
}
|
|
626
643
|
this.simulationStatistics = allocate("simulation-statistics", 64);
|
|
627
644
|
const statisticsResource = graph.importBuffer({ id: `${this.id}-statistics`, byteLength: 64, usage: import_core.Buffer.STORAGE }, this.simulationStatistics);
|
|
628
645
|
const checkpointStates = [
|
|
@@ -649,15 +666,15 @@ class GPURigidBodyWorld {
|
|
|
649
666
|
return { buffer: binding.buffer, resource: binding.resource };
|
|
650
667
|
}), { buffer: this.simulationStatistics, resource: statisticsResource }, allocate) : void 0;
|
|
651
668
|
const continuousSelection = new Uint32Array(this.count);
|
|
652
|
-
for (const body of ((
|
|
669
|
+
for (const body of ((_g = this.props.continuous) == null ? void 0 : _g.bodies) ?? [])
|
|
653
670
|
continuousSelection[body] = this.colliders.findIndex((collider) => collider.body === body) + 1;
|
|
654
|
-
const continuous = this.props.continuous ? (0, import_rigid_body_continuous.addRigidBodyContinuous)(graph, this.id, source, this.count, continuousSelection, this.props.continuous.maximumImpacts ?? 4, bindings, allocate, Boolean((
|
|
671
|
+
const continuous = this.props.continuous ? (0, import_rigid_body_continuous.addRigidBodyContinuous)(graph, this.id, source, this.count, continuousSelection, this.props.continuous.maximumImpacts ?? 4, bindings, allocate, Boolean((_h = this.props.joints) == null ? void 0 : _h.length), this.props.continuous.mode === "convex" ? this.props.continuous.maximumCandidates ?? this.maximumPairs : 0, this.colliderStorageCount, extended, this.colliders.some((collider) => collider.shape.type === "convex-hull")) : void 0;
|
|
655
672
|
const triggers = triggerLayout ? (0, import_rigid_body_triggers.addRigidBodyTriggers)(graph, this.id, source, this.colliderStorageCount, triggerLayout, this.props.triggerEventCapacity ?? 256, bindings, {
|
|
656
673
|
name: "triggerStatistics",
|
|
657
674
|
buffer: this.simulationStatistics,
|
|
658
675
|
resource: statisticsResource,
|
|
659
676
|
location: 18
|
|
660
|
-
}, allocate, Boolean((
|
|
677
|
+
}, allocate, Boolean((_i = this.props.joints) == null ? void 0 : _i.length), extended) : void 0;
|
|
661
678
|
this.triggerEvents = (triggers == null ? void 0 : triggers.events) ?? null;
|
|
662
679
|
const passDescriptions = {
|
|
663
680
|
integrate: "Apply gravity and advance body velocities and predicted poses for this timestep.",
|
|
@@ -708,10 +725,10 @@ class GPURigidBodyWorld {
|
|
|
708
725
|
...this.ensembleBuffer ? ["parallelPrepareSleep"] : [],
|
|
709
726
|
"parallelMarkSleep",
|
|
710
727
|
"parallelSleep"
|
|
711
|
-
] : [...extended && ((
|
|
728
|
+
] : [...extended && ((_j = this.props.joints) == null ? void 0 : _j.length) ? ["meshCollect"] : [], "solve", "finish"]
|
|
712
729
|
]) {
|
|
713
730
|
if (entryPoint === "integrate")
|
|
714
|
-
(
|
|
731
|
+
(_k = restoreCheckpoint == null ? void 0 : restoreCheckpoint.save) == null ? void 0 : _k.call(restoreCheckpoint);
|
|
715
732
|
if (sparse && entryPoint === "collide") {
|
|
716
733
|
const bodyBinding = bindings.find((binding) => binding.name === "bodies");
|
|
717
734
|
const minimumBinding = bindings.find((binding) => binding.name === "minima");
|
|
@@ -758,11 +775,11 @@ class GPURigidBodyWorld {
|
|
|
758
775
|
"maxima"
|
|
759
776
|
].includes(binding.name)).map((binding) => binding.name) : entryPoint === "meshCollide" ? ["velocities", "angularVelocities", "manifolds", "sleepStates", "targets"] : entryPoint === "integrate" ? ["manifolds", ...this.ensembleBuffer ? ["meshTasks"] : []] : entryPoint === "collide" ? [
|
|
760
777
|
"sleepStates",
|
|
761
|
-
...extended || sparse || ((
|
|
762
|
-
] : entryPoint === "finish" ? ["manifolds", "meshTasks"] : ((
|
|
778
|
+
...extended || sparse || ((_l = this.props.joints) == null ? void 0 : _l.length) ? [] : ["targets"]
|
|
779
|
+
] : entryPoint === "finish" ? ["manifolds", "meshTasks"] : ((_m = this.props.joints) == null ? void 0 : _m.length) ? [] : ["targets"];
|
|
763
780
|
const unused = [
|
|
764
781
|
...unusedCore,
|
|
765
|
-
...entryPoint === "solve" && ((
|
|
782
|
+
...entryPoint === "solve" && ((_n = this.props.joints) == null ? void 0 : _n.length) ? ["meshTasks"] : [],
|
|
766
783
|
...entryPoint.startsWith("parallel") ? [] : ["parallelState", "parallelDispatch"],
|
|
767
784
|
...entryPoint === "bounds" ? [] : ["minima", "maxima"]
|
|
768
785
|
];
|
|
@@ -813,7 +830,12 @@ class GPURigidBodyWorld {
|
|
|
813
830
|
].includes(entryPoint));
|
|
814
831
|
const indirectResources = scheduledDispatch ? [{ buffer: schedulerBinding.resource, usage: "indirect" }] : indirectPairs ? [{ buffer: dispatchBinding.resource, usage: "indirect" }] : [];
|
|
815
832
|
if (entryPoint === "parallelSolve") {
|
|
816
|
-
const stages = [
|
|
833
|
+
const stages = [
|
|
834
|
+
"parallelWarm",
|
|
835
|
+
"parallelPairs",
|
|
836
|
+
"parallelGather",
|
|
837
|
+
...((_o = this.props.joints) == null ? void 0 : _o.length) ? ["parallelJointWarm", "parallelJointSolve"] : []
|
|
838
|
+
];
|
|
817
839
|
const properties = stages.map((stage) => ({
|
|
818
840
|
id: `${this.id}-${stage}`,
|
|
819
841
|
source,
|
|
@@ -858,9 +880,19 @@ class GPURigidBodyWorld {
|
|
|
858
880
|
};
|
|
859
881
|
dispatchPairs(computations[0]);
|
|
860
882
|
dispatchBodies(computations[2]);
|
|
883
|
+
if (computations[3])
|
|
884
|
+
computations[3].kernel.dispatch(computePass, {
|
|
885
|
+
bindings: computations[3].bindings,
|
|
886
|
+
x: 1
|
|
887
|
+
});
|
|
861
888
|
for (let iteration = 0; iteration < (this.props.iterations ?? 16); iteration++) {
|
|
862
889
|
dispatchPairs(computations[1]);
|
|
863
890
|
dispatchBodies(computations[2]);
|
|
891
|
+
if (computations[4])
|
|
892
|
+
computations[4].kernel.dispatch(computePass, {
|
|
893
|
+
bindings: computations[4].bindings,
|
|
894
|
+
x: 1
|
|
895
|
+
});
|
|
864
896
|
}
|
|
865
897
|
},
|
|
866
898
|
destroy: () => {
|
|
@@ -870,7 +902,9 @@ class GPURigidBodyWorld {
|
|
|
870
902
|
});
|
|
871
903
|
graph.addComputePass({
|
|
872
904
|
id: `${this.id}-solve`,
|
|
873
|
-
workload: {
|
|
905
|
+
workload: {
|
|
906
|
+
commandCount: (((_p = this.props.joints) == null ? void 0 : _p.length) ? 3 : 2) + (((_q = this.props.joints) == null ? void 0 : _q.length) ? 3 : 2) * (this.props.iterations ?? 16)
|
|
907
|
+
},
|
|
874
908
|
description: passDescriptions["solve"],
|
|
875
909
|
resources: [
|
|
876
910
|
...indirectResources,
|
|
@@ -1098,14 +1132,14 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1098
1132
|
}
|
|
1099
1133
|
else if(command.bodyIndex.y==5u){let body=command.bodyIndex.x;if(dynamic(body)){angularVelocities[body]=vec4f(angularVelocities[body].xyz+inverseInertia(body,command.impulse.xyz),0);}}
|
|
1100
1134
|
else if(command.bodyIndex.y==2u) {applyImpulse(command.bodyIndex.x,positions[command.bodyIndex.x].xyz,command.impulse.xyz);}
|
|
1101
|
-
${((
|
|
1135
|
+
${((_r = this.props.joints) == null ? void 0 : _r.length) ? "else if(command.bodyIndex.y==3u){targets.joints[command.bodyIndex.x].control.x=command.impulse.x;}" : ""}
|
|
1102
1136
|
else {targets.entries[command.bodyIndex.x].position=vec4f(command.point.xyz,1);targets.entries[command.bodyIndex.x].orientation=command.orientation;}
|
|
1103
1137
|
}
|
|
1104
1138
|
@compute @workgroup_size(64) fn invalidate(@builtin(global_invocation_id) invocation:vec3u) {
|
|
1105
1139
|
let index=invocation.x+invocation.y*4194240u;
|
|
1106
1140
|
if(index<BODY_COUNT){sleepStates[index]=vec4f(0);}
|
|
1107
1141
|
if(index<PAIR_CAPACITY){manifolds[index].count=0u;}
|
|
1108
|
-
${((
|
|
1142
|
+
${((_s = this.props.joints) == null ? void 0 : _s.length) ? `if(index<${this.props.joints.length}u){for(var row=0u;row<8u;row++){targets.joints[index].impulses[row]=0.0;}}` : ""}
|
|
1109
1143
|
}`,
|
|
1110
1144
|
entryPoint: "control",
|
|
1111
1145
|
shaderLayout: {
|
|
@@ -1143,7 +1177,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1143
1177
|
const invalidationBindings = [
|
|
1144
1178
|
"sleepStates",
|
|
1145
1179
|
"manifolds",
|
|
1146
|
-
...((
|
|
1180
|
+
...((_t = this.props.joints) == null ? void 0 : _t.length) ? ["targets"] : []
|
|
1147
1181
|
];
|
|
1148
1182
|
this.invalidation = (0, import_bound_kernel.createBoundKernel)(graph.device, {
|
|
1149
1183
|
...controlProperties,
|
|
@@ -1381,7 +1415,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1381
1415
|
}
|
|
1382
1416
|
/** Update motion properties between submissions; preserve the node pose when its COM changes. */
|
|
1383
1417
|
setBodyParameters(bodyIndex, parameters) {
|
|
1384
|
-
var _a, _b;
|
|
1418
|
+
var _a, _b, _c;
|
|
1385
1419
|
if (!this.device || !this.control || !this.controlSettings || this.destroyed || !Number.isInteger(bodyIndex) || !this.props.bodies[bodyIndex])
|
|
1386
1420
|
throw new Error("Invalid body mutation");
|
|
1387
1421
|
const previous = this.props.bodies[bodyIndex];
|
|
@@ -1397,11 +1431,16 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1397
1431
|
next.gravityFactor ?? 1
|
|
1398
1432
|
].every((value) => Number.isFinite(Math.fround(value))) || (next.inertiaDiagonal ?? []).some((value) => !Number.isFinite(Math.fround(value)) || value < 0) || next.inertiaOrientation && !next.inertiaDiagonal)
|
|
1399
1433
|
throw new Error("Invalid motion properties");
|
|
1434
|
+
if ((_a = this.props.joints) == null ? void 0 : _a.length) {
|
|
1435
|
+
const proposedBodies = [...this.props.bodies];
|
|
1436
|
+
proposedBodies[bodyIndex] = next;
|
|
1437
|
+
(0, import_rigid_body_joints.validateRigidBodyJoints)(this.props.joints, proposedBodies, this.solver);
|
|
1438
|
+
}
|
|
1400
1439
|
const colliders = this.colliders.filter((collider) => collider.body === bodyIndex);
|
|
1401
1440
|
for (const collider of colliders)
|
|
1402
1441
|
if ((collider.shape.type === "convex-hull" || collider.shape.type === "triangle-mesh") && mode !== "static" && mass > 0 && (!collider.shape.geometry.closed || !((0, import_rigid_body_shape_properties.getRigidBodyShapeProperties)(collider.shape).volume > 0)))
|
|
1403
1442
|
throw new Error("Dynamic meshes require closed positive-volume geometry");
|
|
1404
|
-
if (((
|
|
1443
|
+
if (((_b = this.props.continuous) == null ? void 0 : _b.bodies.includes(bodyIndex)) && (mode !== "dynamic" || mass === 0 || this.props.continuous.mode !== "convex" && (colliders[0].position ?? [0, 0, 0]).some((value, axis) => value !== center[axis])))
|
|
1405
1444
|
throw new Error("Mutation exceeds the continuous body envelope");
|
|
1406
1445
|
const compound = (0, import_rigid_body_properties.getCompoundBodyInertia)(mass, colliders, center);
|
|
1407
1446
|
const inertia = next.inertiaDiagonal ?? compound.diagonal;
|
|
@@ -1422,7 +1461,7 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1422
1461
|
metadata.write(new Float32Array((collider.position ?? [0, 0, 0]).map((value, axis) => value - center[axis])), this.count * 48 + index * 96 + 16);
|
|
1423
1462
|
attributes == null ? void 0 : attributes.write(new Uint32Array([bodyIndex | (mode === "dynamic" ? 65536 : 0)]), index * 4);
|
|
1424
1463
|
}
|
|
1425
|
-
(
|
|
1464
|
+
(_c = this.ownedBuffers.find((buffer) => buffer.id === `${this.id}-pose-metadata`)) == null ? void 0 : _c.write(new Float32Array(center), bodyIndex * 48);
|
|
1426
1465
|
const data = new ArrayBuffer(64);
|
|
1427
1466
|
new Float32Array(data).set([
|
|
1428
1467
|
...center.map((value, axis) => value - oldCenter[axis]),
|
|
@@ -36,7 +36,7 @@ export type GPURigidBodyWorldProps = {
|
|
|
36
36
|
publicationBounds?: readonly GPURigidBodyBounds[];
|
|
37
37
|
/** Publish rigid body-node matrices without requiring authored visual bounds. */
|
|
38
38
|
publishPoses?: boolean;
|
|
39
|
-
/** Up to 64
|
|
39
|
+
/** Up to 64 joints. Parallel solving supports static-anchored distance joints only. */
|
|
40
40
|
joints?: readonly GPURigidBodyJoint[];
|
|
41
41
|
gravity?: Vector3;
|
|
42
42
|
timeStep?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-rigid-body-world.d.ts","sourceRoot":"","sources":["../../src/gpu-physics/gpu-rigid-body-world.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,MAAM,EAMP,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EAEhB,yCAAsC;AAMvC,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEtB,KAAK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'angularVelocities', 'bodies', 'sleepStates', 'parallelState']
|
|
738
738
|
};
|
|
739
739
|
parallelBindings['parallelSolve'] = parallelBindings['parallelPairs'];
|
|
740
|
+
if (this.props.joints?.length) {
|
|
741
|
+
const jointBindings = [
|
|
742
|
+
'settings',
|
|
743
|
+
'positions',
|
|
744
|
+
'orientations',
|
|
745
|
+
'velocities',
|
|
746
|
+
'angularVelocities',
|
|
747
|
+
'bodies',
|
|
748
|
+
'sleepStates',
|
|
749
|
+
'targets'
|
|
750
|
+
];
|
|
751
|
+
parallelBindings['parallelJointWarm'] = jointBindings;
|
|
752
|
+
parallelBindings['parallelJointSolve'] = jointBindings;
|
|
753
|
+
parallelBindings['parallelSolve'] = [
|
|
754
|
+
...new Set([...parallelBindings['parallelSolve'], ...jointBindings])
|
|
755
|
+
];
|
|
756
|
+
}
|
|
740
757
|
this.simulationStatistics = allocate('simulation-statistics', 64);
|
|
741
758
|
const statisticsResource = graph.importBuffer({ id: `${this.id}-statistics`, byteLength: 64, usage: Buffer.STORAGE }, this.simulationStatistics);
|
|
742
759
|
const checkpointStates = [
|
|
@@ -996,7 +1013,12 @@ export class GPURigidBodyWorld {
|
|
|
996
1013
|
? [{ buffer: dispatchBinding.resource, usage: 'indirect' }]
|
|
997
1014
|
: [];
|
|
998
1015
|
if (entryPoint === 'parallelSolve') {
|
|
999
|
-
const stages = [
|
|
1016
|
+
const stages = [
|
|
1017
|
+
'parallelWarm',
|
|
1018
|
+
'parallelPairs',
|
|
1019
|
+
'parallelGather',
|
|
1020
|
+
...(this.props.joints?.length ? ['parallelJointWarm', 'parallelJointSolve'] : [])
|
|
1021
|
+
];
|
|
1000
1022
|
const properties = stages.map(stage => ({
|
|
1001
1023
|
id: `${this.id}-${stage}`,
|
|
1002
1024
|
source,
|
|
@@ -1041,9 +1063,19 @@ export class GPURigidBodyWorld {
|
|
|
1041
1063
|
};
|
|
1042
1064
|
dispatchPairs(computations[0]);
|
|
1043
1065
|
dispatchBodies(computations[2]);
|
|
1066
|
+
if (computations[3])
|
|
1067
|
+
computations[3].kernel.dispatch(computePass, {
|
|
1068
|
+
bindings: computations[3].bindings,
|
|
1069
|
+
x: 1
|
|
1070
|
+
});
|
|
1044
1071
|
for (let iteration = 0; iteration < (this.props.iterations ?? 16); iteration++) {
|
|
1045
1072
|
dispatchPairs(computations[1]);
|
|
1046
1073
|
dispatchBodies(computations[2]);
|
|
1074
|
+
if (computations[4])
|
|
1075
|
+
computations[4].kernel.dispatch(computePass, {
|
|
1076
|
+
bindings: computations[4].bindings,
|
|
1077
|
+
x: 1
|
|
1078
|
+
});
|
|
1047
1079
|
}
|
|
1048
1080
|
},
|
|
1049
1081
|
destroy: () => {
|
|
@@ -1054,7 +1086,10 @@ export class GPURigidBodyWorld {
|
|
|
1054
1086
|
// Iterations share one semantic graph node; dispatch boundaries synchronize pair and body owners.
|
|
1055
1087
|
graph.addComputePass({
|
|
1056
1088
|
id: `${this.id}-solve`,
|
|
1057
|
-
workload: {
|
|
1089
|
+
workload: {
|
|
1090
|
+
commandCount: (this.props.joints?.length ? 3 : 2) +
|
|
1091
|
+
(this.props.joints?.length ? 3 : 2) * (this.props.iterations ?? 16)
|
|
1092
|
+
},
|
|
1058
1093
|
description: passDescriptions['solve'],
|
|
1059
1094
|
resources: [
|
|
1060
1095
|
...indirectResources,
|
|
@@ -1665,6 +1700,11 @@ struct Command { impulse: vec4f, point: vec4f, orientation: vec4f, bodyIndex: ve
|
|
|
1665
1700
|
(next.inertiaDiagonal ?? []).some(value => !Number.isFinite(Math.fround(value)) || value < 0) ||
|
|
1666
1701
|
(next.inertiaOrientation && !next.inertiaDiagonal))
|
|
1667
1702
|
throw new Error('Invalid motion properties');
|
|
1703
|
+
if (this.props.joints?.length) {
|
|
1704
|
+
const proposedBodies = [...this.props.bodies];
|
|
1705
|
+
proposedBodies[bodyIndex] = next;
|
|
1706
|
+
validateRigidBodyJoints(this.props.joints, proposedBodies, this.solver);
|
|
1707
|
+
}
|
|
1668
1708
|
const colliders = this.colliders.filter(collider => collider.body === bodyIndex);
|
|
1669
1709
|
for (const collider of colliders)
|
|
1670
1710
|
if ((collider.shape.type === 'convex-hull' || collider.shape.type === 'triangle-mesh') &&
|