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 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 Image Image Image Image
wgpu Pure Go WebGPU (Vulkan/Metal/GLES/DX12) Image Image Image Image
naga WGSL → SPIR-V/MSL/GLSL/HLSL compiler Image Image Image Image
gogpu Graphics framework, windowing Image Image Image Image
gpucontext Shared interfaces (DeviceProvider, EventSource) Image Image Image Image
gputypes WebGPU types (webgpu.h spec compliant) Image Image Image Image
gg-pdf PDF export backend for gg recording Image Image Image Image
gg-svg SVG export backend for gg recording Image Image Image Image
ui GUI toolkit (Phase 2 Beta, 61K LOC) Image Image Image Image

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/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)        │
├─────────────────────────────────────────────────────────────┤
│              Vulkan  │  Metal  │  DX12  │  OpenGL           │
└─────────────────────────────────────────────────────────────┘

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) Image Image Image Image
goffi go-webgpu Pure Go FFI library (88-114ns overhead) Image Image Image Image
born born-ml Pure Go ML framework (97%+ MNIST) Image Image Image Image

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 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 🔄 Phase 2 Beta GUI widget toolkit (buttons, checkbox, radio, Material 3, 61K LOC)

Platforms

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

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.


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 178 2

Repositories

Showing 10 of 10 repositories
  • gg Public

    Enterprise-grade 2D graphics library for Go. Pure Go, zero CGO. Part of GoGPU ecosystem.

    gogpu/gg’s past year of commit activity
    Go 69 MIT 2 4 0 Updated Mar 11, 2026
  • ui Public

    Pure Go GUI toolkit built on GoGPU — widgets, layouts, styling

    gogpu/ui’s past year of commit activity
    Go 63 MIT 0 3 0 Updated Mar 11, 2026
  • gogpu Public

    Pure Go Graphics Framework — GPU power, Go simplicity

    gogpu/gogpu’s past year of commit activity
    Go 178 MIT 2 2 0 Updated Mar 11, 2026
  • gpucontext Public

    Shared GPU infrastructure for the gogpu ecosystem (DeviceProvider, EventSource, Registry)

    gogpu/gpucontext’s past year of commit activity
    Go 0 MIT 0 0 0 Updated Mar 11, 2026
  • wgpu Public

    Pure Go WebGPU Implementation

    gogpu/wgpu’s past year of commit activity
    Go 64 MIT 5 1 0 Updated Mar 10, 2026
  • gputypes Public

    WebGPU type definitions for the gogpu ecosystem

    gogpu/gputypes’s past year of commit activity
    Go 0 MIT 0 0 0 Updated Mar 10, 2026
  • naga Public

    Pure Go Shader Compiler — WGSL to SPIR-V, MSL, GLSL, HLSL. Zero CGO.

    gogpu/naga’s past year of commit activity
    Go 25 MIT 4 0 0 Updated Mar 6, 2026
  • .github Public

    GoGPU Organization Profile

    gogpu/.github’s past year of commit activity
    0 0 0 0 Updated Feb 28, 2026
  • gg-svg Public

    SVG export backend for gg's recording system

    gogpu/gg-svg’s past year of commit activity
    Go 0 MIT 0 0 0 Updated Feb 3, 2026
  • gg-pdf Public

    PDF export backend for gg's recording system

    gogpu/gg-pdf’s past year of commit activity
    Go 0 MIT 0 0 0 Updated Feb 3, 2026

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…