From e71aad979a5f795e6450cdb354c6d1c48f3d0585 Mon Sep 17 00:00:00 2001 From: Erin Catto Date: Sun, 28 Jul 2024 23:04:19 -0700 Subject: [PATCH] Updated amd benchmarks (#176) Update benchmark viewer Minor fixes --- benchmark/amd7950x/joint_grid.csv | 16 +- benchmark/amd7950x/large_pyramid.csv | 16 +- benchmark/amd7950x/many_pyramids.csv | 16 +- benchmark/amd7950x/smash.csv | 16 +- benchmark/amd7950x/tumbler.csv | 16 +- benchmark/benchmark_results.html | 335 +++++++++++++++++++-------- include/box2d/base.h | 2 +- include/box2d/collision.h | 2 + include/box2d/types.h | 26 +-- src/distance_joint.c | 6 + src/joint.c | 14 +- src/types.c | 12 +- 12 files changed, 307 insertions(+), 170 deletions(-) diff --git a/benchmark/amd7950x/joint_grid.csv b/benchmark/amd7950x/joint_grid.csv index bb0cd995..23169e43 100644 --- a/benchmark/amd7950x/joint_grid.csv +++ b/benchmark/amd7950x/joint_grid.csv @@ -1,9 +1,9 @@ threads,fps -1,173.008 -2,297.764 -3,438.296 -4,532.458 -5,620.827 -6,691.03 -7,758.122 -8,818.096 +1,331.343 +2,638.04 +3,932.731 +4,1200.15 +5,1480.23 +6,1718.79 +7,1930.12 +8,2133.65 diff --git a/benchmark/amd7950x/large_pyramid.csv b/benchmark/amd7950x/large_pyramid.csv index 1234eb8c..cec71107 100644 --- a/benchmark/amd7950x/large_pyramid.csv +++ b/benchmark/amd7950x/large_pyramid.csv @@ -1,9 +1,9 @@ threads,fps -1,267.265 -2,514.272 -3,744.924 -4,943.519 -5,1130.55 -6,1283.36 -7,1480.21 -8,1533.61 +1,325.705 +2,616.127 +3,886.575 +4,1118.85 +5,1331.22 +6,1498.6 +7,1685.28 +8,1728.1 diff --git a/benchmark/amd7950x/many_pyramids.csv b/benchmark/amd7950x/many_pyramids.csv index 0fde857e..f56a4281 100644 --- a/benchmark/amd7950x/many_pyramids.csv +++ b/benchmark/amd7950x/many_pyramids.csv @@ -1,9 +1,9 @@ threads,fps -1,67.678 -2,133.793 -3,197.986 -4,254.267 -5,311.206 -6,358.975 -7,420.59 -8,459.892 +1,82.8619 +2,160.906 +3,236.027 +4,300.688 +5,368.315 +6,429.822 +7,498.81 +8,549.271 diff --git a/benchmark/amd7950x/smash.csv b/benchmark/amd7950x/smash.csv index f3aa3efb..9c2fd141 100644 --- a/benchmark/amd7950x/smash.csv +++ b/benchmark/amd7950x/smash.csv @@ -1,9 +1,9 @@ threads,fps -1,152.303 -2,249.829 -3,323.223 -4,394.995 -5,450.773 -6,493.691 -7,534.984 -8,568.193 +1,173.898 +2,277.19 +3,357.566 +4,430.528 +5,483.446 +6,525.652 +7,566.859 +8,598.553 diff --git a/benchmark/amd7950x/tumbler.csv b/benchmark/amd7950x/tumbler.csv index e9a50d72..167b662d 100644 --- a/benchmark/amd7950x/tumbler.csv +++ b/benchmark/amd7950x/tumbler.csv @@ -1,9 +1,9 @@ threads,fps -1,294.906 -2,489.948 -3,663.544 -4,777.253 -5,919.769 -6,1024.42 -7,1115.04 -8,1197.18 +1,373.066 +2,581.852 +3,764.444 +4,902.898 +5,1044.99 +6,1143.44 +7,1229.87 +8,1299.61 diff --git a/benchmark/benchmark_results.html b/benchmark/benchmark_results.html index 4ca0667f..1736beda 100644 --- a/benchmark/benchmark_results.html +++ b/benchmark/benchmark_results.html @@ -1,6 +1,10 @@ + + @@ -9,193 +13,318 @@ Box2D Benchmarks + +

Box2D Benchmarks

- - + - - + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
diff --git a/include/box2d/base.h b/include/box2d/base.h index 566954d8..c8110a40 100644 --- a/include/box2d/base.h +++ b/include/box2d/base.h @@ -103,5 +103,5 @@ B2_API int64_t b2GetTicks(b2Timer* timer); B2_API float b2GetMilliseconds(const b2Timer* timer); B2_API float b2GetMillisecondsAndReset(b2Timer* timer); B2_API void b2SleepMilliseconds(int milliseconds); -B2_API void b2Yield(); +B2_API void b2Yield(void); //! @endcond diff --git a/include/box2d/collision.h b/include/box2d/collision.h index f3dc0b46..618d0f8d 100644 --- a/include/box2d/collision.h +++ b/include/box2d/collision.h @@ -251,6 +251,7 @@ B2_API b2CastOutput b2ShapeCastSegment(const b2ShapeCastInput* input, const b2Se B2_API b2CastOutput b2ShapeCastPolygon(const b2ShapeCastInput* input, const b2Polygon* shape); /// A convex hull. Used to create convex polygons. +/// @warning Do not modify these values directly, instead use b2ComputeHull() typedef struct b2Hull { /// The final points of the hull @@ -267,6 +268,7 @@ typedef struct b2Hull /// - less than 3 points /// - more than b2_maxPolygonVertices points /// This welds close points and removes collinear points. +/// @warning Do not modify a hull once it has been computed B2_API b2Hull b2ComputeHull(const b2Vec2* points, int32_t count); /// This determines if a hull is valid. Checks for: diff --git a/include/box2d/types.h b/include/box2d/types.h index 4add917e..4e973671 100644 --- a/include/box2d/types.h +++ b/include/box2d/types.h @@ -114,7 +114,7 @@ typedef struct b2WorldDef /// Use this to initialize your world definition /// @ingroup world -B2_API b2WorldDef b2DefaultWorldDef(); +B2_API b2WorldDef b2DefaultWorldDef(void); /// The body simulation type. /// Each body is one of these three types. The type determines how the body behaves in the simulation. @@ -208,7 +208,7 @@ typedef struct b2BodyDef /// Use this to initialize your body definition /// @ingroup body -B2_API b2BodyDef b2DefaultBodyDef(); +B2_API b2BodyDef b2DefaultBodyDef(void); /// This is used to filter collision on shapes. It affects shape-vs-shape collision /// and shape-versus-query collision (such as b2World_CastRay). @@ -249,7 +249,7 @@ typedef struct b2Filter /// Use this to initialize your filter /// @ingroup shape -B2_API b2Filter b2DefaultFilter(); +B2_API b2Filter b2DefaultFilter(void); /// The query filter is used to filter collisions between queries and shapes. For example, /// you may want a ray-cast representing a projectile to hit players and the static environment @@ -267,7 +267,7 @@ typedef struct b2QueryFilter /// Use this to initialize your query filter /// @ingroup shape -B2_API b2QueryFilter b2DefaultQueryFilter(); +B2_API b2QueryFilter b2DefaultQueryFilter(void); /// Shape type /// @ingroup shape @@ -341,7 +341,7 @@ typedef struct b2ShapeDef /// Use this to initialize your shape definition /// @ingroup shape -B2_API b2ShapeDef b2DefaultShapeDef(); +B2_API b2ShapeDef b2DefaultShapeDef(void); /// Used to create a chain of edges. This is designed to eliminate ghost collisions with some limitations. /// - chains are one-sided @@ -387,7 +387,7 @@ typedef struct b2ChainDef /// Use this to initialize your chain definition /// @ingroup shape -B2_API b2ChainDef b2DefaultChainDef(); +B2_API b2ChainDef b2DefaultChainDef(void); //! @cond /// Profiling data. Times are in milliseconds. @@ -515,7 +515,7 @@ typedef struct b2DistanceJointDef /// Use this to initialize your joint definition /// @ingroup distance_joint -B2_API b2DistanceJointDef b2DefaultDistanceJointDef(); +B2_API b2DistanceJointDef b2DefaultDistanceJointDef(void); /// A motor joint is used to control the relative motion between two bodies /// @@ -556,7 +556,7 @@ typedef struct b2MotorJointDef /// Use this to initialize your joint definition /// @ingroup motor_joint -B2_API b2MotorJointDef b2DefaultMotorJointDef(); +B2_API b2MotorJointDef b2DefaultMotorJointDef(void); /// A mouse joint is used to make a point on a body track a specified world point. /// @@ -595,7 +595,7 @@ typedef struct b2MouseJointDef /// Use this to initialize your joint definition /// @ingroup mouse_joint -B2_API b2MouseJointDef b2DefaultMouseJointDef(); +B2_API b2MouseJointDef b2DefaultMouseJointDef(void); /// Prismatic joint definition /// @@ -663,7 +663,7 @@ typedef struct b2PrismaticJointDef /// Use this to initialize your joint definition /// @ingroupd prismatic_joint -B2_API b2PrismaticJointDef b2DefaultPrismaticJointDef(); +B2_API b2PrismaticJointDef b2DefaultPrismaticJointDef(void); /// Revolute joint definition /// @@ -737,7 +737,7 @@ typedef struct b2RevoluteJointDef /// Use this to initialize your joint definition. /// @ingroup revolute_joint -B2_API b2RevoluteJointDef b2DefaultRevoluteJointDef(); +B2_API b2RevoluteJointDef b2DefaultRevoluteJointDef(void); /// Weld joint definition /// @@ -786,7 +786,7 @@ typedef struct b2WeldJointDef /// Use this to initialize your joint definition /// @ingroup weld_joint -B2_API b2WeldJointDef b2DefaultWeldJointDef(); +B2_API b2WeldJointDef b2DefaultWeldJointDef(void); /// Wheel joint definition /// @@ -851,7 +851,7 @@ typedef struct b2WheelJointDef /// Use this to initialize your joint definition /// @ingroup wheel_joint -B2_API b2WheelJointDef b2DefaultWheelJointDef(); +B2_API b2WheelJointDef b2DefaultWheelJointDef(void); /** * @defgroup events Events diff --git a/src/distance_joint.c b/src/distance_joint.c index 789308ba..70ac9574 100644 --- a/src/distance_joint.c +++ b/src/distance_joint.c @@ -40,6 +40,12 @@ void b2DistanceJoint_EnableLimit(b2JointId jointId, bool enableLimit) joint->enableLimit = enableLimit; } +bool b2DistanceJoint_IsLimitEnabled(b2JointId jointId) +{ + b2JointSim* joint = b2GetJointSimCheckType(jointId, b2_distanceJoint); + return joint->distanceJoint.enableLimit; +} + void b2DistanceJoint_SetLengthRange(b2JointId jointId, float minLength, float maxLength) { b2JointSim* base = b2GetJointSimCheckType(jointId, b2_distanceJoint); diff --git a/src/joint.c b/src/joint.c index 00cae634..06e45104 100644 --- a/src/joint.c +++ b/src/joint.c @@ -16,7 +16,7 @@ #include -b2DistanceJointDef b2DefaultDistanceJointDef() +b2DistanceJointDef b2DefaultDistanceJointDef(void) { b2DistanceJointDef def = {0}; def.length = 1.0f; @@ -25,7 +25,7 @@ b2DistanceJointDef b2DefaultDistanceJointDef() return def; } -b2MotorJointDef b2DefaultMotorJointDef() +b2MotorJointDef b2DefaultMotorJointDef(void) { b2MotorJointDef def = {0}; def.maxForce = 1.0f; @@ -35,7 +35,7 @@ b2MotorJointDef b2DefaultMotorJointDef() return def; } -b2MouseJointDef b2DefaultMouseJointDef() +b2MouseJointDef b2DefaultMouseJointDef(void) { b2MouseJointDef def = {0}; def.hertz = 4.0f; @@ -45,7 +45,7 @@ b2MouseJointDef b2DefaultMouseJointDef() return def; } -b2PrismaticJointDef b2DefaultPrismaticJointDef() +b2PrismaticJointDef b2DefaultPrismaticJointDef(void) { b2PrismaticJointDef def = {0}; def.localAxisA = (b2Vec2){1.0f, 0.0f}; @@ -53,7 +53,7 @@ b2PrismaticJointDef b2DefaultPrismaticJointDef() return def; } -b2RevoluteJointDef b2DefaultRevoluteJointDef() +b2RevoluteJointDef b2DefaultRevoluteJointDef(void) { b2RevoluteJointDef def = {0}; def.drawSize = 0.25f; @@ -61,14 +61,14 @@ b2RevoluteJointDef b2DefaultRevoluteJointDef() return def; } -b2WeldJointDef b2DefaultWeldJointDef() +b2WeldJointDef b2DefaultWeldJointDef(void) { b2WeldJointDef def = {0}; def.internalValue = B2_SECRET_COOKIE; return def; } -b2WheelJointDef b2DefaultWheelJointDef() +b2WheelJointDef b2DefaultWheelJointDef(void) { b2WheelJointDef def = {0}; def.localAxisA.y = 1.0f; diff --git a/src/types.c b/src/types.c index 3803cb0d..943ef31e 100644 --- a/src/types.c +++ b/src/types.c @@ -5,7 +5,7 @@ #include "box2d/types.h" -b2WorldDef b2DefaultWorldDef() +b2WorldDef b2DefaultWorldDef(void) { b2WorldDef def = {0}; def.gravity.x = 0.0f; @@ -23,7 +23,7 @@ b2WorldDef b2DefaultWorldDef() return def; } -b2BodyDef b2DefaultBodyDef() +b2BodyDef b2DefaultBodyDef(void) { b2BodyDef def = {0}; def.type = b2_staticBody; @@ -37,19 +37,19 @@ b2BodyDef b2DefaultBodyDef() return def; } -b2Filter b2DefaultFilter() +b2Filter b2DefaultFilter(void) { b2Filter filter = {0x00000001, 0xFFFFFFFF, 0}; return filter; } -b2QueryFilter b2DefaultQueryFilter() +b2QueryFilter b2DefaultQueryFilter(void) { b2QueryFilter filter = {0x00000001, 0xFFFFFFFF}; return filter; } -b2ShapeDef b2DefaultShapeDef() +b2ShapeDef b2DefaultShapeDef(void) { b2ShapeDef def = {0}; def.friction = 0.6f; @@ -61,7 +61,7 @@ b2ShapeDef b2DefaultShapeDef() return def; } -b2ChainDef b2DefaultChainDef() +b2ChainDef b2DefaultChainDef(void) { b2ChainDef def = {0}; def.friction = 0.6f;