Skip to content

Vector Rendering Performance – Add intelligent caching and invalidation 4/7 - #91

Merged
pmeems merged 2 commits into
developmentfrom
phase4-intelligent-render-cache
Nov 21, 2026
Merged

pmeems merged 2 commits into
developmentfrom
phase4-intelligent-render-cache

Conversation

@pmeems

@pmeems pmeems commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

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 LayerId plus 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.md records the verified cache ownership and invalidation rules.

- 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 Julian-MW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
@pmeems pmeems changed the title MapWinGIS6 – Vector Rendering Performance Improvement Plan MapWinGIS6 – Add intelligent caching and invalidation 4/7 Nov 21, 2026
@pmeems pmeems changed the title MapWinGIS6 – Add intelligent caching and invalidation 4/7 Vector Rendering Performance – Add intelligent caching and invalidation 4/7 Nov 21, 2026
@pmeems
pmeems enabled auto-merge (squash) November 21, 2026 08:01
@pmeems
pmeems merged commit a00f178 into development Nov 21, 2026
17 checks passed
@pmeems
pmeems deleted the phase4-intelligent-render-cache branch November 21, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants