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.
This commit is contained in:
Christian Hergert
2022-03-15 15:52:44 -07:00
committed by Matthias Clasen
parent 468863a8b9
commit f9725cc536
2 changed files with 7 additions and 5 deletions

View File

@@ -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;

View File

@@ -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