Help us shape the future of Go! Take the 2026 Go Developer Survey

gpu

command
v0.52.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package main demonstrates GPU-accelerated 2D rendering with gg.

This example shows how to:

  • Enable GPU acceleration via blank import of gg/gpu
  • Draw shapes that automatically use the three-tier GPU pipeline: Tier 1: SDF fragment shader (circles, rounded rects) Tier 2a: Convex polygon fast-path (triangles, pentagons, etc.) Tier 2b: Stencil-then-cover (arbitrary paths, stars, etc.)
  • Fall back to CPU rendering transparently when GPU is unavailable

The GPU backend uses WebGPU (via gogpu/wgpu) with Vulkan for hardware-accelerated rendering in a single unified render pass.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL