From 9dbd137ec8f0aab41b6cd1f55fe8d4d8f68712d8 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 15 Mar 2022 15:52:44 -0700 Subject: [PATCH] gsk/gl: make max-frame-age configurable This is nice for some texture libraries that we might want to keep around for longer than say 60 frames such as a glyph cache. --- gsk/gl/gskgltexturelibrary.c | 5 +++-- gsk/gl/gskgltexturelibraryprivate.h | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gsk/gl/gskgltexturelibrary.c b/gsk/gl/gskgltexturelibrary.c index 3d32c95945..414190ea7d 100644 --- a/gsk/gl/gskgltexturelibrary.c +++ b/gsk/gl/gskgltexturelibrary.c @@ -27,7 +27,7 @@ #include "gskgldriverprivate.h" #include "gskgltexturelibraryprivate.h" -#define MAX_FRAME_AGE 60 +#define DEFAULT_MAX_FRAME_AGE 60 G_DEFINE_ABSTRACT_TYPE (GskGLTextureLibrary, gsk_gl_texture_library, G_TYPE_OBJECT) @@ -118,6 +118,7 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass) static void gsk_gl_texture_library_init (GskGLTextureLibrary *self) { + self->max_frame_age = DEFAULT_MAX_FRAME_AGE; } void @@ -176,7 +177,7 @@ gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self, G_OBJECT_TYPE_NAME (self), dropped)); } - if (frame_id % MAX_FRAME_AGE == 0) + if (frame_id % self->max_frame_age == 0) { GskGLTextureAtlasEntry *entry; int atlased = 0; diff --git a/gsk/gl/gskgltexturelibraryprivate.h b/gsk/gl/gskgltexturelibraryprivate.h index a784449889..bb1db12172 100644 --- a/gsk/gl/gskgltexturelibraryprivate.h +++ b/gsk/gl/gskgltexturelibraryprivate.h @@ -89,10 +89,11 @@ typedef struct _GskGLTextureAtlasEntry typedef struct _GskGLTextureLibrary { - GObject parent_instance; + GObject parent_instance; GskGLDriver *driver; - GHashTable *hash_table; - guint max_entry_size; + GHashTable *hash_table; + guint max_entry_size; + guint max_frame_age; } GskGLTextureLibrary; typedef struct _GskGLTextureLibraryClass -- 2.30.2