perf: targeted z-scroll dirty marking, per-frame populate budget
on_camera_z_changed: only dirty z-levels whose z_diff changed (both old and new camera positions, within 0..=8 window). Previously dirtied all 20k entities on every z-change. populate_tilemap_chunk_data: process up to MAX_POPULATE_PER_FRAME (512) keys per frame, sorted by z-distance from current camera. Spreads z-scroll cost across multiple frames instead of one spike. TilemapBenchmark: added z-change spike instrumentation (last_z_change_dirty_ms, last_z_change_dirty_count, last_z_change_populate_ms, z_change_history_ms). F9 report now shows z-scroll metrics. PreviousZIndex resource tracks prior camera z for targeted dirty calc.
This commit is contained in:
@@ -27,6 +27,7 @@ impl Plugin for WorldPlugin {
|
||||
.init_resource::<tiles::TilemapBenchmark>()
|
||||
.init_resource::<tiles::TilemapChunkRegistry>()
|
||||
.init_resource::<tiles::TilemapChunkSpawner>()
|
||||
.init_resource::<tiles::PreviousZIndex>()
|
||||
.add_message::<GenerateChunkEvent>()
|
||||
.add_message::<ChunkTerrainEvent>()
|
||||
.add_message::<ChunkWeatheringAndPrecipitationEvent>()
|
||||
|
||||
Reference in New Issue
Block a user