-
Notifications
You must be signed in to change notification settings - Fork 555
[SceneKit] Update for Xcode 11 #7140
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
[SceneKit] Update for Xcode 11 #7140
Conversation
| [MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] | ||
| set; | ||
| } | ||
|
|
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.
Noob question - What does the MarshalDirective do here? Does NativePrefix = "xamarin_simd__" mean that this binding has something to do AOT compilation?
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.
MarshalDirective is a workaround we have to work around a calling convention limitation with P/Invokes.
The problem is that certain native types (such as Vector3) are not put in the normal registers when used as parameters to methods, instead they're passed in special SIMD registers. Unfortunately managed code (i.e. P/Invokes) doesn't know about this, so we can't call these native methods using P/Invokes because the arguments would be in the wrong registers.
Our workaround is a bit involved: we generate a native wrapper method where the parameters are passed in the expected registers, and that calls the actual native function, so that the native compiler puts the arguments in the right registers. The MarshalDirective attribute tells the generator that it should generate a call to the wrapper method instead of the normal P/Invoke (and that the name of the wrapper method is the name of the native function prefixed by xamarin_simd__, and the library where the wrapper method is located - __Internal means the executable itself).
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.
🤯 (takes it in slowly)
Thanks! 😃
|
Build failure Test results1 tests failed, 86 tests passed.Failed tests
|
| [Internal, Export ("setObject:forKeyedSubscript:")] | ||
| void _SetObject ([NullAllowed] NSObject obj, INSCopying key); | ||
|
|
||
| #if XAMCORE_2_0 // Metal is 64 bit only |
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.
Everything is XAMCORE_2_0 now, so this #if is not needed.
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.
True it's redundant but the PR is mergeable right now so I'm not gonna rebuild it (:
Will avoid next time.
| [MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] | ||
| set; | ||
| } | ||
|
|
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.
MarshalDirective is a workaround we have to work around a calling convention limitation with P/Invokes.
The problem is that certain native types (such as Vector3) are not put in the normal registers when used as parameters to methods, instead they're passed in special SIMD registers. Unfortunately managed code (i.e. P/Invokes) doesn't know about this, so we can't call these native methods using P/Invokes because the arguments would be in the wrong registers.
Our workaround is a bit involved: we generate a native wrapper method where the parameters are passed in the expected registers, and that calls the actual native function, so that the native compiler puts the arguments in the right registers. The MarshalDirective attribute tells the generator that it should generate a call to the wrapper method instead of the normal P/Invoke (and that the name of the wrapper method is the name of the native function prefixed by xamarin_simd__, and the library where the wrapper method is located - __Internal means the executable itself).
|
Known watchOS issue: https://github.com/xamarin/maccore/issues/1605 |
And
Xcode 11.1by extension but nothing changed.Note: it's the first time
Vector3are used in SceneKit APIs (usually it'sSCNVector3).It's debatable if we actually want to expose those APIs but it doesn't look like there are alternatives to those APIs.
In the case of other simd specific APIs using
Vector3orVector4, we did not port them because they had anSCNVectorequivalent (the simd being only more performant for Apple, not for us).