1 changed files with 65 additions and 0 deletions
@ -0,0 +1,65 @@
|
||||
# 2025-02-06-ui-buffer-caching-optimization |
||||
|
||||
## Changes Made |
||||
|
||||
### Commit 1: 79a972a - Fix GuiDropdownBox behavior with static edit mode variables |
||||
- Fixed 7 dropdown controls that were incorrectly sharing edit mode variables |
||||
- Each dropdown now has its own static `editMode` variable |
||||
- Affected controls: orbit type, body/craft selection, burn direction, trigger type |
||||
- Updated maneuver dialog progress documentation |
||||
|
||||
### Commit 2: b37497a - Implement UIState buffer caching to eliminate per-frame malloc/free calls |
||||
- Implemented comprehensive buffer caching system in UIState |
||||
- Cached 4 buffer types: |
||||
- Body names list (for object selection dropdown) |
||||
- Spacecraft names list (for object selection dropdown) |
||||
- Maneuver names list (for maneuver info display) |
||||
- Maneuver status strings list |
||||
- Added `needs_update` flags for each cached buffer |
||||
- Added `last_counts` to track when buffers need invalidation |
||||
- Eliminated all per-frame malloc/free calls in ui_render_info_panel_objects() |
||||
- Eliminated all per-frame malloc/free calls in ui_render_info_panel_selected() |
||||
- Integrated cache invalidation into main loop and maneuver execution |
||||
|
||||
### Commit 3: 028b8a8 - Fix UI buffer caching: remove dead code, use count-based invalidation, fix update bug |
||||
- Removed dead code from simulation.cpp/h (52 lines removed, 16 lines from header) |
||||
- Simplified invalidation logic: removed `buffer_valid` flag in favor of count-based checks |
||||
- Fixed bug where maneuver status cache was not being updated after maneuver execution |
||||
- Separated concerns: ui_renderer handles UI cache, simulation module no longer has UI code |
||||
|
||||
### Commit 4: c76380f - Fix UI: maneuver status updates, ZII initialization, helper functions for cache checks |
||||
- Fixed maneuver status update bug: status strings now properly update after execution |
||||
- Fixed ZII initialization in ui_render_info_panel_selected: all state variables now use `= {0}` |
||||
- Added helper functions: |
||||
- `check_needs_update_simcount()` - checks if cache needs update based on body count |
||||
- `check_needs_update_craftcount()` - checks if cache needs update based on craft count |
||||
- `check_needs_update_maneuvercount()` - checks if cache needs update based on maneuver count |
||||
- Refactored buffer update logic to use helper functions for clarity |
||||
- Updated AGENTS.md with command reference for testing |
||||
|
||||
## Results |
||||
|
||||
**Net line count changes:** |
||||
- Insertions: 322 |
||||
- Deletions: 179 |
||||
- **Net: +143 lines** |
||||
|
||||
## Functionality Implemented |
||||
|
||||
### Buffer Caching System |
||||
- Dynamic array allocation only when counts change |
||||
- Automatic cache invalidation based on body/craft/maneuver counts |
||||
- Helper functions for count-based cache invalidation checks |
||||
- Integration points: |
||||
- `main_loop()` - invalidates caches before rendering |
||||
- `execute_maneuver()` - invalidates maneuver cache after execution |
||||
|
||||
### UI Improvements |
||||
- Fixed all dropdown controls with static edit mode variables |
||||
- Proper separation of concerns between UI and simulation modules |
||||
- Cleaner, more maintainable cache update logic |
||||
|
||||
### Code Quality |
||||
- ZII (Zero Is Initialization) pattern applied to UIState |
||||
- Removed 52 lines of dead code from simulation module |
||||
- Better code organization with helper functions |
||||
Loading…
Reference in new issue