1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-20 00:52:01 +00:00

Use Ryujinx Logger

This commit is contained in:
Isaac Marovitz 2023-07-28 16:39:14 -04:00 committed by Isaac Marovitz
parent f4aea9b7ec
commit 28da4248ae
2 changed files with 32 additions and 2 deletions

View file

@ -1,3 +1,4 @@
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Shader;
using SharpMetal.Foundation;
@ -35,8 +36,7 @@ namespace Ryujinx.Graphics.Metal
_renderEncoderState = new(_device.NewRenderPipelineState(renderPipelineDescriptor, ref error));
if (error != IntPtr.Zero)
{
// throw new Exception($"Failed to create render pipeline state! {StringHelp}");
throw new Exception($"Failed to create render pipeline state!");
Logger.Error?.PrintMsg(LogClass.Gpu, $"Failed to create Render Pipeline State: {StringHelper.String(error.LocalizedDescription)}");
}
_commandBuffer = _mtlCommandQueue.CommandBuffer();

View file

@ -0,0 +1,30 @@
using SharpMetal.Foundation;
using SharpMetal.ObjectiveCCore;
using System.Runtime.Versioning;
namespace Ryujinx.Graphics.Metal
{
[SupportedOSPlatform("macos")]
public class StringHelper
{
public static NSString NSString(string source)
{
return new(ObjectiveC.IntPtr_objc_msgSend(new ObjectiveCClass("NSString"), "stringWithUTF8String:", source));
}
public static unsafe string String(NSString source)
{
char[] sourceBuffer = new char[source.Length];
fixed (char* pSourceBuffer = sourceBuffer)
{
ObjectiveC.bool_objc_msgSend(source,
"getCString:maxLength:encoding:",
pSourceBuffer,
source.MaximumLengthOfBytes(NSStringEncoding.UTF16) + 1,
(ulong)NSStringEncoding.UTF16);
}
return new string(sourceBuffer);
}
}
}