87 lines
3.7 KiB
Markdown
87 lines
3.7 KiB
Markdown
# ImGui Integration & Memory Debugger
|
|
|
|
## Task List
|
|
|
|
- [ ] **Preparation**
|
|
- [x] Fetch Dear ImGui Source Files (Verified existing submodule)
|
|
- [x] Create `External/imgui/Imgui.bff`
|
|
- [x] Update `fbuild.bff` to include `Imgui.bff`
|
|
- [x] Update `Juliet.bff` to link `ImGui` and include paths
|
|
- [x] Update `D3D12DescriptorHeap` to support ImGui (SRV for Font)
|
|
|
|
- [ ] **Memory Arena Debugging**
|
|
- [x] Modify `MemoryArena` struct to store allocation tags (Debug builds only)
|
|
- [x] Update `ArenaPush` signature to accept `const char* tag`
|
|
- [x] Update call sites (default parameter should minimize churn)
|
|
|
|
- [ ] **ImGui Core & TDD**
|
|
- [x] Create `Core/ImGui/ImGuiService.h/cpp` (Wrapper)
|
|
- [x] Create `Core/ImGui/ImGuiTests.cpp`
|
|
- [x] Implement `ImGui::SetAllocatorFunctions` using `EngineArena`
|
|
- [x] Test context creation and IO setup
|
|
|
|
- [ ] **Integration**
|
|
- [ ] Win32: Integrate `WndProc` in `Win32DisplayEvent.cpp`
|
|
- [x] DX12: Initialize/Shutdown in `D3D12GraphicsDevice` (Implemented in `ImGuiRenderer.cpp`)
|
|
- [x] DX12: Render Frame in `D3D12GraphicsDevice` (Fixed Buffer Crash)
|
|
|
|
- [ ] **Memory Debugger**
|
|
- [x] Create `Engine/Debug/MemoryDebugger.h/cpp`
|
|
- [x] Implement `DrawMemoryArena(const char* name, MemoryArena* arena)` with Allocation Tags
|
|
- [x] Implement Hex View for Arena Data (Allocations list implemented, Hex view pending/skipped)
|
|
- [x] Integrate into Main Loop (Toggle with 'Home' key)
|
|
|
|
- [ ] **Verification**
|
|
- [ ] Launch and verify ImGui renders
|
|
- [x] Verify Memory Debugger shows allocations and tags
|
|
|
|
---
|
|
|
|
## Implementation Plan
|
|
|
|
### Goal Description
|
|
Integrate Dear ImGui into the Juliet engine.
|
|
Implement a specialized Test Driven Development (TDD) approach.
|
|
Create a Memory Debugger panel to visualize `MemoryArena` state with allocation tags.
|
|
|
|
### Proposed Changes
|
|
|
|
#### Build System
|
|
**[NEW] [Imgui.bff](file:///w:/Classified/Juliet/External/imgui/Imgui.bff)**
|
|
- Defines the `ImGui` library configuration.
|
|
- Includes `imgui.cpp`, `imgui_draw.cpp`, `imgui_tables.cpp`, `imgui_widgets.cpp`, `imgui_demo.cpp`.
|
|
- Includes backends: `imgui_impl_win32.cpp`, `imgui_impl_dx12.cpp`.
|
|
|
|
**[MODIFY] [fbuild.bff](file:///w:/Classified/Juliet/fbuild.bff)**
|
|
- Include `External/imgui/Imgui.bff`.
|
|
|
|
**[MODIFY] [Juliet.bff](file:///w:/Classified/Juliet/Juliet/Juliet.bff)**
|
|
- Add `ImGui` to `Juliet` library dependencies.
|
|
- Add `External/imgui` and `External/imgui/backends` to include paths.
|
|
|
|
#### Core/Memory
|
|
**[MODIFY] [MemoryArena.h](file:///w:/Classified/Juliet/Juliet/include/Core/Memory/MemoryArena.h)**
|
|
**[MODIFY] [MemoryArena.cpp](file:///w:/Classified/Juliet/Juliet/src/Core/Memory/MemoryArena.cpp)**
|
|
- **Struct Change**: Add `AllocationTracking` vector (likely `std::vector` wrapped or fixed size array) in `JULIET_DEBUG`.
|
|
- **Function Change**: `ArenaPush(..., const char* tag = nullptr)`.
|
|
- **Logic**: Store offset + tag on push.
|
|
|
|
#### Core/ImGui
|
|
**[NEW] [ImGuiService.h](file:///w:/Classified/Juliet/Juliet/include/Core/ImGui/ImGuiService.h)**
|
|
**[NEW] [ImGuiService.cpp](file:///w:/Classified/Juliet/Juliet/src/Core/ImGui/ImGuiService.cpp)**
|
|
- Wrapper for ImGui lifecycle.
|
|
- Uses `EngineArena` for internal ImGui allocations.
|
|
|
|
**[NEW] [ImGuiTests.cpp](file:///w:/Classified/Juliet/Juliet/src/Core/ImGui/ImGuiTests.cpp)**
|
|
- TDD suite for ImGui service.
|
|
|
|
#### Graphics/D3D12
|
|
**[MODIFY] [D3D12GraphicsDevice.cpp](file:///w:/Classified/Juliet/Juliet/src/Graphics/D3D12/D3D12GraphicsDevice.cpp)**
|
|
- ImGui backend initialization and rendering.
|
|
|
|
#### Engine/Debug
|
|
**[NEW] [MemoryDebugger.h](file:///w:/Classified/Juliet/Juliet/include/Engine/Debug/MemoryDebugger.h)**
|
|
**[NEW] [MemoryDebugger.cpp](file:///w:/Classified/Juliet/Juliet/src/Engine/Debug/MemoryDebugger.cpp)**
|
|
- Draw arena usage bar using tracked tags.
|
|
- Draw hex dump.
|