From 7b2a4c18efd12eb13666f73db30c02f02c1c80e1 Mon Sep 17 00:00:00 2001 From: Kyle Nusbaum Date: Wed, 4 Sep 2024 09:58:53 -0500 Subject: [PATCH] internal/driver/glfw: clean the cache periodically. The cache is supposed to be cleaned periodically, but the glfw driver does not do this as the mobile driver does. This commit adds similar logic to the glfw driver as exists in the mobile driver, to periodically clean the cache on paint events. Fixes #4903 --- internal/driver/glfw/loop.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/driver/glfw/loop.go b/internal/driver/glfw/loop.go index 6c775dae8f..81ff540ab2 100644 --- a/internal/driver/glfw/loop.go +++ b/internal/driver/glfw/loop.go @@ -212,7 +212,7 @@ func (d *gLDriver) repaintWindow(w *window) { w.shouldExpand = true w.viewLock.Unlock() } - canvas.FreeDirtyTextures() + refresh := canvas.FreeDirtyTextures() > 0 updateGLContext(w) canvas.paint(canvas.Size()) @@ -225,6 +225,7 @@ func (d *gLDriver) repaintWindow(w *window) { if view != nil && visible { view.SwapBuffers() } + cache.Clean(refresh) }) }