Compute
Run WGSL kernels for matrix work, image processing, reductions, and custom workloads.
Version 1.2.1 available
Native WebGPU compute and graphics through wgpu-native, with a Ruby API built for direct, explicit control.
@compute @workgroup_size(4)
fn main(id: vec3<u32>) {
values[id.x] *= 2u;
}
Stay in Ruby while working with the same buffers, shaders, pipelines, and command encoders used across WebGPU.
Run WGSL kernels for matrix work, image processing, reductions, and custom workloads.
Build render pipelines, textures, bind groups, and surfaces with optional SDL3 windows.
Install the gem and its matching wgpu-native library is downloaded for your platform.
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]
Explore sixteen runnable examples covering compute, rendering, errors, async mapping, and readback.
Explore the examples