Skip to content

Tags: gogpu/gg

Tags

v0.38.1

Toggle v0.38.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: ImagePattern affine transform — DrawImage with rotation (#224) (#…

…225)

ImagePattern now uses pre-computed inverse Matrix instead of anchor+offset
for device-to-image coordinate mapping. Supports rotation, scale, skew.
Follows Cairo/Skia/tiny-skia pattern: compose CTM into pattern transform,
store inverse, apply per-pixel via matrix multiply.

9 new tests including Rider21's exact repro case. Zero regression.

Fixes #224.

v0.38.0

Toggle v0.38.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat: SVG renderer, path API, LCD pipeline, fixes (v0.38.0) (#223)

* fix: use Nearest filtering for glyph mask bitmap atlas

GlyphMask pipeline rasterizes glyphs at exact device pixel size with
subpixel hinting. Linear filtering was blurring these pre-hinted bitmaps,
making text appear fuzzy at small sizes (13px).

Nearest filtering preserves the pixel-perfect edges from CPU rasterization.
This was the root cause of 'blurry fonts' on Vulkan/DX12 — GLES appeared
sharper only because it had a bug that hardcoded NEAREST for all textures.

MSDF text pipeline keeps Linear filtering (correct for distance fields).

* feat: ClearType LCD subpixel text rendering pipeline

Dual GPU pipeline (Skia pattern) for LCD subpixel text:
- CPU rasterizes at 3x horizontal oversampling with LCD FIR filter
- GPU composites per-channel alpha via glyph_mask_lcd.wgsl shader
- Separate LCD pipeline avoids Intel Vulkan uniform struct bug
- Public API: dc.SetLCDLayout(gg.LCDLayoutRGB/BGR/None)
- Extracted pipeline helpers to eliminate dupl lint warnings

* feat: add LCD ClearType text example (examples/lcd_text)

GPU Tier 6 LCD pipeline infrastructure is in place but per-channel
subpixel compositing needs investigation — text renders with 3x
oversampling coverage (visibly bolder) but without visible RGB color
fringing. LCD shader may not be selected or per-channel alpha
compositing in glyph_mask_lcd.wgsl needs tuning.

TODO: debug whether LCD pipeline is actually dispatched vs grayscale
fallback, verify atlas stores 3x-wide glyphs, verify fragment shader
samples 3 adjacent texels correctly.

* fix: warn when glyph mask atlas page not synced — text skip diagnostic

Silent text skip (view == nil → continue) now logs a warning.
Helps diagnose RENDER-DIRECT-002 (first-frame missing text).

* fix: move BeginAcceleratorFrame from RenderDirect to Draw (RENDER-DIRECT-003)

BeginAcceleratorFrame was called inside RenderDirect AFTER canvas.Draw,
causing it to wipe content from mid-frame CPU fallback flushes. Now
called at the start of Draw() — before any drawing operations.

This prevents LoadOpClear from wiping GPU content submitted during
bitmap text fallback or gradient fill CPU paths.

* feat: SVG path data parser — ParseSVGPath() (SVG-PATH-001)

Full SVG path d-attribute parser supporting all 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 per W3C SVG spec F.6.5.
56 tests including real JetBrains icon paths.

* feat: add SetPath/AppendPath + Path.Append for SVG icon rendering

SetPath(p) replaces current path with pre-built Path (e.g. from ParseSVGPath).
AppendPath(p) adds elements to current path without clearing.
Path.Append(other) copies all elements from another path.

Enables: dc.SetPath(svgPath); dc.Fill() for filled SVG icons.
Needed by UI icon package (CANVAS-001 fill path rendering).

* feat: DrawPath/FillPath/StrokePath — transform-aware path rendering

DrawPath replays parsed path through current CTM (Translate/Scale/Rotate).
FillPath = DrawPath + Fill, StrokePath = DrawPath + Stroke.

Fixes: SetPath bypassed matrix transform, making SVG icons invisible
when rendered with Push/Translate/Scale/Pop.

Usage: dc.FillPath(svgPath) — correct transform, one call.

* feat: enterprise SVG renderer — gg/svg package (SVG-002)

Full SVG renderer for JetBrains-quality icon rendering:
- Parse SVG XML → Document tree (encoding/xml)
- Render path, circle, rect, g, polygon, polyline, line, ellipse
- Color parsing (#hex, rgb(), rgba(), named, none)
- Transform support (translate, rotate, scale, matrix)
- ViewBox scaling to target size
- RenderWithColor for theme color override (JB SvgAttributePatcher pattern)
- Fill-rule evenodd, stroke-linecap/linejoin, fill-opacity
- 64 tests with 7 real JetBrains SVG icons embedded
- 2054 LOC, zero external dependencies

* docs: update CHANGELOG, README, ROADMAP, ARCHITECTURE for SVG renderer + LCD + path API

* chore: update wgpu v0.22.1, gpucontext v0.11.0

* fix: formatting, lint, lcd_text separate go.mod (no gogpu dep in gg root)

v0.37.4

Toggle v0.37.4's commit message
Merge branch 'main' of https://github.com/gogpu/gg

v0.37.3

Toggle v0.37.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: universal Render + GLES/Software support (v0.37.3)

* feat: universal canvas.Render(dc) — one call, all backends

- ggcanvas.RenderTarget interface (SurfaceView, SurfaceSize, PresentTexture)
- ggcanvas.Render(dc) tries GPU-direct, falls back to Flush+PresentTexture
- SDFAccelerator detects CPU adapter → disables GPU pipelines → CPU fallback
- Example updated: canvas.Render(dc.RenderTarget())
- Software backend: clear works, texture blit chain needs debugging

* chore: wgpu v0.21.3 + naga v0.14.8 + CHANGELOG for v0.37.3

v0.37.2

Toggle v0.37.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: pipeline clip recreation + wgpu v0.21.2 validation (v0.37.2)

* fix: force pipeline recreation when clip layout changes (ui#52)

Track pipeLayoutHasClip flag on all 5 GPU pipelines. When clip layout
is set after pipeline creation, destroy and recreate with correct layout.
Fixes vkCmdBindDescriptorSets crash on AMD/NVIDIA GPUs.

* docs: update CHANGELOG for v0.37.2

* chore: update wgpu v0.21.2 for core validation (v0.37.2)

v0.37.1

Toggle v0.37.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: update wgpu v0.21.1, gogpu v0.24.2 (v0.37.1)

v0.37.0

Toggle v0.37.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat: migrate to wgpu public API, SetViewport fix (v0.37.0)

* refactor: typed DeviceProvider, remove any from SetDeviceProvider

SetDeviceProvider now takes gpucontext.DeviceProvider (was any).
SetAcceleratorDeviceProvider takes gpucontext.DeviceProvider (was any).
GPU accelerators (sdf_gpu, vello_accelerator) use local halAccessor
interface with typed returns instead of any type assertions.
Zero any in the accelerator provider chain.

* fix: explicit SetViewport in all GPU render passes (gg#171)

Add rp.SetViewport(0, 0, w, h, 0, 1) after BeginRenderPass in all 4
render pass entry points:
- encodeSubmitReadback (offscreen)
- encodeSubmitSurface (direct to screen)
- encodeSubmitReadbackGrouped (offscreen with scissor groups)
- encodeSubmitSurfaceGrouped (screen with scissor groups)

Previously relied on Metal's default viewport which caused content
offset on macOS — shapes appeared in wrong corner. Defense-in-depth
matching Gio and wgpu-rs.

Also: encodeSubmitSurface no longer discards w/h parameters.
Also: naga v0.14.6 → v0.14.7 (Metal buffer(0) conflict fix).

Fixes gg#171, ui#48, ui#23.

* fix: handle *wgpu.TextureView in SetSurfaceTarget for gogpu integration

SetSurfaceTarget now tries hal.TextureView first (backward compatible),
then falls back to halTextureViewAccessor interface to extract HAL view
from *wgpu.TextureView. This bridges the gap after gogpu migration to
wgpu public API — gogpu.Context.SurfaceView() now returns *wgpu.TextureView
instead of hal.TextureView.

* feat: migrate internal/gpu from hal to wgpu public API (GPU-API-001 + WGPU-API-002)

Complete migration of gg GPU internals from hal interfaces to wgpu public API:
- 31 files changed: all production + test code uses wgpu.* types
- Stencil types: wgpu.StencilFaceState, wgpu.StencilOperation
- Barrier/copy types: wgpu.TextureBarrier, wgpu.BufferTextureCopy
- Standalone GPU init: wgpu.CreateInstance → RequestAdapter → RequestDevice
- Logger: wgpu.SetLogger() propagation (no hal import)
- Zero hal imports in production code
- Tests updated: noop wgpu.Device instead of hal mocks

* chore: update deps for v0.37.0 release

- wgpu v0.20.2 → v0.21.0 (three-layer public API)
- gpucontext v0.9.0 → v0.10.0 (typed interfaces)
- fix: check rp.End() error returns (errcheck)
- fix: remove unused device param from destroy() (unparam)

v0.36.4

Toggle v0.36.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #208 from gogpu/feat/gpu-clip-002-rrect-sdf

feat: analytic SDF RRect clip in fragment shaders (GPU-CLIP-002)

v0.36.3

Toggle v0.36.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #201 from gogpu/fix/scissor-group-shared-buffer

fix: GPU scissor clipping lost by BeginFrame + shared buffer overwrite

v0.36.2

Toggle v0.36.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #200 from gogpu/perf/scissor-single-render-pass

perf: single render pass with per-group scissor rect