Sort syncshells by VRAM usage

This commit is contained in:
2025-09-03 12:53:21 +01:00
parent f7ecb45774
commit 11e097d696
7 changed files with 67 additions and 35 deletions

View File

@@ -20,6 +20,7 @@ public class DrawGroupPair : DrawPairBase
private readonly GroupPairFullInfoDto _fullInfoDto;
private readonly GroupFullInfoDto _group;
private readonly CharaDataManager _charaDataManager;
public long _VRAMBytes;
public DrawGroupPair(string id, Pair entry, ApiController apiController,
MareMediator mareMediator, GroupFullInfoDto group, GroupPairFullInfoDto fullInfoDto,
@@ -80,11 +81,13 @@ public class DrawGroupPair : DrawPairBase
}
if (_pair.LastAppliedDataBytes >= 0)
{
presenceText += UiSharedService.TooltipSeparator;
presenceText += ((!_pair.IsVisible) ? "(Last) " : string.Empty) + "Mods Info" + Environment.NewLine;
presenceText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
{
_VRAMBytes = _pair.LastAppliedApproximateVRAMBytes;
presenceText += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
}
if (_pair.LastAppliedDataTris >= 0)

View File

@@ -452,7 +452,16 @@ internal sealed class GroupPanel
{
ImGui.TextUnformatted("Visible");
ImGui.Separator();
_uidDisplayHandler.RenderPairList(visibleUsers);
if (_mareConfig.Current.SortSyncshellsByVRAM)
{
List<DrawGroupPair> sortedVisibleUsers = visibleUsers.OrderBy(o=>o._VRAMBytes).ToList();
_uidDisplayHandler.RenderPairList(sortedVisibleUsers);
}
else
{
_uidDisplayHandler.RenderPairList(visibleUsers);
}
}
if (onlineUsers.Count > 0)

View File

@@ -956,6 +956,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.BigText("UI");
var showCharacterNames = _configService.Current.ShowCharacterNames;
var showVisibleSeparate = _configService.Current.ShowVisibleUsersSeparately;
var sortSyncshellByVRAM = _configService.Current.SortSyncshellsByVRAM;
var showOfflineSeparate = _configService.Current.ShowOfflineUsersSeparately;
var showProfiles = _configService.Current.ProfilesShow;
var showNsfwProfiles = _configService.Current.ProfilesAllowNsfw;
@@ -1074,7 +1075,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
}
_uiShared.DrawHelpText("This will show all currently visible users in a special 'Visible' group in the main UI.");
if (ImGui.Checkbox("Sort visible syncshell users by VRAM usage", ref sortSyncshellByVRAM))
{
_configService.Current.SortSyncshellsByVRAM = sortSyncshellByVRAM;
_configService.Save();
}
_uiShared.DrawHelpText("This will put users using the most VRAM in a syncshell at the top of the list.");
if (ImGui.Checkbox("Show separate Offline group", ref showOfflineSeparate))
{
_configService.Current.ShowOfflineUsersSeparately = showOfflineSeparate;