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

Go VersionLicensePure GoDiscussionsOpen 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

LibraryPurposeVersionStarsIssuesPRs
Foundation
🧱gputypesWebGPU types (webgpu.h spec compliant)
🧱nagaWGSL → SPIR-V/MSL/GLSL/HLSL/DXIL shader compiler (~324K LOC)
GPU Core
⚙️wgpuUnified Go WebGPU — Pure Go + Rust FFI + Browser (Vulkan/Metal/DX12/GLES/Software, ~254K LOC)
⚙️gpucontextShared interfaces (DeviceProvider, EventSource)
⚙️gallocO(1) offset allocator for GPU memory sub-allocation (~2.5K LOC)
Framework
🖥️gogpuGraphics framework, windowing, compositor (ADR-067, ~104K LOC)
Graphics
🎨gg2D graphics, 5-engine smart rasterizer, GPU acceleration (~312K LOC)
🎨g3dPure Go 3D rendering (scene graph, PBR materials, forward renderer, ~15K LOC)
🎨gg-pdfPDF export backend for gg recording
🎨gg-svgSVG export backend for gg recording
Application
📱uiEnterprise GUI toolkit (27 widgets, 4 design systems, Layer Tree compositor, ~220K LOC)
📱editorText/Code editor widget — GPU-accelerated, embeddable (like Monaco)
Platform Services
🔧systrayPure Go system tray (Win32/macOS/Linux, zero CGO, ~8K LOC)
🔧audioPure Go audio engine (WASAPI/CoreAudio/PulseAudio, zero CGO)
🔧composeMulti-process composition (Unix socket IPC, LZ4, ~10K LOC)
🎮gamepadPure Go gamepad/joystick input — XInput, evdev, IOKit, W3C

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 gogpu/audio gogpu/gamepad (🚧) │
├─────────────────────────────────────────────────────────────┤
│ 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

FeatureDescription
Zero CGONo C compiler required, simple go build
WebGPU APIModern, portable GPU abstraction
Smart Rasterizer5 algorithms with per-path auto-selection (scanline, 4×4 tiles, 16×16 tiles, SDF, compute)
Triple BackendPure Go (default), Rust FFI (-tags rust), Browser WASM — same API, build tag selects
Layered DesignUse only what you need
webgpu.h CompliantBinary-compatible with wgpu-native

Quick Start

package main
import (
"github.com/gogpu/gogpu""github.com/gogpu/gogpu/gmath"
)
funcmain() {
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"
)
funcmain() {
app:=gogpu.NewApp(gogpu.DefaultConfig().
WithTitle("gg + gogpu").
WithSize(800, 600))
varcanvas*ggcanvas.Canvasapp.OnDraw(func(dc*gogpu.Context) {
w, h:=dc.Width(), dc.Height()
ifcanvas==nil {
varerrerrorcanvas, err=ggcanvas.New(app.GPUContextProvider(), w, h)
iferr!=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

ProjectOrganizationPurposeVersionStarsIssuesPRs
webgpugo-webgpuZero-CGO WebGPU bindings (wgpu-native FFI)
goffigo-webgpuPure Go FFI library (88-114ns overhead)
bornborn-mlPure 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

LayerComponentStatusDescription
Foundationgputypes✅ v0.5.2WebGPU types (webgpu.h spec compliant)
Foundationnaga✅ v0.18.0SPIR-V, MSL, GLSL, HLSL + DXIL shader compiler, ~324K LOC
GPU Corewgpu✅ v0.31.6Triple-backend: Pure Go (Vulkan/Metal/DX12/GLES/Software), Rust FFI, Browser WASM, ~254K LOC
GPU Coregalloc✅ v0.2.1O(1) offset allocator (TLSF-inspired, 256 bins, zero heap allocs)
GPU Coregpucontext✅ v0.28.0Shared interfaces — DeviceProvider, SurfaceCompositor, DamageSource
Frameworkgogpu✅ v0.53.0Graphics framework, windowing, compositor, native printing, ~104K LOC
Graphicsgg✅ v0.52.32D graphics, 5-engine rasterizer, GPU acceleration, recording, ggcanvas, ~312K LOC
Graphicsg3d✅ v0.1.9Pure Go 3D rendering — scene graph, PBR materials, forward renderer, ~15K LOC
Graphicsgg-pdf✅ v0.2.1PDF export backend for gg
Graphicsgg-svg✅ v0.2.1SVG export backend for gg
Applicationui✅ v0.1.54Enterprise GUI toolkit — 27 widgets, 4 design systems, Layer Tree compositor, ~220K LOC
Applicationeditor🚧 Early devText/Code editor widget — GPU-accelerated, embeddable (like Monaco)
Platformsystray✅ v0.2.8System tray — Win32/macOS/Linux, dark mode, notifications, ~8K LOC
Platformaudio✅ v0.1.0Pure Go audio engine — WASAPI driver, WAV decoder, Mixer
Platformcompose✅ v0.2.0Multi-process composition — Unix socket transport, LZ4, pull-based flow, ~10K LOC
Platformgamepad🚧 Early devPure Go gamepad/joystick input — XInput, evdev, IOKit, W3C Gamepad API

Platforms

PlatformVulkanDX12MetalGLESSoftwareRust FFIBrowser
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


Star History

GoGPU Ecosystem Star History

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 · info@gogpu.io · GitHub

Pinned Loading

  1. gogpugogpuPublic

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

    Go 379 26

Repositories

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