Skip to content

Commit

Permalink
Improved error message on failed version check (#928)
Browse files Browse the repository at this point in the history
See #923
  • Loading branch information
jrouwe authored Feb 14, 2024
1 parent 7cb5d1d commit 9631e21
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Jolt/RegisterTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ void RegisterTypesInternal(uint64 inVersionID)
if (!VerifyJoltVersionIDInternal(inVersionID))
{
Trace("Version mismatch, make sure you compile the client code with the same Jolt version and compiler definitions!");
uint64 mismatch = JPH_VERSION_ID ^ inVersionID;
auto check_bit = [mismatch](int inBit, const char *inLabel) { if (mismatch & (uint64(1) << (inBit + 23))) Trace("Mismatching define %s.", inLabel); };
check_bit(1, "JPH_DOUBLE_PRECISION");
check_bit(2, "JPH_CROSS_PLATFORM_DETERMINISTIC");
check_bit(3, "JPH_FLOATING_POINT_EXCEPTIONS_ENABLED");
check_bit(4, "JPH_PROFILE_ENABLED");
check_bit(5, "JPH_EXTERNAL_PROFILE");
check_bit(6, "JPH_DEBUG_RENDERER");
check_bit(7, "JPH_DISABLE_TEMP_ALLOCATOR");
check_bit(8, "JPH_DISABLE_CUSTOM_ALLOCATOR");
check_bit(9, "JPH_OBJECT_LAYER_BITS");
check_bit(10, "JPH_ENABLE_ASSERTS");
std::abort();
}

Expand Down

0 comments on commit 9631e21

Please sign in to comment.