Enhance graphics editor performance with batch processing and profiling
- Integrated performance profiling using ScopedTimer in GraphicsEditor and ScreenEditor for better timing insights. - Implemented batch texture updates in GraphicsEditor and ScreenEditor to reduce individual texture update calls, improving rendering efficiency. - Enhanced tile rendering in ScreenEditor with pre-allocated vectors for batch operations, optimizing drawing performance. - Added safety checks and validation in various components to prevent crashes and ensure data integrity during rendering operations. - Updated Bitmap and Arena classes to support improved texture management and synchronization, enhancing overall graphics performance.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "app/gui/modules/asset_browser.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/rom.h"
|
||||
#include "gfx/performance_profiler.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
@@ -272,6 +273,8 @@ absl::Status GraphicsEditor::UpdateGfxSheetList() {
|
||||
}
|
||||
|
||||
absl::Status GraphicsEditor::UpdateGfxTabView() {
|
||||
gfx::ScopedTimer timer("graphics_editor_update_gfx_tab_view");
|
||||
|
||||
static int next_tab_id = 0;
|
||||
constexpr ImGuiTabBarFlags kGfxEditTabBarFlags =
|
||||
ImGuiTabBarFlags_AutoSelectNewTabs | ImGuiTabBarFlags_Reorderable |
|
||||
@@ -312,7 +315,8 @@ absl::Status GraphicsEditor::UpdateGfxTabView() {
|
||||
auto draw_tile_event = [&]() {
|
||||
current_sheet_canvas_.DrawTileOnBitmap(tile_size_, ¤t_bitmap,
|
||||
current_color_);
|
||||
Renderer::Get().UpdateBitmap(¤t_bitmap);
|
||||
// Use batch operations for texture updates
|
||||
current_bitmap.QueueTextureUpdate(core::Renderer::Get().renderer());
|
||||
};
|
||||
|
||||
current_sheet_canvas_.UpdateColorPainter(
|
||||
@@ -365,6 +369,9 @@ absl::Status GraphicsEditor::UpdateGfxTabView() {
|
||||
}
|
||||
}
|
||||
|
||||
// Process all queued texture updates at once
|
||||
gfx::Arena::Get().ProcessBatchTextureUpdates();
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user