wgpu: overlay labels + HUD text (QPainter rasterise, content-cached)

Ports GL OverlayRenderer's setOverlayLabels + setHudText to wgpu.
Each unique string is rasterised via QPainter into a QImage (dark-grey
rounded background + white antialiased text) and uploaded as an RGBA8
texture; the cache is keyed by content + font size so identical
strings across frames are texture-free. Per-frame work is projection,
vertex assembly, and one draw per visible label.

Drawn last in the frame on the resolved surface so labels sit on top
of every other overlay (no depth-test). HUD uses pt 11 at top-left
matching GL; world-anchored labels use pt 9 centred at the projected
screen position.

WebGPU has no QOpenGLPaintDevice equivalent — the GL backend's two-
stage GL-rect + QPainter pass becomes one textured quad per item here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-31 08:40:54 +10:00
parent 716dba2244
commit 3ac7a79b7a
4 changed files with 475 additions and 0 deletions
+2
View File
@@ -292,6 +292,8 @@ private:
float stroke_r, float stroke_g,
float stroke_b, float stroke_a,
float stroke_extra);
void setOverlayLabels(const std::vector<WgpuOverlayRenderer::Label>& labels);
void setHudText(const QString& text);
void ensureHizTextures(int viewport_w, int viewport_h);
void releaseHizResources();