Ryujinx/src/Ryujinx.Graphics.Metal/Window.cs

65 lines
1.8 KiB
C#
Raw Normal View History

2023-08-02 02:36:07 +00:00
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
2023-08-03 00:32:59 +00:00
using SharpMetal.ObjectiveCCore;
using SharpMetal.QuartzCore;
using System;
2023-07-28 02:54:24 +00:00
using System.Runtime.Versioning;
namespace Ryujinx.Graphics.Metal
{
2023-07-28 02:54:24 +00:00
[SupportedOSPlatform("macos")]
2023-08-03 18:50:49 +00:00
class Window : IWindow, IDisposable
{
2023-07-28 02:54:24 +00:00
private readonly MetalRenderer _renderer;
2023-08-03 00:32:59 +00:00
private readonly CAMetalLayer _metalLayer;
2023-08-03 00:32:59 +00:00
public Window(MetalRenderer renderer, CAMetalLayer metalLayer)
{
2023-07-28 02:54:24 +00:00
_renderer = renderer;
2023-08-03 00:32:59 +00:00
_metalLayer = metalLayer;
}
2023-08-03 01:18:28 +00:00
// TODO: Handle ImageCrop
public void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback)
{
2023-08-03 00:32:59 +00:00
if (_renderer.Pipeline is Pipeline pipeline && texture is Texture tex)
2023-07-28 02:54:24 +00:00
{
2023-08-03 00:32:59 +00:00
var drawable = new CAMetalDrawable(ObjectiveC.IntPtr_objc_msgSend(_metalLayer, "nextDrawable"));
pipeline.Present(drawable, tex);
2023-07-28 02:54:24 +00:00
}
}
public void SetSize(int width, int height)
{
2023-08-02 02:36:07 +00:00
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
}
public void ChangeVSyncMode(bool vsyncEnabled)
{
2023-08-02 02:36:07 +00:00
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
}
public void SetAntiAliasing(AntiAliasing antialiasing)
{
2023-08-02 02:36:07 +00:00
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
}
public void SetScalingFilter(ScalingFilter type)
{
2023-08-02 02:36:07 +00:00
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
}
public void SetScalingFilterLevel(float level)
{
2023-08-02 02:36:07 +00:00
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
}
2023-08-12 14:12:35 +00:00
public void SetColorSpacePassthrough(bool colorSpacePassThroughEnabled) { }
public void Dispose()
{
2024-05-23 18:08:34 +00:00
_metalLayer.Dispose();
}
}
2023-07-28 02:54:24 +00:00
}