Add some Redrawing Debug UI.

This commit is contained in:
Ottermandias 2023-11-03 15:23:48 +01:00
parent 79c43fe7b1
commit 7dabb3c647
2 changed files with 59 additions and 3 deletions

View file

@ -18,10 +18,13 @@ public unsafe partial class RedrawService
public const int GPoseSlots = 42;
public const int GPoseEndIdx = GPosePlayerIdx + GPoseSlots;
private readonly string?[] _gPoseNames = new string?[GPoseSlots];
private readonly string?[] _gPoseNames = new string?[GPoseSlots];
private int _gPoseNameCounter;
private bool InGPose
internal IReadOnlyList<string?> GPoseNames
=> _gPoseNames;
internal bool InGPose
=> _clientState.IsGPosing;
// VFuncs that disable and enable draw, used only for GPose actors.
@ -108,6 +111,15 @@ public sealed unsafe partial class RedrawService : IDisposable
private readonly List<int> _afterGPoseQueue = new(GPoseSlots);
private int _target = -1;
internal IReadOnlyList<int> Queue
=> _queue;
internal IReadOnlyList<int> AfterGPoseQueue
=> _afterGPoseQueue;
internal int Target
=> _target;
public event GameObjectRedrawnDelegate? GameObjectRedrawn;
public RedrawService(IFramework framework, IObjectTable objects, ITargetManager targets, ICondition conditions, IClientState clientState)

View file

@ -65,6 +65,7 @@ public class DebugTab : Window, ITab
private readonly TextureManager _textureManager;
private readonly SkinFixer _skinFixer;
private readonly IdentifierService _identifier;
private readonly RedrawService _redraws;
public DebugTab(StartTracker timer, PerformanceTracker performance, Configuration config, CollectionManager collectionManager,
ValidityChecker validityChecker, ModManager modManager, HttpApi httpApi, ActorService actorService,
@ -72,7 +73,7 @@ public class DebugTab : Window, ITab
ResourceManagerService resourceManager, PenumbraIpcProviders ipc, CollectionResolver collectionResolver,
DrawObjectState drawObjectState, PathState pathState, SubfileHelper subfileHelper, IdentifiedCollectionCache identifiedCollectionCache,
CutsceneService cutsceneService, ModImportManager modImporter, ImportPopup importPopup, FrameworkManager framework,
TextureManager textureManager, SkinFixer skinFixer, IdentifierService identifier)
TextureManager textureManager, SkinFixer skinFixer, IdentifierService identifier, RedrawService redraws)
: base("Penumbra Debug Window", ImGuiWindowFlags.NoCollapse)
{
IsOpen = true;
@ -107,6 +108,7 @@ public class DebugTab : Window, ITab
_textureManager = textureManager;
_skinFixer = skinFixer;
_identifier = identifier;
_redraws = redraws;
}
public ReadOnlySpan<byte> Label
@ -317,6 +319,48 @@ public class DebugTab : Window, ITab
}
}
}
using (var tree = TreeNode("Redraw Service"))
{
if (tree)
{
using var table = Table("##redraws", 3, ImGuiTableFlags.RowBg);
if (table)
{
ImGuiUtil.DrawTableColumn("In GPose");
ImGuiUtil.DrawTableColumn(_redraws.InGPose.ToString());
ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Target");
ImGuiUtil.DrawTableColumn(_redraws.Target.ToString());
ImGui.TableNextColumn();
foreach (var (objectIdx, idx) in _redraws.Queue.WithIndex())
{
var (actualIdx, state) = objectIdx < 0 ? (~objectIdx, "Queued") : (objectIdx, "Invisible");
ImGuiUtil.DrawTableColumn($"Redraw Queue #{idx}");
ImGuiUtil.DrawTableColumn(actualIdx.ToString());
ImGuiUtil.DrawTableColumn(state);
}
foreach (var (objectIdx, idx) in _redraws.AfterGPoseQueue.WithIndex())
{
var (actualIdx, state) = objectIdx < 0 ? (~objectIdx, "Queued") : (objectIdx, "Invisible");
ImGuiUtil.DrawTableColumn($"GPose Queue #{idx}");
ImGuiUtil.DrawTableColumn(actualIdx.ToString());
ImGuiUtil.DrawTableColumn(state);
}
foreach (var (name, idx) in _redraws.GPoseNames.OfType<string>().WithIndex())
{
ImGuiUtil.DrawTableColumn($"GPose Name #{idx}");
ImGuiUtil.DrawTableColumn(name);
ImGui.TableNextColumn();
}
}
}
}
}
private void DrawPerformanceTab()