1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*!
Generate mipmaps for [wgpu](https://github.com/gfx-rs/wgpu-rs) textures.
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
wgpu-mipmap = "0.1"
```
Example usage:
```rust
use wgpu_mipmap::*;
fn example(device: &wgpu::Device, queue: &wgpu::Queue) -> Result<(), Error> {
// create a recommended generator
let generator = RecommendedMipmapGenerator::new(&device);
// create and upload data to a texture
let texture_descriptor = wgpu::TextureDescriptor {
size: wgpu::Extent3d {
width: 512,
height: 512,
depth: 1,
},
mip_level_count: 10, // 1 + log2(512)
sample_count: 1,
format: wgpu::TextureFormat::Rgba8Unorm,
dimension: wgpu::TextureDimension::D2,
usage: wgpu::TextureUsage::STORAGE,
label: None,
};
let texture = device.create_texture(&texture_descriptor);
// upload_data_to_texture(&texture);
// create an encoder and generate mipmaps for the texture
let mut encoder = device.create_command_encoder(&Default::default());
generator.generate(&device, &mut encoder, &texture, &texture_descriptor)?;
queue.submit(std::iter::once(encoder.finish()));
Ok(())
}
```
*/
pub use crate;
pub use crate*;