Skip to content

Commit

Permalink
gsk/gl: make max-frame-age configurable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chergert committed Mar 18, 2022
1 parent 79fad9f commit 9dbd137
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions gsk/gl/gskgltexturelibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions gsk/gl/gskgltexturelibraryprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9dbd137

Please sign in to comment.