Skip to content

Commit

Permalink
Check for GPU availability on startup, no CPU fallback for now since …
Browse files Browse the repository at this point in the history
…NCNN VS doesn't support it
  • Loading branch information
n00mkrad committed Dec 31, 2024
1 parent 048a849 commit fa11214
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions CodeLegacy/Forms/Main/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ private async Task Checks()
try
{
// Task.Run(() => Updater.UpdateModelList());
StartupChecks.GpuCheck();
Task.Run(() => Updater.AsyncUpdateCheck());
Task.Run(() => GetWebInfo.LoadNews(newsLabel));
Task.Run(() => GetWebInfo.LoadPatronListCsv(patronsLabel));
Expand Down
3 changes: 2 additions & 1 deletion CodeLegacy/Forms/MessageForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions CodeLegacy/Os/StartupChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
using Flowframes.Forms.Main;
using Flowframes.IO;
using Flowframes.Ui;

Expand Down Expand Up @@ -121,5 +122,26 @@ public static async Task SymlinksCheck()
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();
}
}
}
}
}
2 changes: 1 addition & 1 deletion CodeLegacy/Ui/UiUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static DialogResult ShowMessageBox(string text, MessageType type = Messag
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;
}
Expand Down

0 comments on commit fa11214

Please sign in to comment.