Repository navigation
Vector Rendering Performance – Add intelligent caching and invalidation 4/7 - #91
Conversation
- Preserve generated meshes across scene reassembly and backend changes - Invalidate changed or removed layers and track retained mesh storage - Cover cache reuse, replacement, removal, and memory release Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Julian-MW
left a comment
There was a problem hiding this comment.
Automated review. Final decision is with the human reviewer.
No new issues found in this review. The per-layer cache is keyed by stable layer ID and scene identity, invalidation/pruning paths are consistent with the documented ownership model, and the added tests cover reuse, hiding/removal, scene replacement, and explicit invalidation. CI build is passing.
There was a problem hiding this comment.
🟡 Changes recommended
Reentrant triangulation callbacks can leave the shared mesh cache incomplete or mismatched and lose layer invalidations, risking incorrect geometry or out-of-bounds access.
3 open issues
What changed in this PR
Implements Phase 4 of the vector-rendering performance plan by moving lazy OpenGL fill meshes into a per-layer cache, reducing repeated triangulation while supporting selective cleanup.
Changes:
- Keys cached meshes by stable layer ID and immutable scene identity.
- Adds removed-layer pruning, per-layer invalidation, and retained-memory measurements.
- Adds cache lifecycle tests and updates architecture documentation.
Builds and tests were not run during this review; the PR reports a successful Debug x64 build and 457 passing non-interactive tests.
| File | Description |
|---|---|
tests/MapWinGIS.ActiveX.Tests/VectorLayerRendererTests.cpp |
Tests cache reuse, removal, replacement, and invalidation. |
tests/MapWinGIS.ActiveX.Tests/OpenGlVectorLayerRendererTestAccess.h |
Exposes cache storage and invalidation to tests. |
src/MapWinGIS.ActiveX/VectorLayerRenderer.h |
Adds per-layer invalidation forwarding. |
src/MapWinGIS.ActiveX/VectorLayerRenderer.cpp |
Prunes cached meshes before backend selection. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.h |
Declares layer-keyed cache operations and storage metrics. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.cpp |
Implements per-layer mesh caching, pruning, and cleanup. |
README.md |
Summarizes cache reuse and invalidation behavior. |
docs/ARCHITECTURE.md |
Documents backend-owned cache identity and lifetime. |
.github/plans/Vector-Rendering-Performance-Improvement.md |
Marks Phase 4 complete and records its scope. |
.ai/memory/architecture/activex.md |
Records cache ownership and updates lazy-fill behavior. |
Review effort: Balanced
- Reject invalidated or mismatched in-flight mesh preparation - Prune mesh caches with indexed lookups and per-layer invalidation - Cover reentrant invalidation without evicting unrelated layers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Implements Phase 4 of the vector rendering performance plan.
Motivation
Generated OpenGL fill meshes should be reused across redraws without retaining geometry for layers that changed or were removed.
Design
The renderer now caches meshes per stable
LayerIdplus immutable scene identity. Reordering, hiding, viewport navigation, temporary draws, and backend selection retain valid entries. Scene replacement, removal, and explicit invalidation release only affected entries, with retained mesh storage exposed for tests.Dependencies
None.
Validation
Debug x64 CMake build completed with no new warnings; all 457 non-interactive CTest cases passed.
.ai/memory/architecture/activex.mdrecords the verified cache ownership and invalidation rules.