From e68650237db2d5fd0fb78d9e21378d139338246f Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Mon, 16 Jan 2023 03:59:41 +0100 Subject: [PATCH] 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 Co-authored-by: Ac_K --- Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs | 7 ++++--- Ryujinx.Ava/UI/Renderer/RendererHost.axaml.cs | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs b/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs index 21d9d12e2..6cacfef49 100644 --- a/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs +++ b/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs @@ -82,7 +82,7 @@ namespace Ryujinx.Ava.UI.Renderer } else if (OperatingSystem.IsMacOS()) { - return CreateMacOs(); + return CreateMacOS(); } return base.CreateNativeControlCore(control); @@ -113,11 +113,12 @@ namespace Ryujinx.Ava.UI.Renderer } [SupportedOSPlatform("linux")] - protected virtual IPlatformHandle CreateLinux(IPlatformHandle control) + private IPlatformHandle CreateLinux(IPlatformHandle control) { if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan) { X11Window = new GLXWindow(new NativeHandle(X11.DefaultDisplay), new NativeHandle(control.Handle)); + X11Window.Hide(); } else { @@ -227,7 +228,7 @@ namespace Ryujinx.Ava.UI.Renderer } [SupportedOSPlatform("macos")] - IPlatformHandle CreateMacOs() + IPlatformHandle CreateMacOS() { MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback); diff --git a/Ryujinx.Ava/UI/Renderer/RendererHost.axaml.cs b/Ryujinx.Ava/UI/Renderer/RendererHost.axaml.cs index 16a46df42..ee10282db 100644 --- a/Ryujinx.Ava/UI/Renderer/RendererHost.axaml.cs +++ b/Ryujinx.Ava/UI/Renderer/RendererHost.axaml.cs @@ -2,14 +2,13 @@ using Avalonia; using Avalonia.Controls; using Ryujinx.Common.Configuration; using Ryujinx.Ui.Common.Configuration; -using Silk.NET.Vulkan; using System; namespace Ryujinx.Ava.UI.Renderer { public partial class RendererHost : UserControl, IDisposable { - public EmbeddedWindow EmbeddedWindow; + public readonly EmbeddedWindow EmbeddedWindow; public event EventHandler WindowCreated; public event Action SizeChanged; @@ -18,8 +17,6 @@ namespace Ryujinx.Ava.UI.Renderer { InitializeComponent(); - Dispose(); - if (ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.OpenGl) { EmbeddedWindow = new EmbeddedWindowOpenGL(); @@ -47,6 +44,8 @@ namespace Ryujinx.Ava.UI.Renderer EmbeddedWindow.WindowCreated -= CurrentWindow_WindowCreated; EmbeddedWindow.SizeChanged -= CurrentWindow_SizeChanged; } + + GC.SuppressFinalize(this); } protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)