Skip to content

Releases

v0.52.8 — wgpu v0.35.6 migration, bounded curve subdivision, no silent draw loss

Choose a tag to compare

@kolkov kolkov released this 28 Nov 14:31

Changed

  • wgpu v0.35.0 (ADR-070 package move): the GPU path no longer depends on the removed wgpu/core package. The
    dead gpu.Backend facade, its stub command encoders and the GPUSceneRenderer chain are deleted (about 17.7K
    lines of legacy wrappers and their tests in internal/gpu, no production caller), and the GPU tests build their
    HAL devices through wgpu's wgputest seam. Dependencies: wgpu v0.35.6, naga v0.22.7, gputypes v0.9.2,
    gpucontext v0.32.1. An app that also uses gogpu needs gogpu v0.56.0 or newer with this release — older
    versions (e.g. v0.54.1) import the wgpu/hal/* packages ADR-070 removed, and go mod tidy cannot resolve
    them alongside gg v0.52.8.

Fixed

  • Native curve subdivision terminates on float32 fixed points (#541, by @timzifer): the analytic rasterizer
    subdivided cubics and quadratics against an absolute 0.1 px deviation test with no depth bound. At large
    coordinates a float32 midpoint can round back to an input point, leaving a child identical to its parent and the
    deviation never decreasing — a stack overflow that a clip rectangle did not prevent either, because the
    out-of-bounds guard ran after the recursive branch. Subdivision now carries a depth through the native helpers
    and emits the remaining chord as a line past depth 10, as the flattening routines already do.
  • Concurrent Close calls are idempotent: Context.Close and the surface Close methods checked a plain
    flag and then set it, so two callers could both run the cleanup and double-free GPU resources. The flag is
    atomic with a compare-and-swap now — exactly one caller runs the body, the rest return nil.
  • The per-context GPU render context is created once: concurrent first use of a Context could create two
    render contexts and leak one; creation and every read now go through a lock.
  • GPU path draws no longer vanish when no device can be had (#534, by @timzifer): the four queueing entry
    points (FillPath, StrokePath, FillShape, StrokeShape) now check device readiness before accepting a
    draw. On a machine without an adapter they report the CPU fallback instead of queueing into a Flush that would
    drop the work — previously every filled and stroked path disappeared while text still rendered, and no error
    surfaced.
  • Standalone GPU initialization on macOS: the device request is no longer Vulkan-only. Metal is now requested
    too — the platform set wgpu registers by default — so gg without a device provider uses the GPU on macOS instead
    of silently falling back to the CPU rasterizer. Windows and Linux keep Vulkan.
  • Stencil cover pipeline without a session clip layout: the cover shader always declares the @group(1) clip
    uniform, but the pipeline layout included the group only when the session had attached its shared clip layout.
    A built-in no-clip group keeps direct renderer use (the render/readback path) valid; naga v0.22+ rejects the
    mismatch at MSL compile on Metal.

v0.52.7 — font fallback on the GPU path, reused ggcanvas, MSAA cap

Choose a tag to compare

@kolkov kolkov released this 08 Nov 14:11

Added

  • Font fallback stays on the GPU text path (#513, #521, thanks @besmpl) — text drawn with a MultiFace or
    FilteredFace that mixes fonts used to fall back to CPU rendering, because the GPU paths need glyph IDs from one
    font. Text is now split into runs by source font before shaping (MultiFace.FontRuns, FilteredFace.FontRuns,
    text.ShapeRuns), each glyph keeps the face it came from (ShapedGlyph.Face), and single-font runs go to the
    glyph-mask and MSDF pipelines.
  • SetAcceleratorMaxSampleCount (#547, thanks @sogonov): caps the MSAA sample count of the GPU
    accelerator. 1 turns multi-sampling off (strategyNoMSAA, the path
    software adapters already take), and 0 restores the default. The optional
    SampleCountAware interface carries it, and SDFAccelerator implements it
    by forwarding to GPUShared. An application that draws only glyph-mask text
    and pixel-aligned rectangles, such as a terminal UI, looks the same without
    MSAA. Turning it off frees the 4x color and depth/stencil targets: about
    120 MB of GPU memory for a 2060x1638 window, with screenshots identical
    byte for byte.

Fixed

  • Translucent fills and strokes on the GPU stencil path render at full strength again (#540, thanks @timzifer) —
    the renderer stores premultiplied colour for the stencil-then-cover pass and the cover uniform multiplied by alpha
    a second time, so translucent geometry came out as alpha²·colour over the background: darker and grayer than
    the CPU output. Opaque colours were unaffected, which is why it depended on what was drawn.
  • FontSource keeps one copy of its data (#546, thanks @sogonov) — NewFontSource documented that the caller's
    slice may be reused, but it parsed the caller's slice and stored a copy that nothing read: reusing the buffer broke
    the font, and every source held its file twice. It now parses the copy, and NewFontSourceFromFile hands over the
    buffer it just read instead of copying it.
  • Arbitrary-path clips draw their content in gogpu windows — with a circle, star or any other non-rectangular
    clip, nothing inside the clip was drawn when gg rendered into a window (examples/clip_path). On that path the
    frame is recorded into gogpu's command encoder, and gg dropped the pass that marks the clip region in the depth
    buffer while the clipped content still tested against it. Offscreen rendering with readback was not affected. A
    GPU readback test now renders through a shared encoder as well.
  • ggcanvas.New reuses the canvas instead of allocating one per frame (#484, #496, thanks @besmpl) —
    applications that take a fresh GPUContextProvider wrapper every frame and call ggcanvas.New with it got a new
    canvas, context and texture pipeline each time. New and NewWithScale now return the existing canvas for the
    same GPU device, size and scale, keyed by the provider's stable device/queue/adapter handles. A different size or
    scale keeps its own canvas, and Draw follows the window's size from WindowProvider. Render now reads the
    window provider under the canvas's lifecycle lock, since a concurrent New replaces it.

Changed

  • Dependencies: wgpu v0.34.10, naga v0.21.5, gpucontext v0.31.3, gputypes v0.8.2, go-webgpu/goffi v0.6.8,
    go-webgpu/webgpu v0.5.5. wgpu v0.34.10 releases resources before they are submitted, refcounts samplers and holds
    them from bind groups, keeps a texture alive from its view, and holds the Vulkan dynamic buffer types in the
    descriptor pool; naga v0.21.5 carries the security fixes of the v0.21 line. The go line stays 1.25.0.

Install:

go get github.com/gogpu/gg@v0.52.7

Full Changelog: v0.52.6...v0.52.7

v0.52.6

Choose a tag to compare

@kolkov kolkov released this 08 Nov 08:19

gg builds with the current GoGPU modules again. go get github.com/gogpu/gg@latest next to gogpu v0.54.x (wgpu v0.34.9, naga v0.21.4) compiles; with v0.52.5 it did not.

Fixes #531, #535.

Security

  • naga v0.21.4 — gg compiles its shaders with naga, and naga before v0.21.3 could overflow the stack on deeply
    nested WGSL (GHSA-887q-cf99-367r). gg only parses its own embedded shaders, so gg itself is not exposed, but
    govulncheck flags the reachable parser; this release requires the fixed naga.

Fixed

  • gg builds with gogpu v0.54.0 and the current GPU modules (#531, #535) — gg v0.52.5 required
    wgpu v0.31.6, gpucontext v0.28.0 and gputypes v0.5.2. gogpu v0.54.0 requires wgpu v0.34.2,
    gpucontext v0.31.3 and gputypes v0.8.0, and with those gg failed to compile: wgpu v0.34 takes
    struct arguments for Draw, DrawIndexed, SetViewport and SetScissorRect
    (gputypes.DrawArgs, DrawIndexedArgs, Viewport, ScissorRect), and gpucontext v0.31 changed
    UpdateRegion. Every call site is migrated.

  • ggcanvas partial upload uses the strided UpdateRegion (#529, @lkmavi) — damaged regions are
    uploaded with gpucontext.TextureRegionUpdater.UpdateRegion(region, data, layout) and
    ImageDataLayout{BytesPerRow: width*4} straight from the pixmap buffer, without the per-region copy.

  • No compute pipelines on adapters without compute shaders (ADR-071) — the GPU accelerator now
    checks DownlevelFlagsComputeShaders (from the shared DeviceProvider, or from the adapter in
    standalone mode) before creating the Vello compute pipelines. GLES 3.0 and WebGL2 skip them cleanly
    and use the CPU coverage filler, instead of failing at pipeline creation.

  • Soft-light blend shader used a float vector as the select() condition — blend_soft_light
    in blend.wgsl passed step(...) (a vec3<f32>) to select(), which WGSL requires to be
    bool or vecN<bool>. Rust naga, browsers and naga v0.21.0 reject the shader; older naga
    backends disagreed on its result (SPIR-V converted with != 0, the HLSL failed under DXC,
    the DXIL was invalid). The condition is now the equivalent comparison (dst <= 0.25,
    src <= 0.5), so the output is unchanged. A test parses and validates every gg shader with
    naga, whose validator now enforces the rule.

  • Standalone stencil and SDF readback padded to 256-byte rows — CopyTextureToBuffer needs BytesPerRow to be
    a multiple of 256, which wgpu checks since v0.34.7. The standalone StencilRenderer.RenderPath and SDF pipeline
    readback helpers used width*4 and failed for widths that are not a multiple of 64 pixels. The frame rendering
    path already padded its rows and was not affected. Both helpers now pad the rows and strip the padding after the
    copy, and tests cover both at an unaligned width.

  • Text pipelines leaked a sampler when the clip layout arrived after first use — the MSDF and glyph-mask
    pipelines are rebuilt once the clip bind layout is set, and the rebuild created a new sampler over the old one,
    which then outlived the device (Vulkan validation: VUID-vkDestroyDevice-device-05137 on close). The sampler does
    not depend on the clip layout and is now kept across the rebuild.

  • Translucent image.RGBA drew too dark (#532, @kivutar) — Go's image.RGBA is premultiplied, but
    FromStdImage stored it as straight RGBA, so the alpha was applied twice. It is kept as premultiplied now, and
    other image types go through NRGBAModel.

  • Damage-path docs state the buffer-age contract — FlushGPUWithViewDamage, RenderDirectWithDamage and
    RenderDirectWithDamageRects keep the target image's own last contents outside the damage rect. With a rotating
    swapchain that image can be several frames old, so the caller unions the damage over the image's age.

Added

  • render.NullDeviceHandle implements Features() and DownlevelCapabilities() (#529), as the
    gpucontext v0.31 DeviceProvider requires; both return zero values.

Changed

  • Dependencies: wgpu v0.34.9, naga v0.21.4, gpucontext v0.31.3, gputypes v0.8.2, golang.org/x/image v0.45.0,
    golang.org/x/text v0.41.0 (the newest releases that keep the Go 1.25 minimum; later ones require Go 1.26).

  • Readback no longer issues manual texture barriers — wgpu v0.34.6+ transitions textures for copies itself, so
    the explicit TransitionTextures calls around the MSAA resolve readback are gone.

Known issues

  • GPU depth clip for arbitrary paths draws nothing inside the clip (examples/clip_path, circle and star clips): the clipped content is missing on the GPU path. It is not new in this release (earlier releases behave the same); rectangle and rounded-rectangle clips work. Tracked as P1-GPU-042 for the next release.

v0.52.5 — raster backend device scale + anchored text fix

Choose a tag to compare

@kolkov kolkov released this 25 Aug 21:22
9dd168c

Fixed

  • Raster backend device scale preserved — FillRect, setPath, SetClip, SetTransform called ctx.Identity() which reset Scale(2,2). At 2x, content rendered in top-left quadrant only (25% coverage). Fix: applyDeviceScale() replaces Identity() (Skia fInitialCTM pattern).

  • Recording DrawStringAnchored anchor offset — Recorder.DrawStringAnchored ignored ax/ay entirely. Right-aligned text extended past position instead of ending at it. Fix: anchor offset computed at record time using text.Measure + face metrics. Pixel-perfect parity with Context.DrawStringAnchored verified.

v0.52.4 — recording DrawText + HiDPI, font ID fix, dead code removal

Choose a tag to compare

@kolkov kolkov released this 25 Aug 17:30
3bb9988

Fixed

  • Recording raster backend: DrawText now renders text — font face stored in commands (Skia sk_sp<SkTextBlob> / Cairo cairo_scaled_font_reference pattern). Font size scaled by CTM at record time.

  • Recording raster backend: HiDPI scale — NewBackendWithScale(scale) for Retina-quality PNG output (Skia fInitialCTM / Cairo replay_with_transform pattern).

  • Font face cache collision (#514, @kivutar) — text.ComputeFontID uses FullName(), preventing Regular/Bold outline cache collision. Unified across CPU, MSDF, and glyph mask pipelines.

Removed

  • Dead internal/gpucore abstraction layer (#518) — removed ~2,960 LOC of orphaned code. Production uses *wgpu.Device/*wgpu.Queue directly (Vello pattern).

Changed

  • deps: wgpu v0.31.4 → v0.31.6

v0.52.3 — NoAA stroke fix (@lkmavi) + platform font smoothing (@besmpl)

Choose a tag to compare

@kolkov kolkov released this 13 Aug 14:13
c250eee

Added

  • Platform font smoothing integration (#495, @besmpl) —
    ggcanvas now applies PlatformProvider.FontSmoothing: disabled smoothing
    selects TextModeAliased, grayscale disables LCD masks, and subpixel mode
    uses the reported RGB/BGR layout. Aliased mode now also preserves binary
    coverage for pre-shaped scene glyphs instead of routing them through the
    regular anti-aliased shaped-text pipeline.

Fixed

  • NoAA curved strokes no longer collapse by 4x (#510, @lkmavi, #509) —
    SetAntiAlias(false) + Stroke() on circles/arcs displaced geometry (335→83 in X).
    Root cause: curvePixelAccuracy() unconditionally right-shifted by kDefaultAccuracy=2
    at aaShift=0. Fixed with min(shift, kDefaultAccuracy). NoAA path now defaults to
    flattenCurves=true (Skia SkScan::FillPath pattern). Dropped unused error return
    from fillNoAA.

Changed

  • deps: gpucontext v0.27.0 → v0.28.0, wgpu v0.31.0 → v0.31.4, gputypes v0.5.1 → v0.5.2

v0.52.2 — Community Bug Fixes (@besmpl)

Choose a tag to compare

@kolkov kolkov released this 11 Aug 09:22
fbacef2

v0.52.2 — Community Bug Fixes

7 bug fixes from @besmpl + 1 interaction fix. All reviewed and CI-validated.

Fixed

  • Concurrent global text cache race (#494, @besmpl) — atomic.Pointer[T] for globalGlyphCache / globalSubpixelCache
  • Path bounds not preserved across Reset/Append/Clone (#497, @besmpl)
  • Premultiplied alpha double-multiplication in scene renderer (#500, @besmpl) — semi-transparent fills appeared darker
  • HiDPI layer and mask dimensions (#502, @besmpl) — PushLayer/PushMaskLayer/AsMask used logical instead of physical dims
  • Transformed rectangular clips (#503, @besmpl) — ClipRect/ClipRoundRect now transform all 4 corners under rotation/shear
  • Recording stroke rectangles under transforms (#498, @besmpl) — all 4 corners + scaled stroke metrics
  • Recording clips were no-ops (#499, @besmpl) — SetClip now calls Clip(), ClearClip calls ResetClip(), fill rule + subpath fixes
  • Recording ClipRoundRect transform parity — playback matches Context.ClipRoundRect for non-axis-aligned transforms

Install

go get github.com/gogpu/gg@v0.52.2

v0.52.1 — Fix Orphaned Dependencies

Choose a tag to compare

@kolkov kolkov released this 11 Aug 05:18
802af7d

v0.52.1 — Fix Orphaned Dependencies

Fixed

  • Remove orphaned gogpu/ui dependency from go.mod — tmp/ test scripts without own go.mod caused go mod tidy to pull gogpu and ui into gg's module graph. gg is a pure drawing library and must not depend on gogpu or ui. Users doing go get github.com/gogpu/gg@v0.52.0 were pulling unnecessary transitive dependencies.

Changed

  • docs: ARCHITECTURE.md updated for ADR-065/066/067 — new "Compositor Delegation (ADR-067)" section, damage pipeline Level 3/4 descriptions, stale SetDamageRects comment fixed in context.go.

v0.52.0 — Compositor Architecture Migration (ADR-067)

Choose a tag to compare

@kolkov kolkov released this 10 Aug 19:17
74881ea

v0.52.0 — Compositor Architecture Migration (ADR-067)

gg becomes a pure drawing library. Surface-level compositor decisions (LoadOp, damage scissoring, MSAA overlay compositing) are delegated to gogpu via the SurfaceCompositor interface. Enterprise pattern validated by Chromium cc/, GTK4 GSK, and Flutter flow/ source code.

Changed

  • Compositor architecture migration (ADR-067, #493)
    • preserveContent removed from GPURenderSession — compositor decides LoadOp
    • shouldPreserveSurface() simplified to gg-internal multi-pass only
    • selectBaseLayer uses target.PreserveContent (explicit external content signal), not frameRendered
    • Per-frame compositor via GPURenderTarget.Compositor field
    • MarkFrameRendered() replaces preserveContent flag for compositor → gg signal
    • MSAA overlay compositing delegates to SurfaceCompositor.CompositeMSAAOverlay() when available
    • Legacy fallback preserved for standalone gg without gogpu
  • deps: gpucontext v0.26.0 → v0.27.0 (SurfaceCompositor interface)
  • deps: gogpu v0.51.0 → v0.52.0

v0.51.0 — Damage Overlay + TT Advance Cache

Choose a tag to compare

@kolkov kolkov released this 10 Aug 08:18
e5274ca

v0.51.0 — Damage Overlay + TT Advance Cache

Added

  • Damage source registration API (ADR-065) — ggcanvas migrated to gpucontext.DamageReporter. Chromium cc compositor pattern — one path for all damage sources.
  • Damage debug overlay (ADR-066) — GOGPU_DEBUG_DAMAGE=overlay renders per-source colored flash-and-fade overlays with text labels. Pluggable via gpucontext.DamageOverlayRenderer.

Fixed

  • TT bytecode advance cache (#490) — per-(ppem, glyphID) advance width cache avoids 60fps→15fps regression from v0.50.13 advanceResolver. First frame ~40 interpreter executions (warm-up), subsequent frames 0 for advance queries.

Changed

  • deps: gpucontext v0.26.0, wgpu v0.31.0, gogpu v0.51.0
  • Examples migrated from deprecated LoadFontFace to text.NewFontSourceFromFile API
  • GOGPU_DEBUG_DAMAGE=1 renamed to GOGPU_DEBUG_DAMAGE=overlay (pre-v1.0 clean cut)

Install

go get github.com/gogpu/gg@v0.51.0