SDL2 Headless Metal Backend support
This commit is contained in:
committed by
Evan Husted
parent
8b9d6ffc94
commit
7c31a411df
49
src/Ryujinx.Headless.SDL2/Metal/MetalWindow.cs
Normal file
49
src/Ryujinx.Headless.SDL2/Metal/MetalWindow.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Input.HLE;
|
||||
using Ryujinx.SDL2.Common;
|
||||
using SharpMetal.QuartzCore;
|
||||
using System.Runtime.Versioning;
|
||||
using static SDL2.SDL;
|
||||
|
||||
namespace Ryujinx.Headless.SDL2.Metal
|
||||
{
|
||||
[SupportedOSPlatform("macos")]
|
||||
class MetalWindow : WindowBase
|
||||
{
|
||||
private CAMetalLayer _caMetalLayer;
|
||||
|
||||
public CAMetalLayer GetLayer()
|
||||
{
|
||||
return _caMetalLayer;
|
||||
}
|
||||
|
||||
public MetalWindow(
|
||||
InputManager inputManager,
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursorMode hideCursorMode)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode) { }
|
||||
|
||||
public override SDL_WindowFlags GetWindowFlags() => SDL_WindowFlags.SDL_WINDOW_METAL;
|
||||
|
||||
protected override void InitializeWindowRenderer()
|
||||
{
|
||||
void CreateLayer()
|
||||
{
|
||||
_caMetalLayer = new CAMetalLayer(SDL_Metal_GetLayer(SDL_Metal_CreateView(WindowHandle)));
|
||||
}
|
||||
|
||||
if (SDL2Driver.MainThreadDispatcher != null)
|
||||
{
|
||||
SDL2Driver.MainThreadDispatcher(CreateLayer);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitializeRenderer() { }
|
||||
|
||||
protected override void FinalizeWindowRenderer() { }
|
||||
|
||||
protected override void SwapBuffers() { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user