forge
Explore
Log in

Don't you dare go Hollow

Share frames freed from the drawing window's atlas: pump runs in on_next_frame with the window leased, so drop_image(None) skipped it and every frame's texture leaked VRAM/RAM

Browse files at this commit

8544849088c3d3118929cbca0f03969904911a67Ahmet Kaan GümüşParent: 3183cf2
  • fix
    • share frames freed from the drawing window's atlas: pump runs in on_next_frame with the window leased, so drop_image(None) skipped it and every frame's texture leaked VRAM/RAM
Show full message
🐛 fix: share frames freed from the drawing window's atlas: pump runs in on_next_frame with the window leased, so drop_image(None) skipped it and every frame's texture leaked VRAM/RAM
crates/client/src/gui/camera_view.rsmodified+11 -7
@@ -56,7 +56,11 @@ impl Yumush {
56 .collect()56 .collect()
57 }57 }
58 58
59- pub(super) fn tick_tiles(&mut self, cx: &mut Context<Self>) -> bool {59+ pub(super) fn tick_tiles(
60+ &mut self,
61+ mut window: Option<&mut Window>,
62+ cx: &mut Context<Self>,
63+ ) -> bool {
60 let wanted = self.tile_sources();64 let wanted = self.tile_sources();
61 let viewing = self.viewing();65 let viewing = self.viewing();
62 let quality = tile_quality(self.chat.stage);66 let quality = tile_quality(self.chat.stage);
@@ -105,7 +109,7 @@ impl Yumush {
105 .surface109 .surface
106 .update(cx, |surface, cx| surface.replace(None, cx))110 .update(cx, |surface, cx| surface.replace(None, cx))
107 {111 {
108- cx.drop_image(frame, None);112+ cx.drop_image(frame, window.as_deref_mut());
109 }113 }
110 if viewing != Some(source) {114 if viewing != Some(source) {
111 let network = self.network.clone();115 let network = self.network.clone();
@@ -132,7 +136,7 @@ impl Yumush {
132 .surface136 .surface
133 .update(cx, |surface, cx| surface.replace(next, cx))137 .update(cx, |surface, cx| surface.replace(next, cx))
134 {138 {
135- cx.drop_image(old, None);139+ cx.drop_image(old, window.as_deref_mut());
136 }140 }
137 }141 }
138 142
@@ -312,16 +316,16 @@ impl Yumush {
312 fn pump(&mut self, window: &mut Window, cx: &mut Context<Self>) {316 fn pump(&mut self, window: &mut Window, cx: &mut Context<Self>) {
313 self.pumping = false;317 self.pumping = false;
314 self.pumped = Instant::now();318 self.pumped = Instant::now();
315- self.tick_viewer(cx);319+ self.tick_viewer(Some(window), cx);
316- self.tick_tiles(cx);320+ self.tick_tiles(Some(window), cx);
317 self.tick_player(window, cx);321 self.tick_player(window, cx);
318 self.schedule_pump(window, cx);322 self.schedule_pump(window, cx);
319 }323 }
320 324
321 fn idle_tick(&mut self, cx: &mut Context<Self>) -> bool {325 fn idle_tick(&mut self, cx: &mut Context<Self>) -> bool {
322 if self.pumped.elapsed() > PUMP_STALL {326 if self.pumped.elapsed() > PUMP_STALL {
323- self.tick_viewer(cx);327+ self.tick_viewer(None, cx);
324- self.tick_tiles(cx);328+ self.tick_tiles(None, cx);
325 }329 }
326 self.streaming()330 self.streaming()
327 }331 }
crates/client/src/gui/share_view.rsmodified+3 -3
@@ -363,7 +363,7 @@ impl Yumush {
363 cx.notify();363 cx.notify();
364 }364 }
365 365
366- pub(super) fn tick_viewer(&mut self, cx: &mut Context<Self>) {366+ pub(super) fn tick_viewer(&mut self, mut window: Option<&mut Window>, cx: &mut Context<Self>) {
367 let Some(viewer) = self.chat.viewer.as_mut() else {367 let Some(viewer) = self.chat.viewer.as_mut() else {
368 return;368 return;
369 };369 };
@@ -385,11 +385,11 @@ impl Yumush {
385 .as_ref()385 .as_ref()
386 .is_some_and(|current| Arc::ptr_eq(current, &old))386 .is_some_and(|current| Arc::ptr_eq(current, &old))
387 {387 {
388- cx.drop_image(old, None);388+ cx.drop_image(old, window.as_deref_mut());
389 }389 }
390 }390 }
391 if let Some(old) = previous {391 if let Some(old) = previous {
392- cx.drop_image(old, None);392+ cx.drop_image(old, window);
393 }393 }
394 if appeared {394 if appeared {
395 cx.notify();395 cx.notify();