-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into refactor/ava/headless-in-avalonia-v2
- Loading branch information
Showing
31 changed files
with
1,367 additions
and
347 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
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
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,3 +1,4 @@ | ||
using Ryujinx.Common.Configuration; | ||
using System; | ||
|
||
namespace Ryujinx.Graphics.GAL | ||
|
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 was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/Ryujinx.Graphics.Metal.SharpMetalExtensions/CAMetalLayerExtensions.cs
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,22 @@ | ||
using SharpMetal; | ||
using SharpMetal.Foundation; | ||
using SharpMetal.ObjectiveCCore; | ||
using SharpMetal.QuartzCore; | ||
using System.Runtime.Versioning; | ||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Ryujinx.Graphics.Metal.SharpMetalExtensions | ||
{ | ||
[SupportedOSPlatform("macOS")] | ||
public static class CAMetalLayerExtensions | ||
{ | ||
private static readonly Selector sel_developerHUDProperties = "developerHUDProperties"; | ||
private static readonly Selector sel_setDeveloperHUDProperties = "setDeveloperHUDProperties:"; | ||
|
||
public static NSDictionary GetDeveloperHudProperties(this CAMetalLayer metalLayer) | ||
=> new(ObjectiveCRuntime.IntPtr_objc_msgSend(metalLayer.NativePtr, sel_developerHUDProperties)); | ||
|
||
public static void SetDeveloperHudProperties(this CAMetalLayer metalLayer, NSDictionary dictionary) | ||
=> ObjectiveCRuntime.objc_msgSend(metalLayer.NativePtr, sel_setDeveloperHUDProperties, dictionary); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Ryujinx.Graphics.Metal.SharpMetalExtensions/NSHelper.cs
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,32 @@ | ||
using SharpMetal.Foundation; | ||
using SharpMetal.ObjectiveCCore; | ||
using System.Runtime.Versioning; | ||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Ryujinx.Graphics.Metal.SharpMetalExtensions | ||
{ | ||
[SupportedOSPlatform("macOS")] | ||
public static class NSHelper | ||
{ | ||
private static readonly Selector sel_getCStringMaxLengthEncoding = "getCString:maxLength:encoding:"; | ||
private static readonly Selector sel_stringWithUTF8String = "stringWithUTF8String:"; | ||
|
||
public static unsafe string ToDotNetString(this NSString source) | ||
{ | ||
char[] sourceBuffer = new char[source.Length]; | ||
fixed (char* pSourceBuffer = sourceBuffer) | ||
{ | ||
ObjectiveC.bool_objc_msgSend(source, | ||
sel_getCStringMaxLengthEncoding, | ||
pSourceBuffer, | ||
source.MaximumLengthOfBytes(NSStringEncoding.UTF16) + 1, | ||
(ulong)NSStringEncoding.UTF16); | ||
} | ||
|
||
return new string(sourceBuffer); | ||
} | ||
|
||
public static NSString ToNSString(this string source) | ||
=> new(ObjectiveC.IntPtr_objc_msgSend(new ObjectiveCClass(nameof(NSString)), sel_stringWithUTF8String, source)); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...nx.Graphics.Metal.SharpMetalExtensions/Ryujinx.Graphics.Metal.SharpMetalExtensions.csproj
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="SharpMetal" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.