Skip to content

MapWinGIS6 – Vector Rendering Performance Improvement Plan – Phase 3 – Implement lazy polygon triangulation - #90

Merged
pmeems merged 2 commits into
developmentfrom
phase3-lazy-polygon-triangulation
Nov 20, 2026
Merged

pmeems merged 2 commits into
developmentfrom
phase3-lazy-polygon-triangulation

Conversation

@pmeems

@pmeems pmeems commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

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.md and docs/ARCHITECTURE.md.

- 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 Victor-MW-cl 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.

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.

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

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
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>
@pmeems
pmeems enabled auto-merge (squash) November 20, 2026 19:30
@pmeems
pmeems merged commit d0105fd into development Nov 20, 2026
49 of 51 checks passed
@pmeems
pmeems deleted the phase3-lazy-polygon-triangulation branch November 20, 2026 23:33
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