Skip to content

Commit

Permalink
gles: destroy surface before creating the new one
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Nov 10, 2024
1 parent 4811306 commit c75fd1f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions blade-graphics/src/gles/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ impl super::Context {
}

let mut inner = self.platform.inner.lock().unwrap();
if let Some(s) = inner.swapchain.take() {
inner
.egl
.instance
.destroy_surface(inner.egl.display, s.surface)
.unwrap();
}

let mut attributes = vec![
egl::RENDER_BUFFER,
Expand Down Expand Up @@ -468,7 +475,7 @@ impl super::Context {
.unwrap()
},
};
let old_swapchain = inner.swapchain.replace(Swapchain {
inner.swapchain = Some(Swapchain {
surface,
extent: config.size,
format,
Expand All @@ -477,13 +484,6 @@ impl super::Context {
crate::DisplaySync::Recent | crate::DisplaySync::Tear => 0,
},
});
if let Some(s) = old_swapchain {
inner
.egl
.instance
.destroy_surface(inner.egl.display, s.surface)
.unwrap();
}

let format_desc = super::describe_texture_format(format);
inner.egl.make_current();
Expand Down

0 comments on commit c75fd1f

Please sign in to comment.