internal static void OnVideoAdaptersResponse(MyRenderMessageVideoAdaptersResponse message) { MyRenderProxy.Log.WriteLine("MyVideoSettingsManager.OnVideoAdaptersResponse"); using (MyRenderProxy.Log.IndentUsing(LoggingOptions.NONE)) { m_adapters = message.Adapters; int currentAdapterIndex = -1; MyAdapterInfo currentAdapter; currentAdapter.Priority = 1000; try { currentAdapterIndex = MySandboxGame.Static.GameRenderComponent.RenderThread.CurrentAdapter; currentAdapter = m_adapters[currentAdapterIndex]; GpuUnderMinimum = !(currentAdapter.Has512MBRam || currentAdapter.VRAM >= (512 * 1024 * 1024)); } catch { } m_recommendedAspectRatio = new Dictionary <int, MyAspectRatio>(); if (m_adapters.Length == 0) { MyRenderProxy.Log.WriteLine("ERROR: Adapters count is 0!"); } for (int adapterIndex = 0; adapterIndex < m_adapters.Length; ++adapterIndex) { var adapter = m_adapters[adapterIndex]; MyRenderProxy.Log.WriteLine(string.Format("Adapter {0}", adapter)); using (MyRenderProxy.Log.IndentUsing(LoggingOptions.NONE)) { float aspectRatio = (float)adapter.CurrentDisplayMode.Width / (float)adapter.CurrentDisplayMode.Height; m_recommendedAspectRatio.Add(adapterIndex, GetAspectRatio(GetClosestAspectRatio(aspectRatio))); if (adapter.SupportedDisplayModes.Length == 0) { MyRenderProxy.Log.WriteLine(string.Format("WARNING: Adapter {0} count of supported display modes is 0!", adapterIndex)); } int maxTextureSize = adapter.MaxTextureSize; foreach (var mode in adapter.SupportedDisplayModes) { MyRenderProxy.Log.WriteLine(mode.ToString()); if (mode.Width > maxTextureSize || mode.Height > maxTextureSize) { MyRenderProxy.Log.WriteLine( string.Format("WARNING: Display mode {0} requires texture size which is not supported by this HW (this HW supports max {1})", mode, maxTextureSize)); } } } MySandboxGame.ShowIsBetterGCAvailableNotification |= currentAdapterIndex != adapterIndex && currentAdapter.Priority < adapter.Priority; } } }
internal static void OnVideoAdaptersResponse(MyRenderMessageVideoAdaptersResponse message) { MyRenderProxy.Log.WriteLine("MyVideoSettingsManager.OnVideoAdaptersResponse"); using (MyRenderProxy.Log.IndentUsing(LoggingOptions.NONE)) { MyAdapterInfo info; m_adapters = message.Adapters; int index = -1; info.Priority = 0x3e8; try { index = MySandboxGame.Static.GameRenderComponent.RenderThread.CurrentAdapter; info = m_adapters[index]; GpuUnderMinimum = !info.Has512MBRam; } catch { } m_recommendedAspectRatio = new Dictionary <int, MyAspectRatio>(); if (m_adapters.Length == 0) { MyRenderProxy.Log.WriteLine("ERROR: Adapters count is 0!"); } for (int i = 0; i < m_adapters.Length; i++) { MyAdapterInfo info2 = m_adapters[i]; MyRenderProxy.Log.WriteLine($"Adapter {info2}"); using (MyRenderProxy.Log.IndentUsing(LoggingOptions.NONE)) { m_recommendedAspectRatio.Add(i, GetAspectRatio(GetClosestAspectRatio(((float)info2.DesktopBounds.Width) / ((float)info2.DesktopBounds.Height)))); if (info2.SupportedDisplayModes.Length == 0) { MyRenderProxy.Log.WriteLine($"WARNING: Adapter {i} count of supported display modes is 0!"); } int maxTextureSize = info2.MaxTextureSize; foreach (MyDisplayMode mode in info2.SupportedDisplayModes) { MyRenderProxy.Log.WriteLine(mode.ToString()); if ((mode.Width > maxTextureSize) || (mode.Height > maxTextureSize)) { MyRenderProxy.Log.WriteLine($"WARNING: Display mode {mode} requires texture size which is not supported by this HW (this HW supports max {maxTextureSize})"); } } } MySandboxGame.ShowIsBetterGCAvailableNotification |= (index != i) && (info.Priority < info2.Priority); } } }
// Checks the graphics card and exits application if it is not supported. protected void CheckGraphicsCard(MyRenderMessageVideoAdaptersResponse msgVideoAdapters) { Debug.Assert(MyVideoSettingsManager.CurrentDeviceSettings.AdapterOrdinal >= 0 && MyVideoSettingsManager.CurrentDeviceSettings.AdapterOrdinal < msgVideoAdapters.Adapters.Length, "Graphics adapter index out of range."); var adapter = msgVideoAdapters.Adapters[MyVideoSettingsManager.CurrentDeviceSettings.AdapterOrdinal]; if (MyGpuIds.IsUnsupported(adapter.VendorId, adapter.DeviceId) || MyGpuIds.IsUnderMinimum(adapter.VendorId, adapter.DeviceId)) { MySandboxGame.Log.WriteLine("Error: It seems that your graphics card is currently unsupported or it does not meet minimum requirements."); MySandboxGame.Log.WriteLine(string.Format("Graphics card name: {0}, vendor id: 0x{1:X}, device id: 0x{2:X}.", adapter.DeviceName, adapter.VendorId, adapter.DeviceId)); MyErrorReporter.ReportNotCompatibleGPU(Sandbox.Game.MyPerGameSettings.GameName, MySandboxGame.Log.GetFilePath(), Sandbox.Game.MyPerGameSettings.MinimumRequirementsPage); //MySandboxGame.ExitThreadSafe(); // let him play, maybe it will work, he was warned } }