From 22ef66747d565667875622aac7a8407f07444062 Mon Sep 17 00:00:00 2001 From: Myrkur Date: Fri, 11 Nov 2022 14:37:52 -0500 Subject: [PATCH 1/2] (Minor) Added argument to set VROverlay GPU to index 1, Fixes issues when rendering SteamVR on a GPU that is not considered the main GPU, such as with an IGPU --- Program.cs | 2 +- StartupArgs.cs | 1 + VRCXVR.cs | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Program.cs b/Program.cs index 1b24b010..f7532b28 100644 --- a/Program.cs +++ b/Program.cs @@ -17,7 +17,7 @@ namespace VRCX public static string ConfigLocation; public static string Version { get; private set; } public static bool LaunchDebug; - + public static bool GPUFix; static Program() { BaseDirectory = AppDomain.CurrentDomain.BaseDirectory; diff --git a/StartupArgs.cs b/StartupArgs.cs index c6236807..4614e342 100644 --- a/StartupArgs.cs +++ b/StartupArgs.cs @@ -24,6 +24,7 @@ namespace VRCX foreach (string arg in args) { + if (arg.Contains("--gpufix")) Program.GPUFix = true; if (arg.Length > 12 && arg.Substring(0, 12) == "/uri=vrcx://") LaunchCommand = arg.Substring(12); diff --git a/VRCXVR.cs b/VRCXVR.cs index 5cfbcc1b..2ea60788 100644 --- a/VRCXVR.cs +++ b/VRCXVR.cs @@ -88,11 +88,23 @@ namespace VRCX // REMOVE THIS // nextOverlay = DateTime.MaxValue; + // https://stackoverflow.com/questions/38312597/how-to-choose-a-specific-graphics-device-in-sharpdx-directx-11/38596725#38596725 + SharpDX.DXGI.Factory f = new SharpDX.DXGI.Factory1(); + SharpDX.DXGI.Adapter a = f.GetAdapter(1); + FeatureLevel[] levels = new FeatureLevel[] + { +#if DIRECTX11_1 + FeatureLevel.Level_11_1, +#endif + FeatureLevel.Level_11_0, + FeatureLevel.Level_10_1, + FeatureLevel.Level_10_0, + FeatureLevel.Level_9_3 + }; + DeviceCreationFlags flags = DeviceCreationFlags.BgraSupport; + // _device = new Device(a, flags, levels); - _device = new Device( - DriverType.Hardware, - DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.BgraSupport - ); + _device = Program.GPUFix ? new Device(a, flags) : new Device(DriverType.Hardware, DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.BgraSupport); _texture1 = new Texture2D( _device, From e24103ec30ea2deda1e3780d1976622b17166d95 Mon Sep 17 00:00:00 2001 From: Myrkur Date: Sun, 13 Nov 2022 15:14:35 -0500 Subject: [PATCH 2/2] cleanup of useless code --- VRCXVR.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/VRCXVR.cs b/VRCXVR.cs index 2ea60788..da98cf36 100644 --- a/VRCXVR.cs +++ b/VRCXVR.cs @@ -89,20 +89,10 @@ namespace VRCX // REMOVE THIS // nextOverlay = DateTime.MaxValue; // https://stackoverflow.com/questions/38312597/how-to-choose-a-specific-graphics-device-in-sharpdx-directx-11/38596725#38596725 - SharpDX.DXGI.Factory f = new SharpDX.DXGI.Factory1(); - SharpDX.DXGI.Adapter a = f.GetAdapter(1); - FeatureLevel[] levels = new FeatureLevel[] - { -#if DIRECTX11_1 - FeatureLevel.Level_11_1, -#endif - FeatureLevel.Level_11_0, - FeatureLevel.Level_10_1, - FeatureLevel.Level_10_0, - FeatureLevel.Level_9_3 - }; + Factory f = new Factory1(); + Adapter a = f.GetAdapter(1); + DeviceCreationFlags flags = DeviceCreationFlags.BgraSupport; - // _device = new Device(a, flags, levels); _device = Program.GPUFix ? new Device(a, flags) : new Device(DriverType.Hardware, DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.BgraSupport);