diff --git a/aephysics/dynamics/module.ae b/aephysics/dynamics/module.ae index 18f9af5..a9c4b41 100644 --- a/aephysics/dynamics/module.ae +++ b/aephysics/dynamics/module.ae @@ -1035,6 +1035,15 @@ struct SphericalJoint { index_a: int index_b: int linear_impulse: Vec3 + // The point's anchors (frame A's and B's origins, world rotation, + // relative to the centres of mass) and the centres' offset, single + // precision as the reference keeps them: a plain ball joint's point + // is solved in single precision from these (spherical_point_f). Beside + // the flags, the indices and the impulse, so that solve's every pass + // reads one span of the joint, not that and a line 700 bytes on. + anchor_a: Vec3f + anchor_b: Vec3f + delta_center_f: Vec3f frame_a: Transform frame_b: Transform delta_center: Vec3 @@ -1078,13 +1087,6 @@ struct SphericalJoint { twist_limit_hertz: float twist_limit_damping_ratio: float twist_limit_softness: Softness // made each prepare, as the joint's limit_softness - // The point's anchors (frame A's and B's origins, world rotation, - // relative to the centres of mass) and the centres' offset, single - // precision as the reference keeps them: a plain ball joint's point - // is solved in single precision from these (spherical_point_f). - anchor_a: Vec3f - anchor_b: Vec3f - delta_center_f: Vec3f } struct WeldJoint { diff --git a/aephysics/snapshot/module.ae b/aephysics/snapshot/module.ae index 38d5fcf..e00388c 100644 --- a/aephysics/snapshot/module.ae +++ b/aephysics/snapshot/module.ae @@ -44,7 +44,7 @@ extern memcpy(dst: ptr, src: ptr, size: int) -> ptr extern memset(block: ptr, value: int, size: int) -> ptr const SNAPSHOT_MAGIC = 0x4E535041 // "APSN", little-endian -const SNAPSHOT_VERSION = 12 +const SNAPSHOT_VERSION = 13 const NULL_INDEX = 0 - 1 // --- the bytes written ------------------------------------------------------------------------------- diff --git a/bench/suite.ae b/bench/suite.ae index 4114b37..4b2a071 100644 --- a/bench/suite.ae +++ b/bench/suite.ae @@ -137,6 +137,9 @@ run(name: string, world_id: WorldId, scene_steps: int, scene: int) { refit_ms = 0.0 sleep_ms = 0.0 sensors_ms = 0.0 + setup_ms = 0.0 + constraints_ms = 0.0 + bullets_ms = 0.0 t0 = clock() s = 1 while s < steps { @@ -150,6 +153,9 @@ run(name: string, world_id: WorldId, scene_steps: int, scene: int) { refit_ms = refit_ms + seen.refit sleep_ms = sleep_ms + seen.sleep_islands sensors_ms = sensors_ms + seen.sensors + setup_ms = setup_ms + seen.solver_setup + constraints_ms = constraints_ms + seen.constraints + bullets_ms = bullets_ms + seen.bullets s = s + 1 } t1 = clock() @@ -159,6 +165,8 @@ run(name: string, world_id: WorldId, scene_steps: int, scene: int) { println("aephysics suite: ${name}: ${steps} steps of ${counters.body_count} bodies ${ms(t1 - t0)} ms, ${ms(t1 - t0) / timed} ms per step (height sum ${height_sum(world_id)}, ${counters.contact_count} contacts, ${counters.joint_count} joints, ${awake} awake)") println("aephysics phases ms/step: pairs ${pairs_ms / timed} collide ${collide_ms / timed}") println("aephysics stages ms/step: solve ${solve_ms / timed} transforms ${transforms_ms / timed} refit ${refit_ms / timed} sleep ${sleep_ms / timed} sensors ${sensors_ms / timed}") + // Inside the solve, as the reference's b3Profile splits it. + println("aephysics solve parts ms/step: setup ${setup_ms / timed} constraints ${constraints_ms / timed} transforms ${transforms_ms / timed} bullets ${bullets_ms / timed}") // The graph's colours, each one's contacts and joints (the overflow // last), as bench/suite_box3d.c prints the reference's. colors = "aephysics colors:" diff --git a/bench/suite_box3d.c b/bench/suite_box3d.c index d171d5f..52d9042 100644 --- a/bench/suite_box3d.c +++ b/bench/suite_box3d.c @@ -91,6 +91,7 @@ static void Run( const Scene* scene ) double pairs = 0.0, collide = 0.0, solve = 0.0, transforms = 0.0, refit = 0.0, sleep = 0.0, sensors = 0.0; // The solve's own stages, as bench/physics_world_box3d.c sums them, to // read beside ours (AEPHYSICS_STAGES=1). + double setup = 0.0, constraints = 0.0, bullets = 0.0; double prepare = 0.0, integrateV = 0.0, warm = 0.0, impulses = 0.0, integrateP = 0.0, relax = 0.0, restitution = 0.0, store = 0.0; double t0 = now_ms(); for ( int stepIndex = 1; stepIndex < steps; ++stepIndex ) @@ -108,6 +109,9 @@ static void Run( const Scene* scene ) refit += p.refit; sleep += p.sleepIslands; sensors += p.sensors; + setup += p.solverSetup; + constraints += p.constraints; + bullets += p.bullets; prepare += p.prepareConstraints; integrateV += p.integrateVelocities; warm += p.warmStart; @@ -127,6 +131,8 @@ static void Run( const Scene* scene ) printf( "box3d phases ms/step: pairs %.6f collide %.6f\n", pairs / timed, collide / timed ); printf( "box3d stages ms/step: solve %.6f transforms %.6f refit %.6f sleep %.6f sensors %.6f\n", solve / timed, transforms / timed, refit / timed, sleep / timed, sensors / timed ); + printf( "box3d solve parts ms/step: setup %.6f constraints %.6f transforms %.6f bullets %.6f\n", setup / timed, constraints / timed, + transforms / timed, bullets / timed ); printf( "box3d colors:" ); for ( int i = 0; i < 24; ++i ) {