aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-06-11 18:31:22 +0200
committerGitHub <noreply@github.com>2023-06-11 18:31:22 +0200
commit9a1b74799d350f9b4ba365bf8b118bddf517711f (patch)
treeb46d4013a625e6321497989da220ac69665347ee /src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs
parent638f3761f3215d088ed8c6da3cd461bb830d2c31 (diff)
Ava: Fix OpenGL on Linux again (#5216)
* ava: Fix OpenGL on Linux again This shouldn't be working like that, but for some reason it does. * Apply the correct fix * gtk: Add warning messages for caught exceptions * ava: Handle disposing the same way as GTK does * Address review feedback
Diffstat (limited to 'src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs')
-rw-r--r--src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs b/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs
index 305e891a..d427ab88 100644
--- a/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs
+++ b/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindowOpenGL.cs
@@ -1,9 +1,11 @@
using OpenTK.Graphics.OpenGL;
using Ryujinx.Common.Configuration;
+using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.OpenGL;
using Ryujinx.Ui.Common.Configuration;
using SPB.Graphics;
+using SPB.Graphics.Exceptions;
using SPB.Graphics.OpenGL;
using SPB.Platform;
using SPB.Platform.WGL;
@@ -18,8 +20,6 @@ namespace Ryujinx.Ava.UI.Renderer
public OpenGLContextBase Context { get; set; }
- public EmbeddedWindowOpenGL() { }
-
protected override void OnWindowDestroying()
{
Context.Dispose();
@@ -62,14 +62,21 @@ namespace Ryujinx.Ava.UI.Renderer
Context.MakeCurrent(null);
}
- public void MakeCurrent()
+ public void MakeCurrent(bool unbind = false, bool shouldThrow = true)
{
- Context?.MakeCurrent(_window);
- }
+ try
+ {
+ Context?.MakeCurrent(!unbind ? _window : null);
+ }
+ catch (ContextException e)
+ {
+ if (shouldThrow)
+ {
+ throw;
+ }
- public void MakeCurrent(NativeWindowBase window)
- {
- Context?.MakeCurrent(window);
+ Logger.Warning?.Print(LogClass.Ui, $"Failed to {(!unbind ? "bind" : "unbind")} OpenGL context: {e}");
+ }
}
public void SwapBuffers()