You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vector Rendering First-Frame Performance Plan 3/3 - #97
Finish the remaining first-frame rendering work without moving expensive setup into the next paint or blocking the test host during dataset reads.
Context
This is Phase 3 of the first-frame performance plan, built on GDI-first Automatic frames and background earcut mesh preparation. The real-dataset Release path measured 93.4 ms load + 21.6 ms first paint synchronously and 194.4 ms + 20.4 ms asynchronously.
Key design decisions
Warm the OpenGL context, staging buffer, and FBO when all background meshes are published, before invalidating the GDI frame.
Use BeginLoadVectorDataset and completion events for interactive host Open and drag-and-drop loads.
Keep pixel-level vertex reduction and OGR batch/Arrow reads deferred because current measurements meet the target without adding viewport caches or driver-specific semantics.
Update .ai/memory/lessons/lessons.md with the verified first-consumer and Debug/Release lessons.
Dependencies
No new dependencies. Earcut and the existing asynchronous COM loading contract are reused.
Validation
CMake Debug x64 and Release x64 builds
507/507 non-interactive Debug CTest cases
Automated ActiveX host checks
Real-dataset Release rendering baselines; no code-level Level 4 warnings
- Warm OpenGL target resources before the backend-switch repaint
- Load interactive host datasets through the asynchronous COM path
- Record release measurements, documentation, and rendering lessons
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Rendering races can still stall the first visible frame, cancellation can leave native load slots retained, and first-frame timing may measure a later cached redraw.
This PR implements Phase 3 of the vector-rendering performance plan: preparing OpenGL targets before the backend-switch repaint and moving interactive dataset reads off the C# host’s UI thread.
Changes:
Extracts reusable OpenGL target initialization and invokes it when background meshes are published.
Adds asynchronous Open/drop loading and updates the host’s automated checks.
Adds warm-up coverage and documents measurements, lessons, and deferred optimizations.
The reason will be displayed to describe this comment to others. Learn more.
Automated review. Final decision is with the human reviewer.
Scope reviewed: OpenGL target warm-up extraction (InitializeTarget/WarmUp), the publish-time warm-up in CMapWinGISControl::DispatchFillMeshPreparation, the new async vector-load client and host changes, tests, and docs/memory updates.
The refactor of the draw-path initialization into InitializeTarget is faithful to the previous code, the C# COM client matches the IDL (IID, DispIds 18–20, events IID/DispId 2), and threading assumptions check out (publish and warm-up run on the owner thread; the completion callback runs before sink notification, so EndLoadVectorDataset polling is safe).
Five findings posted as line comments (3 Minor, 2 Suggestion), none blocking. Not re-posted because the existing Copilot review already covers them: first-frame measurement possibly capturing a cached repaint, cancellation letting E_PENDING escape before EndLoadVectorDataset releases the native slot, draw-side mesh publication bypassing warm-up, and warm-up possibly delaying the first visible frame.
- Defer fill-mesh publication and OpenGL warm-up until the first frame of a new layer set is presented
- Leave owner-dispatched fill-mesh publication to the completion handler instead of Draw
- Ignore unsized OpenGL warm-up targets without recording a failure reason
- Keep warm-up attempts from consuming the draw retry back-off
- Wait for EndLoadVectorDataset after cancellation so the native load slot is released
- Require the observed completion event and measure the first frame inside it in the test host
- Return interactive load failures instead of throwing from async-void callers
- Add tests and update the docs, plan, and lessons memory
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The scope guard acknowledges failed draws as presented, clearing the pending-frame flag and allowing OpenGL allocation before the first successful GDI frame.
- Clear the pending layer frame only after a successful, drawable, client-sized draw
- Keep fill-mesh publication deferred after failed or undrawable draws
- Add a regression test for an undrawable frame
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Clear can remove a loaded layer before its list entry is added, leaving a stale row that only triggers a metadata warning and fails when zoomed to.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Prevent stale layer rows after clearing during load
samples/CSharp/ActiveXTestHost/MainForm.cs:594
Severity: Minor | Confidence: High
Issue: Clear remains enabled while the load is awaited and can remove a committed layer before the continuation adds its list entry. Impact: The stored load result still reports success, so this line inserts a stale row; the metadata check only warns, and zooming to that row fails. Fix: Verify that the returned layer still exists before adding its row, or block Clear for the duration of the load batch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Finish the remaining first-frame rendering work without moving expensive setup into the next paint or blocking the test host during dataset reads.
Context
This is Phase 3 of the first-frame performance plan, built on GDI-first Automatic frames and background earcut mesh preparation. The real-dataset Release path measured 93.4 ms load + 21.6 ms first paint synchronously and 194.4 ms + 20.4 ms asynchronously.
Key design decisions
BeginLoadVectorDatasetand completion events for interactive host Open and drag-and-drop loads..ai/memory/lessons/lessons.mdwith the verified first-consumer and Debug/Release lessons.Dependencies
No new dependencies. Earcut and the existing asynchronous COM loading contract are reused.
Validation