Check for GPU availability on startup, no CPU fallback for now since NCNN VS doesn't support it

This commit is contained in:
N00MKRAD
2024-12-31 19:08:28 +01:00
parent 048a849e49
commit fa11214b6e
4 changed files with 26 additions and 2 deletions

View File

@@ -181,6 +181,7 @@ namespace Flowframes.Forms.Main
try
{
// Task.Run(() => Updater.UpdateModelList());
StartupChecks.GpuCheck();
Task.Run(() => Updater.AsyncUpdateCheck());
Task.Run(() => GetWebInfo.LoadNews(newsLabel));
Task.Run(() => GetWebInfo.LoadPatronListCsv(patronsLabel));

View File

@@ -37,11 +37,12 @@
// textLabel
//
this.textLabel.AutoSize = true;
this.textLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textLabel.ForeColor = System.Drawing.Color.White;
this.textLabel.Location = new System.Drawing.Point(15, 15);
this.textLabel.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
this.textLabel.Name = "textLabel";
this.textLabel.Size = new System.Drawing.Size(0, 13);
this.textLabel.Size = new System.Drawing.Size(0, 16);
this.textLabel.TabIndex = 8;
//
// btn1

View File

@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
using Flowframes.Forms.Main;
using Flowframes.IO;
using Flowframes.Ui;
@@ -121,5 +122,26 @@ namespace Flowframes.Os
IoUtils.TryDeleteIfExists(devmodeBatchPath);
}
}
public static void GpuCheck(bool exit = true)
{
bool anyGpu = OsUtils.HasGpu();
if (!anyGpu)
{
if (exit)
{
Form1.CloseAllSplashForms();
}
UiUtils.ShowMessageBox("No GPU detected!\n\nFlowframes requires a GPU (graphics card or integrated) with Vulkan support to run AI interpolation models.\n\nRecommended:" +
"\n- Nvidia GeForce GTX 1000 series or newer\n- AMD Radeon RX 5000 series or newer", UiUtils.MessageType.Error);
if (exit)
{
Application.Exit();
}
}
}
}
}

View File

@@ -100,7 +100,7 @@ namespace Flowframes.Ui
if (type == MessageType.Warning) icon = MessageBoxIcon.Warning;
else if (type == MessageType.Error) icon = MessageBoxIcon.Error;
MessageForm form = new MessageForm(text, type.ToString());
MessageForm form = new MessageForm(text, type.ToString()) { TopMost = true };
form.ShowDialog();
return DialogResult.OK;
}