Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/arkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,14 @@ interface ARVideoFormat : NSCopying {
[iOS (16, 0)]
[Export ("videoHDRSupported")]
bool IsVideoHdrSupported { [Bind ("isVideoHDRSupported")] get; }

[iOS (26, 0)]
[Export ("defaultColorSpace")]
AVCaptureColorSpace DefaultColorSpace { get; }

[iOS (26, 0)]
[Export ("defaultPhotoSettings")]
AVCapturePhotoSettings DefaultPhotoSettings { get; }
}

/// <summary>A subclass of <see cref="SceneKit.SCNView" /> that supports augmented-reality content.</summary>
Expand Down Expand Up @@ -1038,8 +1046,15 @@ interface ARSession {
[Async]
[Export ("captureHighResolutionFrameWithCompletion:")]
void CaptureHighResolutionFrame (Action<ARFrame?, NSError?> handler);

[iOS (26, 0)]
[Async]
[Export ("captureHighResolutionFrameUsingPhotoSettings:completion:")]
void CaptureHighResolutionFrame ([NullAllowed] AVCapturePhotoSettings photoSettings, ARSessionCaptureHighResolutionFrame completion);
}

delegate void ARSessionCaptureHighResolutionFrame ([NullAllowed] ARFrame frame, [NullAllowed] NSError error);

/// <summary>Interface defining methods that respond to events in an <see cref="ARKit.ARSession" />.</summary>
/// <remarks>To be added.</remarks>
[NoTV, NoMac]
Expand Down Expand Up @@ -1140,6 +1155,10 @@ interface ARConfiguration : NSCopying {
[Export ("isSupported")]
bool IsSupported { get; }

[Static]
[Export ("supportedVideoFormats")]
ARVideoFormat [] SupportedVideoFormats { get; }

[Export ("videoFormat", ArgumentSemantic.Strong)]
ARVideoFormat VideoFormat { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8645,6 +8645,7 @@ M:ARKit.ARReferenceImage.ValidateAsync
M:ARKit.ARSCNView.ARSCNViewAppearance.#ctor(System.IntPtr)
M:ARKit.ARSCNView.Dispose(System.Boolean)
M:ARKit.ARSession.CaptureHighResolutionFrameAsync
M:ARKit.ARSession.CaptureHighResolutionFrameAsync(AVFoundation.AVCapturePhotoSettings)
M:ARKit.ARSession.Dispose(System.Boolean)
M:ARKit.ARSession.GetGeoLocationAsync(CoreGraphics.NVector3)
M:ARKit.ARSession.TrackedRaycastAsync(ARKit.ARRaycastQuery,ARKit.ARTrackedRaycast@)
Expand Down Expand Up @@ -26118,6 +26119,7 @@ T:ARKit.ARRaycastTarget
T:ARKit.ARRaycastTargetAlignment
T:ARKit.ARSceneReconstruction
T:ARKit.ARSegmentationClass
T:ARKit.ARSessionCaptureHighResolutionFrame
T:ARKit.ARSkeletonJointName
T:ARKit.GetGeolocationCallback
T:AudioToolbox.AudioCodecContentSource
Expand Down
23 changes: 20 additions & 3 deletions tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-ARKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@
!missing-protocol! ARSKViewDelegate not bound
!missing-protocol! ARTrackable not bound
!missing-selector! +ARBodyTrackingConfiguration::supportsAppClipCodeTracking not bound
!missing-selector! +ARConfiguration::configurableCaptureDeviceForPrimaryCamera not bound
!missing-selector! +ARConfiguration::isSupported not bound
!missing-selector! +ARConfiguration::recommendedVideoFormatFor4KResolution not bound
!missing-selector! +ARConfiguration::recommendedVideoFormatForHighResolutionFrameCapturing not bound
!missing-selector! +ARConfiguration::supportedVideoFormats not bound
!missing-selector! +ARConfiguration::supportsFrameSemantics: not bound
!missing-selector! +ARFaceTrackingConfiguration::supportedNumberOfTrackedFaces not bound
Expand Down Expand Up @@ -194,8 +197,10 @@
!missing-selector! ARConfiguration::setLightEstimationEnabled: not bound
!missing-selector! ARConfiguration::setProvidesAudioData: not bound
!missing-selector! ARConfiguration::setVideoFormat: not bound
!missing-selector! ARConfiguration::setVideoHDRAllowed: not bound
!missing-selector! ARConfiguration::setWorldAlignment: not bound
!missing-selector! ARConfiguration::videoFormat not bound
!missing-selector! ARConfiguration::videoHDRAllowed not bound
!missing-selector! ARConfiguration::worldAlignment not bound
!missing-selector! ARDepthData::confidenceMap not bound
!missing-selector! ARDepthData::depthMap not bound
Expand Down Expand Up @@ -233,6 +238,7 @@
!missing-selector! ARFrame::detectedBody not bound
!missing-selector! ARFrame::displayTransformForOrientation:viewportSize: not bound
!missing-selector! ARFrame::estimatedDepthData not bound
!missing-selector! ARFrame::exifData not bound
!missing-selector! ARFrame::geoTrackingStatus not bound
!missing-selector! ARFrame::lightEstimate not bound
!missing-selector! ARFrame::rawFeaturePoints not bound
Expand Down Expand Up @@ -313,6 +319,10 @@
!missing-selector! ARPlaneAnchor::classification not bound
!missing-selector! ARPlaneAnchor::classificationStatus not bound
!missing-selector! ARPlaneAnchor::geometry not bound
!missing-selector! ARPlaneAnchor::planeExtent not bound
!missing-selector! ARPlaneExtent::height not bound
!missing-selector! ARPlaneExtent::rotationOnYAxis not bound
!missing-selector! ARPlaneExtent::width not bound
!missing-selector! ARPlaneGeometry::boundaryVertexCount not bound
!missing-selector! ARPlaneGeometry::boundaryVertices not bound
!missing-selector! ARPlaneGeometry::textureCoordinateCount not bound
Expand Down Expand Up @@ -375,6 +385,8 @@
!missing-selector! ARSCNView::setSession: not bound
!missing-selector! ARSCNView::unprojectPoint:ontoPlaneWithTransform: not bound
!missing-selector! ARSession::addAnchor: not bound
!missing-selector! ARSession::captureHighResolutionFrameUsingPhotoSettings:completion: not bound
!missing-selector! ARSession::captureHighResolutionFrameWithCompletion: not bound
!missing-selector! ARSession::configuration not bound
!missing-selector! ARSession::createReferenceObjectWithTransform:center:extent:completionHandler: not bound
!missing-selector! ARSession::currentFrame not bound
Expand All @@ -393,15 +405,15 @@
!missing-selector! ARSession::setWorldOrigin: not bound
!missing-selector! ARSession::trackedRaycast:updateHandler: not bound
!missing-selector! ARSession::updateWithCollaborationData: not bound
!missing-selector! ARSkeleton::definition not bound
!missing-selector! ARSkeleton::isJointTracked: not bound
!missing-selector! ARSkeleton::jointCount not bound
!missing-selector! ARSkeleton2D::jointLandmarks not bound
!missing-selector! ARSkeleton2D::landmarkForJointNamed: not bound
!missing-selector! ARSkeleton3D::jointLocalTransforms not bound
!missing-selector! ARSkeleton3D::jointModelTransforms not bound
!missing-selector! ARSkeleton3D::localTransformForJointName: not bound
!missing-selector! ARSkeleton3D::modelTransformForJointName: not bound
!missing-selector! ARSkeleton::definition not bound
!missing-selector! ARSkeleton::isJointTracked: not bound
!missing-selector! ARSkeleton::jointCount not bound
!missing-selector! ARSkeletonDefinition::indexForJointName: not bound
!missing-selector! ARSkeletonDefinition::jointCount not bound
!missing-selector! ARSkeletonDefinition::jointNames not bound
Expand All @@ -416,8 +428,12 @@
!missing-selector! ARTrackedRaycast::stopTracking not bound
!missing-selector! ARVideoFormat::captureDevicePosition not bound
!missing-selector! ARVideoFormat::captureDeviceType not bound
!missing-selector! ARVideoFormat::defaultColorSpace not bound
!missing-selector! ARVideoFormat::defaultPhotoSettings not bound
!missing-selector! ARVideoFormat::framesPerSecond not bound
!missing-selector! ARVideoFormat::imageResolution not bound
!missing-selector! ARVideoFormat::isRecommendedForHighResolutionFrameCapturing not bound
!missing-selector! ARVideoFormat::isVideoHDRSupported not bound
!missing-selector! ARWorldMap::anchors not bound
!missing-selector! ARWorldMap::center not bound
!missing-selector! ARWorldMap::extent not bound
Expand Down Expand Up @@ -482,6 +498,7 @@
!missing-type! AROrientationTrackingConfiguration not bound
!missing-type! ARParticipantAnchor not bound
!missing-type! ARPlaneAnchor not bound
!missing-type! ARPlaneExtent not bound
!missing-type! ARPlaneGeometry not bound
!missing-type! ARPointCloud not bound
!missing-type! ARPositionalTrackingConfiguration not bound
Expand Down
17 changes: 0 additions & 17 deletions tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-ARKit.todo

This file was deleted.

3 changes: 0 additions & 3 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-ARKit.ignore

This file was deleted.

13 changes: 0 additions & 13 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-ARKit.todo

This file was deleted.

32 changes: 22 additions & 10 deletions tests/xtro-sharpie/xtro-sharpie/SimdCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public override void VisitManagedMethod (MethodDefinition method)
return; // Extension methods can't be mapped.

var invalid_simd_type = false;
var contains_simd_types = ContainsSimdTypes (method, ref invalid_simd_type);
var only_return_type_is_simd = true;
var contains_simd_types = ContainsSimdTypes (method, ref invalid_simd_type, ref only_return_type_is_simd);

var key = method.GetName ();
if (key is null) {
Expand Down Expand Up @@ -147,15 +148,17 @@ public override void VisitManagedMethod (MethodDefinition method)
}
}

bool ContainsSimdTypes (MethodDefinition method, ref bool invalid_for_simd)
bool ContainsSimdTypes (MethodDefinition method, ref bool invalid_for_simd, ref bool only_return_type_is_simd)
{
if (IsSimdType (method.ReturnType, ref invalid_for_simd))
return true;

if (method.HasParameters) {
foreach (var param in method.Parameters)
if (IsSimdType (param.ParameterType, ref invalid_for_simd))
if (IsSimdType (param.ParameterType, ref invalid_for_simd)) {
only_return_type_is_simd = false;
return true;
}
}

return false;
Expand All @@ -166,14 +169,18 @@ bool IsSimdType (TypeReference td, ref bool invalid_for_simd)
return managed_simd_types.TryGetValue (td.Name, out invalid_for_simd);
}

bool ContainsSimdTypes (ObjCMethodDecl decl, ref string simd_type, ref bool requires_marshal_directive)
bool ContainsSimdTypes (ObjCMethodDecl decl, ref string simd_type, ref bool requires_marshal_directive, ref bool only_return_type_is_simd)
{
if (IsSimdType (decl, decl.ReturnQualType, ref simd_type, ref requires_marshal_directive))
return true;

var is_simd_type = false;
foreach (var param in decl.Parameters)
is_simd_type |= IsSimdType (decl, param.QualType, ref simd_type, ref requires_marshal_directive);
foreach (var param in decl.Parameters) {
if (!IsSimdType (decl, param.QualType, ref simd_type, ref requires_marshal_directive))
continue;
is_simd_type = true;
only_return_type_is_simd = false;
}

return is_simd_type;
}
Expand Down Expand Up @@ -286,14 +293,18 @@ bool HasMarshalDirective (ICustomAttributeProvider provider)
return false;
}

void CheckMarshalDirective (MethodDefinition method, string simd_type)
void CheckMarshalDirective (MethodDefinition method, string simd_type, bool only_return_type_is_simd)
{
if (!method.HasBody)
return;

if (method.IsObsolete ())
return;

// In some cases we've bound return types as IntPtr, and then we marshal manually. Assuming this is OK.
if (only_return_type_is_simd && method.ReturnType.Namespace == "System" && method.ReturnType.Name == "IntPtr")
return;

// The [MarshalDirective] attribute isn't copied to the generated code,
// so instead apply some heuristics and detect calls to the xamarin_simd__ P/Invoke,
// and if there are any, then assume the method binding has a [MarshalDirective].
Expand Down Expand Up @@ -342,7 +353,8 @@ public override void VisitObjCMethodDecl (ObjCMethodDecl decl, VisitKind visitKi

var simd_type = string.Empty;
var requires_marshal_directive = false;
var native_simd = ContainsSimdTypes (decl, ref simd_type, ref requires_marshal_directive);
var only_return_type_is_simd = true;
var native_simd = ContainsSimdTypes (decl, ref simd_type, ref requires_marshal_directive, ref only_return_type_is_simd);

ManagedSimdInfo info;
managed_methods.TryGetValue (decl.GetName (), out info);
Expand Down Expand Up @@ -391,7 +403,7 @@ public override void VisitObjCMethodDecl (ObjCMethodDecl decl, VisitKind visitKi
if (!info.ContainsInvalidMappingForSimd) {
// The managed method does not have any types that are incorrect for Simd.
if (requires_marshal_directive)
CheckMarshalDirective (method, simd_type);
CheckMarshalDirective (method, simd_type, only_return_type_is_simd);
return;
}

Expand All @@ -401,7 +413,7 @@ public override void VisitObjCMethodDecl (ObjCMethodDecl decl, VisitKind visitKi
}

if (requires_marshal_directive)
CheckMarshalDirective (method, simd_type);
CheckMarshalDirective (method, simd_type, only_return_type_is_simd);

// We have a potentially broken managed method. This needs fixing/investigation.
Log.On (framework).Add ($"!unknown-simd-type-in-signature! {method}: the native signature has a simd type ({simd_type}), while the corresponding managed method is using an incorrect (non-simd) type.");
Expand Down