Skip to content

Commit

Permalink
Display estimated sprite batch count.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Mar 18, 2024
1 parent fffc8e3 commit fbaafe7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions editor/ScreenLayers/ProjectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ private string buildWarningMessage()
if (activeSpriteCount >= 1500)
warnings += $"⚠ {activeSpriteCount:n0} Sprites\n";

var batches = project.FrameStats.Batches;
if (batches >= 500)
warnings += $"⚠ {batches:0} Batches\n";

var commandCount = project.FrameStats.CommandCount;
if (commandCount >= 15000)
warnings += $"⚠ {commandCount:n0} Commands\n";
Expand Down
2 changes: 2 additions & 0 deletions editor/Storyboarding/EditorOsbSprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public static void Draw(DrawContext drawContext, Camera camera, Box2 bounds, flo
if (frameStats.LastTexture != fullPath)
{
frameStats.LastTexture = fullPath;
frameStats.Batches++;

if (frameStats.LoadedPaths.Add(fullPath))
frameStats.GpuPixelsFrame += (ulong)texture.Size.X * (ulong)texture.Size.Y;
}
Expand Down
2 changes: 2 additions & 0 deletions editor/Storyboarding/FrameStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class FrameStats
public HashSet<string> LoadedPaths = new HashSet<string>();

public int SpriteCount;
public int Batches;

public int CommandCount;
public int EffectiveCommandCount;
public bool IncompatibleCommands;
Expand Down

0 comments on commit fbaafe7

Please sign in to comment.