Skip to content

friflo/Friflo.Vectorization.WebGPU

Repository files navigation

nuget Discord

friflo wgpu

Friflo Vectorization WebGPU

Designed to provide a high-performance WebGPU backend for https://github.com/friflo/Friflo.Vectorization.
It enables hardware-accelerated compute using wgpu-native with zero-overhead C# bindings."

Setup

Install dotnet tool ClangSharpPInvokeGenerator

dotnet tool install -g ClangSharpPInvokeGenerator

Download libraries

Download libraries and include from: https://github.com/gfx-rs/wgpu-native/releases
with Power Shell

./download-wgpu-native.ps1

Generate C# Binding

Generate initial WebGPU_native.cs with ClangSharp

ClangSharpPInvokeGenerator "@generate.rsp"

generated WebGPU_native.cs requires adjustments

Make Rider happy by adding the comments at the top

// ReSharper disable UnusedType.Global
// ReSharper disable InconsistentNaming
// ReSharper disable PartialTypeWithSinglePart

Strip long enum names.

./strip_enums.ps1

Strip long type names

./strip_types.ps1

Create .nupkg

dotnet pack -c Release "/p:Version=0.1.0-test.1"

Local Test

Register folder containing the created .nupkg searchable for nuget.

dotnet nuget add source "C:\...\Friflo.Vectorization.WebGPU\WebGPU.Runtime\bin\Release" --name "WebGPULocal"

Register new version of test package in your *.csproj