Rendering optimization #78#81
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a graph rendering optimization pipeline by adding cached-artist compositing to the visualization engine API, plus culling-aware graph drawing backed by a spatial index and per-graph render cache.
Changes:
- Extend
IVisualizationEnginewith cached-artist rendering and camera/viewport query methods (render_cached_artist,get_culling_bounds,world_to_screen_scale). - Update
RenderManagerandPygameVisualizationEngineto composite cached graph artists and redraw only uncovered “strips” during camera movement/zoom. - Add
GraphRenderCache/GraphSpatialIndexand update default graph drawers to use culling + cached line geometry.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
gamms/typing/visualization_engine.py |
Adds new abstract methods needed for cached rendering and culling-aware drawers. |
gamms/VisualizationEngine/render_manager.py |
Adds culling-bounds override helpers and switches graph rendering from layer blits to per-artist cached compositing. |
gamms/VisualizationEngine/pygame_engine.py |
Implements cached-artist compositing, strip redraw, and render-target routing via _render_surface / _cache_surface. |
gamms/VisualizationEngine/no_engine.py |
Implements new interface methods with no-op/“no viewport” defaults. |
gamms/VisualizationEngine/graph_render_cache.py |
New spatial index + render cache builder for graph geometry and culling queries. |
gamms/VisualizationEngine/default_drawers.py |
Uses render cache + spatial index + pixel-threshold logic to reduce graph draw work. |
gamms/VisualizationEngine/builtin_artists.py |
Replaces per-graph edge_line_points storage with GraphData.render_cache. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR focuses on rendering performance improvements in the VisualizationEngine by introducing cached rendering for static artists and adding viewport-aware graph drawing to reduce per-frame work.
Changes:
- Added a cached-artist compositing hook in
RenderManagerand implemented per-artist caching / partial redraw behavior in the Pygame engine. - Introduced
IVisualizationEngine.get_viewport()and updated drawers to use viewport data for culling and pixel-threshold LOD decisions. - Added
GraphRenderCache(uniform-grid spatial index + precomputed edge polylines) and wired it intorender_graph.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| gamms/VisualizationEngine/render_manager.py | Adds cached-artist handler hook plus culling-bounds setters/getters used by cached redraw strips and viewport reporting. |
| gamms/VisualizationEngine/pygame_engine.py | Reworks rendering pipeline around _render_surface + per-artist caching; adds get_viewport() implementation. |
| gamms/VisualizationEngine/no_engine.py | Implements new get_viewport() API (returns None). |
| gamms/VisualizationEngine/graph_render_cache.py | New spatial index + render cache for faster graph rendering and edge polyline reuse. |
| gamms/VisualizationEngine/default_drawers.py | Uses viewport + cache for culling/LOD; uses GraphRenderCache for edge drawing performance. |
| gamms/VisualizationEngine/builtin_artists.py | Replaces GraphData.edge_line_points with GraphData.render_cache. |
| gamms/typing/visualization_engine.py | Adds abstract get_viewport() contract to the visualization engine interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
render agent optimization
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Replace per-layer surfaces with single render surface + per-artist RGBA cache * Reuse graph cache across camera moves via offset blit and zoom stretch * Substitute short edges and skip sub-pixel edges and nodes in graph rendering * Clean up docstring formatting in default_drawers * Move cached artist rendering behind a RenderManager callback * Merge get_culling_bounds and world_to_screen_scale into get_viewport * Skip edge.linestring access for short or cached edges in graph rendering * Move constants to init * Revert graph render cache to lazy edge_line_points dict * Apply skip/short edge optimization to render_map_sensor * Avoid strip re-render and bilinear cost on zoom-out * Clarify cached artist handler docstring * render agent optimization * get_edges in a box * edge caching in waiting_simulation * edge finding optimizations * Fix projection updates on window resize * Remove will_draw from artist interfaces and use ArtistType for static cache routing * Replace per-artist pixel caches with per-layer surfaces * Guard render projection against zero screen size * Change layer cache artist_names from set to tuple * cache mismatch bug fix * Remove unused _static_layers from RenderManager * Clamp render dimensions on resize --------- Co-authored-by: Jinmin Lee <90895797+jinmin111@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mehul Sinha <mehulsinha73@gmail.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Mehul Sinha <72033137+mehulsinha73@users.noreply.github.com>
No description provided.