Skip to content

Releases: gogpu/gg

v0.40.0 — Alpha Mask API

08 Apr 07:45
8f6d134

Choose a tag to compare

Alpha Mask API

Complete enterprise-level alpha masking system following Vello/tiny-skia patterns. Fixes #238 and #236. Thanks @Rider21 for the reports and API feedback!

New Features

Per-shape maskingSetMask(mask) modulates each Fill/Stroke individually:

mask := gg.NewMask(300, 300)
// ... fill mask ...
dc.SetMask(mask)
dc.DrawRectangle(0, 0, 300, 300)
dc.Fill() // only visible through mask

Per-layer maskingPushMaskLayer(mask) masks entire groups:

dc.PushMaskLayer(circleMask)
dc.DrawCircle(100, 100, 50)
dc.Fill()
dc.DrawRect(200, 200, 80, 80)
dc.Fill()
dc.PopLayer() // entire layer masked, then composited

Post-processingApplyMask(mask) for DestinationIn blend on existing content.

Constructors:

  • NewLuminanceMask(img) — CSS Masking Level 1 formula
  • NewMaskFromData(data, w, h) — raw byte constructor

GPU integration:

  • MaskAware interface for GPU accelerators
  • Automatic CPU fallback when GPU doesn't support masks

Quality

  • 25 mask-related tests across all platforms
  • Enterprise references: Cairo, Skia, tiny-skia, Vello
  • Mask + clip compose multiplicatively

v0.39.4

08 Apr 01:59
b947e54

Choose a tag to compare

Changed

  • Dependencies: wgpu v0.24.3 → v0.24.4 (software backend enterprise Present, core routing, adapter logging), gogpu v0.26.3 → v0.26.4

v0.39.3

07 Apr 09:20
44ed7df

Choose a tag to compare

Fixed

  • MSDF text overlapping on Retina — Large text (28px+) had overlapping letters and rectangular artifacts on HiDPI displays (scale=2). MSDF quad positioning included deviceScale in ratio, producing physical-pixel positions in a logical coordinate system. Fixed to use logicalSize/refSize — CTM handles device scaling. Small text (<48px device) was unaffected (Glyph Mask pipeline). (#247, reported by @jdbann)

v0.39.2

07 Apr 02:01
b81325c

Choose a tag to compare

Added

  • ParseHex() — hex color parsing with error handling. Returns (RGBA, error) for invalid input. Existing Hex() unchanged. Validates hex characters, supports #RGB, #RGBA, #RRGGBB, #RRGGBBAA. (PR #237 by @adamsanclemente)

v0.39.1

06 Apr 23:29
c5d14f6

Choose a tag to compare

Changed

  • wgpu v0.23.9 → v0.24.2: Metal PollCompleted atomic tracking, MapWrite staging, DX12 HEAP_TYPE_CUSTOM, encoder pool, Metal SetBindGroup cross-group slot fix
  • gogpu v0.26.1 → v0.26.3: cascade dependency updates
  • naga v0.16.6 → v0.17.0: DXIL direct compilation backend
  • Examples updated (gogpu_integration, lcd_text)

v0.39.0 — Zero-Alloc Rasterizer + Path SOA

05 Apr 14:12
27c2fa1

Choose a tag to compare

Breaking Changes

  • Path API: SOA representationPathElement interface deleted. Use Iterate(), Verbs(), Coords(). Verb constants renamed: VerbMoveToMoveTo. See migration guide in CHANGELOG.

Performance

  • Zero-alloc rasterizer — FillRect: 14 → 0 allocs. FillCircle r500: 270 → 0 allocs.
  • Path SOA — zero per-verb heap allocations (Skia/tiny-skia/Blend2D pattern, ADR-010)
  • Embedded stack buffer — small paths use stack memory. ParseSVGPath: 14 → 1 alloc.
  • Gradient 2-5x faster — pre-sorted stops, 0 allocs per pixel
  • Scene renderer -40% allocs, -71% memory — pooled Paths/Paints/Decoders
  • Stroke expansion 2-13x faster — embedded builders, reusable flatten buffer
  • Worker pool -50% allocsExecuteIndexed() eliminates per-tile closures

Fixed

  • Removed 3 dead naga SPIR-V workarounds (GPU golden test verified)
  • dashQuad/dashCubic off-by-one
  • Standalone compute adapter selection

Changed

  • deps: wgpu v0.23.9, naga v0.16.6, gputypes v0.4.0, x/image v0.38.0

v0.38.3

05 Apr 10:27
f7977ae

Choose a tag to compare

Performance

  • Gradient rendering 2-5x faster, zero allocationssortStops() was called per-pixel. Now pre-sorted at AddColorStop(). LinearGradient: 5.5x, RadialGradient: 2.4x.
  • Circle/curve rendering 90-95% fewer allocsNewLineEdge() returns value type. r500: 270 → 14 allocs.
  • Scene renderer -40% allocs, -71% memory — pooled Paths, Paints, Decoders, clip masks per tile. 4K: 4M → 2.4M allocs, 238MB → 68MB.
  • Scene build -75% allocsPathBuilder interface + path pool. 10K shapes: 40K → 10K.
  • Worker pool -50% allocsExecuteIndexed() eliminates per-tile closures.
  • Stroke expansion 2-13x faster, up to 98% less memory — embedded builders, reusable flatten buffer.

Fixed

  • Removed 3 dead naga SPIR-V workarounds in Vello compute shaders — naga v0.16.6 fixed the codegen bugs. Verified with GPU golden comparison on Vulkan, DX12, and GLES.
  • Standalone compute adapter selectionRequestAdapter(nil) instead of HighPerformance.
  • dashQuad/dashCubic off-by-one — flattened curve points loop index fix.

Changed

  • deps: wgpu v0.23.9, naga v0.16.6, gputypes v0.4.0, x/image v0.38.0

v0.38.2

30 Mar 22:33
f9ddee2

Choose a tag to compare

Fixed

  • Clear() documentation and examples — Godoc now correctly states that Clear() resets to transparent; ClearWithColor() is the recommended way to set a background color (Blend2D/Skia/HTML Canvas pattern). Updated all examples. Fixes #227.
  • Recorder.Clear() semantics — now matches Context.Clear() (transparent), was incorrectly using current fill brush.
  • Render() promotes pendingTexture — Universal rendering path now correctly promotes pending texture. Fixes black screen on CPU-only adapters (BUG-GOGPU-001).
  • Skip GPU-direct path on CPU adaptersAcceleratorCanRenderDirect() returns false on llvmpipe/SwiftShader.

Changed

  • GPU accelerator: wgpu Submit API updateSubmitWithFence + WaitForFenceSubmit + WaitIdle (wgpu BUG-GOGPU-004).
  • deps: wgpu v0.22.1 → v0.23.0, naga v0.14.8 → v0.15.0, goffi v0.4.2 → v0.5.0

v0.38.1

22 Mar 09:39
f2ea244

Choose a tag to compare

Fixed

  • DrawImage with rotation/skewImagePattern now uses pre-computed inverse affine matrix for device-to-image coordinate mapping (Cairo/Skia/tiny-skia pattern). Previously used simple anchor+offset which only worked for axis-aligned transforms. Fixes #224.

v0.38.0

21 Mar 10:28
7eb1555

Choose a tag to compare

Added

  • Enterprise SVG renderer (gg/svg package) — full SVG XML parser and renderer for JetBrains-quality icons. Supports path, circle, rect, g, polygon, polyline, line, ellipse. Color override for theming (RenderWithColor). ViewBox scaling. 2054 LOC, 64 tests with real JB SVG icons.
  • SVG path data parserParseSVGPath(d) all SVG commands (M/m, L/l, H/h, V/v, C/c, S/s, Q/q, T/t, A/a, Z/z). Arc-to-cubic conversion. 56 tests.
  • Transform-aware path renderingDrawPath, FillPath, StrokePath replay parsed paths through current CTM. SetPath, AppendPath, Path.Append for pre-built paths.
  • ClearType LCD subpixel text pipeline — dual GPU pipeline (Skia pattern), SetLCDLayout(LCDLayoutRGB/BGR/None) API.
  • LCD text example (examples/lcd_text/)

Fixed

  • BeginAcceleratorFrame ordering — moved from RenderDirect to Draw, prevents mid-frame content wipe (RENDER-DIRECT-003)
  • Atlas sync diagnostic — warning log when text skipped due to unsynchronized atlas
  • Nearest filtering for glyph mask bitmap atlas
  • Buffer test MapRead|MapWrite — fixed WebGPU spec violation caught by wgpu v0.22.1

Dependencies

  • wgpu v0.21.3 → v0.22.1
  • gpucontext v0.10.0 → v0.11.0