aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx/UI/SPBOpenGLContext.cs
diff options
context:
space:
mode:
authorIsaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com>2024-02-11 02:09:18 +0000
committerGitHub <noreply@github.com>2024-02-11 03:09:18 +0100
commitf06d22d6f01e657ebbc0c8ef082739cd468e47b5 (patch)
treec10a566438d3801b33c1d7b4eff73ea62b2f1a63 /src/Ryujinx/UI/SPBOpenGLContext.cs
parent84d6e8d121a1b329d26cc0e462aadd1108d99a04 (diff)
Infra: Capitalisation Consistency (#6296)1.1.1187
* Rename Ryujinx.UI.Common * Rename Ryujinx.UI.LocaleGenerator * Update in Files AboutWindow * Configuration State * Rename projects * Ryujinx/UI * Fix build * Main remaining inconsistencies * HLE.UI Namespace * HLE.UI Files * Namespace * Ryujinx.UI.Common.Configuration.UI * Ryujinx.UI.Common,Configuration.UI Files * More instances
Diffstat (limited to 'src/Ryujinx/UI/SPBOpenGLContext.cs')
-rw-r--r--src/Ryujinx/UI/SPBOpenGLContext.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Ryujinx/UI/SPBOpenGLContext.cs b/src/Ryujinx/UI/SPBOpenGLContext.cs
new file mode 100644
index 00000000..97feb434
--- /dev/null
+++ b/src/Ryujinx/UI/SPBOpenGLContext.cs
@@ -0,0 +1,49 @@
+using OpenTK.Graphics.OpenGL;
+using Ryujinx.Graphics.OpenGL;
+using SPB.Graphics;
+using SPB.Graphics.OpenGL;
+using SPB.Platform;
+using SPB.Windowing;
+
+namespace Ryujinx.UI
+{
+ class SPBOpenGLContext : IOpenGLContext
+ {
+ private readonly OpenGLContextBase _context;
+ private readonly NativeWindowBase _window;
+
+ private SPBOpenGLContext(OpenGLContextBase context, NativeWindowBase window)
+ {
+ _context = context;
+ _window = window;
+ }
+
+ public void Dispose()
+ {
+ _context.Dispose();
+ _window.Dispose();
+ }
+
+ public void MakeCurrent()
+ {
+ _context.MakeCurrent(_window);
+ }
+
+ public bool HasContext() => _context.IsCurrent;
+
+ public static SPBOpenGLContext CreateBackgroundContext(OpenGLContextBase sharedContext)
+ {
+ OpenGLContextBase context = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, 3, 3, OpenGLContextFlags.Compat, true, sharedContext);
+ NativeWindowBase window = PlatformHelper.CreateOpenGLWindow(FramebufferFormat.Default, 0, 0, 100, 100);
+
+ context.Initialize(window);
+ context.MakeCurrent(window);
+
+ GL.LoadBindings(new OpenToolkitBindingsContext(context));
+
+ context.MakeCurrent(null);
+
+ return new SPBOpenGLContext(context, window);
+ }
+ }
+}