diff options
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/BackgroundContextWorker.cs')
| -rw-r--r-- | Ryujinx.Graphics.OpenGL/BackgroundContextWorker.cs | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/Ryujinx.Graphics.OpenGL/BackgroundContextWorker.cs b/Ryujinx.Graphics.OpenGL/BackgroundContextWorker.cs index d56951a7..f942037c 100644 --- a/Ryujinx.Graphics.OpenGL/BackgroundContextWorker.cs +++ b/Ryujinx.Graphics.OpenGL/BackgroundContextWorker.cs @@ -1,37 +1,24 @@ -using OpenTK; -using OpenTK.Graphics; -using Ryujinx.Common; +using Ryujinx.Common; using System; using System.Collections.Generic; using System.Threading; namespace Ryujinx.Graphics.OpenGL { - class BackgroundContextWorker : IDisposable + unsafe class BackgroundContextWorker : IDisposable { [ThreadStatic] public static bool InBackground; - - private GameWindow _window; - private GraphicsContext _context; private Thread _thread; private bool _running; private AutoResetEvent _signal; private Queue<Action> _work; private ObjectPool<ManualResetEventSlim> _invokePool; + private readonly IOpenGLContext _backgroundContext; - public BackgroundContextWorker(IGraphicsContext baseContext) + public BackgroundContextWorker(IOpenGLContext backgroundContext) { - _window = new GameWindow( - 100, 100, GraphicsMode.Default, - "Background Window", OpenTK.GameWindowFlags.FixedWindow, OpenTK.DisplayDevice.Default, - 3, 3, GraphicsContextFlags.ForwardCompatible, baseContext, false); - - _window.Visible = false; - _context = (GraphicsContext)_window.Context; - _context.MakeCurrent(null); - _running = true; _signal = new AutoResetEvent(false); @@ -40,12 +27,14 @@ namespace Ryujinx.Graphics.OpenGL _thread = new Thread(Run); _thread.Start(); + _backgroundContext = backgroundContext; } private void Run() { InBackground = true; - _context.MakeCurrent(_window.WindowInfo); + + _backgroundContext.MakeCurrent(); while (_running) { @@ -66,7 +55,7 @@ namespace Ryujinx.Graphics.OpenGL } } - _window.Dispose(); + _backgroundContext.Dispose(); } public void Invoke(Action action) @@ -99,4 +88,4 @@ namespace Ryujinx.Graphics.OpenGL _signal.Dispose(); } } -} +}
\ No newline at end of file |
