Version 1.2.1 available

Put your GPU to work. From Ruby.

Native WebGPU compute and graphics through wgpu-native, with a Ruby API built for direct, explicit control.

Ruby
3.2+
Systems
macOS, Linux, Windows
Backends
Metal, Vulkan, DirectX 12, OpenGL
compute.rb completed
Ruby buffer [1, 2, 3, 4]
@compute @workgroup_size(4)
fn main(id: vec3<u32>) {
  values[id.x] *= 2u;
}
GPU result [2, 4, 6, 8]
wgpu-native 4 values ยท 1 workgroup

One gem, the GPU primitives you expect.

Stay in Ruby while working with the same buffers, shaders, pipelines, and command encoders used across WebGPU.

Compute

Run WGSL kernels for matrix work, image processing, reductions, and custom workloads.

Render

Build render pipelines, textures, bind groups, and surfaces with optional SDL3 windows.

Native by default

Install the gem and its matching wgpu-native library is downloaded for your platform.

From install to adapter in six lines.

No browser runtime. No graphics framework required for compute. Start with the default adapter, then opt into the controls your workload needs.

Read the compute guide
$ gem install wgpu

require "wgpu"

instance = WGPU::Instance.new
adapter = instance.request_adapter
device = adapter.request_device

puts adapter.info[:device]

Ruby has the control flow.
The GPU has the throughput.

Explore sixteen runnable examples covering compute, rendering, errors, async mapping, and readback.

Explore the examples