Last updated: December 29, 2025
Join the Discussion: Help shape the future of Go graphics! GitHub Discussions
Update (December 29, 2025): All backends complete! The ecosystem has grown to 249K lines of Pure Go. 5 GPU backends (Vulkan, DX12, Metal, GLES, Software). 4 shader targets (SPIR-V, MSL, GLSL, HLSL). Full cross-platform: Windows, Linux (X11+Wayland), macOS.
For years I couldn't understand why Go — a language loved for its simplicity and performance — still doesn't have a professional GUI ecosystem. Every time I needed graphics in Go, I hit the same walls: CGO requirements, abandoned projects, incomplete solutions. It was frustrating.
Six months ago, I started preparing. Reading WebGPU specs, studying wgpu and naga source code, designing architecture. I was waiting for the right moment.
Then I saw this Reddit thread. Hundreds of developers sharing the same frustration. That was my trigger.
I published my first article with a simple triangle demo and started coding.
Two weeks later: 100,000+ lines of pure Go.
What We Built
Four repositories. Zero CGO. Just go build.
gogpu/gogpu (v0.8.3) — Graphics Framework
~26K lines | GitHub
The main framework with dual backend architecture and full cross-platform windowing:
package main
import (
"github.com/gogpu/gogpu"
"github.com/gogpu/gogpu/gmath"
)
func main() {
app := gogpu.NewApp(gogpu.DefaultConfig().
WithTitle("Hello GoGPU").
WithSize(800, 600))
app.OnDraw(func(ctx *gogpu.Context) {
ctx.DrawTriangleColor(gmath.DarkGray)
})
app.Run()
}
Build tags for backend selection:
go build ./... # Both backends
go build -tags rust ./... # Rust backend (max performance)
go build -tags purego ./... # Pure Go backend (zero dependencies)
gogpu/wgpu (v0.8.2) — Pure Go WebGPU
~87K lines | GitHub
Complete WebGPU implementation. No wgpu-native, no CGO:
| Component | Lines | Description |
|---|---|---|
| types/ | ~3K | WebGPU type definitions |
| core/ | ~8K | Validation and state tracking |
| hal/vulkan/ | ~27K | Vulkan 1.3 backend |
| hal/dx12/ | ~12K | DirectX 12 backend (NEW!) |
| hal/metal/ | ~3K | Metal backend (macOS/iOS) |
| hal/gles/ | ~7.5K | OpenGL ES backend |
| hal/software/ | ~10K | CPU rasterizer for CI/CD |
Five backends — all complete:
- Vulkan — Windows, Linux, macOS. Auto-generated bindings, buddy memory allocator, Vulkan 1.3 dynamic rendering.
- DX12 — Windows native. Pure Go COM bindings, descriptor heaps, flip swapchain. (NEW!)
- Metal — macOS/iOS. Full swapchain, render pipelines.
- OpenGL ES — Windows (WGL), Linux (EGL)
- Software — Full CPU rasterizer. 100+ tests, parallel rendering.
// CI/CD without GPU
import _ "github.com/gogpu/wgpu/hal/software"
pixels := surface.GetFramebuffer() // CPU-rendered pixels
gogpu/naga (v0.8.0) — Shader Compiler
~32K lines | GitHub
WGSL → SPIR-V/MSL/GLSL/HLSL compiler. Pure Go, 200+ tests:
source := `
@compute @workgroup_size(64)
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
let index = id.x;
output[index] = input[index] * 2.0;
}
`
spirv, _ := naga.Compile(source) // SPIR-V for Vulkan
msl, _ := msl.Compile(module, msl.Options{}) // MSL for Metal
glsl, _ := glsl.Compile(module, glsl.Options{}) // GLSL for OpenGL
hlsl, _ := hlsl.Compile(module, hlsl.Options{}) // HLSL for DirectX
Four output targets — all stable:
- SPIR-V — Vulkan (all platforms)
- MSL — Metal (macOS/iOS)
- GLSL — OpenGL 3.3+, ES 3.0+
- HLSL — DirectX 11/12 (NEW!)
Vertex, fragment, compute shaders. Atomics, barriers, texture sampling. 50+ built-in functions.
gogpu/gg (v0.15.3) — 2D Graphics
~104K lines | GitHub
Enterprise-grade 2D graphics. Inspired by fogleman/gg:
ctx := gg.NewContext(800, 600)
ctx.ClearWithColor(gg.White)
// Shapes
ctx.SetColor(gg.Hex("#3498db"))
ctx.DrawCircle(400, 300, 100)
ctx.Fill()
// Fluent PathBuilder (v0.14.0)
path := gg.BuildPath().
Circle(100, 100, 50).
Star(200, 100, 40, 20, 5).
Build()
ctx.DrawPath(path)
ctx.Fill()
// Text with font fallback
source, _ := text.NewFontSourceFromFile("Roboto.ttf")
defer source.Close() // io.Closer support (v0.14.0)
ctx.SetFont(source.Face(24))
ctx.DrawString("Hello, GoGPU!", 350, 305)
// Layers with blend modes
ctx.PushLayer(gg.BlendMultiply, 0.7)
ctx.SetColor(gg.Red)
ctx.DrawRectangle(350, 250, 100, 100)
ctx.Fill()
ctx.PopLayer()
ctx.SavePNG("output.png")
Key features:
- Canvas API, scene graph with dirty region tracking
- GPU compute shaders via Sparse Strips (v0.15.0)
- 29 blend modes (Porter-Duff + Advanced + HSL)
- Layers with per-layer opacity
- Alpha masks for compositing
- Fluent PathBuilder
- GPU text rendering with MSDF atlas
- 80%+ test coverage for core packages
The Numbers
| Metric | Then (Nov 2024) | Now (Dec 2025) |
|---|---|---|
| Total Lines of Code | 106,295 | 248,772 |
| Repositories | 4 | 5 (+ gogpu/ui planning) |
| GPU Backends | 3 | 5 (+ DX12, Metal) |
| Shader Targets | 1 (SPIR-V) | 4 (+ MSL, GLSL, HLSL) |
| Platforms | Windows | Windows, Linux (X11+Wayland), macOS |
| CGO Required | No | No |
Platform Support (December 2025)
| Platform | Windowing | GPU Backends | Status |
|---|---|---|---|
| Windows | Win32 | Vulkan, DX12, GLES | Production |
| Linux X11 | X11 | Vulkan, GLES | Production |
| Linux Wayland | Wayland | Vulkan, GLES | Production |
| macOS | Cocoa | Metal | Production |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Your Application │
├─────────────────────────────────────────────────────────────┤
│ gogpu/ui (planning) │ gogpu/gg (2D) │
├─────────────────────────────────────────────────────────────┤
│ gogpu/gogpu (framework) │
│ Win32 │ X11 │ Wayland │ Cocoa — Input, GPU Abstraction │
├─────────────────────────────────────────────────────────────┤
│ Rust Backend (wgpu-native) │ Pure Go Backend (wgpu) │
├─────────────────────────────────────────────────────────────┤
│ gogpu/naga (WGSL → SPIR-V │ MSL │ GLSL │ HLSL) │
├─────────────────────────────────────────────────────────────┤
│ Vulkan │ DX12 │ Metal │ OpenGL ES │ Software │
└─────────────────────────────────────────────────────────────┘
Why Pure Go?
For developers:
-
go buildjust works - Cross-compilation is trivial
- Debugging stays in Go
For CI/CD:
- Software backend — no GPU needed
- Tests run in containers
- No driver hassle
For the ecosystem:
- Native tooling
- Standard profiling
- No CGO overhead
What's Next
gogpu/ui — Signals-based GUI widget toolkit. Enterprise features: docking, virtualization, accessibility. Join the design discussion.
v1.0.0 — Production release with stable API.
Compute shaders — Full compute pipeline in all backends.
naga optimizations — Dead code elimination, constant folding for smaller shaders.
Get Involved
Star the repos:
- gogpu/gogpu — Framework
- gogpu/gg — 2D Graphics
- gogpu/wgpu — Pure Go WebGPU
- gogpu/naga — Shader Compiler
- gogpu/ui — GUI Toolkit (planning)
Join the discussion:
- GitHub Discussions #18 — Shape the future of gogpu/ui
Try it:
go get github.com/gogpu/gg@v0.15.3
Contribute: UI toolkit, compute shader examples, docs, cross-platform testing.
Acknowledgments
- Michael Fogleman — original gg library
- gfx-rs — wgpu and naga reference implementations
- r/golang community — for the push I needed
Years of frustration. Six months of preparation. Two weeks to 100K. Now 249K lines of pure Go.
The GPU ecosystem Go deserves is here.
GoGPU — github.com/gogpu
Top comments (0)