Skip to content

Commit

Permalink
[Metal] Add support for xcode 13 beta5 . (#12875)
Browse files Browse the repository at this point in the history
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
  • Loading branch information
mandel-macaque and rolfbjarne authored Oct 5, 2021
1 parent f1e4cbc commit 67e1ca5
Show file tree
Hide file tree
Showing 20 changed files with 1,035 additions and 772 deletions.
16 changes: 14 additions & 2 deletions src/Metal/MTLDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ public static IMTLDevice? SystemDefault {
return system_default;
}
}

#if MONOMAC || __MACCATALYST__

#if MONOMAC
#if !NET
[MacCatalyst (15,0)]
#else
[SupportedOSPlatform ("maccatalyst15.0")]
#endif
[DllImport (Constants.MetalLibrary)]
unsafe static extern IntPtr MTLCopyAllDevices ();

#if !NET
[NoiOS, NoWatch, NoTV]
[MacCatalyst (15,0)]
#else
[SupportedOSPlatform ("maccatalyst15.0")]
#endif
public static IMTLDevice [] GetAllDevices ()
{
Expand All @@ -66,6 +74,10 @@ public static IMTLDevice [] GetAllDevices ()
return devices;
}

#endif

#if MONOMAC

#if !NET
[Mac (10, 13)]
#endif
Expand Down
41 changes: 39 additions & 2 deletions src/Metal/MTLEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

using CoreFoundation;
using Foundation;
using ModelIO;
using ObjCRuntime;
Expand Down Expand Up @@ -88,6 +88,7 @@ public enum MTLCommandBufferError : ulong {
InvalidResource = 9,
Memoryless = 10,
DeviceRemoved = 11,
StackOverflow = 12,
}

[Native]
Expand Down Expand Up @@ -682,6 +683,16 @@ public enum MTLDataType : ulong {
[Mac (10,14), iOS (12,0), TV (12,0)] RenderPipeline = 78,
[Mac (11,0), iOS (13,0), TV (13,0)] ComputePipeline = 79,
[Mac (10,14), iOS (12,0), TV (12,0)] IndirectCommandBuffer = 80,

[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] Long = 81,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] Long2 = 82,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] Long3 = 83,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] Long4 = 84,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] ULong = 85,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] ULong2 = 86,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] ULong3 = 87,
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch] ULong4 = 88,

[Mac (11,0), iOS (14,0), NoTV] VisibleFunctionTable = 115,
[Mac (11,0), iOS (14,0), NoTV] IntersectionFunctionTable = 116,
[Mac (11,0), iOS (14,0), NoTV] PrimitiveAccelerationStructure = 117,
Expand Down Expand Up @@ -818,6 +829,8 @@ public enum MTLLanguageVersion : ulong {
v2_2 = (2 << 16) + 2,
[Mac (11,0), iOS (14,0), TV (14,0), NoWatch]
v2_3 = (2 << 16) + 3,
[iOS (15,0), TV (15,0), MacCatalyst (15,0), Mac (12,0), NoWatch]
v2_4 = (2uL << 16) + 4,
}

[iOS (9,0)][Mac (10,11)]
Expand Down Expand Up @@ -1001,7 +1014,9 @@ public enum MTLStepFunction : ulong {
[Native]
public enum MTLRenderStages : ulong {
Vertex = (1 << 0),
Fragment = (1 << 1)
Fragment = (1 << 1),
[iOS (15,0), TV (15,0), NoWatch, Mac (12,0), MacCatalyst (15,0)]
Tile = (1uL << 2),
}

[Mac (10,13), iOS (11,0), TV (11,0), NoWatch]
Expand Down Expand Up @@ -1252,6 +1267,8 @@ public enum MTLAccelerationStructureUsage : ulong {
None = 0x0,
Refit = (1uL << 0),
PreferFastBuild = (1uL << 1),
[iOS (15,0), TV (15,0), MacCatalyst (15,0), Mac (12,0), NoWatch]
ExtendedLimits = (1uL << 2),
}

[Mac (11,0), iOS (14,0), TV (14,0)]
Expand Down Expand Up @@ -1326,6 +1343,12 @@ public enum MTLIntersectionFunctionSignature : ulong {
Instancing = (1uL << 0),
TriangleData = (1uL << 1),
WorldSpaceData = (1uL << 2),
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
InstanceMotion = (1uL << 3),
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
PrimitiveMotion = (1uL << 4),
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
ExtendedLimits = (1uL << 5),
}

[Mac (11,0), iOS (14,0), TV (14,0)]
Expand All @@ -1344,4 +1367,18 @@ public enum MTLTextureSwizzle : byte {
Blue = 4,
Alpha = 5,
}

[Mac (12,0), iOS (15,0), MacCatalyst (15,0), NoTV, NoWatch]
public enum MTLMotionBorderMode : uint {
Clamp = 0,
Vanish = 1,
}

[Mac (12,0), iOS (15,0), MacCatalyst (15,0), NoTV, NoWatch]
[Native]
public enum MTLAccelerationStructureInstanceDescriptorType : ulong {
Default = 0,
UserID = 1,
Motion = 2,
}
}
21 changes: 14 additions & 7 deletions src/Metal/MTLRasterizationRateLayerDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
namespace Metal {
public partial class MTLRasterizationRateLayerDescriptor
{
/* Selectors reported as not working by introspection: https://github.com/xamarin/maccore/issues/1976
[NoMac]
#if !NET
[MacCatalyst (15,0)]
#else
[SupportedOSPlatform ("maccatalyst15.0")]
#endif
public double[] HorizontalSampleStorage {
get {
var width = (int)SampleCount.Width;
Expand All @@ -23,7 +26,11 @@ public double[] HorizontalSampleStorage {
}
}

[NoMac]
#if !NET
[MacCatalyst (15,0)]
#else
[SupportedOSPlatform ("maccatalyst15.0")]
#endif
public double[] VerticalSampleStorage {
get {
var height = (int)SampleCount.Height;
Expand All @@ -32,11 +39,11 @@ public double[] VerticalSampleStorage {
return floatArray;
}
}
*/
#if NET
[UnsupportedOSPlatform ("macos")]

#if !NET
[MacCatalyst (15,0)]
#else
[NoMac]
[SupportedOSPlatform ("maccatalyst15.0")]
#endif
static public MTLRasterizationRateLayerDescriptor Create (MTLSize sampleCount, float[] horizontal, float[] vertical)
{
Expand Down
Loading

2 comments on commit 67e1ca5

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on Build (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent
[Metal] Add support for xcode 13 beta5 . (#12875)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on Build (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent
[Metal] Add support for xcode 13 beta5 . (#12875)

Please sign in to comment.