Ava: Fix Linux Vulkan renderer regression (#4303)

* ava: Fix Linux Vulkan renderer staying transparent

* ava: Minor Renderer cleanup

* Don't supress potential NRE warning

Co-authored-by: Ac_K <Acoustik666@gmail.com>

Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
TSRBerry 2023-01-16 03:59:41 +01:00 committed by GitHub
parent 1faff14e73
commit e68650237d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -82,7 +82,7 @@ namespace Ryujinx.Ava.UI.Renderer
} }
else if (OperatingSystem.IsMacOS()) else if (OperatingSystem.IsMacOS())
{ {
return CreateMacOs(); return CreateMacOS();
} }
return base.CreateNativeControlCore(control); return base.CreateNativeControlCore(control);
@ -113,11 +113,12 @@ namespace Ryujinx.Ava.UI.Renderer
} }
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]
protected virtual IPlatformHandle CreateLinux(IPlatformHandle control) private IPlatformHandle CreateLinux(IPlatformHandle control)
{ {
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan) if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan)
{ {
X11Window = new GLXWindow(new NativeHandle(X11.DefaultDisplay), new NativeHandle(control.Handle)); X11Window = new GLXWindow(new NativeHandle(X11.DefaultDisplay), new NativeHandle(control.Handle));
X11Window.Hide();
} }
else else
{ {
@ -227,7 +228,7 @@ namespace Ryujinx.Ava.UI.Renderer
} }
[SupportedOSPlatform("macos")] [SupportedOSPlatform("macos")]
IPlatformHandle CreateMacOs() IPlatformHandle CreateMacOS()
{ {
MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback); MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback);

View File

@ -2,14 +2,13 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Ui.Common.Configuration; using Ryujinx.Ui.Common.Configuration;
using Silk.NET.Vulkan;
using System; using System;
namespace Ryujinx.Ava.UI.Renderer namespace Ryujinx.Ava.UI.Renderer
{ {
public partial class RendererHost : UserControl, IDisposable public partial class RendererHost : UserControl, IDisposable
{ {
public EmbeddedWindow EmbeddedWindow; public readonly EmbeddedWindow EmbeddedWindow;
public event EventHandler<EventArgs> WindowCreated; public event EventHandler<EventArgs> WindowCreated;
public event Action<object, Size> SizeChanged; public event Action<object, Size> SizeChanged;
@ -18,8 +17,6 @@ namespace Ryujinx.Ava.UI.Renderer
{ {
InitializeComponent(); InitializeComponent();
Dispose();
if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl) if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl)
{ {
EmbeddedWindow = new EmbeddedWindowOpenGL(); EmbeddedWindow = new EmbeddedWindowOpenGL();
@ -47,6 +44,8 @@ namespace Ryujinx.Ava.UI.Renderer
EmbeddedWindow.WindowCreated -= CurrentWindow_WindowCreated; EmbeddedWindow.WindowCreated -= CurrentWindow_WindowCreated;
EmbeddedWindow.SizeChanged -= CurrentWindow_SizeChanged; EmbeddedWindow.SizeChanged -= CurrentWindow_SizeChanged;
} }
GC.SuppressFinalize(this);
} }
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)