wgpu-mipmap
Generate mipmaps for wgpu textures.
Usage
Add this to your Cargo.toml
:
[]
= "0.1"
Example usage:
use *;
Features
wgpu-mipmap is in the early stages of development and can only generate mipmaps for 2D textures with floating-point formats. The library implements several backends in order to support various texture usage patterns:
ComputeMipmapGenerator
: For power of two textures with with usageTextureUsage::STORAGE
. Uses a compute pipeline to generate mipmaps.RenderMipmapGenerator
: For textures with usageTextureUsage::OUTPUT_ATTACHMENT
. Uses a render pipeline to generate mipmaps.CopyMipmapGenerator
: For textures with usageTextureUsage::SAMPLED
. Allocates a new texture, uses a render pipeline to generate mipmaps in the new texture, then copies the result back to the original texture.RecommendedMipmapGenerator
: Uses one of the above implementations depending on texture usage (prefers the compute backend, followed by the render backend, and finally the copy backend).
Development
Run the examples
The examples test various use cases and generate images for manual inspection and comparsion.
$ cargo run --example cat
$ cargo run --example checkerboard
Run the tests
$ cargo test
How to compile the shaders
$ make build-shaders
See src/shaders/README.md for dependencies and more information.
Benchmarks
TODO