Mochi.PhysX
Mochi.PhysX copied to clipboard
Ensure PxSomeFlag::Enum is passed correctly
PxFlags
are translated as [Flags]
-style C# enums. This works perfectly for the most part, but there are some places in PhysX where the underlying enum type is referenced directly. (IE: Referring to PxSomeFlag::Enum
instead of the PxFlags<PxSomeFlag::Enum, PxU8>
type.)
This could be problematic when sizeof(PxFlags<PxSomeFlag::Enum, PxU8>) != sizeof(PxSomeFlag::Enum)
(which is generally always when the second template argument isn't 32 bits.) In theory the enum values will always just go into a register anyway, but I need to double check this doesn't cause subtle issues.
It may be easier to just leave this issue to https://github.com/InfectedLibraries/Biohazrd/issues/32 since it probably depends on the target platform (and maybe even the target compiler.)
Can [MarshalAs]
be used to coerce the enum in these scenarios?