Repository navigation
Vector Rendering Performance – Optimize OpenGL rendering and data transfer - #93
Conversation
- Cache immutable fill and outline geometry in context-local OpenGL buffers. - Reuse matrix transforms across viewport changes and remove the CPU row reversal. - Add cache lifecycle tests, benchmark results, and updated rendering documentation. 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.
One Major finding: the stale-entry erase in DrawLayerWithGpuBuffers keeps the iterator returned by std::map::erase, so invalidating any layer that is not the last in LayerId order skips the re-upload and draws another cached layer's buffers for one frame. The rest of the design — origin-localized VBO/IBO caching, matrix-based pan/zoom, bottom-up DIB presentation without the CPU row reversal, context-local buffers for temporary renderers — checks out against the client-array fallback math and the documented cache-lifetime rules. CI is green across all builds.
- Rebuild invalidated GPU buffers instead of drawing the next cached layer - Propagate geometry-buffer invalidation queue failures - Avoid double-counting failed GPU upload diagnostics - Cover multi-layer invalidation and outline-to-fill upgrades Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Layer-wide coordinate rebasing can collapse distant polygon edges, leaving a significant rendering correctness defect unresolved.
4 open issues
What changed in this PR
This PR implements Phase 6 of the vector-rendering performance plan, reducing repeated geometry submission and presentation overhead in the ActiveX OpenGL backend.
Changes:
- Caches context-local vertex and index buffers per layer scene, using matrix transforms for navigation and retaining client-array fallback.
- Removes CPU scanline reversal by presenting OpenGL’s bottom-up framebuffer data directly through GDI.
- Adds GPU-cache regression tests and updates architecture, performance measurements, and planning documentation.
The PR reports successful Debug/Release builds and 474 passing non-interactive tests. Builds and tests were not rerun during this review.
| File | Description |
|---|---|
tests/MapWinGIS.ActiveX.Tests/VectorLayerRendererTests.cpp |
Tests buffer reuse, invalidation, and fill-mode upgrades. |
tests/MapWinGIS.ActiveX.Tests/OpenGlVectorLayerRendererTestAccess.h |
Exposes GPU-cache counters and invalidation helpers. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.h |
Declares GPU-cache storage and lifecycle operations. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.cpp |
Implements cached geometry, matrix transforms, fallback, and bottom-up presentation. |
README.md |
Summarizes GPU-buffer reuse and compatibility fallback. |
docs/TESTING.md |
Documents regression coverage and Phase 6 measurements. |
docs/ARCHITECTURE.md |
Describes buffer ownership, invalidation, and presentation. |
.github/plans/Vector-Rendering-Performance-Improvement.md |
Updates phase status, results, and limitations. |
.ai/memory/architecture/activex.md |
Records context-local buffer ownership and readback behavior. |
Review effort: Balanced
- Localize cached polygon coordinates to preserve far-from-origin precision - Index layer IDs during GPU cache pruning and drain deletions independently of OpenGL frames - Add zoom-only and far-origin rendering regressions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>



Motivation
Reduce repeated OpenGL geometry submission and the CPU cost of copying framebuffer rows to the ActiveX/GDI presentation surface.
Key design decisions
Validation
developmentat 30 existingD9025overrides.No dependency changes. Updated the ActiveX architecture memory with the verified buffer lifetime and fallback rules.