Home

Awesome

go-webgpu-examples

go-webgpu is Go bindings for wgpu-native, a cross-platform, safe, graphics api. It runs natively on Vulkan, Metal, D3D12.

Examples

compute

go run github.com/rajveermalviya/go-webgpu-examples/compute@latest

capture

Creates ./image.png with all pixels red and size 100x200

go run github.com/rajveermalviya/go-webgpu-examples/capture@latest

triangle

This example uses go-glfw so it will use cgo on all platforms, you will also need some libraries installed to run the example.

go run github.com/rajveermalviya/go-webgpu-examples/triangle@latest

# same example but with 4x MSAA
go run github.com/rajveermalviya/go-webgpu-examples/triangle-msaa@latest

cube

This example also uses go-glfw.

go run github.com/rajveermalviya/go-webgpu-examples/cube@latest

boids

This example also uses go-glfw.

go run github.com/rajveermalviya/go-webgpu-examples/boids@latest

gamen-windowing

This example uses gamen for windowing, it doesn't use cgo on windows. On linux you may need to install some packages.

go run github.com/rajveermalviya/go-webgpu-examples/gamen-windowing@latest

This example also supports running on android.

# install android sdk
# connect your device and setup adb / run android emulator

# install tsukuru to build apk
go install github.com/rajveermalviya/tsukuru/cmd/tsukuru@latest

cd examples/gamen-windowing
tsukuru run apk .