Skip to content

Conversation

@VincentDondain
Copy link
Contributor

And Xcode 11.1 by extension but nothing changed.

Note: it's the first time Vector3 are used in SceneKit APIs (usually it's SCNVector3).

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 Vector3 or Vector4, we did not port them because they had an SCNVector equivalent (the simd being only more performant for Apple, not for us).

[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
set;
}

Copy link
Contributor

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?

Copy link
Member

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).

Copy link
Contributor

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! 😃

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
🔥 Test run failed 🔥

Test results

1 tests failed, 86 tests passed.

Failed tests

  • monotouch-test/watchOS 32-bits - simulator/Release (all optimizations): Failed

[Internal, Export ("setObject:forKeyedSubscript:")]
void _SetObject ([NullAllowed] NSObject obj, INSCopying key);

#if XAMCORE_2_0 // Metal is 64 bit only
Copy link
Member

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.

Copy link
Contributor Author

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;
}

Copy link
Member

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).

@VincentDondain
Copy link
Contributor Author

Known watchOS issue: https://github.com/xamarin/maccore/issues/1605

[FAIL] NSMutableDictionary2Test.AddEntries :   ICE 1

@VincentDondain VincentDondain merged commit d81f05f into dotnet:xcode11.1 Oct 1, 2019
@VincentDondain VincentDondain deleted the xcode11.1-scenekit branch October 1, 2019 14:55
VincentDondain added a commit to VincentDondain/xamarin-macios that referenced this pull request Oct 16, 2019
@rolfbjarne rolfbjarne added the not-notes-worthy Ignore for release notes label Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-notes-worthy Ignore for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants