Repository navigation
Releases
v0.52.8 — wgpu v0.35.6 migration, bounded curve subdivision, no silent draw loss
Changed
- wgpu v0.35.0 (ADR-070 package move): the GPU path no longer depends on the removed
wgpu/corepackage. The
deadgpu.Backendfacade, its stub command encoders and theGPUSceneRendererchain are deleted (about 17.7K
lines of legacy wrappers and their tests ininternal/gpu, no production caller), and the GPU tests build their
HAL devices through wgpu'swgputestseam. 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 thewgpu/hal/*packages ADR-070 removed, andgo mod tidycannot 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
Closecalls are idempotent:Context.Closeand the surfaceClosemethods 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
Contextcould 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
Added
- Font fallback stays on the GPU text path (#513, #521, thanks @besmpl) — text drawn with a
MultiFaceor
FilteredFacethat 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.1turns multi-sampling off (strategyNoMSAA, the path
software adapters already take), and0restores the default. The optional
SampleCountAwareinterface carries it, andSDFAcceleratorimplements it
by forwarding toGPUShared. 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 asalpha²·colourover the background: darker and grayer than
the CPU output. Opaque colours were unaffected, which is why it depended on what was drawn. FontSourcekeeps one copy of its data (#546, thanks @sogonov) —NewFontSourcedocumented 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, andNewFontSourceFromFilehands 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.Newreuses the canvas instead of allocating one per frame (#484, #496, thanks @besmpl) —
applications that take a freshGPUContextProviderwrapper every frame and callggcanvas.Newwith it got a new
canvas, context and texture pipeline each time.NewandNewWithScalenow 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, andDrawfollows the window's size fromWindowProvider.Rendernow reads the
window provider under the canvas's lifecycle lock, since a concurrentNewreplaces 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. Thegoline 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
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.
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
govulncheckflags 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 forDraw,DrawIndexed,SetViewportandSetScissorRect
(gputypes.DrawArgs,DrawIndexedArgs,Viewport,ScissorRect), and gpucontext v0.31 changed
UpdateRegion. Every call site is migrated. -
ggcanvaspartial upload uses the stridedUpdateRegion(#529, @lkmavi) — damaged regions are
uploaded withgpucontext.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
checksDownlevelFlagsComputeShaders(from the sharedDeviceProvider, 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
inblend.wgslpassedstep(...)(avec3<f32>) toselect(), which WGSL requires to be
boolorvecN<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 —
CopyTextureToBufferneedsBytesPerRowto be
a multiple of 256, which wgpu checks since v0.34.7. The standaloneStencilRenderer.RenderPathand SDF pipeline
readback helpers usedwidth*4and 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-05137on close). The sampler does
not depend on the clip layout and is now kept across the rebuild. -
Translucent
image.RGBAdrew too dark (#532, @kivutar) — Go'simage.RGBAis premultiplied, but
FromStdImagestored it as straight RGBA, so the alpha was applied twice. It is kept as premultiplied now, and
other image types go throughNRGBAModel. -
Damage-path docs state the buffer-age contract —
FlushGPUWithViewDamage,RenderDirectWithDamageand
RenderDirectWithDamageRectskeep 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.NullDeviceHandleimplementsFeatures()andDownlevelCapabilities()(#529), as the
gpucontext v0.31DeviceProviderrequires; 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 explicitTransitionTexturescalls 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
Fixed
-
Raster backend device scale preserved —
FillRect,setPath,SetClip,SetTransformcalledctx.Identity()which resetScale(2,2). At 2x, content rendered in top-left quadrant only (25% coverage). Fix:applyDeviceScale()replacesIdentity()(SkiafInitialCTMpattern). -
Recording DrawStringAnchored anchor offset —
Recorder.DrawStringAnchoredignoredax/ayentirely. Right-aligned text extended past position instead of ending at it. Fix: anchor offset computed at record time usingtext.Measure+ face metrics. Pixel-perfect parity withContext.DrawStringAnchoredverified.
v0.52.4 — recording DrawText + HiDPI, font ID fix, dead code removal
Fixed
-
Recording raster backend: DrawText now renders text — font face stored in commands (Skia
sk_sp<SkTextBlob>/ Cairocairo_scaled_font_referencepattern). Font size scaled by CTM at record time. -
Recording raster backend: HiDPI scale —
NewBackendWithScale(scale)for Retina-quality PNG output (SkiafInitialCTM/ Cairoreplay_with_transformpattern). -
Font face cache collision (#514, @kivutar) —
text.ComputeFontIDusesFullName(), preventing Regular/Bold outline cache collision. Unified across CPU, MSDF, and glyph mask pipelines.
Removed
- Dead
internal/gpucoreabstraction layer (#518) — removed ~2,960 LOC of orphaned code. Production uses*wgpu.Device/*wgpu.Queuedirectly (Vello pattern).
Changed
- deps: wgpu v0.31.4 → v0.31.6
v0.52.3 — NoAA stroke fix (@lkmavi) + platform font smoothing (@besmpl)
Added
- Platform font smoothing integration (#495, @besmpl) —
ggcanvasnow appliesPlatformProvider.FontSmoothing: disabled smoothing
selectsTextModeAliased, 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 bykDefaultAccuracy=2
ataaShift=0. Fixed withmin(shift, kDefaultAccuracy). NoAA path now defaults to
flattenCurves=true(SkiaSkScan::FillPathpattern). Dropped unused error return
fromfillNoAA.
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)
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]forglobalGlyphCache/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/AsMaskused logical instead of physical dims - Transformed rectangular clips (#503, @besmpl) —
ClipRect/ClipRoundRectnow 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) —
SetClipnow callsClip(),ClearClipcallsResetClip(), fill rule + subpath fixes - Recording ClipRoundRect transform parity — playback matches
Context.ClipRoundRectfor non-axis-aligned transforms
Install
go get github.com/gogpu/gg@v0.52.2
v0.52.1 — Fix Orphaned Dependencies
v0.52.1 — Fix Orphaned Dependencies
Fixed
- Remove orphaned gogpu/ui dependency from go.mod —
tmp/test scripts without owngo.modcausedgo mod tidyto pullgogpuanduiinto gg's module graph. gg is a pure drawing library and must not depend on gogpu or ui. Users doinggo get github.com/gogpu/gg@v0.52.0were 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
SetDamageRectscomment fixed incontext.go.
v0.52.0 — Compositor Architecture Migration (ADR-067)
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)
preserveContentremoved fromGPURenderSession— compositor decides LoadOpshouldPreserveSurface()simplified to gg-internal multi-pass onlyselectBaseLayerusestarget.PreserveContent(explicit external content signal), notframeRendered- Per-frame compositor via
GPURenderTarget.Compositorfield MarkFrameRendered()replacespreserveContentflag 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
v0.51.0 — Damage Overlay + TT Advance Cache
Added
- Damage source registration API (ADR-065) — ggcanvas migrated to
gpucontext.DamageReporter. Chromiumcccompositor pattern — one path for all damage sources. - Damage debug overlay (ADR-066) —
GOGPU_DEBUG_DAMAGE=overlayrenders per-source colored flash-and-fade overlays with text labels. Pluggable viagpucontext.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
LoadFontFacetotext.NewFontSourceFromFileAPI GOGPU_DEBUG_DAMAGE=1renamed toGOGPU_DEBUG_DAMAGE=overlay(pre-v1.0 clean cut)
Install
go get github.com/gogpu/gg@v0.51.0