fix: ignore exceptions when getting video memory info

This commit is contained in:
goat 2023-01-26 22:38:42 +01:00
parent 91ac86a12a
commit 42ebf4145b
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -417,13 +417,22 @@ internal class InterfaceManager : IDisposable, IServiceType
if (this.Device == null) if (this.Device == null)
return null; return null;
var dxgiDev = this.Device.QueryInterfaceOrNull<SharpDX.DXGI.Device>(); try
var dxgiAdapter = dxgiDev?.Adapter.QueryInterfaceOrNull<SharpDX.DXGI.Adapter4>(); {
if (dxgiAdapter == null) var dxgiDev = this.Device.QueryInterfaceOrNull<SharpDX.DXGI.Device>();
return null; var dxgiAdapter = dxgiDev?.Adapter.QueryInterfaceOrNull<SharpDX.DXGI.Adapter4>();
if (dxgiAdapter == null)
return null;
var memInfo = dxgiAdapter.QueryVideoMemoryInfo(0, SharpDX.DXGI.MemorySegmentGroup.Local); var memInfo = dxgiAdapter.QueryVideoMemoryInfo(0, SharpDX.DXGI.MemorySegmentGroup.Local);
return (memInfo.CurrentUsage, memInfo.CurrentReservation); return (memInfo.CurrentUsage, memInfo.CurrentReservation);
}
catch
{
// ignored
}
return null;
} }
private static void ShowFontError(string path) private static void ShowFontError(string path)