diff options
| author | 2024-02-19 08:18:51 +0100 | |
|---|---|---|
| committer | 2024-02-19 08:18:51 +0100 | |
| commit | 04df889cacfc4dfe93c2640b75f65eaafa060dba (patch) | |
| tree | a59fd2d8c360a3a7b81d079e733b715e4a49db0d /wgpu/src/image | |
| parent | 4272090d36caf2937c170d3b28d1be1acc94a440 (diff) | |
| download | iced-04df889cacfc4dfe93c2640b75f65eaafa060dba.tar.gz iced-04df889cacfc4dfe93c2640b75f65eaafa060dba.tar.bz2 iced-04df889cacfc4dfe93c2640b75f65eaafa060dba.zip | |
Use two layers for `image::atlas` only on `Gl` backend
Diffstat (limited to 'wgpu/src/image')
| -rw-r--r-- | wgpu/src/image/atlas.rs | 14 | 
1 files changed, 9 insertions, 5 deletions
| diff --git a/wgpu/src/image/atlas.rs b/wgpu/src/image/atlas.rs index 0919f6df..ea36e06d 100644 --- a/wgpu/src/image/atlas.rs +++ b/wgpu/src/image/atlas.rs @@ -23,11 +23,15 @@ pub struct Atlas {  }  impl Atlas { -    pub fn new(device: &wgpu::Device) -> Self { -        // We start with 2 layers, to help wgpu figure out that this texture is `GL_TEXTURE_2D_ARRAY` rather -        // than `GL_TEXTURE_2D` -        // https://github.com/gfx-rs/wgpu/blob/004e3efe84a320d9331371ed31fa50baa2414911/wgpu-hal/src/gles/mod.rs#L371 -        let layers = vec![Layer::Empty, Layer::Empty]; +    pub fn new(device: &wgpu::Device, backend: wgpu::Backend) -> Self { +        let layers = match backend { +            // On the GL backend we start with 2 layers, to help wgpu figure +            // out that this texture is `GL_TEXTURE_2D_ARRAY` rather than `GL_TEXTURE_2D` +            // https://github.com/gfx-rs/wgpu/blob/004e3efe84a320d9331371ed31fa50baa2414911/wgpu-hal/src/gles/mod.rs#L371 +            wgpu::Backend::Gl => vec![Layer::Empty, Layer::Empty], +            _ => vec![Layer::Empty], +        }; +          let extent = wgpu::Extent3d {              width: SIZE,              height: SIZE, | 
