Skip to content

Commit 98309e6

Browse files
committed
changed B2_VALIDATE to DEBUG define
1 parent 0a41d9b commit 98309e6

File tree

14 files changed

+65
-24
lines changed

14 files changed

+65
-24
lines changed

src/Box2D.NET.Samples/Box2D.NET.Samples.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
1616
<DefineConstants>$(DefineConstants);ENABLED</DefineConstants>
1717
</PropertyGroup>
18-
18+
1919
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
20-
<DefineConstants>$(DefineConstants);B2_SNOOP_TOI_COUNTERS;ENABLED</DefineConstants>
20+
<DefineConstants>$(DefineConstants);B2_SNOOP_TOI_COUNTERS;ENABLED;B2_SNOOP_TABLE_COUNTERS;B2_SNOOP_PAIR_COUNTERS</DefineConstants>
2121
</PropertyGroup>
2222

2323
<ItemGroup>

src/Box2D.NET.Shared/Box2D.NET.Shared.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
<PackageReleaseNotes>https://github.com/ikpil/Box2D.NET/blob/main/CHANGELOG.md</PackageReleaseNotes>
1414
</PropertyGroup>
1515

16+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
17+
<DefineConstants>$(DefineConstants);ENABLED</DefineConstants>
18+
</PropertyGroup>
19+
20+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
21+
<DefineConstants>$(DefineConstants);B2_SNOOP_TOI_COUNTERS;ENABLED;B2_SNOOP_TABLE_COUNTERS;B2_SNOOP_PAIR_COUNTERS</DefineConstants>
22+
</PropertyGroup>
23+
1624
<ItemGroup>
1725
<None Include="../../README.md" Pack="true" PackagePath="\"/>
1826
</ItemGroup>

src/Box2D.NET/B2BoardPhases.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public static void b2ValidateBroadphase(B2BroadPhase bp)
523523

524524
public static void b2ValidateNoEnlarged(B2BroadPhase bp)
525525
{
526-
#if B2_VALIDATE
526+
#if DEBUG
527527
for (int j = 0; j < (int)B2BodyType.b2_bodyTypeCount; ++j)
528528
{
529529
B2DynamicTree tree = bp.trees[j];

src/Box2D.NET/B2ContactSim.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class B2ContactSim
1111
{
1212
public int contactId;
1313

14-
#if B2_VALIDATE
14+
#if DEBUG
1515
public int bodyIdA;
1616
public int bodyIdB;
1717
#endif
@@ -45,7 +45,7 @@ public void CopyFrom(B2ContactSim other)
4545
{
4646
contactId = other.contactId;
4747

48-
#if B2_VALIDATE
48+
#if DEBUG
4949
bodyIdA = other.bodyIdA;
5050
bodyIdB = other.bodyIdB;
5151
#endif

src/Box2D.NET/B2ContactSolvers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void b2PrepareOverflowContacts(B2StepContext context)
3939
B2ContactSim[] contacts = color.contactSims.data;
4040
B2BodyState[] awakeStates = context.states;
4141

42-
#if B2_VALIDATE
42+
#if DEBUG
4343
B2Body[] bodies = world.bodies.data;
4444
#endif
4545

@@ -61,7 +61,7 @@ public static void b2PrepareOverflowContacts(B2StepContext context)
6161
int indexA = contactSim.bodySimIndexA;
6262
int indexB = contactSim.bodySimIndexB;
6363

64-
#if B2_VALIDATE
64+
#if DEBUG
6565
B2Body bodyA = bodies[contactSim.bodyIdA];
6666
int validIndexA = bodyA.setIndex == (int)B2SetType.b2_awakeSet ? bodyA.localIndex : B2_NULL_INDEX;
6767
B2_ASSERT(indexA == validIndexA);
@@ -1123,7 +1123,7 @@ public static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepCon
11231123
Span<B2ContactSim> contacts = context.contacts;
11241124
Span<B2ContactConstraintSIMD> constraints = context.simdContactConstraints;
11251125
B2BodyState[] awakeStates = context.states;
1126-
#if B2_VALIDATE
1126+
#if DEBUG
11271127
B2Body[] bodies = world.bodies.data;
11281128
#endif
11291129

@@ -1148,7 +1148,7 @@ public static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepCon
11481148
int indexA = contactSim.bodySimIndexA;
11491149
int indexB = contactSim.bodySimIndexB;
11501150

1151-
#if B2_VALIDATE
1151+
#if DEBUG
11521152
B2Body bodyA = bodies[contactSim.bodyIdA];
11531153
int validIndexA = bodyA.setIndex == (int)B2SetType.b2_awakeSet ? bodyA.localIndex : B2_NULL_INDEX;
11541154
B2Body bodyB = bodies[contactSim.bodyIdB];

src/Box2D.NET/B2Contacts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public static void b2CreateContact(B2World world, B2Shape shapeA, B2Shape shapeB
276276
ref B2ContactSim contactSim = ref b2Array_Add(ref set.contactSims);
277277
contactSim.contactId = contactId;
278278

279-
#if B2_VALIDATE
279+
#if DEBUG
280280
contactSim.bodyIdA = shapeA.bodyId;
281281
contactSim.bodyIdB = shapeB.bodyId;
282282
#endif

src/Box2D.NET/B2DynamicTrees.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ public static B2AABB b2DynamicTree_GetRootBounds(B2DynamicTree tree)
921921
return empty;
922922
}
923923

924-
#if B2_VALIDATE
924+
#if DEBUG
925925
// Compute the height of a sub-tree.
926926
public static int b2ComputeHeight(B2DynamicTree tree, int nodeId)
927927
{
@@ -1025,7 +1025,7 @@ public static void b2ValidateMetrics(B2DynamicTree tree, int index)
10251025
/// Validate this tree. For testing.
10261026
public static void b2DynamicTree_Validate(B2DynamicTree tree)
10271027
{
1028-
#if B2_VALIDATE
1028+
#if DEBUG
10291029
if (tree.root == B2_NULL_INDEX)
10301030
{
10311031
return;
@@ -1056,7 +1056,7 @@ public static void b2DynamicTree_Validate(B2DynamicTree tree)
10561056
/// Validate this tree has no enlarged AABBs. For testing.
10571057
public static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree)
10581058
{
1059-
#if B2_VALIDATE
1059+
#if DEBUG
10601060
int capacity = tree.nodeCapacity;
10611061
B2TreeNode[] nodes = tree.nodes;
10621062
for (int i = 0; i < capacity; ++i)
@@ -1986,7 +1986,7 @@ public static int b2DynamicTree_Rebuild(B2DynamicTree tree, bool fullBuild)
19861986
node = ref nodes[nodeIndex];
19871987
}
19881988

1989-
#if B2_VALIDATE
1989+
#if DEBUG
19901990
int capacity = tree.nodeCapacity;
19911991
for (int i = 0; i < capacity; ++i)
19921992
{

src/Box2D.NET/B2IdPools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static void b2FreeId(B2IdPool pool, int id)
6161
b2Array_Push(ref pool.freeArray, id);
6262
}
6363

64-
#if B2_VALIDATE
64+
#if DEBUG
6565
public static void b2ValidateFreeId(B2IdPool pool, int id)
6666
{
6767
int freeCount = pool.freeArray.count;

src/Box2D.NET/B2Islands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ public static void b2SplitIslandTask(int startIndex, int endIndex, uint threadIn
881881
b2TracyCZoneEnd(B2TracyCZone.split);
882882
}
883883

884-
#if B2_VALIDATE
884+
#if DEBUG
885885
public static void b2ValidateIsland(B2World world, int islandId)
886886
{
887887
B2Island island = b2Array_Get(ref world.islands, islandId);

src/Box2D.NET/B2Worlds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,7 @@ public static void b2World_EnableSpeculative(B2WorldId worldId, bool flag)
27752775
world.enableSpeculative = flag;
27762776
}
27772777

2778-
#if B2_VALIDATE
2778+
#if DEBUG
27792779
// When validating islands ids I have to compare the root island
27802780
// ids because islands are not merged until the next time step.
27812781
public static int b2GetRootIslandId(B2World world, int islandId)

0 commit comments

Comments
 (0)