Skip to content

Commit

Permalink
egl: destroy the previous surface on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Nov 7, 2024
1 parent 3622d85 commit b4afdc5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions blade-graphics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo run --example bunnymar
This path can be activated on all platforms via Angle library.
For example, on macOS it's sufficient to place `libEGL.dylib` and `libGLESv2.dylib` in the working directory.

On Windows, the quotes aren't expected:
```bash
set RUSTFLAGS=--cfg gles
```

### WebGL2

Following command will start a web server offering the `bunnymark` example:
Expand Down
10 changes: 8 additions & 2 deletions blade-graphics/src/gles/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,7 @@ impl super::Context {
.unwrap()
},
};
//TODO: remove old surface
inner.swapchain = Some(Swapchain {
let old_swapchain = inner.swapchain.replace(Swapchain {
surface,
extent: config.size,
format,
Expand All @@ -478,6 +477,13 @@ 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
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Changelog for Blade
- Metal:
- support for workgroup memory
- concurrent compute dispatches
- Egl:
- destroy old surface on resize

## blade-graphics-0.5, blade-macros-0.3, blade-egui-0.4, blade-util-0.1 (27 Aug 2024)

Expand Down

0 comments on commit b4afdc5

Please sign in to comment.