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

egl: destroy the previous surface on resize #199

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading