Add texture vram usage estimation

This commit is contained in:
Soreepeong 2024-03-05 01:53:31 +09:00
parent e9b903b2a7
commit 9ba0a297c9
4 changed files with 39 additions and 8 deletions

View file

@ -309,7 +309,7 @@ internal class TexWidget : IDataWindowWidget
conf.QueueSave();
}
if (!ImGui.BeginTable("##table", 5))
if (!ImGui.BeginTable("##table", 6))
return;
const int numIcons = 1;
@ -318,12 +318,21 @@ internal class TexWidget : IDataWindowWidget
iconWidths = ImGui.CalcTextSize(FontAwesomeIcon.Save.ToIconString()).X;
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableSetupColumn("Size", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("00000x00000").X);
ImGui.TableSetupColumn(
"Dimensions",
ImGuiTableColumnFlags.WidthFixed,
ImGui.CalcTextSize("00000x00000").X);
ImGui.TableSetupColumn(
"Format",
ImGuiTableColumnFlags.WidthFixed,
ImGui.CalcTextSize("R32G32B32A32_TYPELESS").X);
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn(
"Size",
ImGuiTableColumnFlags.WidthFixed,
ImGui.CalcTextSize("123.45 MB").X);
ImGui.TableSetupColumn(
"Name",
ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn(
"Actions",
ImGuiTableColumnFlags.WidthFixed,
@ -353,6 +362,11 @@ internal class TexWidget : IDataWindowWidget
ImGui.TableNextColumn();
ImGui.TextUnformatted(Enum.GetName(wrap.Format)?[12..] ?? wrap.Format.ToString());
ImGui.TableNextColumn();
var rawSpec = new RawImageSpecification(wrap.Width, wrap.Height, (int)wrap.Format, 0);
var bytes = rawSpec.EstimatedBytes;
ImGui.TextUnformatted(bytes < 0 ? "-" : Util.FormatBytes(bytes));
ImGui.TableNextColumn();
ImGui.TextUnformatted(wrap.Name);