-
-
Notifications
You must be signed in to change notification settings - Fork 131
Improve no_std compatibility
#330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bushrat011899
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I know this looks like a large change, but it's almost entirely busywork with import names. This brings the project more Inline with how other no_std compatible libraries work, which should help with getting outside assistance.
ThierryBerger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks great! Thanks :)
That PR will need the changelog updated, but the PR description provides a good base for that 👍
|
I added a rough changelog entry, let me know if it's missing something or needs to be tweaked in some way |
|
Looking good, thanks! |
Fixes #84.
Updated alternative to #170.
Parry technically supports
no_std, but it is incredibly limited.SharedShape,partitioning,transformation, all of the polytopes, trimeshes, heightfields, and many more features are gated behindstd. This makes it practically unusable for physics inno_stdenvironments.Additionally, the current
no_stdsetup is quite confusing. ascoreis type aliased asstd, andallocis also only available ifstdis not. It would be much clearer to usecoreandallocdirectly, and enforce this via the official Clippy lints.This PR aims to improve Parry's
no_stdcompatibility. This allows Avian to supportno_std, and could be used for Rapier too. Prior to my changes here, I was getting numerous errors becauseSharedShapeandQbvh(among other types) requiredstd.Changes
This PR is large, but most changes are largely mechanical and fairly trivial, changing use of
stdtocoreoralloc.Some notable changes:
coreis no longer type aliased asstdinno_stdenvironments.coreandallocare used directly wherever possible.coreoverallocandstd, and use ofallocoverstdis enforced via Clippy lints.stdfeature gates have been changed toallocinstead.spadeis now optional, and must be disabled forno_std.stdfeature, I was getting errors aboutnum-traits. It seems that this is becausespadehas default features enabled for most of their dependencies (link).robusthas ano_stdfeature that we could manually enable, butnum-traitsjust hasstdandlibm, andspadeunconditionally enablesstd. So this would most likely have to be fixed inspade.hashbrownis now used instead ofrustc-hashfor theHashMapandHashSetwhenenhanced-determinismis not enabled. This also changes the hashing algorithm from fxhash to foldhash. Aside from havingno_stdsupport, foldhash should also be faster for larger inputs, and has fewer hash collisions, see foldhash.Things that still require
std:mesh_intersectionsandsplit_trimesh(spade)log)TriMesh::compute_connected_components(performs union-find usingena, which does not supportno_std)Usage without
allocis also still supported, though it is quite limited. It could be worth considering droppingno_allocsupport, since practical uses seem very limited and having to feature gate it everywhere is annoying, but I will leave that for future consideration.