Граф коммитов

19 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 68de101ce6
[UIKit] Wrap the call to UIApplicationMain in a @try/@catch handler. (#15746)
Wrap the call to UIApplicationMain in a @try/@catch handler, and convert any
Objective-C exceptions to a managed exception.

This way the managed Main method (which calls UIApplication.Main) will be able
to catch any Objective-C exceptions.
2022-08-26 13:56:33 +02:00
Rolf Bjarne Kvinge f557936e9c
[runtime] Use the correct underlying types for our own nfloat/n(u)int types. (#12714)
Defining xm_nint_t to be 32-bit sized only on i386 is not the right thing to do for armv7.

Strangely enough this caused just a single test failure:

    MonoTouchFixtures.Foundation.CalendarTest
        [FAIL] TestFindNextDateAfterDateMatching :   Expected: <Foundation.MonoTouchException>
            But was:  null
            at MonoTouchFixtures.Foundation.CalendarTest.TestFindNextDateAfterDateMatching()

and that happened because:

1. We use a wrapper function around objc_msgSend:

    void *
    xamarin_IntPtr_objc_msgSend_IntPtr_IntPtr_nuint_exception (id self, SEL sel, void * p0, void * p1, xm_nuint_t p2, GCHandle *exception_gchandle)
    {
    	@try {
    		return ((func_xamarin_IntPtr_objc_msgSend_IntPtr_IntPtr_nuint_exception) objc_msgSend) (self, sel, p0, p1, p2);
    	} @catch (NSException *e) {
    		xamarin_process_nsexception_using_mode (e, true, exception_gchandle);
    		return NULL;
    	}
    }

2. Note that the second to last argument is an 'xm_nuint_t'. We told the
   native compiler this was a 64-bit value, when the managed P/Invoke would
   give it a 32-bit value. This had no effect on the 'p2' parameter, but it
   meant that clang would thing the next argument, 'exception_gchandle', would
   be somewhere it wasn't (the managed function would pass two 32-bit values,
   'p2' and 'exception_gchandle', which clang would merge into a single 64-bit
   'p2' argument, and then read random stuff for 'exception_gchandle').

3. Finally things would go sideways when we caught the exception and passed
   'exception_gchandle' to xamarin_process_nsexception_using_mode. In effect
   we'd ask xamarin_process_nsexception_using_mode to store the resulting
   gchandle in random memory. Amazingly it only resulted in a test failure
   (because upon return the managed location for the 'exception_gchandle'
   wasn't touched, and would have its initial value of 0, thus managed code
   would think no exception occurred).

So fix this to use the correct underlying types, instead of trying to figure
out the correct #if condition.

I'm not sure why we're using our own types here anyways, but this fix is the
smallest.
2021-09-15 09:17:43 +02:00
Rolf Bjarne Kvinge 14e76c0139
[runtime] Return the exception from wrapper methods for exception marshalling. (#11382)
There's no general way to set a pending managed exception in CoreCLR (the
current plan is to support setting a pending managed exception for the
objc_msgSend family of functions). This means that the way we've implemented
custom wrappers that can handle Objective-C exceptions won't work, because
those wrappers currently tries to set a pending managed exception (which Mono
throws upon returning from the corresponding native wrapper function).

So rewrite this a bit: these custom wrappers now return a GCHandle with the
managed exception as an out parameter, and the calling managed code throws
that exception instead.

This also required adjusting a few API definitions to match how their wrapper
functions are defined.
2021-05-04 08:25:38 +02:00
Rolf Bjarne Kvinge 24ed1ddc66
[runtime] Remove Classic code. (#8720) 2020-06-02 08:18:24 +02:00
Rolf Bjarne Kvinge 366f46ba21
[ModelIO] Implement new API introduced with Xcode 11 b1-7. (#6930) 2019-09-09 13:15:07 -07:00
Bernhard Urban 06fcf59b78 [build/runtime] Add build rules for arm64_32 2019-05-22 08:05:40 +02:00
Alex Soto 3e0bcf2b32
[MetalPerformanceShaders] Update bindings from Xcode 9.2 to 10.2 - Part 1 of 2
Fixes: xamarin/xamarin-macios#5362

This includes updates for:

* MetalPerformanceShaders.framework
* MPSCore.framework
* MPSImage.framework
* MPSMatrix.framework
* MPSRayIntersector.framework

Pending:

* MPSNeuralNetwork.framework
2019-01-29 15:37:49 -05:00
Alex Soto 277be204ca [SIMD] Implement Simd double types (VectorDouble3/MatrixDouble4x4). (#2632)
The following types will be used by ModelIO bindings

* Fix delta to be double

* Rename Simd-compatible matrices and vectors to match our final naming.

This also means removing the new Vector2 and Vector4 variants (but not
Vector3).
2017-09-13 15:28:16 -04:00
Rolf Bjarne Kvinge 9fbfd97a8a [AVFoundation] Use Simd-matrix for API that needs it. (#2679)
This also requires implementing the corresponding matrix (NMatrix4x3).

Fixes this xtro issue:

> !unknown-simd-type-in-signature! OpenTK.Matrix3 AVFoundation.AVCameraCalibrationData::get_GetIntrinsicMatrix(): the native signature has a simd type (matrix_float3x3), while the corresponding managed method is using an incorrect (non-simd) type.
2017-09-13 18:46:06 +02:00
Rolf Bjarne Kvinge 7a674ec490 Tweak the Simd-compatible matrices and vectors (#2668)
* Rename them to be OpenTK.NMatrix# (instead of Simd.MatrixFloat#x#).
* Remove the Vector2 and Vector4 variants, we'll use the OpenTK types instead (but we'll keep the NVector3 variant, since it's not identical to the OpenTK version).
* Update the API to match their OpenTK counterparts better:
    * NMatrix2 and NMatrix3 have a 0-based R#C# scheme for their fields.
    * NMatrix4 has a 1-based M## scheme for its fields (i.e. no change).
2017-09-13 11:08:39 -04:00
Rolf Bjarne Kvinge c2c78cee08 [SpriteKit] Use the new Simd-compatible matrix types, and deprecate the old API. 2017-08-31 14:03:13 +02:00
Rolf Bjarne Kvinge 6e96f1d56b [ARKit] Use the new Simd matrix types. 2017-08-31 14:03:11 +02:00
Rolf Bjarne Kvinge 1d8bbdbcbf [ModelIO] Fix MDLVoxelIndexExtent struct. (#2564)
The MDLVoxelIndexExtent is a struct containing two 4-dimensional vectors of
integers (not floats, as originally and incorrectly implemented).

Fix this my creating a new MDLVoxelIndexExtent2 struct with the right fields,
re-implement all the API that exposes this struct and obsolete the old API.

Also add missing [MarshalDirective] attributes.

And write a test to make sure it works fine now and forever.
2017-08-30 13:36:35 -04:00
Rolf Bjarne Kvinge bc9a39fcb3 Add missing [MarshalDirective] attributes. (#2558)
* [bindings-generator] Improve build & project file.

* Add missing [MarshalDirective] attributes.

Add missing [MarshalDirective] attributes, which also requires implementing
support for out parameters in the binding generator, since one of the
signatures missing the [MarshalDirective] contains such an out parameter.

Also add tests for all the API I've added [MarshalDirective] to.

* [bindings-generator] Remove redundant if check.

* [monotouch-test] Rename file to end with 'Test.cs'.

* [tests] Fix a few build errors for Xamarin.Mac.
2017-08-29 14:59:24 +02:00
Vincent Dondain 49b020e2b2 [spritekit] Update for Xcode 9 beta 1, 2 & 3 (#2331)
- Added Quaternion support to XI runtime (simd_quatf).
2017-07-19 16:19:02 -04:00
Alex Soto 89071bc19d [Vision] Add bindings for Xcode 9 Beta 1, 2 & 3 (#2301)
* [Vision] Add bindings for Xcode 9 Beta 1 & 2

This commit also adds two convenience overloads to GetAttachments
that allows you to get a more strongly typed version of the
returned dictionary, this is needed because there is no easy way
to downcast from NSDictionary to NSDictionary<TKey, TValue>
and it is used in the sample that excecises the Vision API found here

https://github.com/dalexsoto/FaceDetector

* [Vision] Implement feedback

* Add commas to enums to avoid diff spam
* Throw a managed exception when we fail to dinamically call Vision framework

* [Vision] Update to xcode 9 Beta 3

* [vision] fix VNImageCropAndScaleOption enum

Also removed public modifier from enums in order to have interfaces
and enums in sync

* [Vision] Add missing comma to enum

* [Vision] More API enhancements

* Removed default .ctor from types that are not user created
* Added Strong Dictionary to VNImageRequestHandler ctors
* Turned VNImageOption into a StrongDictionary
* Added bug report[1] for BarcodeDescriptor so we do not forget
* Removed duped metadata from manual bindings
* VNDetectedObjectObservation subclasses now have the factory
  method FromBoundingBox inherited from its parent class
  (VNDetectedObjectObservation).

[1]: https://bugzilla.xamarin.com/show_bug.cgi?id=58197

* [Vision] Merge extern API with wrappers, fixed intro!

* [Vision] Add one missing public accessor to VNUtils
2017-07-18 11:12:10 -05:00
Alex Soto 209f4f3709 [GameplayKit] Update from Xcode8 Beta 1 to Beta 6 (#689)
Runtime
- Added support for Vector2d, Vector3d and Vector4d SIMD types
- Added support for GKBox, GKQuad and GKTriangle SIMD types

GameplayKit
- Apple introduced GKQuadTreeNode and GKQuadTree in Xcode 7.1 and
  removed those types in a later Xcode (7.2?) but we kept them around.
  Now apple introduced again both types but renamed them to GKQuadtreeNode
  and GKQuadtree (lowercase t), this is a breaking change and since we do
  care about binary compat we are just changing the registration name and
  keeping the same managed name deprecating old methods and introducing
  the new ones.
- Added tests for new SIMD types
2016-08-30 15:32:46 -04:00
Vincent Dondain ddd1988f64 [spritekit] Update for iOS 10 beta 1 (#498)
* [spritekit] Update for iOS 10 beta 1

* [spritekit] Add missing MarshalDirective

* [runtime] Add missing simd function signatures

- Add matrix_float2x2 and matrix_float3x3 natives types.

* [introspection] Fix ApiSignatureTest

- We now avoid checking {?=[X]} encoded signatures.
- We now calculate the right size for matrix_float2x2, matrix_float3x3 and matrix_float4x4.
- Fix SKWarpGeometryGrid wrong bindings revealed by tests (IntPtr instead of Vector2).

* [monotouch-test] Add SKUniform and SKWarpGeometryGrid tests
2016-08-03 19:12:07 +02:00
Rolf Bjarne Kvinge ac418df815 Build our runtime. 2016-04-24 14:47:24 -04:00