Skip to content
@gogpu

GoGPU

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

GoGPU Logo

GoGPU

Pure Go GPU Computing Ecosystem
1.25M+ lines of code. GPU power, Go simplicity. Zero CGO.

Go Version License Pure Go Discussions Open Collective


Why GoGPU?

GoGPU is to Go what Flutter is to Dart, Qt is to C++, and JavaFX is to Java — a professional, complete GPU computing ecosystem, not just a single library. From shader compilation and GPU abstraction to 2D/3D rendering, GUI toolkit with themed widgets, and platform integration — all in Pure Go with zero CGO.

Inspired by this discussion on r/golang. Go waited 17 years for a professional graphics ecosystem. We're building it — together with you.


Ecosystem

Library Purpose Version Stars Issues PRs
Foundation
🧱 gputypes WebGPU types (webgpu.h spec compliant)
🧱 naga WGSL → SPIR-V/MSL/GLSL/HLSL/DXIL shader compiler (~324K LOC)
GPU Core
⚙️ wgpu Unified Go WebGPU — Pure Go + Rust FFI + Browser (Vulkan/Metal/DX12/GLES/Software, ~254K LOC)
⚙️ gpucontext Shared interfaces (DeviceProvider, EventSource)
⚙️ galloc O(1) offset allocator for GPU memory sub-allocation
Framework
🖥️ gogpu Graphics framework, windowing, compositor (ADR-067, ~96K LOC)
Graphics
🎨 gg 2D graphics, 5-engine smart rasterizer, GPU acceleration (~312K LOC)
🎨 g3d Pure Go 3D rendering (scene graph, PBR materials, forward renderer, ~14K LOC)
🎨 gg-pdf PDF export backend for gg recording
🎨 gg-svg SVG export backend for gg recording
Application
📱 ui Enterprise GUI toolkit (27 widgets, 4 design systems, Layer Tree compositor, ~211K LOC)
📱 editor Text/Code editor widget — GPU-accelerated, embeddable (like Monaco)
Platform Services
🔧 systray Pure Go system tray (Win32/macOS/Linux, zero CGO, ~8K LOC)
🔧 audio Pure Go audio engine (WASAPI/CoreAudio/PulseAudio, zero CGO)
🔧 compose Multi-process composition (Unix socket IPC, LZ4, ~10K LOC)

Pure Go | Zero CGO | Cross-platform


Architecture

┌─────────────────────────────────────────────────────────────┐
│              Your Application                               │
├─────────────────────────────────────────────────────────────┤
│   gogpu/ui (GUI)   │   born-ml/born   │   Your Framework    │
├─────────────────────────────────────────────────────────────┤
│  gogpu/gg (2D Graphics)  │  gogpu/g3d (3D Rendering)        │
│   Smart Rasterizer: Scanline│4×4 Tiles│16×16│SDF│Compute    │
│                 ↓ export to ↓                               │
│           gg-pdf (PDF)    gg-svg (SVG)                      │
├─────────────────────────────────────────────────────────────┤
│              gogpu/gogpu (Graphics Framework)               │
│    Windowing, compositor (ADR-067), damage overlay, input   │
│     gogpu/systray (System Tray)   gogpu/audio (Audio)       │
├─────────────────────────────────────────────────────────────┤
│    gogpu/gpucontext (Shared Interfaces)                     │
│ DeviceProvider, SurfaceCompositor, DamageSource, EventSource│
├─────────────────────────────────────────────────────────────┤
│    gogpu/gputypes (WebGPU Types, webgpu.h compliant)        │
│       TextureFormat, BufferUsage, PresentMode, etc.         │
├─────────────────────────────────────────────────────────────┤
│       gogpu/wgpu (Unified WebGPU: Pure Go │ Rust FFI │ WASM)│
├─────────────────────────────────────────────────────────────┤
│                   gogpu/naga (Shader Compiler)              │
│       (WGSL → SPIR-V/MSL/GLSL/HLSL/DXIL)                    │
├─────────────────────────────────────────────────────────────┤
│        Vulkan │ Metal │ DX12 │ OpenGL │ Software            │
└─────────────────────────────────────────────────────────────┘

Key Features

Feature Description
Zero CGO No C compiler required, simple go build
WebGPU API Modern, portable GPU abstraction
Smart Rasterizer 5 algorithms with per-path auto-selection (scanline, 4×4 tiles, 16×16 tiles, SDF, compute)
Triple Backend Pure Go (default), Rust FFI (-tags rust), Browser WASM — same API, build tag selects
Layered Design Use only what you need
webgpu.h Compliant Binary-compatible with wgpu-native

Quick Start

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(dc *gogpu.Context) {
        dc.DrawTriangleColor(gmath.DarkGray)
    })

    app.Run()
}

Result: A window with a rendered triangle in ~20 lines of code.


gg + gogpu Integration

Use 2D graphics from gg directly in gogpu windows — with smart rasterizer auto-selection and GPU-direct rendering (zero CPU readback):

package main

import (
    "log"

    "github.com/gogpu/gg"
    _ "github.com/gogpu/gg/gpu" // Register GPU accelerator
    "github.com/gogpu/gg/integration/ggcanvas"
    "github.com/gogpu/gogpu"
)

func main() {
    app := gogpu.NewApp(gogpu.DefaultConfig().
        WithTitle("gg + gogpu").
        WithSize(800, 600))

    var canvas *ggcanvas.Canvas

    app.OnDraw(func(dc *gogpu.Context) {
        w, h := dc.Width(), dc.Height()
        if canvas == nil {
            var err error
            canvas, err = ggcanvas.New(app.GPUContextProvider(), w, h)
            if err != nil {
                log.Fatal(err)
            }
        }

        canvas.Draw(func(cc *gg.Context) {
            cc.SetRGB(1, 0, 0)
            cc.DrawCircle(400, 300, 100)
            cc.Fill()
        })

        canvas.Render(dc.RenderTarget()) // GPU-direct, zero-copy
    })

    app.Run()
}

Related Projects

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

Tutorials & Articles

We haven't had time to write comprehensive tutorials yet — we've been focused on building the ecosystem itself. But the community has started filling that gap:

Community Tutorials

🇨🇿 Pavel Tišnovský (root.cz — Czech Republic's leading tech portal) wrote two in-depth tutorials covering the gg 2D graphics library with 54 working examples:

  1. Creating 2D/3D Graphics and Animations in Go with GoGPU — 49 min read. Paths, Bézier curves, transforms, text, animations.
  2. GoGPU Part 2: Gradients, SVG & PDF Export — 39 min read. Gradients, vector export, GUI integration.
  3. Interactive Applications with GUI using GoGPU — ~40 min read. Windowing, ggcanvas, keyboard/mouse input, interactive Bezier editor.

Articles are in Czech — use Google Translate for other languages. The code examples are universal.

Our Articles


Status

Layer Component Status Description
Foundation gputypes ✅ v0.5.2 WebGPU types (webgpu.h spec compliant)
Foundation naga ✅ v0.18.0 SPIR-V, MSL, GLSL, HLSL + DXIL shader compiler, ~324K LOC
GPU Core wgpu ✅ v0.31.4 Triple-backend: Pure Go (Vulkan/Metal/DX12/GLES/Software), Rust FFI, Browser WASM, ~254K LOC
GPU Core galloc ✅ v0.1.0 O(1) offset allocator (TLSF-inspired, 256 bins, zero heap allocs)
GPU Core gpucontext ✅ v0.28.0 Shared interfaces — DeviceProvider, SurfaceCompositor, DamageSource
Framework gogpu ✅ v0.53.0 Graphics framework, windowing, compositor, native printing, ~96K LOC
Graphics gg ✅ v0.52.1 2D graphics, 5-engine rasterizer, GPU acceleration, recording, ggcanvas, ~312K LOC
Graphics g3d ✅ v0.1.7 Pure Go 3D rendering — scene graph, PBR materials, forward renderer, ~14K LOC
Graphics gg-pdf ✅ v0.1.0 PDF export backend for gg
Graphics gg-svg ✅ v0.1.0 SVG export backend for gg
Application ui ✅ v0.1.52 Enterprise GUI toolkit — 27 widgets, 4 design systems, Layer Tree compositor, ~211K LOC
Application editor 🚧 Early dev Text/Code editor widget — GPU-accelerated, embeddable (like Monaco)
Platform systray ✅ v0.2.8 System tray — Win32/macOS/Linux, dark mode, notifications, ~8K LOC
Platform audio ✅ v0.1.0 Pure Go audio engine — WASAPI driver, WAV decoder, Mixer
Platform compose ✅ v0.1.0 Multi-process composition — Unix socket transport, LZ4, pull-based flow, ~10K LOC

Platforms

Platform Vulkan DX12 Metal GLES Software Rust FFI Browser
Windows
macOS ⚠️
Linux (X11)
Linux (Wayland)
Browser/WASM

See individual project ROADMAP.md files for detailed roadmaps.


Support

GoGPU is free and open source. If you find it useful, please consider supporting continued development:

🥇 First Sponsor: Inkflow (@omer316) — the person who asked "is there a way to support this project?" and then became the answer!

Backers

Sponsors


Contributing

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

Areas where we need help:

  • GUI widgets and themes for gogpu/ui
  • Cross-platform testing (macOS, Linux)
  • WebGPU examples and tutorials
  • Documentation

License

All projects are licensed under the MIT License.


GO ❤ GPU

Building the GPU computing ecosystem Go deserves
gogpu.io · [email protected] · GitHub

Pinned Loading

  1. gogpu gogpu Public

    Pure Go GPU Application Framework — windowing, input, lifecycle, platform abstraction. Part of the GoGPU ecosystem.

    Go 371 23

Repositories

Showing 10 of 18 repositories

People

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

Top languages

Loading…

Most used topics

Loading…