Polyphase Game Engine
Loading...
Searching...
No Matches
MemorySnapshotWindow.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include <cstdint>
6#include <string>
7
8#include "imgui.h"
9#include "MemorySnapshot.h"
10
11// "Memory Snapshot" editor panel. Captures the running game's per-resource
12// memory footprint (Game / 3DS preview surface, or live PIE -- never the editor
13// viewport), shows it as a category tree + per-asset table with RAM-budget bars,
14// and saves/loads snapshots as loose <project>/Debug/DebugSnapshot_*.oct files.
15class MemorySnapshotWindow
16{
17public:
18 void Open();
19 void Close();
20 void Draw();
21 bool IsOpen() const { return mIsOpen; }
22
23 // Capture a snapshot now (also used by the Profiling window's button).
24 void CaptureNow();
25
26 // Release the cached thumbnail texture. Call from EditorImguiPreShutdown.
27 void Shutdown();
28
29private:
30 void DrawToolbar();
31 void DrawHeaderStrip();
32 void DrawCategoryTree();
33 void DrawEntryTable();
34
35 void SaveCurrent();
36 void LoadFromDialog();
37 void RefreshThumbnailTexture();
38 uint64_t GetSelectedBudgetBytes() const;
39
40 bool mIsOpen = false;
41
42 MemorySnapshot mSnapshot;
43 bool mHasSnapshot = false;
44
45 // -1 = show all categories; otherwise a SnapshotCategory index.
46 int32_t mCategoryFilter = -1;
47
48 int32_t mBudgetPresetIndex = 6; // default 64 MB (see sBudgetPresets)
49 int32_t mCustomBudgetMB = 64;
50
51 // Cached thumbnail (written to a temp PNG and loaded via EditorImageCache).
52 ImTextureID mThumbTexId = 0;
53 bool mThumbDirty = false;
54};
55
56MemorySnapshotWindow* GetMemorySnapshotWindow();
57
58#endif
void Shutdown()
Definition Engine.cpp:1147