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
800K+ lines of code. GPU power, Go simplicity. Zero CGO.

Go Version License Pure Go 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 Version Stars Issues PRs
gg 2D graphics, 5-engine smart rasterizer, GPU acceleration (~215K LOC)
wgpu Pure Go WebGPU (Vulkan/Metal/GLES/DX12, ~170K LOC)
naga WGSL → SPIR-V/MSL/GLSL/HLSL/DXIL shader compiler (~189K LOC)
gogpu Graphics framework, windowing (~53K LOC)
gpucontext Shared interfaces (DeviceProvider, EventSource)
gputypes WebGPU types (webgpu.h spec compliant)
gg-pdf PDF export backend for gg recording
gg-svg SVG export backend for gg recording
ui Enterprise GUI toolkit (22 widgets, M3/Fluent/Cupertino, ~167K LOC)
g3d Pure Go 3D rendering (scene graph, PBR, GLTF)
systray Pure Go system tray (Win32/macOS/Linux, zero CGO, ~6.2K LOC)
audio Pure Go audio engine (WASAPI/CoreAudio/PulseAudio, zero CGO)
editor Text/Code editor widget — GPU-accelerated, embeddable (like Monaco)
compose Multi-process composition (Unix socket IPC, LZ4, ~9K LOC)

Pure Go | Zero CGO | Cross-platform


Architecture

┌─────────────────────────────────────────────────────────────┐
│              Your Application                               │
├─────────────────────────────────────────────────────────────┤
│   gogpu/ui (GUI)   │   born-ml/born   │   Your Framework    │
├─────────────────────────────────────────────────────────────┤
│              gogpu/gg (2D Graphics + Recording)             │
│   Smart Rasterizer: Scanline│4×4 Tiles│16×16│SDF│Compute    │
│                 ↓ export to ↓                               │
│           gg-pdf (PDF)    gg-svg (SVG)                      │
├─────────────────────────────────────────────────────────────┤
│              gogpu/gogpu (Graphics Framework)               │
│         GPU abstraction, windowing, input, math             │
│     gogpu/systray (System Tray)   gogpu/audio (Audio)       │
├─────────────────────────────────────────────────────────────┤
│    gogpu/gpucontext (Shared Interfaces)                     │
│       DeviceProvider, EventSource, Registry                 │
├─────────────────────────────────────────────────────────────┤
│    gogpu/gputypes (WebGPU Types, webgpu.h compliant)        │
│       TextureFormat, BufferUsage, PresentMode, etc.         │
├─────────────────────────────────────────────────────────────┤
│   go-webgpu/webgpu (FFI)  ←or→  gogpu/wgpu (Pure Go)        │
├─────────────────────────────────────────────────────────────┤
│                   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)
Dual Backend Pure Go (default) or Rust FFI (-tags rust) — same API, transparent choice
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):

import (
    "github.com/gogpu/gg"
    "github.com/gogpu/gg/integration/ggcanvas"
)

canvas, _ := ggcanvas.New(app.GPUContextProvider(), 800, 600)

app.OnDraw(func(dc *gogpu.Context) {
    sv := dc.SurfaceView()
    sw, sh := dc.SurfaceSize()
    gg.SetAcceleratorSurfaceTarget(sv, sw, sh)

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

    canvas.RenderDirect(sv, sw, sh) // GPU-direct, zero-copy
})

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)

Status

Component Status Description
gputypes ✅ Stable WebGPU types (webgpu.h spec compliant)
gpucontext ✅ Stable Shared interfaces (zero deps)
wgpu ✅ Stable Vulkan, Metal, GLES, Software backends
naga ✅ Stable SPIR-V, MSL, GLSL, HLSL + DXIL (experimental) outputs
gg ✅ Stable 2D graphics, 5-engine rasterizer, recording, ggcanvas
gg-pdf ✅ Stable PDF export backend for gg
gg-svg ✅ Stable SVG export backend for gg
gogpu ✅ Stable Graphics framework, windowing
ui ✅ v0.1.1 Enterprise GUI toolkit — 22 widgets, Material 3 / Fluent / Cupertino themes, ~167K LOC
systray ✅ v0.1.0 System tray — Win32/macOS/Linux, dark mode, notifications, 72 tests
audio ✅ v0.1.0 Pure Go audio engine — WASAPI driver, WAV decoder, Mixer, 42 tests
editor 🚧 Early dev Text/Code editor widget — GPU-accelerated, embeddable (like Monaco)
compose ✅ v0.1.0 Multi-process composition — Unix socket transport, LZ4, pull-based flow, ~9K LOC

Platforms

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

See individual project ROADMAP.md files for detailed roadmaps.


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
github.com/gogpu

Pinned Loading

  1. gogpu gogpu Public

    Pure Go Graphics Framework — GPU power, Go simplicity

    Go 283 10

Repositories

Showing 10 of 15 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…