Skip to content

HUD and map render performance: GL batching, glyph atlas, video upload - #3845

Open
meee1 wants to merge 5 commits into
ArduPilot:masterfrom
meee1:worktree-bridge-cse_01YCb9Wr56gTCqQpa3GKHSyv
Open

meee1 wants to merge 5 commits into
ArduPilot:masterfrom
meee1:worktree-bridge-cse_01YCb9Wr56gTCqQpa3GKHSyv

Conversation

@meee1

@meee1 meee1 commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • HUD (GDI/shared): cache glyph lookups (TryGetValue), reuse the wings pen, point arrays and pre-arm font instead of allocating per frame, and skip heading-tape degrees that draw nothing.
  • HUD (OpenGL): replace GL.Begin/End and per-call arrays with one interleaved vertex array drawn from a streamed VBO (client arrays on a pre-1.5 driver). Consecutive same-width lines and consecutive strings merge into single draw calls; draw order is unchanged because any other call flushes the batch.
  • HUD (OpenGL): one 1024x1024 glyph atlas replaces a texture, bind and draw call per character. Rebuilt on resize and when full.
  • HUD video: upload the background texture only when bgimage was set since the last upload; the video and the cached status icons each get their own texture so they no longer re-allocate each other's.
  • GMap: don't clone the route pen on every render (dispose it when a custom dash needs a copy), dispose the decoded frame image in the Skia path, cache the scale-bar brush.

Testing

Not built or run yet. To check on a Windows build with SITL:

  • HUD text, line widths, gradients and tape draw order look unchanged in GL mode and in GDI mode
  • the HUD <n> hz drawtime <ms> gl <bool> console line before and after
  • video behind the HUD still updates, and icons still show
  • resize the HUD and the atlas rebuilds without garbled text

🤖 Generated with Claude Code

meee1 and others added 5 commits October 25, 2026 17:46
…kip unmarked heading degrees

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ache scale brush

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…textures for video and icons

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The netstandard2.0 build of MissionPlanner.Controls (Android/Mac) compiles
HUD.cs against the stub GL class in netstandard2.0/Shim.cs instead of
OpenTK.  The batched drawing path uses buffer objects, the IntPtr forms of
the client-array pointers, GenTexture, TexImage2D with a managed array and
the TextureEnvMode enum, none of which the stub had, so every CI build
failed with CS0117/CS0103/CS1503 in HUD.cs.

Add those members and enums to the shim, throwing NotImplementedException
like the rest of it; the GL path is never taken on those platforms.

Built MissionPlanner.Controls for both net472 and netstandard2.0.

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
@meee1

meee1 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

Notes from a review pass. The diff reads correctly and CI is green, but the description says it hasn't been run yet, so this should be held until the manual test list has been done on both GL and GDI.

Open questions:

  • GMapRoute no longer clones the shared pen. GDI+ Pen objects aren't thread-safe, so concurrent rendering could throw "object is currently in use elsewhere".
  • There is a ~4 MB allocation on every resize.
  • FillPolygon(Brush, PointF[]) changed from Quads to TriangleFan. That's equivalent for convex quads but differs for callers passing more than 4 points, so it belongs on the visual checklist.

Generated by Claude Code

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.

1 participant