Repository navigation
MapWinGIS6 – Vector Rendering Performance Improvement Plan – Phase 3 – Implement lazy polygon triangulation - #90
Conversation
- Generate missing fill meshes on the first OpenGL fill draw and reuse them for the same immutable scene. - Preserve outline rendering and GDI fallback when triangulation fails. - Cover lazy reuse, GDAL callback exceptions, documentation, and Phase 3 plan completion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Victor-MW-cl
left a comment
There was a problem hiding this comment.
Automated review. Final decision is with the human reviewer.
Review summary: I did not identify an actionable correctness, safety, or regression issue in the changes. The lazy mesh generation/cache is keyed to the immutable scene identities, explicit meshes are validated before rendering, failures route to fallback, and temporary scaled draws share the cache. I also checked the changed documentation and test updates. CI currently shows successful build/test jobs; one x64 Release VS build is still in progress, while several Win32 jobs are skipped.
There was a problem hiding this comment.
🟡 Changes recommended
A reentrant draw can invalidate the scene during triangulation and crash the host, while mesh caches can retain unnecessary memory after layer removal or triangulation failure.
6 open issues
Snapshot the scene to prevent reentrant draw invalidation · New Release cached meshes when layers are cleared · New Discard generated meshes when triangulation fails · New Probe OpenGL availability before testing lazy triangulation · New Test lazy-mesh reuse across temporary renderers · New Test coordinator fallback and outlines after triangulation failure · New
What changed in this PR
Implements Phase 3 by adding lazy polygon triangulation to the ActiveX OpenGL renderer. This builds on Core’s mesh-free scene construction while keeping scenes immutable and preserving GDI fallback.
Changes:
- Generates missing fill meshes on the first OpenGL fill draw and shares cached meshes with temporary renderers.
- Prefers explicit meshes, preserves source-ring outlines, and falls back to GDI when preparation fails.
- Adds lazy-preparation tests and updates rendering documentation and the phase checklist.
The PR reports a warning-free Debug x64 build and 453 passing non-interactive tests; opt-in baselines were skipped. These checks were not rerun.
| File | Description |
|---|---|
tests/MapWinGIS.ActiveX.Tests/VectorLayerRendererTests.cpp |
Adds lazy triangulation, reuse, and failure tests. |
tests/MapWinGIS.ActiveX.Tests/OpenGlVectorLayerRendererTestAccess.h |
Exposes mesh preparation for tests. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.h |
Declares lazy mesh preparation and cache state. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.cpp |
Implements lazy generation, caching, and temporary-renderer sharing. |
README.md |
Describes first-fill mesh generation and reuse. |
docs/TESTING.md |
Documents lazy preparation behavior. |
docs/ARCHITECTURE.md |
Explains cache ownership, draw reuse, and fallback. |
.github/plans/Vector-Rendering-Performance-Improvement.md |
Marks Phase 3 complete and records remaining limitations. |
Review effort: Balanced
- snapshot render scenes across reentrant callbacks and GDI fallback - release lazy caches on layer clear and after failed triangulation - verify shared cache reuse, fallback, outlines, and memory release Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>



Motivation
Opening a polygon layer must not require triangulation, but OpenGL fills still need usable triangle meshes.
Design
OpenGL now prepares missing meshes on the first fill draw and reuses a scene-identity-bound cache for later normal and temporary draws. Core scenes stay immutable. Explicit meshes remain preferred; triangulation failures return to the coordinator for GDI fallback while outlines continue to use source rings.
Dependencies and validation
No new dependencies. Debug x64 CMake build completed with zero compiler warnings, and all 453 non-interactive CTest cases passed. The opt-in rendering baselines remained skipped. No project memory changes were needed because the behavior is covered by
README.mdanddocs/ARCHITECTURE.md.