Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a3314bc
[xtro-sharpie] Add a Simd check class to verify signatures with Simd …
rolfbjarne Aug 18, 2017
7647972
[Simd] Add simd matrix types.
rolfbjarne Aug 18, 2017
6e96f1d
[ARKit] Use the new Simd matrix types.
rolfbjarne Aug 31, 2017
f6a01bb
[Vision] Use the new Simd matrix types.
rolfbjarne Aug 31, 2017
788cd94
[ModelIO] Use the new Simd-compatible matrix types, and deprecate the…
rolfbjarne Aug 31, 2017
5303155
[GameplayKit] Use the new Simd-compatible matrix types, and deprecate…
rolfbjarne Aug 31, 2017
c2c78ce
[SpriteKit] Use the new Simd-compatible matrix types, and deprecate t…
rolfbjarne Aug 31, 2017
8ec1baf
[xtro] Don't report missing [MarshalDirective] for obsolete methods.
rolfbjarne Aug 31, 2017
11b0eb9
[xtro] Remove unnecessary ignores.
rolfbjarne Aug 31, 2017
96ad068
[xtro] Reword some of the Simd diagnostic messages according to review.
rolfbjarne Sep 1, 2017
d562435
[tests] Make sure test symbols don't clash between different test lib…
rolfbjarne Sep 1, 2017
b80cfee
[tests] Since libtest.a need ModelIO now, the corresponding LinkWith …
rolfbjarne Sep 1, 2017
b97ea9f
[introspection] Don't check native signatures on obsolete members, an…
rolfbjarne Sep 1, 2017
6f2549f
[monotouch-tests] Include more custom asserts for watchOS to make the…
rolfbjarne Sep 1, 2017
371827e
[monotouch-test] Exclude code that requires the binding project from …
rolfbjarne Sep 1, 2017
45c37d2
[xtro] Reword some of the Simd diagnostic messages according to review.
rolfbjarne Sep 1, 2017
977a976
[SpriteKit] SKTransformNode is new in Xcode 9 so no need to keep the …
rolfbjarne Sep 4, 2017
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
264 changes: 264 additions & 0 deletions runtime/bindings-generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,26 @@ static IEnumerable<FunctionData> GetFunctionData ()
}
);

data.Add (
new FunctionData {
Comment = " // void func (MatrixFloat2x2)",
Prefix = "simd__",
Variants = Variants.NonStret,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.MatrixFloat2x2 },
},
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat2x2 func ()",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat2x2,
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (IntPtr, ref MPSImageHistogramInfo)",
Expand All @@ -2004,6 +2024,42 @@ static IEnumerable<FunctionData> GetFunctionData ()
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (IntPtr, MatrixFloat2x2)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.IntPtr },
new ParameterData { TypeData = Types.MatrixFloat2x2 },
},
}
);

data.Add (
new FunctionData {
Comment = " // void func (MatrixFloat3x3)",
Prefix = "simd__",
Variants = Variants.NonStret,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.MatrixFloat3x3 },
},
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (MatrixFloat3x3)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.MatrixFloat3x3 },
},
}
);

data.Add (
new FunctionData {
Comment = " // MDLVoxelIndexExtent2 func ()",
Expand All @@ -2013,13 +2069,83 @@ static IEnumerable<FunctionData> GetFunctionData ()
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat3x3 func ()",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat3x3,
}
);

data.Add (
new FunctionData {
Comment = " // void func (MDLVoxelIndexExtent2)",
Prefix = "simd__",
Variants = Variants.NonStret,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.MDLVoxelIndexExtent2 },
}
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (IntPtr, MatrixFloat3x3)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.IntPtr },
new ParameterData { TypeData = Types.MatrixFloat3x3 },
},
}
);

data.Add (
new FunctionData {
Comment = " // void func (MatrixFloat4x4)",
Prefix = "simd__",
Variants = Variants.NonStret,
Parameters = new ParameterData[] {
new ParameterData { TypeData = Types.MatrixFloat4x4 },
},
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (MatrixFloat4x4)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData[] {
new ParameterData { TypeData = Types.MatrixFloat4x4 },
},
}
);

data.Add (
new FunctionData {
Comment = " // void func (MatrixFloat4x4, double)",
Prefix = "simd__",
Variants = Variants.NonStret,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.MatrixFloat4x4 },
new ParameterData { TypeData = Types.Double },
},
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (MatrixFloat4x4, bool)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.MatrixFloat4x4 },
new ParameterData { TypeData = Types.Bool },
},
}
);
Expand All @@ -2036,6 +2162,111 @@ static IEnumerable<FunctionData> GetFunctionData ()
}
);


data.Add (
new FunctionData {
Comment = " // IntPtr func (IntPtr, nuint, MatrixFloat4x4)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.IntPtr },
new ParameterData { TypeData = Types.NUInt },
new ParameterData { TypeData = Types.MatrixFloat4x4 },
},
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat4x4 func ()",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat4x4,
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat4x4 func (int, CGSize, nfloat, nfloat)",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat4x4,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.Int32 },
new ParameterData { TypeData = Types.CGSize },
new ParameterData { TypeData = Types.NFloat },
new ParameterData { TypeData = Types.NFloat },
},
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat4x4 func (Int64, CGSize, nfloat, nfloat)",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat4x4,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.Int64 },
new ParameterData { TypeData = Types.CGSize },
new ParameterData { TypeData = Types.NFloat },
new ParameterData { TypeData = Types.NFloat },
},
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat4x4 func (double)",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat4x4,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.Double },
},
}
);

data.Add (
new FunctionData {
Comment = " // MatrixFloat4x4 func (nint)",
Prefix = "simd__",
Variants = Variants.All,
ReturnType = Types.MatrixFloat4x4,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.NInt },
},
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (IntPtr, nint, MatrixFloat4x4)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.IntPtr },
new ParameterData { TypeData = Types.NInt },
new ParameterData { TypeData = Types.MatrixFloat4x4 },
},
}
);

data.Add (
new FunctionData {
Comment = " // IntPtr func (IntPtr, MatrixFloat4x4)",
Prefix = "simd__",
Variants = Variants.NonStret,
ReturnType = Types.IntPtr,
Parameters = new ParameterData [] {
new ParameterData { TypeData = Types.IntPtr },
new ParameterData { TypeData = Types.MatrixFloat4x4 },
},
}
);

// We must expand functions with native types to their actual type as well.
for (int i = data.Count - 1; i >= 0; i--) {
if (!data [i].HasNativeType)
Expand Down Expand Up @@ -2087,19 +2318,22 @@ static void MarshalToManaged (StringWriter writer, TypeData type, string nativeV
}
break;
case "Matrix2":
case "MatrixFloat2x2":
writer.WriteLine ("\tfor (int i = 0; i < 2; i++) {");
writer.WriteLine ("\t\t{0}{2}columns [i].a = {1}.columns [i] [0];", managedVariable, nativeVariable, accessor);
writer.WriteLine ("\t\t{0}{2}columns [i].b = {1}.columns [i] [1];", managedVariable, nativeVariable, accessor);
writer.WriteLine ("\t}");
break;
case "Matrix3":
case "MatrixFloat3x3":
writer.WriteLine ("\tfor (int i = 0; i < 3; i++) {");
writer.WriteLine ("\t\t{0}{2}columns [i].a = {1}.columns [i] [0];", managedVariable, nativeVariable, accessor);
writer.WriteLine ("\t\t{0}{2}columns [i].b = {1}.columns [i] [1];", managedVariable, nativeVariable, accessor);
writer.WriteLine ("\t\t{0}{2}columns [i].c = {1}.columns [i] [2];", managedVariable, nativeVariable, accessor);
writer.WriteLine ("\t}");
break;
case "Matrix4":
case "MatrixFloat4x4":
writer.WriteLine ("\tfor (int i = 0; i < 4; i++) {");
writer.WriteLine ("\t\t{0}{2}columns [i].a = {1}.columns [i] [0];", managedVariable, nativeVariable, accessor);
writer.WriteLine ("\t\t{0}{2}columns [i].b = {1}.columns [i] [1];", managedVariable, nativeVariable, accessor);
Expand Down Expand Up @@ -2203,19 +2437,22 @@ static void MarshalToNative (StringWriter writer, TypeData type, string nativeVa
}
break;
case "Matrix2":
case "MatrixFloat2x2":
writer.WriteLine ("\tfor (int i = 0; i < 2; i++) {");
writer.WriteLine ("\t\t{0}.columns [i][0] = {1}{2}columns [i].a;", nativeVariable, managedVariable, accessor);
writer.WriteLine ("\t\t{0}.columns [i][1] = {1}{2}columns [i].b;", nativeVariable, managedVariable, accessor);
writer.WriteLine ("\t}");
break;
case "Matrix3":
case "MatrixFloat3x3":
writer.WriteLine ("\tfor (int i = 0; i < 3; i++) {");
writer.WriteLine ("\t\t{0}.columns [i][0] = {1}{2}columns [i].a;", nativeVariable, managedVariable, accessor);
writer.WriteLine ("\t\t{0}.columns [i][1] = {1}{2}columns [i].b;", nativeVariable, managedVariable, accessor);
writer.WriteLine ("\t\t{0}.columns [i][2] = {1}{2}columns [i].c;", nativeVariable, managedVariable, accessor);
writer.WriteLine ("\t}");
break;
case "Matrix4":
case "MatrixFloat4x4":
writer.WriteLine ("\tfor (int i = 0; i < 4; i++) {");
writer.WriteLine ("\t\t{0}.columns [i][0] = {1}{2}columns [i].a;", nativeVariable, managedVariable, accessor);
writer.WriteLine ("\t\t{0}.columns [i][1] = {1}{2}columns [i].b;", nativeVariable, managedVariable, accessor);
Expand Down Expand Up @@ -2736,6 +2973,15 @@ public static class Types {
IsX86Stret = true,
IsX64Stret = false,
};
public static TypeData MatrixFloat2x2 = new TypeData {
ManagedType = "MatrixFloat2x2",
NativeType = "matrix_float2x2",
NativeWrapperType = "struct MatrixFloat2x2",
RequireMarshal = true,
IsARMStret = true,
IsX86Stret = true,
IsX64Stret = false,
};
public static TypeData Matrix3f = new TypeData {
ManagedType = "Matrix3",
NativeType = "matrix_float3x3",
Expand All @@ -2745,6 +2991,15 @@ public static class Types {
IsX86Stret = true,
IsX64Stret = true,
};
public static TypeData MatrixFloat3x3 = new TypeData {
ManagedType = "MatrixFloat3x3",
NativeType = "matrix_float3x3",
NativeWrapperType = "struct MatrixFloat3x3",
RequireMarshal = true,
IsARMStret = true,
IsX86Stret = true,
IsX64Stret = true,
};
public static TypeData Matrix4f = new TypeData {
ManagedType = "Matrix4",
NativeType = "matrix_float4x4",
Expand All @@ -2754,6 +3009,15 @@ public static class Types {
IsX86Stret = true,
IsX64Stret = true,
};
public static TypeData MatrixFloat4x4 = new TypeData {
ManagedType = "MatrixFloat4x4",
NativeType = "matrix_float4x4",
NativeWrapperType = "struct MatrixFloat4x4",
RequireMarshal = true,
IsARMStret = true,
IsX86Stret = true,
IsX64Stret = true,
};
public static TypeData Double = new TypeData {
ManagedType = "Double",
NativeType = "double",
Expand Down
12 changes: 12 additions & 0 deletions runtime/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,26 @@ struct Matrix2f {
Vector2f columns [2];
};

struct MatrixFloat2x2 {
Vector2f columns [2];
};

struct Matrix3f {
Vector3f columns [3];
};

struct MatrixFloat3x3 {
Vector4f columns [3];
};

struct Matrix4f {
Vector4f columns [4];
};

struct MatrixFloat4x4 {
Vector4f columns [4];
};

struct QuatF {
Vector4f vector;
};
Expand Down
Loading