mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-24 15:26:01 +00:00
Use Ryujinx Logger
This commit is contained in:
parent
f4aea9b7ec
commit
28da4248ae
2 changed files with 32 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Shader;
|
using Ryujinx.Graphics.Shader;
|
||||||
using SharpMetal.Foundation;
|
using SharpMetal.Foundation;
|
||||||
|
@ -35,8 +36,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
_renderEncoderState = new(_device.NewRenderPipelineState(renderPipelineDescriptor, ref error));
|
_renderEncoderState = new(_device.NewRenderPipelineState(renderPipelineDescriptor, ref error));
|
||||||
if (error != IntPtr.Zero)
|
if (error != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
// throw new Exception($"Failed to create render pipeline state! {StringHelp}");
|
Logger.Error?.PrintMsg(LogClass.Gpu, $"Failed to create Render Pipeline State: {StringHelper.String(error.LocalizedDescription)}");
|
||||||
throw new Exception($"Failed to create render pipeline state!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_commandBuffer = _mtlCommandQueue.CommandBuffer();
|
_commandBuffer = _mtlCommandQueue.CommandBuffer();
|
||||||
|
|
30
src/Ryujinx.Graphics.Metal/StringHelper.cs
Normal file
30
src/Ryujinx.Graphics.Metal/StringHelper.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue