-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Metal] Add support up to GM1 of metal. (#7007)
- Loading branch information
1 parent
382083c
commit 5703082
Showing
15 changed files
with
1,279 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
#if XAMCORE_2_0 || !MONOMAC | ||
|
||
using System; | ||
using ObjCRuntime; | ||
|
||
namespace Metal { | ||
|
||
} | ||
public partial class MTLSharedTextureHandle { | ||
|
||
[Obsolete ("Default constructor was removed. Do not use.")] | ||
public MTLSharedTextureHandle () {} | ||
} | ||
|
||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#if IOS | ||
using System; | ||
using System.ComponentModel; | ||
using System.Runtime.InteropServices; | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
namespace Metal { | ||
public partial class MTLRasterizationRateLayerDescriptor | ||
{ | ||
/* Selectors reported as not working by instrospection: https://github.com/xamarin/maccore/issues/1976 | ||
[NoMac, NoTV, iOS (13,0)] | ||
public double[] HorizontalSampleStorage { | ||
get { | ||
var width = (int)SampleCount.Width; | ||
var floatArray = new double[width]; | ||
Marshal.Copy (_HorizontalSampleStorage, floatArray, 0, width); | ||
return floatArray; | ||
} | ||
} | ||
[NoMac, NoTV, iOS (13,0)] | ||
public double[] VerticalSampleStorage { | ||
get { | ||
var height = (int)SampleCount.Height; | ||
var floatArray = new double[height]; | ||
Marshal.Copy (_VerticalSampleStorage, floatArray, 0, height); | ||
return floatArray; | ||
} | ||
} | ||
*/ | ||
[NoMac, NoTV, iOS (13,0)] | ||
static public MTLRasterizationRateLayerDescriptor Create (MTLSize sampleCount, float[] horizontal, float[] vertical) | ||
{ | ||
if (horizontal == null) | ||
throw new ArgumentNullException (nameof (horizontal)); | ||
if (vertical == null) | ||
throw new ArgumentNullException (nameof (vertical)); | ||
if (sampleCount.Width != horizontal.Length) | ||
throw new ArgumentOutOfRangeException ("Horizontal length should be equal to the sampleCount.Width."); | ||
if (sampleCount.Height != vertical.Length) | ||
throw new ArgumentOutOfRangeException ("Vertical length should be equal to the sampleCount.Height."); | ||
|
||
unsafe { | ||
fixed (void* horizontalHandle = horizontal) | ||
fixed (void* verticalHandle = vertical) { | ||
return new MTLRasterizationRateLayerDescriptor (sampleCount, (IntPtr) horizontalHandle, (IntPtr) verticalHandle); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// API for the Metal framework | ||
// | ||
// Authors: | ||
// Manuel de la Pena <mandel@microsoft.com> | ||
// | ||
#if IOS | ||
using System; | ||
using System.ComponentModel; | ||
using System.Runtime.InteropServices; | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
namespace Metal { | ||
|
||
public static partial class MTLResourceStateCommandEncoder_Extensions { | ||
|
||
[NoMac, NoTV, iOS (13,0)] | ||
public static void Update (this IMTLResourceStateCommandEncoder This, IMTLTexture texture, MTLSparseTextureMappingMode mode, MTLRegion[] regions, nuint[] mipLevels, nuint[] slices) | ||
{ | ||
if (texture == null) | ||
throw new ArgumentNullException (nameof (texture)); | ||
if (regions == null) | ||
throw new ArgumentNullException (nameof (regions)); | ||
if (mipLevels == null) | ||
throw new ArgumentNullException (nameof (mipLevels)); | ||
if (slices == null) | ||
throw new ArgumentNullException (nameof (slices)); | ||
|
||
var regionsHandle = GCHandle.Alloc (regions, GCHandleType.Pinned); | ||
var mipLevelsHandle = GCHandle.Alloc (mipLevels, GCHandleType.Pinned); | ||
var slicesHandle = GCHandle.Alloc (slices, GCHandleType.Pinned); | ||
try { | ||
var regionsPtr = regionsHandle.AddrOfPinnedObject (); | ||
var mipLevelsPtr = mipLevelsHandle.AddrOfPinnedObject (); | ||
var slicesPtr = slicesHandle.AddrOfPinnedObject (); | ||
This.Update (texture, mode, regionsPtr, mipLevelsPtr, slicesPtr, (nuint)regions.Length); | ||
} finally { | ||
regionsHandle.Free (); | ||
mipLevelsHandle.Free (); | ||
slicesHandle.Free (); | ||
} | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5703082
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Build was (probably) aborted
🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Build' 🔥 : hudson.AbortException: script returned exit code 2
🔥 Build failed 🔥