Use two layers for image::atlas only on Gl backend
This commit is contained in:
parent
4272090d36
commit
04df889cac
5 changed files with 46 additions and 24 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue