1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 07:10:04 -04:00

Fix multiple partial updates of the same texture (#1338)

Co-authored-by: Wanja Zaeske <wanja.zaeske@dlr.de>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
wucke13
2022-06-19 22:49:06 +02:00
committed by GitHub
parent f5b2363fff
commit bd5f553c3a

View File

@@ -39,7 +39,7 @@ impl TextureManager {
filter, filter,
}); });
self.delta.set.insert(id, ImageDelta::full(image, filter)); self.delta.set.push((id, ImageDelta::full(image, filter)));
id id
} }
@@ -57,9 +57,10 @@ impl TextureManager {
// whole update // whole update
meta.size = delta.image.size(); meta.size = delta.image.size();
meta.bytes_per_pixel = delta.image.bytes_per_pixel(); meta.bytes_per_pixel = delta.image.bytes_per_pixel();
// since we update the whole image, we can discard all old enqueued deltas
self.delta.set.retain(|(x, _)| x != &id);
} }
self.delta.set.push((id, delta));
self.delta.set.insert(id, delta);
} else { } else {
crate::epaint_assert!(false, "Tried setting texture {id:?} which is not allocated"); crate::epaint_assert!(false, "Tried setting texture {id:?} which is not allocated");
} }
@@ -175,7 +176,7 @@ impl TextureMeta {
#[must_use = "The painter must take care of this"] #[must_use = "The painter must take care of this"]
pub struct TexturesDelta { pub struct TexturesDelta {
/// New or changed textures. Apply before painting. /// New or changed textures. Apply before painting.
pub set: AHashMap<TextureId, ImageDelta>, pub set: Vec<(TextureId, ImageDelta)>,
/// Textures to free after painting. /// Textures to free after painting.
pub free: Vec<TextureId>, pub free: Vec<TextureId>,