mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 08:27:44 +01:00
Hide certain settings based on conditions, auto-pick DAIN tile size based on VRAM
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Flowframes
|
|||||||
{
|
{
|
||||||
public class Cli
|
public class Cli
|
||||||
{
|
{
|
||||||
public static bool ShowConsole = false;
|
public static bool Debug = false;
|
||||||
public static bool DisablePython = true;
|
public static bool DisablePython = true;
|
||||||
public static bool ShowMdlDownloader = false;
|
public static bool ShowMdlDownloader = false;
|
||||||
public static bool CloseMdlDownloaderWhenDone = false;
|
public static bool CloseMdlDownloaderWhenDone = false;
|
||||||
@@ -43,6 +43,10 @@ namespace Flowframes
|
|||||||
|
|
||||||
var optsSet = new OptionSet
|
var optsSet = new OptionSet
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
"d|debug", "Enable debug/developer features and experimental or deprecated options",
|
||||||
|
v => Debug = v != null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"np|no_python", "Disable Python implementations",
|
"np|no_python", "Disable Python implementations",
|
||||||
v => DisablePython = v != null
|
v => DisablePython = v != null
|
||||||
|
|||||||
@@ -437,5 +437,29 @@ namespace Flowframes
|
|||||||
{
|
{
|
||||||
return Math.Abs(a - b) < tolerance;
|
return Math.Abs(a - b) < tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float GetVramGb(this NvAPIWrapper.GPU.PhysicalGPU gpu)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return gpu.MemoryInformation.AvailableDedicatedVideoMemoryInkB / 1024f / 1000f;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetFreeVramGb(this NvAPIWrapper.GPU.PhysicalGPU gpu)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB / 1024f / 1000f;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1375
CodeLegacy/Forms/SettingsForm.Designer.cs
generated
1375
CodeLegacy/Forms/SettingsForm.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -2,9 +2,11 @@
|
|||||||
using Flowframes.IO;
|
using Flowframes.IO;
|
||||||
using Flowframes.Media;
|
using Flowframes.Media;
|
||||||
using Flowframes.MiscUtils;
|
using Flowframes.MiscUtils;
|
||||||
|
using Flowframes.Os;
|
||||||
using Flowframes.Ui;
|
using Flowframes.Ui;
|
||||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@@ -169,6 +171,28 @@ namespace Flowframes.Forms
|
|||||||
ConfigParser.LoadGuiElement(ffEncArgs);
|
ConfigParser.LoadGuiElement(ffEncArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetVisibility ()
|
||||||
|
{
|
||||||
|
// Dev options
|
||||||
|
List<Control> devOptions = new List<Control> { panKeepTempFolder, };
|
||||||
|
devOptions.ForEach(c => c.SetVisible(Program.Debug));
|
||||||
|
|
||||||
|
// Legacy/deprecated/untested options
|
||||||
|
List<Control> legacyUntestedOptions = new List<Control> { panProcessingStyle, panEnableAlpha, panHqJpegImport };
|
||||||
|
legacyUntestedOptions.ForEach(c => c.SetVisible(Program.Debug));
|
||||||
|
|
||||||
|
// AutoEnc options
|
||||||
|
bool autoEncEnabled = autoEncMode.SelectedIndex != 0;
|
||||||
|
List<Control> autoEncOptions = new List<Control> { panAutoEncBackups, panAutoEncLowSpaceMode };
|
||||||
|
autoEncOptions.ForEach(c => c.SetVisible(autoEncEnabled));
|
||||||
|
panAutoEncInSbsMode.SetVisible(autoEncEnabled && panProcessingStyle.Visible);
|
||||||
|
|
||||||
|
var availAis = Implementations.NetworksAvailable;
|
||||||
|
panTorchGpus.SetVisible(NvApi.NvGpus.Count > 0 && Python.IsPytorchReady());
|
||||||
|
panNcnnGpus.SetVisible(VulkanUtils.VkDevices.Count > 0);
|
||||||
|
panRifeCudaHalfPrec.SetVisible(NvApi.NvGpus.Count > 0 && availAis.Contains(Implementations.rifeCuda));
|
||||||
|
}
|
||||||
|
|
||||||
private void tempFolderLoc_SelectedIndexChanged(object sender, EventArgs e)
|
private void tempFolderLoc_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
tempDirBrowseBtn.Visible = tempFolderLoc.SelectedIndex == 4;
|
tempDirBrowseBtn.Visible = tempFolderLoc.SelectedIndex == 4;
|
||||||
@@ -229,7 +253,7 @@ namespace Flowframes.Forms
|
|||||||
|
|
||||||
private void autoEncMode_SelectedIndexChanged(object sender, EventArgs e)
|
private void autoEncMode_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
autoEncBlockPanel.Visible = autoEncMode.SelectedIndex == 0;
|
SetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void resetBtn_Click(object sender, EventArgs e)
|
private async void resetBtn_Click(object sender, EventArgs e)
|
||||||
@@ -253,6 +277,8 @@ namespace Flowframes.Forms
|
|||||||
|
|
||||||
private void settingsTabList_SelectedIndexChanged(object sender, EventArgs e)
|
private void settingsTabList_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
SetVisibility();
|
||||||
|
|
||||||
if (!_sizeFixApplied)
|
if (!_sizeFixApplied)
|
||||||
{
|
{
|
||||||
Size = new Size(Width + 1, Height + 1);
|
Size = new Size(Width + 1, Height + 1);
|
||||||
|
|||||||
@@ -120,6 +120,9 @@
|
|||||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
<data name="info1.ToolTip" xml:space="preserve">
|
<data name="info1.ToolTip" xml:space="preserve">
|
||||||
<value>Set the filename patterns using placeholders:
|
<value>Set the filename patterns using placeholders:
|
||||||
[NAME] for the input filename
|
[NAME] for the input filename
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Flowframes.Forms;
|
using Flowframes.Forms;
|
||||||
|
using Flowframes.Utilities;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -157,7 +158,7 @@ namespace Flowframes.IO
|
|||||||
|
|
||||||
public static bool GetBool(Key key, bool defaultVal = false)
|
public static bool GetBool(Key key, bool defaultVal = false)
|
||||||
{
|
{
|
||||||
WriteIfDoesntExist(key.ToString(), (defaultVal ? "True" : "False"));
|
WriteIfDoesntExist(key.ToString(), (defaultVal ? true : false).ToString());
|
||||||
return Get(key, Type.Bool).GetBool();
|
return Get(key, Type.Bool).GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ namespace Flowframes.IO
|
|||||||
|
|
||||||
public static bool GetBool(string key, bool defaultVal)
|
public static bool GetBool(string key, bool defaultVal)
|
||||||
{
|
{
|
||||||
WriteIfDoesntExist(key.ToString(), (defaultVal ? "True" : "False"));
|
WriteIfDoesntExist(key.ToString(), (defaultVal ? true : false).ToString());
|
||||||
return bool.Parse(Get(key, Type.Bool));
|
return bool.Parse(Get(key, Type.Bool));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,22 +259,22 @@ namespace Flowframes.IO
|
|||||||
return WriteDefault(keyStr, "");
|
return WriteDefault(keyStr, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == Key.disablePreview) return WriteDefault(key, "True");
|
if (key == Key.disablePreview) return WriteDefault(key, true);
|
||||||
if (key == Key.maxVidHeight) return WriteDefault(key, "2160");
|
if (key == Key.maxVidHeight) return WriteDefault(key, "2160");
|
||||||
if (key == Key.clearLogOnInput) return WriteDefault(key, "True");
|
if (key == Key.clearLogOnInput) return WriteDefault(key, true);
|
||||||
if (key == Key.tempDirCustom) return WriteDefault(key, "D:/");
|
if (key == Key.tempDirCustom) return WriteDefault(key, "D:/");
|
||||||
if (key == Key.exportNamePattern) return WriteDefault(key, "[NAME]-[FACTOR]x-[MODEL]-[FPS]fps");
|
if (key == Key.exportNamePattern) return WriteDefault(key, "[NAME]-[FACTOR]x-[MODEL]-[FPS]fps");
|
||||||
if (key == Key.exportNamePatternLoop) return WriteDefault(key, "-Loop[LOOPS]");
|
if (key == Key.exportNamePatternLoop) return WriteDefault(key, "-Loop[LOOPS]");
|
||||||
// Interpolation
|
// Interpolation
|
||||||
if (key == Key.dedupThresh) return WriteDefault(key, "2");
|
if (key == Key.dedupThresh) return WriteDefault(key, "2");
|
||||||
if (key == Key.keepAudio) return WriteDefault(key, "True");
|
if (key == Key.keepAudio) return WriteDefault(key, true);
|
||||||
if (key == Key.keepSubs) return WriteDefault(key, "True");
|
if (key == Key.keepSubs) return WriteDefault(key, true);
|
||||||
if (key == Key.keepMeta) return WriteDefault(key, "True");
|
if (key == Key.keepMeta) return WriteDefault(key, true);
|
||||||
if (key == Key.scnDetect) return WriteDefault(key, "True");
|
if (key == Key.scnDetect) return WriteDefault(key, true);
|
||||||
if (key == Key.scnDetectValue) return WriteDefault(key, "0.2");
|
if (key == Key.scnDetectValue) return WriteDefault(key, "0.2");
|
||||||
if (key == Key.sceneChangeFillMode) return WriteDefault(key, "0");
|
if (key == Key.sceneChangeFillMode) return WriteDefault(key, "0");
|
||||||
if (key == Key.autoEncMode) return WriteDefault(key, "2");
|
if (key == Key.autoEncMode) return WriteDefault(key, "2");
|
||||||
if (key == Key.jpegFrames) return WriteDefault(key, "True");
|
if (key == Key.jpegFrames) return WriteDefault(key, true);
|
||||||
// Video Export
|
// Video Export
|
||||||
if (key == Key.minOutVidLength) return WriteDefault(key, "5");
|
if (key == Key.minOutVidLength) return WriteDefault(key, "5");
|
||||||
if (key == Key.gifDitherType) return WriteDefault(key, "bayer");
|
if (key == Key.gifDitherType) return WriteDefault(key, "bayer");
|
||||||
@@ -283,15 +284,21 @@ namespace Flowframes.IO
|
|||||||
if (key == Key.torchGpus) return WriteDefault(key, "0");
|
if (key == Key.torchGpus) return WriteDefault(key, "0");
|
||||||
if (key == Key.ncnnGpus) return WriteDefault(key, "0");
|
if (key == Key.ncnnGpus) return WriteDefault(key, "0");
|
||||||
if (key == Key.ncnnThreads) return WriteDefault(key, "0");
|
if (key == Key.ncnnThreads) return WriteDefault(key, "0");
|
||||||
if (key == Key.dainNcnnTilesize) return WriteDefault(key, "768");
|
if (key == Key.dainNcnnTilesize) return WriteDefault(key, NcnnUtils.GetDainNcnnTileSizeBasedOnVram(768).ToString());
|
||||||
// Debug / Other / Experimental
|
// Debug / Other / Experimental
|
||||||
if (key == Key.ffEncPreset) return WriteDefault(key, "fast");
|
if (key == Key.ffEncPreset) return WriteDefault(key, "fast");
|
||||||
if (key == Key.sbsRunPreviousStepIfNeeded) return WriteDefault(key, "True");
|
if (key == Key.sbsRunPreviousStepIfNeeded) return WriteDefault(key, true);
|
||||||
if (type == Type.Int || type == Type.Float) return WriteDefault(key, "0"); // Write default int/float (0)
|
if (type == Type.Int || type == Type.Float) return WriteDefault(key, "0"); // Write default int/float (0)
|
||||||
if (type == Type.Bool) return WriteDefault(key, "False"); // Write default bool (False)
|
if (type == Type.Bool) return WriteDefault(key, false); // Write default bool (False)
|
||||||
return WriteDefault(key, "");
|
return WriteDefault(key, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string WriteDefault(Key key, object def)
|
||||||
|
{
|
||||||
|
Set(key, def.ToString());
|
||||||
|
return def.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
private static string WriteDefault(Key key, string def)
|
private static string WriteDefault(Key key, string def)
|
||||||
{
|
{
|
||||||
Set(key, def);
|
Set(key, def);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace Flowframes.Main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckAiAvailable(AiInfo ai, ModelCollection.ModelInfo model)
|
public static bool CheckAiAvailable(AiInfo ai, ModelCollection.ModelInfo model, bool allowNullModel = false)
|
||||||
{
|
{
|
||||||
if (IoUtils.GetAmountOfFiles(Path.Combine(Paths.GetPkgPath(), ai.PkgDir), true) < 1)
|
if (IoUtils.GetAmountOfFiles(Path.Combine(Paths.GetPkgPath(), ai.PkgDir), true) < 1)
|
||||||
{
|
{
|
||||||
@@ -170,14 +170,14 @@ namespace Flowframes.Main
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model == null || model.Dir.Trim() == "")
|
if (!allowNullModel && (model == null || model.Dir.Trim() == ""))
|
||||||
{
|
{
|
||||||
UiUtils.ShowMessageBox("No valid AI model has been selected!", UiUtils.MessageType.Error);
|
UiUtils.ShowMessageBox("No valid AI model has been selected!", UiUtils.MessageType.Error);
|
||||||
I.Cancel("No valid model selected.", true);
|
I.Cancel("No valid model selected.", true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (I.currentSettings.ai.NameInternal.Upper().Contains("CUDA") && NvApi.gpuList.Count < 1)
|
if (I.currentSettings.ai.NameInternal.Upper().Contains("CUDA") && NvApi.NvGpus.Count < 1)
|
||||||
{
|
{
|
||||||
UiUtils.ShowMessageBox("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", UiUtils.MessageType.Error);
|
UiUtils.ShowMessageBox("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", UiUtils.MessageType.Error);
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ using NvAPIWrapper.GPU;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Flowframes.Os
|
namespace Flowframes.Os
|
||||||
{
|
{
|
||||||
class NvApi
|
class NvApi
|
||||||
{
|
{
|
||||||
public enum Architecture { Undetected, Fermi, Kepler, Maxwell, Pascal, Turing, Ampere };
|
public enum Architecture { Undetected, Fermi, Kepler, Maxwell, Pascal, Turing, Ampere, Ada, Blackwell };
|
||||||
public static List<PhysicalGPU> gpuList = new List<PhysicalGPU>();
|
public static List<PhysicalGPU> NvGpus = new List<PhysicalGPU>();
|
||||||
|
public static PhysicalGPU GpuWithMostVram = null;
|
||||||
|
public static int GpuWithMostVramId => NvGpus.IndexOf(GpuWithMostVram);
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
@@ -24,16 +25,22 @@ namespace Flowframes.Os
|
|||||||
if (gpus.Length == 0)
|
if (gpus.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gpuList = gpus.ToList();
|
NvGpus = gpus.ToList();
|
||||||
|
float mostVram = -1f;
|
||||||
List<string> gpuNames = new List<string>();
|
|
||||||
|
|
||||||
foreach (PhysicalGPU gpu in gpus)
|
foreach (PhysicalGPU gpu in gpus)
|
||||||
gpuNames.Add(gpu.FullName);
|
{
|
||||||
|
float vramGb = gpu.GetVramGb();
|
||||||
|
Logger.Log($"Nvidia GPU: {gpu.FullName} ({vramGb.ToString("0.")} GB) {GetArch(gpu)} Architecture", true);
|
||||||
|
|
||||||
string gpuNamesList = string.Join(", ", gpuNames);
|
if (vramGb > mostVram)
|
||||||
|
{
|
||||||
|
mostVram = vramGb;
|
||||||
|
GpuWithMostVram = gpu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Logger.Log($"Initialized Nvidia API in {sw.ElapsedMs} ms. GPU{(gpus.Length > 1 ? "s" : "")}: {gpuNamesList}", true);
|
Logger.Log($"Initialized Nvidia API in {sw.ElapsedMs} ms. GPU{(gpus.Length > 1 ? "s" : "")}: {string.Join(", ", gpus.Select(g => g.FullName))}. Most VRAM: {GpuWithMostVram.FullName} ({mostVram} GB)", true);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -46,7 +53,7 @@ namespace Flowframes.Os
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (gpuList[gpu].MemoryInformation.AvailableDedicatedVideoMemoryInkB / 1000f / 1024f);
|
return (NvGpus[gpu].MemoryInformation.AvailableDedicatedVideoMemoryInkB / 1000f / 1024f);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -58,7 +65,7 @@ namespace Flowframes.Os
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (gpuList[gpu].MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB / 1000f / 1024f);
|
return (NvGpus[gpu].MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB / 1000f / 1024f);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -85,7 +92,7 @@ namespace Flowframes.Os
|
|||||||
|
|
||||||
public static bool HasAmpereOrNewer()
|
public static bool HasAmpereOrNewer()
|
||||||
{
|
{
|
||||||
foreach (PhysicalGPU gpu in gpuList)
|
foreach (PhysicalGPU gpu in NvGpus)
|
||||||
{
|
{
|
||||||
Architecture arch = GetArch(gpu);
|
Architecture arch = GetArch(gpu);
|
||||||
|
|
||||||
@@ -98,14 +105,16 @@ namespace Flowframes.Os
|
|||||||
|
|
||||||
public static Architecture GetArch(PhysicalGPU gpu)
|
public static Architecture GetArch(PhysicalGPU gpu)
|
||||||
{
|
{
|
||||||
string gpuCode = gpu.ArchitectInformation.ShortName;
|
string arch = gpu.ArchitectInformation.ShortName.Trim();
|
||||||
|
|
||||||
if (gpuCode.Trim().StartsWith("GF")) return Architecture.Fermi;
|
if (arch.StartsWith("GF")) return Architecture.Fermi;
|
||||||
if (gpuCode.Trim().StartsWith("GK")) return Architecture.Kepler;
|
if (arch.StartsWith("GK")) return Architecture.Kepler;
|
||||||
if (gpuCode.Trim().StartsWith("GM")) return Architecture.Maxwell;
|
if (arch.StartsWith("GM")) return Architecture.Maxwell;
|
||||||
if (gpuCode.Trim().StartsWith("GP")) return Architecture.Pascal;
|
if (arch.StartsWith("GP")) return Architecture.Pascal;
|
||||||
if (gpuCode.Trim().StartsWith("TU")) return Architecture.Turing;
|
if (arch.StartsWith("TU")) return Architecture.Turing;
|
||||||
if (gpuCode.Trim().StartsWith("GA")) return Architecture.Ampere;
|
if (arch.StartsWith("GA")) return Architecture.Ampere;
|
||||||
|
if (arch.StartsWith("AD")) return Architecture.Ada;
|
||||||
|
if (arch.StartsWith("GB")) return Architecture.Blackwell;
|
||||||
|
|
||||||
return Architecture.Undetected;
|
return Architecture.Undetected;
|
||||||
}
|
}
|
||||||
@@ -114,14 +123,14 @@ namespace Flowframes.Os
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (gpuList == null)
|
if (NvGpus == null)
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
if (gpuList == null)
|
if (NvGpus == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Architecture arch = GetArch(gpuList[gpu]);
|
Architecture arch = GetArch(NvGpus[gpu]);
|
||||||
return arch == Architecture.Turing || arch == Architecture.Ampere;
|
return arch >= Architecture.Turing;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -291,9 +291,9 @@ namespace Flowframes.Os
|
|||||||
gpusVk.AddRange(VulkanUtils.VkDevices.Select(d => $"{d.Name.Remove("NVIDIA ").Remove("GeForce ").Remove("AMD ").Remove("Intel ").Remove("(TM)")} ({d.Id})"));
|
gpusVk.AddRange(VulkanUtils.VkDevices.Select(d => $"{d.Name.Remove("NVIDIA ").Remove("GeForce ").Remove("AMD ").Remove("Intel ").Remove("(TM)")} ({d.Id})"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NvApi.gpuList != null && NvApi.gpuList.Any())
|
if (NvApi.NvGpus != null && NvApi.NvGpus.Any())
|
||||||
{
|
{
|
||||||
gpusNv.AddRange(NvApi.gpuList.Select(d => $"{d.FullName.Remove("NVIDIA ").Remove("GeForce ")} ({NvApi.gpuList.IndexOf(d)})"));
|
gpusNv.AddRange(NvApi.NvGpus.Select(d => $"{d.FullName.Remove("NVIDIA ").Remove("GeForce ")} ({NvApi.NvGpus.IndexOf(d)})"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gpusVk.Any() && !gpusNv.Any())
|
if (!gpusVk.Any() && !gpusNv.Any())
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace Flowframes
|
|||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
|
public static bool Debug = false;
|
||||||
public static string[] args = new string[0];
|
public static string[] args = new string[0];
|
||||||
public static bool initialRun = true;
|
public static bool initialRun = true;
|
||||||
public static Form1 mainForm;
|
public static Form1 mainForm;
|
||||||
@@ -40,6 +41,7 @@ namespace Flowframes
|
|||||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||||
|
|
||||||
Cli.HandleCli();
|
Cli.HandleCli();
|
||||||
|
Debug = Cli.Debug || System.Diagnostics.Debugger.IsAttached;
|
||||||
CmdMode = Paths.GetExe().EndsWith("Cmd.exe");
|
CmdMode = Paths.GetExe().EndsWith("Cmd.exe");
|
||||||
|
|
||||||
// Show splash screen
|
// Show splash screen
|
||||||
|
|||||||
@@ -30,5 +30,36 @@ namespace Flowframes.Ui
|
|||||||
controls.ForEach(c => list.AddRange(c.GetControls()));
|
controls.ForEach(c => list.AddRange(c.GetControls()));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetEnabled(this Control control, bool enabled, bool includeChildren = false)
|
||||||
|
{
|
||||||
|
// Set Enabled property of the control only if it's different from the desired value to avoid event firing etc.
|
||||||
|
if (enabled && !control.Enabled)
|
||||||
|
{
|
||||||
|
control.Enabled = true;
|
||||||
|
}
|
||||||
|
else if (!enabled && control.Enabled)
|
||||||
|
{
|
||||||
|
control.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includeChildren)
|
||||||
|
{
|
||||||
|
control.GetControls().ForEach(c => c.SetEnabled(enabled, includeChildren));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetVisible(this Control control, bool visible)
|
||||||
|
{
|
||||||
|
// Set Visible property of the control only if it's different from the desired value to avoid event firing etc.
|
||||||
|
if (visible && !control.Visible)
|
||||||
|
{
|
||||||
|
control.Visible = true;
|
||||||
|
}
|
||||||
|
else if (!visible && control.Visible)
|
||||||
|
{
|
||||||
|
control.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Flowframes.Ui
|
|||||||
|
|
||||||
static void SelectNcnnIfNoCudaAvail(ComboBox combox)
|
static void SelectNcnnIfNoCudaAvail(ComboBox combox)
|
||||||
{
|
{
|
||||||
if (NvApi.gpuList.Count < 1)
|
if (NvApi.NvGpus.Count < 1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < combox.Items.Count; i++)
|
for (int i = 0; i < combox.Items.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -86,7 +86,7 @@ namespace Flowframes.Ui
|
|||||||
{
|
{
|
||||||
Logger.Log($"MessageBox: {text} ({type}){(BatchProcessing.busy ? "[Batch Mode - Will not display messagebox]" : "")}", true);
|
Logger.Log($"MessageBox: {text} ({type}){(BatchProcessing.busy ? "[Batch Mode - Will not display messagebox]" : "")}", true);
|
||||||
|
|
||||||
if(Cli.ShowConsole)
|
if(Program.CmdMode)
|
||||||
return DialogResult.OK;
|
return DialogResult.OK;
|
||||||
|
|
||||||
if (BatchProcessing.busy)
|
if (BatchProcessing.busy)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Flowframes.Utilities
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
files.ForEach(x => x.Delete());
|
files.ForEach(x => IoUtils.DeleteIfExists(x.FullName));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -83,5 +83,24 @@ namespace Flowframes.Utilities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetDainNcnnTileSizeBasedOnVram(int defaultTileSize = 512)
|
||||||
|
{
|
||||||
|
if(NvApi.NvGpus.Count < 1)
|
||||||
|
return defaultTileSize;
|
||||||
|
|
||||||
|
float vram = NvApi.GpuWithMostVram.GetVramGb();
|
||||||
|
int tileSize = defaultTileSize;
|
||||||
|
|
||||||
|
if (vram > 5.5f) tileSize = 640; // 6 GB VRAM default
|
||||||
|
else if (vram > 7.5f) tileSize = 768; // 8 GB VRAM default
|
||||||
|
else if (vram > 11.5f) tileSize = 1024; // 12 GB VRAM default
|
||||||
|
else if (vram > 15.5f) tileSize = 1536; // 16 GB VRAM default
|
||||||
|
else if (vram > 19.5f) tileSize = 2048; // 20+ GB VRAM default
|
||||||
|
|
||||||
|
Logger.Log($"Using DAIN NCNN tile size {tileSize} for {vram.ToString("0.")} GB GPU", true);
|
||||||
|
|
||||||
|
return tileSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user