Ahjo.Wgpu 0.6.0

dotnet add package Ahjo.Wgpu --version 0.6.0
                    
NuGet\Install-Package Ahjo.Wgpu -Version 0.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ahjo.Wgpu" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ahjo.Wgpu" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Ahjo.Wgpu" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ahjo.Wgpu --version 0.6.0
                    
#r "nuget: Ahjo.Wgpu, 0.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ahjo.Wgpu@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ahjo.Wgpu&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Ahjo.Wgpu&version=0.6.0
                    
Install as a Cake Tool

Ahjo.Wgpu

Idiomatic C# wrapper over wgpu-native, the Rust implementation of WebGPU. Built for games: ref struct encoders, readonly struct resource handles, polled futures instead of Task<T>, zero heap allocations on per-frame paths.

Status: pre-1.0. The public surface may shift between 0.x releases as the wrapper fills in remaining wgpu-native coverage. Tag your PackageReference to an exact version.

Install

dotnet add package Ahjo.Wgpu

The native binaries (wgpu_native.dll / libwgpu_native.so / libwgpu_native.dylib) ship inside the Ahjo.Wgpu.Native dependency and land in your bin/ automatically — no native-resolver setup required.

Hello triangle

using WgpuSharp;
using WgpuSharp.Native;

using var instance = Instance.Create();
using var adapter  = instance.RequestAdapterBlocking();
using var device   = adapter.RequestDeviceBlocking();
var queue = device.Queue;

using var encoder = device.CreateCommandEncoder();
// ... create pipeline, begin render pass, draw, submit.
using var cmd = encoder.Finish();
queue.Submit(cmd);

End-to-end examples live in the repo (samples/HelloTriangle, samples/HeadlessTriangle).

Platforms

Runs everywhere wgpu-native does: Windows, Linux, macOS on x64 and arm64. TFM: net10.0.

Design principles

Games-first. Low allocation, raw-pointer friendly, minimal ceremony.

This is an opinionated wrapper over wgpu-native — not a SafeHandle-shaped .NET port. Three load-bearing idioms worth reading about before you build on it:

  • Struct handles. Buffer, Texture, Pipeline, etc. are readonly structs holding one raw pointer. Copy-by-value, no finalizer, default(T) is a legal null handle, double-dispose is UB.
  • Polled futures. Per-frame async (Buffer.BeginMap, work-done) returns a struct you drive via Instance.ProcessEvents() — no Task<T>, no allocations.
  • ref struct encoders + span-parameter descriptors. CommandEncoder, RenderPassEncoder, ComputePassEncoder don't escape methods; spans live on method parameters, not descriptor fields, to keep escape-analysis happy.

Full user guide: docs/using-the-wrapper.md. Contributor-side design rationale: CLAUDE.md.

Repository

Source, issues, samples: https://github.com/pekkah/wgpu-sharp

License

MIT. © Pekka Heikura.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 97 4/26/2026
0.5.0 91 4/25/2026
0.4.0 93 4/25/2026
0.3.1 97 4/22/2026
0.3.0 96 4/21/2026
0.2.0 94 4/21/2026
0.1.1 100 4/21/2026
0.1.0 97 4/21/2026