Fix GL backend choosing wrong texture format in wgpu::image::atlas
This commit is contained in:
parent
4dbce8272e
commit
baf3b8e501
1 changed files with 7 additions and 5 deletions
|
|
@ -449,13 +449,15 @@ impl Atlas {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On the GL backend if layers.len() == 6 we need to help wgpu figure out that this texture
|
// On the GL backend if layers.len() is a multiple of 6 we need to help wgpu figure out that this texture
|
||||||
// is still a `GL_TEXTURE_2D_ARRAY` rather than `GL_TEXTURE_CUBE_MAP`. This will over-allocate
|
// is still a `GL_TEXTURE_2D_ARRAY` rather than `GL_TEXTURE_CUBE_MAP` or `GL_TEXTURE_CUBE_ARRAY`.
|
||||||
// some unused memory on GL, but it's better than not being able to grow the atlas past a depth
|
// This will over-allocate some unused memory on GL, but it's better than not being able to
|
||||||
// of 6!
|
// grow the atlas past multiples of 6!
|
||||||
// https://github.com/gfx-rs/wgpu/blob/004e3efe84a320d9331371ed31fa50baa2414911/wgpu-hal/src/gles/mod.rs#L371
|
// https://github.com/gfx-rs/wgpu/blob/004e3efe84a320d9331371ed31fa50baa2414911/wgpu-hal/src/gles/mod.rs#L371
|
||||||
let depth_or_array_layers = match backend {
|
let depth_or_array_layers = match backend {
|
||||||
wgpu::Backend::Gl if self.layers.len() == 6 => 7,
|
wgpu::Backend::Gl if self.layers.len().is_multiple_of(6) => {
|
||||||
|
self.layers.len() as u32 + 1
|
||||||
|
}
|
||||||
_ => self.layers.len() as u32,
|
_ => self.layers.len() as u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue