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
Comprehensive audit of gogpu/gg conducted with 8 independent research agents + manual code validation. All findings confirmed against source code (10/11 claims validated, 1 already fixed).
Scope: Thread safety, correctness, performance, API quality, test coverage
🔴 P0 — Data Races (must fix)
BUG-RACE-001 — Global cache pointer race (text/glyph_cache.go:459, text/subpixel.go:418). SetGlobalGlyphCache() / GetGlobalGlyphCache() without any synchronization. Detectable by go test -race.
BUG-GLES-002 — Glyph mask quadOffset not advanced on nil bind group skip (render_session.go:2199). Subsequent batches read wrong quads → invisible text in offscreen textures. GLES-specific manifestation.
TASK-PERF-004 — Atlas full recreation + fmt.Sprintf in hot path. Fix: incremental page upload, pre-computed labels.
📋 P2 — Test Coverage
TASK-TEST-002 — gpu_render_context.go has 0 tests for ~40K LOC. Create dedicated test file.
TASK-TEST-003 — render_session.go has only 31 tests for 3,314 LOC.
TASK-TEST-004 — 0 t.Parallel() in 4,039 test functions. Enable for CPU-only tests (3-5× CI speedup).
TASK-TEST-005 — No GLES-specific test file.
📐 P3 — API Quality (v1.0 planning)
TASK-API-003 — 7 type aliases in public API violate project policy: ImageBuf, InterpolationMode, ImageFormat, BlendMode, LCDLayout, Align, DeviceHandle. Replace with real types (breaking change for v1.0).
TASK-API-004 — Duplicate internal TextureFormat (uint8 stub) can be consolidated to gputypes.TextureFormat.
This audit was conducted systematically, but no audit is perfect. We may have missed something, misunderstood a design decision, or misjudged a priority.
If you've worked with gg and noticed something that doesn't feel right — an API that surprised you, a performance cliff you hit, a pattern that seemed off — this is the place to share it. Even small observations help.
Specifically, we'd love feedback on:
Are the priority levels right? Should anything be higher or lower?
Do you disagree with any of the findings? Some "issues" may be intentional design trade-offs we don't fully appreciate.
Have you encountered bugs or rough edges not listed here?
For the v1.0 API items (P3) — which matter most to you as a user?
One head is good — two is better. Help us make gg the best 2D graphics library it can be.
Enterprise API & Quality Audit — gg (June 2026)
Comprehensive audit of gogpu/gg conducted with 8 independent research agents + manual code validation. All findings confirmed against source code (10/11 claims validated, 1 already fixed).
Scope: Thread safety, correctness, performance, API quality, test coverage
🔴 P0 — Data Races (must fix)
text/glyph_cache.go:459,text/subpixel.go:418).SetGlobalGlyphCache()/GetGlobalGlyphCache()without any synchronization. Detectable bygo test -race.quadOffsetnot advanced on nil bind group skip (render_session.go:2199). Subsequent batches read wrong quads → invisible text in offscreen textures. GLES-specific manifestation.🟡 P1 — Correctness
Context.closedTOCTOU: concurrentClose()→ double-free of GPU resources (context.go:248). Fix:atomic.Bool+CompareAndSwap.ensureGPUCtx()lazy init withoutsync.Once→ lost GPU context under concurrent Fill/Stroke (context.go:1509).⚡ P2 — Performance (5-15% headroom)
make+copyper flush. Fix: ownership transfer pattern. ~5-10% CPU.convertGGPathToCorePathcreates fresh slices every Fill. Fix: scratch buffer reuse (Skia pattern). ~2-4% CPU.make([]stroke.PathVerb, N)whenunsafe.Slicepossible. ~1-2% CPU.fmt.Sprintfin hot path. Fix: incremental page upload, pre-computed labels.📋 P2 — Test Coverage
gpu_render_context.gohas 0 tests for ~40K LOC. Create dedicated test file.render_session.gohas only 31 tests for 3,314 LOC.t.Parallel()in 4,039 test functions. Enable for CPU-only tests (3-5× CI speedup).📐 P3 — API Quality (v1.0 planning)
ImageBuf,InterpolationMode,ImageFormat,BlendMode,LCDLayout,Align,DeviceHandle. Replace with real types (breaking change for v1.0).TextureFormat(uint8 stub) can be consolidated togputypes.TextureFormat.Paintfields (Pattern, LineWidth, LineCap, LineJoin) without removal timeline.✅ Validated as Enterprise-Grade
Cross-references
💬 We want your input
This audit was conducted systematically, but no audit is perfect. We may have missed something, misunderstood a design decision, or misjudged a priority.
If you've worked with gg and noticed something that doesn't feel right — an API that surprised you, a performance cliff you hit, a pattern that seemed off — this is the place to share it. Even small observations help.
Specifically, we'd love feedback on:
One head is good — two is better. Help us make gg the best 2D graphics library it can be.