Select first NCNN by default if CUDA is not detected

This commit is contained in:
N00MKRAD
2021-05-09 18:15:37 +02:00
parent f3434a71e4
commit b3a32ff557

View File

@@ -1,5 +1,6 @@
using Flowframes.Data; using Flowframes.Data;
using Flowframes.IO; using Flowframes.IO;
using Flowframes.OS;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@@ -59,6 +60,8 @@ namespace Flowframes.UI
if (combox.SelectedIndex < 0) if (combox.SelectedIndex < 0)
combox.SelectedIndex = 0; combox.SelectedIndex = 0;
SelectNcnnIfNoCudaAvail(combox);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -67,5 +70,17 @@ namespace Flowframes.UI
return combox; return combox;
} }
static void SelectNcnnIfNoCudaAvail (ComboBox combox)
{
if(NvApi.gpuList.Count < 1)
{
for(int i = 0; i < combox.Items.Count; i++)
{
if (((string)combox.Items[i]).ToUpper().Contains("NCNN"))
combox.SelectedIndex = i;
}
}
}
} }
} }