From 0034b24effbcac5571a07c978b7e2bd200674334 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 28 Sep 2022 16:52:01 -0700 Subject: [PATCH] initial refresh backend selection API support --- lib/RefreshCS | 2 +- src/Game.cs | 1 + src/Graphics/GraphicsDevice.cs | 4 ++++ src/Graphics/RefreshEnums.cs | 8 ++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/RefreshCS b/lib/RefreshCS index 356f8e9..eaed76f 160000 --- a/lib/RefreshCS +++ b/lib/RefreshCS @@ -1 +1 @@ -Subproject commit 356f8e9ec2a6118b75e32d2a2ed7dbf4297aba78 +Subproject commit eaed76f4dcc60022b3f10997fb34eb8ead9ae7d7 diff --git a/src/Game.cs b/src/Game.cs index 12a453a..5c31153 100644 --- a/src/Game.cs +++ b/src/Game.cs @@ -79,6 +79,7 @@ namespace MoonWorks GraphicsDevice = new GraphicsDevice( Window.Handle, + Backend.Vulkan, moonWorksToRefreshPresentMode[presentMode], debugMode ); diff --git a/src/Graphics/GraphicsDevice.cs b/src/Graphics/GraphicsDevice.cs index c111c9e..8d58559 100644 --- a/src/Graphics/GraphicsDevice.cs +++ b/src/Graphics/GraphicsDevice.cs @@ -8,6 +8,7 @@ namespace MoonWorks.Graphics public class GraphicsDevice : IDisposable { public IntPtr Handle { get; } + public Backend Backend { get; } // Built-in video pipeline private ShaderModule VideoVertexShader { get; } @@ -20,10 +21,13 @@ namespace MoonWorks.Graphics public GraphicsDevice( IntPtr deviceWindowHandle, + Backend preferredBackend, Refresh.PresentMode presentMode, bool debugMode ) { + Backend = (Backend) Refresh.Refresh_SelectBackend((Refresh.Backend) preferredBackend, out uint flags); + var presentationParameters = new Refresh.PresentationParameters { deviceWindowHandle = deviceWindowHandle, diff --git a/src/Graphics/RefreshEnums.cs b/src/Graphics/RefreshEnums.cs index 1587dd8..1362a90 100644 --- a/src/Graphics/RefreshEnums.cs +++ b/src/Graphics/RefreshEnums.cs @@ -280,4 +280,12 @@ namespace MoonWorks.Graphics FloatOpaqueWhite, IntOpaqueWhite } + + public enum Backend + { + DontCare, + Vulkan, + PS5, + Invalid + } }