Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wgpu.image] Workaround WGPU OpenGL heuristics #2259

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions wgpu/src/image/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ 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];
let extent = wgpu::Extent3d {
width: SIZE,
height: SIZE,
depth_or_array_layers: 1,
depth_or_array_layers: layers.len() as u32,
};

let texture = device.create_texture(&wgpu::TextureDescriptor {
Expand Down Expand Up @@ -55,7 +59,7 @@ impl Atlas {
Atlas {
texture,
texture_view,
layers: vec![Layer::Empty],
layers,
}
}

Expand Down
Loading