Repository navigation
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