Merge pull request #1996 from iced-rs/fix/wgpu-freeze

Fix `iced_wgpu` freezing on empty layers
This commit is contained in:
Héctor Ramón 2023-08-02 22:26:11 +02:00 committed by GitHub
commit f7ca420817
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -78,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Tooltip` overlay position inside `Scrollable`. [#1978](https://github.com/iced-rs/iced/pull/1978) - `Tooltip` overlay position inside `Scrollable`. [#1978](https://github.com/iced-rs/iced/pull/1978)
- `BorderRadius` not exposed in root crate. [#1972](https://github.com/iced-rs/iced/pull/1972) - `BorderRadius` not exposed in root crate. [#1972](https://github.com/iced-rs/iced/pull/1972)
- Outdated `ROADMAP`. [#1958](https://github.com/iced-rs/iced/pull/1958) - Outdated `ROADMAP`. [#1958](https://github.com/iced-rs/iced/pull/1958)
- `iced_wgpu` freezing on empty layers. [#1996](https://github.com/iced-rs/iced/pull/1996)
Many thanks to... Many thanks to...

View file

@ -87,7 +87,10 @@ impl Backend {
let transformation = viewport.projection(); let transformation = viewport.projection();
let mut layers = Layer::generate(primitives, viewport); let mut layers = Layer::generate(primitives, viewport);
layers.push(Layer::overlay(overlay_text, viewport));
if !overlay_text.is_empty() {
layers.push(Layer::overlay(overlay_text, viewport));
}
self.prepare( self.prepare(
device, device,
@ -236,7 +239,7 @@ impl Backend {
let bounds = (layer.bounds * scale_factor).snap(); let bounds = (layer.bounds * scale_factor).snap();
if bounds.width < 1 || bounds.height < 1 { if bounds.width < 1 || bounds.height < 1 {
return; continue;
} }
if !layer.quads.is_empty() { if !layer.quads.is_empty() {