Skip to content
@gogpu

GoGPU

Pure Go GPU Computing Ecosystem — Graphics, Shaders, ML. Zero CGO.

GoGPU Logo

GoGPU

Pure Go GPU Computing Ecosystem
GPU power, Go simplicity. Zero CGO.

Go Version License 224K LOC Discussions


Why GoGPU?

Inspired by this discussion on r/golang, we're building the GPU computing ecosystem that Go deserves — from low-level graphics to high-level GUI, all with zero CGO.


Ecosystem

Library Purpose LOC Stars Issues
gg 2D graphics, Canvas API, GPU compute ~104K Image Image
wgpu Pure Go WebGPU (Vulkan/Metal/GLES) ~71K Image Image
gogpu Graphics framework, windowing ~26K Image Image
naga WGSL → SPIR-V/MSL/GLSL compiler ~23K Image Image
ui GUI toolkit (planned) Image Image

Total: ~224K LOC Pure Go | Zero CGO | Cross-platform


Architecture

┌─────────────────────────────────────────────────────────────┐
│              Your Application                               │
├─────────────────────────────────────────────────────────────┤
│   gogpu/ui (GUI)   │   born-ml/born   │   Your Framework    │
├─────────────────────────────────────────────────────────────┤
│              gogpu/gg (2D Graphics)                         │
├─────────────────────────────────────────────────────────────┤
│              gogpu/gogpu (Graphics Framework)               │
│         GPU abstraction, windowing, input, math             │
├─────────────────────────────────────────────────────────────┤
│   go-webgpu/webgpu (FFI)    →    gogpu/wgpu (Pure Go)       │
├─────────────────────────────────────────────────────────────┤
│              Vulkan  │  Metal  │  DX12  │  OpenGL           │
└─────────────────────────────────────────────────────────────┘

Key Features

Feature Description
Zero CGO No C compiler required, simple go build
WebGPU API Modern, portable GPU abstraction
Layered Design Use only what you need
Pure Go Goal Gradually replacing FFI with native Go

Quick Start

package main

import "github.com/gogpu/gogpu"

func main() {
    app := gogpu.NewApp(gogpu.Config{
        Title:  "Hello GoGPU",
        Width:  800,
        Height: 600,
    })

    app.OnDraw(func(ctx *gogpu.Context) {
        ctx.Clear(gogpu.Black)
        ctx.DrawTriangle(/* ... */)
    })

    app.Run()
}

Note: API is in active development and will change.


Related Projects

Project Organization Purpose Stars Issues
webgpu go-webgpu Zero-CGO WebGPU bindings (wgpu-native FFI) Image Image
goffi go-webgpu Pure Go FFI library (88-114ns overhead) Image Image
born born-ml Pure Go ML framework (97%+ MNIST) Image Image

Roadmap

Foundation ✅

  • Zero-CGO WebGPU bindings (go-webgpu/webgpu)
  • Pure Go FFI (go-webgpu/goffi)

Phase 1 — Graphics ✅

  • Graphics framework (gogpu/gogpu) — Triangle, Textures, Dual Backend
  • Shader compiler (gogpu/naga) — WGSL → SPIR-V/MSL + compute shaders (~21K LOC)

Phase 2 — Pure Go WebGPU ✅

  • WebGPU types package (gogpu/wgpu/types)
  • Core validation & state (gogpu/wgpu/core)
  • HAL abstraction layer (gogpu/wgpu/hal)
  • OpenGL ES backend (gogpu/wgpu/hal/gles) — ~7.5K LOC, Windows + Linux
  • Vulkan backend (gogpu/wgpu/hal/vulkan) — ~27K LOC, cross-platform!
  • Software backend (gogpu/wgpu/hal/software) — ~10K LOC, full rasterizer!
  • Metal backend (gogpu/wgpu/hal/metal) — ~2.5K LOC, macOS/iOS!

Phase 3 — 2D Graphics ✅

  • 2D graphics library (gogpu/gg) — v0.15.0 with GPU compute shaders!
  • Text rendering (v0.2.0) — FontSource/Face, MultiFace fallback
  • Images, Clipping, Compositing (v0.3.0) — DrawImage, Clip API, Porter-Duff
  • Layer API, Color Pipeline (v0.4.0) — PushLayer/PopLayer, HSL blend modes
  • SIMD Optimization (v0.5.0) — Fast div255, sRGB LUTs, batch blending (260x faster)
  • Parallel Rendering (v0.6.0) — TileGrid, WorkerPool, lock-free DirtyRegion!
  • Scene Graph (v0.7.0) — Retained mode, 13 shapes, filters, layer cache!
  • Backend Abstraction (v0.8.0) — RenderBackend interface, registry!
  • GPU Backend (v0.9.0) — Sparse Strips, WGSL shaders, 29 blend modes on GPU!
  • GPU Text Pipeline (v0.10.0) — Shaper, Layout, Bidi, 25+ scripts!
  • GPU Text Rendering (v0.11.0) — MSDF atlas, emoji, subpixel positioning!
  • Rust-First API (v0.12.0) — Brush, Gradients, Stroke, Dash!
  • Go 1.25+ (v0.13.0) — Iterators, Generic Cache, Context!
  • Advanced Features (v0.14.0) — Alpha Masks, PathBuilder, io.Closer!
  • GPU Compute Shaders (v0.15.0) — vello-style flatten/coarse/fine pipeline!

Phase 3.5 — Platform Expansion ✅

  • Linux Wayland (v0.4.0) — Pure Go implementation, 5,700 LOC!
  • Linux X11 (v0.6.0) — Pure Go wire protocol, ~5K LOC!
  • macOS Cocoa (v0.5.0) — Pure Go via goffi, ~950 LOC!
  • Metal backend (wgpu v0.7.0) — WGSL→MSL compilation, render pipeline!
  • GLSL shader output (naga v0.6.0) — WGSL → OpenGL 3.3+/ES 3.0+!

Phase 4 — GUI

  • Widget toolkit (gogpu/ui)
  • Layouts, styling, themes

Contributing

We welcome contributions! See individual repository CONTRIBUTING.md files.

Areas where we need help:

  • Pure Go GPU backends (DX12)
  • WebGPU examples and tutorials
  • Documentation
  • GUI widget toolkit (gogpu/ui)

License

All projects are licensed under the MIT License.


Building the GPU computing ecosystem Go deserves
github.com/gogpu

Pinned Loading

  1. gogpu gogpu Public

    Pure Go Graphics Framework — GPU power, Go simplicity

    Go 103 1

Repositories

Showing 6 of 6 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Go Shell