mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 23:04:07 +00:00
webgl2: recreate surface texture in fn configure (#2067)
Currently the configure function reuses the surface texture if it already exist, and will call Glow::Context::tex_storage_2d to reconfigure the texture. However doing so on an already configured texture will cause the browser warning: WebGL warning: texStorage(Multisample)?: Specified texture is immutable. and will NOT apply the new configuration such as new dimensions. Co-authored-by: Nicklas Warming Jacobsen <nwj@skybox.gg>
This commit is contained in:
parent
3ec17cf9ed
commit
ea0c974bed
@ -188,10 +188,12 @@ impl crate::Surface<super::Api> for Surface {
|
||||
self.present_program = Some(Self::create_present_program(gl));
|
||||
}
|
||||
|
||||
if self.texture.is_none() {
|
||||
self.texture = Some(gl.create_texture().unwrap());
|
||||
if let Some(texture) = self.texture.take() {
|
||||
gl.delete_texture(texture);
|
||||
}
|
||||
|
||||
self.texture = Some(gl.create_texture().unwrap());
|
||||
|
||||
let desc = device.shared.describe_texture_format(config.format);
|
||||
gl.bind_texture(glow::TEXTURE_2D, self.texture);
|
||||
gl.tex_parameter_i32(
|
||||
|
Loading…
Reference in New Issue
Block a user