A WebGPU texture mipmap generator.
License
—
Deps
3
Install Size
—
Vulns
✓ 0
Published
May 26, 2024
$ dotnet add package wgpu-mipmapThe mipmap generator for WebGPU with Silk.Net bindings.
To use simply create Texture using CreateTexture2DWithMipmaps.
MipmapGenerator mipmapGenerator = new MipmapGenerator(wgpu, device);
TextureFormat format = TextureFormat.Rgba8Unorm;
TextureMipmapResult result = mipmapGenerator.CreateTexture2DWithMipmaps(bytePtr, 2, 2, TextureFormat.Rgba8Unorm);
Texture* texture = result.Texture;
uint mipLevelCount = result.MipLevelCount;
Mipmap generator uses compute shader and storage texture to write mipmaps. This might be an issue for certain texture formats,
most notably bgra8unorm. To use it require feature bgra8unorm-storage when creating WebGPU device. Should be passed to RequireFeatures
property of DeviceDescriptor.
If bgra8unorm-storage is not available pass takes somewhat longer due to fallback solution which creates texture with supported formats first and then copies it.