-
Notifications
You must be signed in to change notification settings - Fork 8
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
Comment on System.Numerics in the readme #1
Comments
Was just going to comment the same 😄 C# emits classes using |
Thanks for the tip. Will leave this issue open and upgrade when I’ll have time. Will definitely work for vectors, quaternions and 4x4 matrices About 3x2 matrices, do you happen to know have someone tested Matrix3x2 from .NET against the corresponding C++ class from Windows SDK? https://docs.microsoft.com/en-us/windows/win32/api/d2d1helper/nl-d2d1helper-matrix3x2f I did and I think I had to make some compatibility adjustments to my initial implementation of these matrices. |
|
An example of the upper layer of the ABI: https://github.com/Const-me/Vrmac/blob/master/VrmacInterop/Draw/Direct2D/iDrawContext.cs#L29 There’re more methods passing them between C++ and C#, they are used a lot over both 2D backends. When running on Windows, my COM runtime compiles that method into unmanaged delegate with On Windows, the layer below that are C++ methods with Does this mean the 3x2 matrices from .NET Numerics are binary compatible with D2D matrices? Also, do you happen to know the operations on these matrices, especially vector transform and inversion, are identical (apart from inevitable float precision issues caused by FMA and other factors, I’m fine with them) across the 2 implementations, in .NET and D2D? |
It would depend on the underlying ABI and would require more investigation. I believe in the case of Matrix3x2 they are compatible, but there can be lots of tiny nuances when you actually dig into things: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019#return-values
I haven't done any analysis to determine if we are or are not compatible with the Direct2D algorithms (or DirectX Math). In general, I would expect results to at least be similar. |
@tannergooding Fixed now. Will release 1.1 after improving couple more things. Had no compatibility issues with 3x2 matrices, tested both 2D backends on Windows, and my custom one on Linux. But I had a couple with 4x4 ones: https://github.com/Const-me/Vrmac/blob/master/Vrmac/Utils/Math/DiligentMatrices.cs The projection was expected, but I forgot I have also patched LookAt in the old MonoGame-based code. |
Fixed in 1.1 |
From the readme:
C# structs use sequential layout by default, which means they all are.
The text was updated successfully, but these errors were encountered: