| 1 | #cxx . . $ `<file>/gsk/gpu/gskgpucache.c`/include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 2 | |
| 3 | #include "gskgpucacheprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpucacheprivate.h`/ |
| 4 | |
| 5 | #include "gskgpucachedglyphprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpucachedglyphprivate.h`/ |
| 6 | #include "gskgpucachedfillprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpucachedfillprivate.h`/ |
| 7 | #include "gskgpucachedstrokeprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpucachedstrokeprivate.h`/ |
| 8 | #include "gskgpucachedprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpucachedprivate.h`/ |
| 9 | #include "gskgpudeviceprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpudeviceprivate.h`/ |
| 10 | #include "gskgpuframeprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpuframeprivate.h`/ |
| 11 | #include "gskgpuimageprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpuimageprivate.h`/ |
| 12 | #ifdef GDK_RENDERING_VULKANcxx . . $ `build/gdk/gdkconfig.h:22:9`! |
| 13 | #include "gskvulkanycbcrprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanycbcrprivate.h`/ |
| 14 | #endif |
| 15 | |
| 16 | #include "gdk/gdkcolorstateprivate.h"cxx . . $ `<file>/gdk/gdkcolorstateprivate.h`/ |
| 17 | #include "gdk/gdkprofilerprivate.h"cxx . . $ `<file>/gdk/gdkprofilerprivate.h`/ |
| 18 | #include "gdk/gdktextureprivate.h"cxx . . $ `<file>/gdk/gdktextureprivate.h`/ |
| 19 | |
| 20 | #include "gsk/gskdebugprivate.h"cxx . . $ `<file>/gsk/gskdebugprivate.h`/ |
| 21 | |
| 22 | #define MAX_SLICES_PER_ATLAScxx . . $ `gsk/gpu/gskgpucache.c:22:9`! 64 |
| 23 | |
| 24 | #define ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! 1024 |
| 25 | |
| 26 | #define MAX_ATLAS_ITEM_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:26:9`! 256 |
| 27 | |
| 28 | #define MIN_ALIVE_PIXELScxx . . $ `gsk/gpu/gskgpucache.c:28:9`! (ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! * ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! / 2) |
| 29 | |
| 30 | #define ATLAS_TIMEOUT_SCALEcxx . . $ `gsk/gpu/gskgpucache.c:30:9`! 4 |
| 31 | |
| 32 | G_STATIC_ASSERTcxx . . $ `<external>/12741050725406041920/gmacros.h:910:9`! (MAX_ATLAS_ITEM_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:26:9`! < ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`!); |
| 33 | G_STATIC_ASSERTcxx . . $ `<external>/12741050725406041920/gmacros.h:910:9`! (MIN_ALIVE_PIXELScxx . . $ `gsk/gpu/gskgpucache.c:28:9`! < ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! * ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`!); |
| 34 | |
| 35 | typedef struct _GskGpuCachedGlyphcxx . . $ _GskGpuCachedGlyph# GskGpuCachedGlyphcxx . . $ GskGpuCachedGlyph#; |
| 36 | typedef struct _GskGpuCachedTexturecxx . . $ _GskGpuCachedTexture# GskGpuCachedTexturecxx . . $ GskGpuCachedTexture#; |
| 37 | typedef struct _GskGpuCachedTilecxx . . $ _GskGpuCachedTile# GskGpuCachedTilecxx . . $ GskGpuCachedTile#; |
| 38 | |
| 39 | struct _GskGpuCachecxx . . $ _GskGpuCache# |
| 40 | { |
| 41 | GObjectcxx . . $ GObject# parent_instancecxx . . $ _GskGpuCache#parent_instance.; |
| 42 | |
| 43 | GskGpuDevicecxx . . $ GskGpuDevice# *devicecxx . . $ _GskGpuCache#device.; |
| 44 | gint64cxx . . $ gint64# timestampcxx . . $ _GskGpuCache#timestamp.; |
| 45 | |
| 46 | GskGpuCachedcxx . . $ GskGpuCached# *first_cachedcxx . . $ _GskGpuCache#first_cached.; |
| 47 | GskGpuCachedcxx . . $ GskGpuCached# *last_cachedcxx . . $ _GskGpuCache#last_cached.; |
| 48 | |
| 49 | GHashTablecxx . . $ GHashTable# *texture_cachecxx . . $ _GskGpuCache#texture_cache.; |
| 50 | GHashTablecxx . . $ GHashTable# *ccs_texture_cachescxx . . $ _GskGpuCache#ccs_texture_caches.[GDK_COLOR_STATE_N_IDScxx . . $ GDK_COLOR_STATE_N_IDS.]; |
| 51 | GHashTablecxx . . $ GHashTable# *tile_cachecxx . . $ _GskGpuCache#tile_cache.; |
| 52 | |
| 53 | GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *current_atlascxx . . $ _GskGpuCache#current_atlas.; |
| 54 | |
| 55 | /* atomic */ gsizecxx . . $ gsize# dead_texturescxx . . $ _GskGpuCache#dead_textures.; |
| 56 | /* atomic */ gsizecxx . . $ gsize# dead_texture_pixelscxx . . $ _GskGpuCache#dead_texture_pixels.; |
| 57 | }; |
| 58 | |
| 59 | G_DEFINE_TYPE_WITH_PRIVATEcxx . . $ `<external>/9567554376676449156/gtype.h:1876:9`! (GskGpuCache, gsk_gpu_cache, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!) |
| 60 | |
| 61 | /* {{{ Cached base class */ |
| 62 | |
| 63 | static void |
| 64 | gsk_gpu_cached_freecxx . . $ gsk_gpu_cached_free(5a53b82634f8e5da). (GskGpuCachedcxx . . $ GskGpuCached# *cached) |
| 65 | { |
| 66 | GskGpuCachecxx . . $ GskGpuCache# *self = cached->cachecxx . . $ _GskGpuCached#cache.; |
| 67 | |
| 68 | if (cached->nextcxx . . $ _GskGpuCached#next.) |
| 69 | cached->nextcxx . . $ _GskGpuCached#next.->prevcxx . . $ _GskGpuCached#prev. = cached->prevcxx . . $ _GskGpuCached#prev.; |
| 70 | else |
| 71 | self->last_cachedcxx . . $ _GskGpuCache#last_cached. = cached->prevcxx . . $ _GskGpuCached#prev.; |
| 72 | if (cached->prevcxx . . $ _GskGpuCached#prev.) |
| 73 | cached->prevcxx . . $ _GskGpuCached#prev.->nextcxx . . $ _GskGpuCached#next. = cached->nextcxx . . $ _GskGpuCached#next.; |
| 74 | else |
| 75 | self->first_cachedcxx . . $ _GskGpuCache#first_cached. = cached->nextcxx . . $ _GskGpuCached#next.; |
| 76 | |
| 77 | gsk_gpu_cached_set_stalecxx . . $ gsk_gpu_cached_set_stale(e295147961fe45a0). (cached, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 78 | |
| 79 | cached->classcxx . . $ _GskGpuCached#class.->freecxx . . $ _GskGpuCachedClass#free. (cached); |
| 80 | } |
| 81 | |
| 82 | static gbooleancxx . . $ gboolean# |
| 83 | gsk_gpu_cached_should_collectcxx . . $ gsk_gpu_cached_should_collect(8e8e89998884adad). (GskGpuCachedcxx . . $ GskGpuCached# *cached, |
| 84 | gint64cxx . . $ gint64# cache_timeout, |
| 85 | gint64cxx . . $ gint64# timestamp) |
| 86 | { |
| 87 | return cached->classcxx . . $ _GskGpuCached#class.->should_collectcxx . . $ _GskGpuCachedClass#should_collect. (cached, cache_timeout, timestamp); |
| 88 | } |
| 89 | |
| 90 | static gpointercxx . . $ gpointer# |
| 91 | gsk_gpu_cached_new_from_atlascxx . . $ gsk_gpu_cached_new_from_atlas(9e6ad944a4f2dea8). (GskGpuCachecxx . . $ GskGpuCache# *cache, |
| 92 | const GskGpuCachedClasscxx . . $ GskGpuCachedClass# *class, |
| 93 | GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *atlas) |
| 94 | { |
| 95 | GskGpuCachedcxx . . $ GskGpuCached# *cached; |
| 96 | |
| 97 | cached = g_malloc0cxx . . $ g_malloc0(bfcfa4d6b7f7ef64). (class->sizecxx . . $ _GskGpuCachedClass#size.); |
| 98 | |
| 99 | cached->cachecxx . . $ _GskGpuCached#cache. = cache; |
| 100 | cached->classcxx . . $ _GskGpuCached#class. = class; |
| 101 | cached->atlascxx . . $ _GskGpuCached#atlas. = atlas; |
| 102 | |
| 103 | cached->prevcxx . . $ _GskGpuCached#prev. = cache->last_cachedcxx . . $ _GskGpuCache#last_cached.; |
| 104 | cache->last_cachedcxx . . $ _GskGpuCache#last_cached. = cached; |
| 105 | if (cached->prevcxx . . $ _GskGpuCached#prev.) |
| 106 | cached->prevcxx . . $ _GskGpuCached#prev.->nextcxx . . $ _GskGpuCached#next. = cached; |
| 107 | else |
| 108 | cache->first_cachedcxx . . $ _GskGpuCache#first_cached. = cached; |
| 109 | |
| 110 | return cached; |
| 111 | } |
| 112 | |
| 113 | gpointercxx . . $ gpointer# |
| 114 | gsk_gpu_cached_new_from_current_atlascxx . . $ gsk_gpu_cached_new_from_current_atlas(9c808eb1e438eb24). (GskGpuCachecxx . . $ GskGpuCache# *cache, |
| 115 | const GskGpuCachedClasscxx . . $ GskGpuCachedClass# *class) |
| 116 | { |
| 117 | return gsk_gpu_cached_new_from_atlascxx . . $ gsk_gpu_cached_new_from_atlas(9e6ad944a4f2dea8). (cache, |
| 118 | class, |
| 119 | cache->current_atlascxx . . $ _GskGpuCache#current_atlas.); |
| 120 | } |
| 121 | |
| 122 | gpointercxx . . $ gpointer# |
| 123 | gsk_gpu_cached_newcxx . . $ gsk_gpu_cached_new(9c808eb1e438eb24). (GskGpuCachecxx . . $ GskGpuCache# *cache, |
| 124 | const GskGpuCachedClasscxx . . $ GskGpuCachedClass# *class) |
| 125 | { |
| 126 | return gsk_gpu_cached_new_from_atlascxx . . $ gsk_gpu_cached_new_from_atlas(9e6ad944a4f2dea8). (cache, class, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 127 | } |
| 128 | |
| 129 | void |
| 130 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). (GskGpuCachedcxx . . $ GskGpuCached# *cached) |
| 131 | { |
| 132 | cached->timestampcxx . . $ _GskGpuCached#timestamp. = cached->cachecxx . . $ _GskGpuCached#cache.->timestampcxx . . $ _GskGpuCache#timestamp.; |
| 133 | gsk_gpu_cached_set_stalecxx . . $ gsk_gpu_cached_set_stale(e295147961fe45a0). (cached, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 134 | } |
| 135 | |
| 136 | /* }}} */ |
| 137 | /* {{{ CachedAtlas */ |
| 138 | |
| 139 | struct _GskGpuCachedAtlascxx . . $ _GskGpuCachedAtlas# |
| 140 | { |
| 141 | GskGpuCachedcxx . . $ GskGpuCached# parentcxx . . $ _GskGpuCachedAtlas#parent.; |
| 142 | |
| 143 | GskGpuImagecxx . . $ GskGpuImage# *imagecxx . . $ _GskGpuCachedAtlas#image.; |
| 144 | |
| 145 | gsizecxx . . $ gsize# remaining_pixelscxx . . $ _GskGpuCachedAtlas#remaining_pixels.; |
| 146 | gsizecxx . . $ gsize# n_slicescxx . . $ _GskGpuCachedAtlas#n_slices.; |
| 147 | structcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0# { |
| 148 | gsizecxx . . $ gsize# widthcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#width.; |
| 149 | gsizecxx . . $ gsize# heightcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#height.; |
| 150 | } slicescxx . . $ _GskGpuCachedAtlas#slices.[MAX_SLICES_PER_ATLAScxx . . $ `gsk/gpu/gskgpucache.c:22:9`!]; |
| 151 | }; |
| 152 | |
| 153 | static void |
| 154 | gsk_gpu_cached_atlas_freecxx . . $ gsk_gpu_cached_atlas_free(5a53b82634f8e5da). (GskGpuCachedcxx . . $ GskGpuCached# *cached) |
| 155 | { |
| 156 | GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *self = (GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *) cached; |
| 157 | GskGpuCachecxx . . $ GskGpuCache# *cache = cached->cachecxx . . $ _GskGpuCached#cache.; |
| 158 | GskGpuCachedcxx . . $ GskGpuCached# *c, *next; |
| 159 | |
| 160 | /* Free all remaining glyphs on this atlas */ |
| 161 | for (c = cache->first_cachedcxx . . $ _GskGpuCache#first_cached.; c != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; c = next) |
| 162 | { |
| 163 | next = c->nextcxx . . $ _GskGpuCached#next.; |
| 164 | if (c->atlascxx . . $ _GskGpuCached#atlas. == self) |
| 165 | gsk_gpu_cached_freecxx . . $ gsk_gpu_cached_free(5a53b82634f8e5da). (c); |
| 166 | } |
| 167 | |
| 168 | if (cache->current_atlascxx . . $ _GskGpuCache#current_atlas. == self) |
| 169 | cache->current_atlascxx . . $ _GskGpuCache#current_atlas. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 170 | |
| 171 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self->imagecxx . . $ _GskGpuCachedAtlas#image.); |
| 172 | |
| 173 | g_freecxx . . $ g_free(5d22bdacc48458e8). (self); |
| 174 | } |
| 175 | |
| 176 | static gbooleancxx . . $ gboolean# |
| 177 | gsk_gpu_cached_atlas_should_collectcxx . . $ gsk_gpu_cached_atlas_should_collect(8e8e89998884adad). (GskGpuCachedcxx . . $ GskGpuCached# *cached, |
| 178 | gint64cxx . . $ gint64# cache_timeout, |
| 179 | gint64cxx . . $ gint64# timestamp) |
| 180 | { |
| 181 | GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *self = (GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *) cached; |
| 182 | |
| 183 | if (cached->cachecxx . . $ _GskGpuCached#cache.->current_atlascxx . . $ _GskGpuCache#current_atlas. == self && |
| 184 | gsk_gpu_cached_is_oldcxx . . $ gsk_gpu_cached_is_old(8e8e89998884adad). (cached, cache_timeout * ATLAS_TIMEOUT_SCALEcxx . . $ `gsk/gpu/gskgpucache.c:30:9`!, timestamp) && |
| 185 | cached->pixelscxx . . $ _GskGpuCached#pixels. == 0) |
| 186 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 187 | |
| 188 | return cached->pixelscxx . . $ _GskGpuCached#pixels. + self->remaining_pixelscxx . . $ _GskGpuCachedAtlas#remaining_pixels. < MIN_ALIVE_PIXELScxx . . $ `gsk/gpu/gskgpucache.c:28:9`!; |
| 189 | } |
| 190 | |
| 191 | static const GskGpuCachedClasscxx . . $ GskGpuCachedClass# GSK_GPU_CACHED_ATLAS_CLASScxx . . $ GSK_GPU_CACHED_ATLAS_CLASS. = |
| 192 | { |
| 193 | sizeof (GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas#), |
| 194 | "Atlas", |
| 195 | gsk_gpu_cached_atlas_freecxx . . $ gsk_gpu_cached_atlas_free(5a53b82634f8e5da)., |
| 196 | gsk_gpu_cached_atlas_should_collectcxx . . $ gsk_gpu_cached_atlas_should_collect(8e8e89998884adad). |
| 197 | }; |
| 198 | |
| 199 | static GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# * |
| 200 | gsk_gpu_cached_atlas_newcxx . . $ gsk_gpu_cached_atlas_new(afa53925113c4a50). (GskGpuCachecxx . . $ GskGpuCache# *cache) |
| 201 | { |
| 202 | GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *self; |
| 203 | |
| 204 | self = gsk_gpu_cached_newcxx . . $ gsk_gpu_cached_new(9c808eb1e438eb24). (cache, &GSK_GPU_CACHED_ATLAS_CLASScxx . . $ GSK_GPU_CACHED_ATLAS_CLASS.); |
| 205 | self->imagecxx . . $ _GskGpuCachedAtlas#image. = gsk_gpu_device_create_atlas_imagecxx . . $ gsk_gpu_device_create_atlas_image(1caf50e10af4e5b7). (cache->devicecxx . . $ _GskGpuCache#device., ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`!, ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`!); |
| 206 | self->remaining_pixelscxx . . $ _GskGpuCachedAtlas#remaining_pixels. = gsk_gpu_image_get_widthcxx . . $ gsk_gpu_image_get_width(4bdeec44aa36e037). (self->imagecxx . . $ _GskGpuCachedAtlas#image.) * gsk_gpu_image_get_heightcxx . . $ gsk_gpu_image_get_height(4bdeec44aa36e037). (self->imagecxx . . $ _GskGpuCachedAtlas#image.); |
| 207 | |
| 208 | return self; |
| 209 | } |
| 210 | |
| 211 | /* This rounds up to the next number that has <= 2 bits set: |
| 212 | * 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, ... |
| 213 | * That is roughly sqrt(2), so it should limit waste |
| 214 | */ |
| 215 | static gsizecxx . . $ gsize# |
| 216 | round_up_atlas_sizecxx . . $ round_up_atlas_size(ecdaa1632f49f591). (gsizecxx . . $ gsize# num) |
| 217 | { |
| 218 | gsizecxx . . $ gsize# storage = g_bit_storagecxx . . $ `<external>/10725994368378097379/gutils.h:363:9`! (num); |
| 219 | |
| 220 | num = num + (((1 << storage) - 1) >> 2); |
| 221 | num &= (((gsizecxx . . $ gsize#) 7) << storage) >> 2; |
| 222 | |
| 223 | return num; |
| 224 | } |
| 225 | |
| 226 | static gbooleancxx . . $ gboolean# |
| 227 | gsk_gpu_cached_atlas_allocatecxx . . $ gsk_gpu_cached_atlas_allocate(19a791a6db195478). (GskGpuCachedAtlascxx . . $ GskGpuCachedAtlas# *atlas, |
| 228 | gsizecxx . . $ gsize# width, |
| 229 | gsizecxx . . $ gsize# height, |
| 230 | gsizecxx . . $ gsize# *out_x, |
| 231 | gsizecxx . . $ gsize# *out_y) |
| 232 | { |
| 233 | gsizecxx . . $ gsize# i; |
| 234 | gsizecxx . . $ gsize# waste, slice_waste; |
| 235 | gsizecxx . . $ gsize# best_slice; |
| 236 | gsizecxx . . $ gsize# y, best_y; |
| 237 | gbooleancxx . . $ gboolean# can_add_slice; |
| 238 | |
| 239 | best_y = 0; |
| 240 | best_slice = G_MAXSIZEcxx . . $ `<external>/10505296616216143549/glibconfig.h:89:9`!; |
| 241 | can_add_slice = atlas->n_slicescxx . . $ _GskGpuCachedAtlas#n_slices. < MAX_SLICES_PER_ATLAScxx . . $ `gsk/gpu/gskgpucache.c:22:9`!; |
| 242 | if (can_add_slice) |
| 243 | waste = height; /* Require less than 100% waste */ |
| 244 | else |
| 245 | waste = G_MAXSIZEcxx . . $ `<external>/10505296616216143549/glibconfig.h:89:9`!; /* Accept any slice, we can't make better ones */ |
| 246 | |
| 247 | for (i = 0, y = 0; i < atlas->n_slicescxx . . $ _GskGpuCachedAtlas#n_slices.; y += atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[i].heightcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#height., i++) |
| 248 | { |
| 249 | if (atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[i].heightcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#height. < height || ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! - atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[i].widthcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#width. < width) |
| 250 | continue; |
| 251 | |
| 252 | slice_waste = atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[i].heightcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#height. - height; |
| 253 | if (slice_waste < waste) |
| 254 | { |
| 255 | waste = slice_waste; |
| 256 | best_slice = i; |
| 257 | best_y = y; |
| 258 | if (waste == 0) |
| 259 | break; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | if (best_slice >= i && i == atlas->n_slicescxx . . $ _GskGpuCachedAtlas#n_slices.) |
| 264 | { |
| 265 | gsizecxx . . $ gsize# slice_height; |
| 266 | |
| 267 | if (!can_add_slice) |
| 268 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 269 | |
| 270 | slice_height = round_up_atlas_sizecxx . . $ round_up_atlas_size(ecdaa1632f49f591). (MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (height, 4)); |
| 271 | if (slice_height > ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! - y) |
| 272 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 273 | |
| 274 | atlas->n_slicescxx . . $ _GskGpuCachedAtlas#n_slices.++; |
| 275 | if (atlas->n_slicescxx . . $ _GskGpuCachedAtlas#n_slices. == MAX_SLICES_PER_ATLAScxx . . $ `gsk/gpu/gskgpucache.c:22:9`!) |
| 276 | slice_height = ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! - y; |
| 277 | |
| 278 | atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[i].widthcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#width. = 0; |
| 279 | atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[i].heightcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#height. = slice_height; |
| 280 | best_y = y; |
| 281 | best_slice = i; |
| 282 | } |
| 283 | |
| 284 | *out_x = atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[best_slice].widthcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#width.; |
| 285 | *out_y = best_y; |
| 286 | |
| 287 | atlas->slicescxx . . $ _GskGpuCachedAtlas#slices.[best_slice].widthcxx . . $ _GskGpuCachedAtlas#$anonymous_type_0#width. += width; |
| 288 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (atlas->slices[best_slice].width <= ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`!); |
| 289 | |
| 290 | atlas->remaining_pixelscxx . . $ _GskGpuCachedAtlas#remaining_pixels. -= width * height; |
| 291 | ((GskGpuCachedcxx . . $ GskGpuCached# *) atlas)->pixelscxx . . $ _GskGpuCached#pixels. += width * height; |
| 292 | |
| 293 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 294 | } |
| 295 | |
| 296 | static void |
| 297 | gsk_gpu_cache_ensure_atlascxx . . $ gsk_gpu_cache_ensure_atlas(fdecfbb861ec07a5). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 298 | gbooleancxx . . $ gboolean# recreate) |
| 299 | { |
| 300 | if (self->current_atlascxx . . $ _GskGpuCache#current_atlas. && !recreate) |
| 301 | return; |
| 302 | |
| 303 | if (self->current_atlascxx . . $ _GskGpuCache#current_atlas.) |
| 304 | self->current_atlascxx . . $ _GskGpuCache#current_atlas.->remaining_pixelscxx . . $ _GskGpuCachedAtlas#remaining_pixels. = 0; |
| 305 | |
| 306 | self->current_atlascxx . . $ _GskGpuCache#current_atlas. = gsk_gpu_cached_atlas_newcxx . . $ gsk_gpu_cached_atlas_new(afa53925113c4a50). (self); |
| 307 | } |
| 308 | |
| 309 | GskGpuImagecxx . . $ GskGpuImage# * |
| 310 | gsk_gpu_cache_get_atlas_imagecxx . . $ gsk_gpu_cache_get_atlas_image(6d439900507125ba). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 311 | { |
| 312 | gsk_gpu_cache_ensure_atlascxx . . $ gsk_gpu_cache_ensure_atlas(fdecfbb861ec07a5). (self, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 313 | |
| 314 | return self->current_atlascxx . . $ _GskGpuCache#current_atlas.->imagecxx . . $ _GskGpuCachedAtlas#image.; |
| 315 | } |
| 316 | |
| 317 | GskGpuImagecxx . . $ GskGpuImage# * |
| 318 | gsk_gpu_cache_add_atlas_imagecxx . . $ gsk_gpu_cache_add_atlas_image(e64916a9eafb68c9). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 319 | gsizecxx . . $ gsize# width, |
| 320 | gsizecxx . . $ gsize# height, |
| 321 | gsizecxx . . $ gsize# *out_x, |
| 322 | gsizecxx . . $ gsize# *out_y) |
| 323 | { |
| 324 | if (width > MAX_ATLAS_ITEM_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:26:9`! || height > MAX_ATLAS_ITEM_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:26:9`!) |
| 325 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 326 | |
| 327 | gsk_gpu_cache_ensure_atlascxx . . $ gsk_gpu_cache_ensure_atlas(fdecfbb861ec07a5). (self, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 328 | |
| 329 | if (gsk_gpu_cached_atlas_allocatecxx . . $ gsk_gpu_cached_atlas_allocate(19a791a6db195478). (self->current_atlascxx . . $ _GskGpuCache#current_atlas., width, height, out_x, out_y)) |
| 330 | { |
| 331 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). ((GskGpuCachedcxx . . $ GskGpuCached# *) self->current_atlascxx . . $ _GskGpuCache#current_atlas.); |
| 332 | return self->current_atlascxx . . $ _GskGpuCache#current_atlas.->imagecxx . . $ _GskGpuCachedAtlas#image.; |
| 333 | } |
| 334 | |
| 335 | gsk_gpu_cache_ensure_atlascxx . . $ gsk_gpu_cache_ensure_atlas(fdecfbb861ec07a5). (self, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 336 | |
| 337 | if (gsk_gpu_cached_atlas_allocatecxx . . $ gsk_gpu_cached_atlas_allocate(19a791a6db195478). (self->current_atlascxx . . $ _GskGpuCache#current_atlas., width, height, out_x, out_y)) |
| 338 | { |
| 339 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). ((GskGpuCachedcxx . . $ GskGpuCached# *) self->current_atlascxx . . $ _GskGpuCache#current_atlas.); |
| 340 | return self->current_atlascxx . . $ _GskGpuCache#current_atlas.->imagecxx . . $ _GskGpuCachedAtlas#image.; |
| 341 | } |
| 342 | |
| 343 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 344 | } |
| 345 | |
| 346 | /* }}} */ |
| 347 | /* {{{ CachedTexture */ |
| 348 | |
| 349 | struct _GskGpuCachedTexturecxx . . $ _GskGpuCachedTexture# |
| 350 | { |
| 351 | GskGpuCachedcxx . . $ GskGpuCached# parentcxx . . $ _GskGpuCachedTexture#parent.; |
| 352 | |
| 353 | /* atomic */ int use_countcxx . . $ _GskGpuCachedTexture#use_count.; /* We count the use by the cache (via the linked |
| 354 | * list) and by the texture (via render data or |
| 355 | * weak ref. |
| 356 | */ |
| 357 | |
| 358 | gsizecxx . . $ gsize# *dead_textures_countercxx . . $ _GskGpuCachedTexture#dead_textures_counter.; |
| 359 | gsizecxx . . $ gsize# *dead_pixels_countercxx . . $ _GskGpuCachedTexture#dead_pixels_counter.; |
| 360 | |
| 361 | GdkTexturecxx . . $ GdkTexture# *texturecxx . . $ _GskGpuCachedTexture#texture.; |
| 362 | GskGpuImagecxx . . $ GskGpuImage# *imagecxx . . $ _GskGpuCachedTexture#image.; |
| 363 | GdkColorStatecxx . . $ GdkColorState# *color_statecxx . . $ _GskGpuCachedTexture#color_state.; /* no ref because global. May be NULL */ |
| 364 | }; |
| 365 | |
| 366 | static GHashTablecxx . . $ GHashTable# * |
| 367 | gsk_gpu_cache_get_texture_hash_tablecxx . . $ gsk_gpu_cache_get_texture_hash_table(7a939245d1f919d0). (GskGpuCachecxx . . $ GskGpuCache# *cache, |
| 368 | GdkColorStatecxx . . $ GdkColorState# *color_state) |
| 369 | { |
| 370 | if (color_state == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 371 | { |
| 372 | return cache->texture_cachecxx . . $ _GskGpuCache#texture_cache.; |
| 373 | } |
| 374 | else if (GDK_IS_DEFAULT_COLOR_STATEcxx . . $ `gdk/gdkcolorstateprivate.h:95:9`! (color_state)) |
| 375 | { |
| 376 | GdkColorStateIdcxx . . $ GdkColorStateId# id = GDK_DEFAULT_COLOR_STATE_IDcxx . . $ `gdk/gdkcolorstateprivate.h:97:9`! (color_state); |
| 377 | |
| 378 | if (cache->ccs_texture_cachescxx . . $ _GskGpuCache#ccs_texture_caches.[id] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 379 | cache->ccs_texture_cachescxx . . $ _GskGpuCache#ccs_texture_caches.[id] = g_hash_table_newcxx . . $ g_hash_table_new(444186de27d60923). (g_direct_hashcxx . . $ g_direct_hash(b11f534102b1ad6)., |
| 380 | g_direct_equalcxx . . $ g_direct_equal(9148c8c3ff42c9d8).); |
| 381 | return cache->ccs_texture_cachescxx . . $ _GskGpuCache#ccs_texture_caches.[id]; |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | static void |
| 390 | gsk_gpu_cached_texture_freecxx . . $ gsk_gpu_cached_texture_free(5a53b82634f8e5da). (GskGpuCachedcxx . . $ GskGpuCached# *cached) |
| 391 | { |
| 392 | GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *self = (GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *) cached; |
| 393 | GskGpuCachecxx . . $ GskGpuCache# *cache = cached->cachecxx . . $ _GskGpuCached#cache.; |
| 394 | GHashTablecxx . . $ GHashTable# *texture_cache; |
| 395 | gpointercxx . . $ gpointer# key, value; |
| 396 | |
| 397 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->image); |
| 398 | |
| 399 | texture_cache = gsk_gpu_cache_get_texture_hash_tablecxx . . $ gsk_gpu_cache_get_texture_hash_table(7a939245d1f919d0). (cache, self->color_statecxx . . $ _GskGpuCachedTexture#color_state.); |
| 400 | |
| 401 | if (g_hash_table_steal_extendedcxx . . $ g_hash_table_steal_extended(af2aa9836613954a). (texture_cache, self->texturecxx . . $ _GskGpuCachedTexture#texture., &key, &value)) |
| 402 | { |
| 403 | /* If the texture has been reused already, we put the entry back */ |
| 404 | if ((GskGpuCachedcxx . . $ GskGpuCached# *) value != cached) |
| 405 | g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (texture_cache, key, value); |
| 406 | } |
| 407 | |
| 408 | /* If the cached item itself is still in use by the texture, we leave |
| 409 | * it to the weak ref or render data to free it. |
| 410 | */ |
| 411 | if (g_atomic_int_dec_and_testcxx . . $ `<external>/742587799302188836/gatomic.h:167:9`! (&self->use_count)) |
| 412 | { |
| 413 | g_freecxx . . $ g_free(5d22bdacc48458e8). (self); |
| 414 | return; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | static inline gbooleancxx . . $ gboolean# |
| 419 | gsk_gpu_cached_texture_is_invalidcxx . . $ gsk_gpu_cached_texture_is_invalid(4b2e8fb65a75fb0). (GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *self) |
| 420 | { |
| 421 | /* If the use count is less than 2, the orignal texture has died, |
| 422 | * and the memory may have been reused for a new texture, so we |
| 423 | * can't hand out the image that is for the original texture. |
| 424 | */ |
| 425 | return g_atomic_int_getcxx . . $ `<external>/742587799302188836/gatomic.h:109:9`! (&self->use_count) < 2; |
| 426 | } |
| 427 | |
| 428 | static gbooleancxx . . $ gboolean# |
| 429 | gsk_gpu_cached_texture_should_collectcxx . . $ gsk_gpu_cached_texture_should_collect(8e8e89998884adad). (GskGpuCachedcxx . . $ GskGpuCached# *cached, |
| 430 | gint64cxx . . $ gint64# cache_timeout, |
| 431 | gint64cxx . . $ gint64# timestamp) |
| 432 | { |
| 433 | GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *self = (GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *) cached; |
| 434 | |
| 435 | return gsk_gpu_cached_is_oldcxx . . $ gsk_gpu_cached_is_old(8e8e89998884adad). (cached, cache_timeout, timestamp) || |
| 436 | gsk_gpu_cached_texture_is_invalidcxx . . $ gsk_gpu_cached_texture_is_invalid(4b2e8fb65a75fb0). (self); |
| 437 | } |
| 438 | |
| 439 | static const GskGpuCachedClasscxx . . $ GskGpuCachedClass# GSK_GPU_CACHED_TEXTURE_CLASScxx . . $ GSK_GPU_CACHED_TEXTURE_CLASS. = |
| 440 | { |
| 441 | sizeof (GskGpuCachedTexturecxx . . $ GskGpuCachedTexture#), |
| 442 | "Texture", |
| 443 | gsk_gpu_cached_texture_freecxx . . $ gsk_gpu_cached_texture_free(5a53b82634f8e5da)., |
| 444 | gsk_gpu_cached_texture_should_collectcxx . . $ gsk_gpu_cached_texture_should_collect(8e8e89998884adad). |
| 445 | }; |
| 446 | |
| 447 | /* Note: this function can run in an arbitrary thread, so it can |
| 448 | * only access things atomically |
| 449 | */ |
| 450 | static void |
| 451 | gsk_gpu_cached_texture_destroy_cbcxx . . $ gsk_gpu_cached_texture_destroy_cb(5d22bdacc48458e8). (gpointercxx . . $ gpointer# data) |
| 452 | { |
| 453 | GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *self = data; |
| 454 | |
| 455 | if (!gsk_gpu_cached_texture_is_invalidcxx . . $ gsk_gpu_cached_texture_is_invalid(4b2e8fb65a75fb0). (self)) |
| 456 | { |
| 457 | g_atomic_pointer_addcxx . . $ `<external>/742587799302188836/gatomic.h:278:9`! (self->dead_textures_counter, 1); |
| 458 | g_atomic_pointer_addcxx . . $ `<external>/742587799302188836/gatomic.h:278:9`! (self->dead_pixels_counter, ((GskGpuCached *) self)->pixels); |
| 459 | } |
| 460 | |
| 461 | if (g_atomic_int_dec_and_testcxx . . $ `<external>/742587799302188836/gatomic.h:167:9`! (&self->use_count)) |
| 462 | g_freecxx . . $ g_free(5d22bdacc48458e8). (self); |
| 463 | } |
| 464 | |
| 465 | static GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# * |
| 466 | gsk_gpu_cached_texture_newcxx . . $ gsk_gpu_cached_texture_new(689e5cbe56367e7f). (GskGpuCachecxx . . $ GskGpuCache# *cache, |
| 467 | GdkTexturecxx . . $ GdkTexture# *texture, |
| 468 | GskGpuImagecxx . . $ GskGpuImage# *image, |
| 469 | GdkColorStatecxx . . $ GdkColorState# *color_state) |
| 470 | { |
| 471 | GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *self; |
| 472 | GHashTablecxx . . $ GHashTable# *texture_cache; |
| 473 | |
| 474 | texture_cache = gsk_gpu_cache_get_texture_hash_tablecxx . . $ gsk_gpu_cache_get_texture_hash_table(7a939245d1f919d0). (cache, color_state); |
| 475 | if (texture_cache == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 476 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 477 | |
| 478 | /* First, move any existing renderdata */ |
| 479 | self = gdk_texture_get_render_datacxx . . $ gdk_texture_get_render_data(282e10688b8294a1). (texture, cache); |
| 480 | if (self) |
| 481 | { |
| 482 | if (gsk_gpu_cached_texture_is_invalidcxx . . $ gsk_gpu_cached_texture_is_invalid(4b2e8fb65a75fb0). (self)) |
| 483 | { |
| 484 | gdk_texture_clear_render_datacxx . . $ gdk_texture_clear_render_data(e88dd8ca87a2cf7d). (texture); |
| 485 | } |
| 486 | else |
| 487 | { |
| 488 | gdk_texture_steal_render_datacxx . . $ gdk_texture_steal_render_data(e88dd8ca87a2cf7d). (texture); |
| 489 | g_object_weak_refcxx . . $ g_object_weak_ref(a513422a6c5b79d2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (texture), (GWeakNotifycxx . . $ GWeakNotify#) gsk_gpu_cached_texture_destroy_cbcxx . . $ gsk_gpu_cached_texture_destroy_cb(5d22bdacc48458e8)., self); |
| 490 | texture_cache = gsk_gpu_cache_get_texture_hash_tablecxx . . $ gsk_gpu_cache_get_texture_hash_table(7a939245d1f919d0). (cache, self->color_statecxx . . $ _GskGpuCachedTexture#color_state.); |
| 491 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (texture_cache != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 492 | g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (texture_cache, texture, self); |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | self = gsk_gpu_cached_newcxx . . $ gsk_gpu_cached_new(9c808eb1e438eb24). (cache, &GSK_GPU_CACHED_TEXTURE_CLASScxx . . $ GSK_GPU_CACHED_TEXTURE_CLASS.); |
| 497 | self->texturecxx . . $ _GskGpuCachedTexture#texture. = texture; |
| 498 | self->imagecxx . . $ _GskGpuCachedTexture#image. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (image); |
| 499 | self->color_statecxx . . $ _GskGpuCachedTexture#color_state. = color_state; |
| 500 | ((GskGpuCachedcxx . . $ GskGpuCached# *)self)->pixelscxx . . $ _GskGpuCached#pixels. = gsk_gpu_image_get_widthcxx . . $ gsk_gpu_image_get_width(4bdeec44aa36e037). (image) * gsk_gpu_image_get_heightcxx . . $ gsk_gpu_image_get_height(4bdeec44aa36e037). (image); |
| 501 | self->dead_textures_countercxx . . $ _GskGpuCachedTexture#dead_textures_counter. = &cache->dead_texturescxx . . $ _GskGpuCache#dead_textures.; |
| 502 | self->dead_pixels_countercxx . . $ _GskGpuCachedTexture#dead_pixels_counter. = &cache->dead_texture_pixelscxx . . $ _GskGpuCache#dead_texture_pixels.; |
| 503 | self->use_countcxx . . $ _GskGpuCachedTexture#use_count. = 2; |
| 504 | |
| 505 | if (!gdk_texture_set_render_datacxx . . $ gdk_texture_set_render_data(eb8218c8a111bc21). (texture, cache, self, gsk_gpu_cached_texture_destroy_cbcxx . . $ gsk_gpu_cached_texture_destroy_cb(5d22bdacc48458e8).)) |
| 506 | { |
| 507 | g_object_weak_refcxx . . $ g_object_weak_ref(a513422a6c5b79d2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (texture), (GWeakNotifycxx . . $ GWeakNotify#) gsk_gpu_cached_texture_destroy_cbcxx . . $ gsk_gpu_cached_texture_destroy_cb(5d22bdacc48458e8)., self); |
| 508 | |
| 509 | g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (texture_cache, texture, self); |
| 510 | } |
| 511 | |
| 512 | return self; |
| 513 | } |
| 514 | |
| 515 | /* }}} */ |
| 516 | /* {{{ CachedTile */ |
| 517 | |
| 518 | struct _GskGpuCachedTilecxx . . $ _GskGpuCachedTile# |
| 519 | { |
| 520 | GskGpuCachedcxx . . $ GskGpuCached# parentcxx . . $ _GskGpuCachedTile#parent.; |
| 521 | |
| 522 | GdkTexturecxx . . $ GdkTexture# *texturecxx . . $ _GskGpuCachedTile#texture.; |
| 523 | guintcxx . . $ guint# lod_levelcxx . . $ _GskGpuCachedTile#lod_level.; |
| 524 | gbooleancxx . . $ gboolean# lod_linearcxx . . $ _GskGpuCachedTile#lod_linear.; |
| 525 | gsizecxx . . $ gsize# tile_idcxx . . $ _GskGpuCachedTile#tile_id.; |
| 526 | |
| 527 | /* atomic */ int use_countcxx . . $ _GskGpuCachedTile#use_count.; /* We count the use by the cache (via the linked |
| 528 | * list) and by the texture (via weak ref) |
| 529 | */ |
| 530 | |
| 531 | gsizecxx . . $ gsize# *dead_textures_countercxx . . $ _GskGpuCachedTile#dead_textures_counter.; |
| 532 | gsizecxx . . $ gsize# *dead_pixels_countercxx . . $ _GskGpuCachedTile#dead_pixels_counter.; |
| 533 | |
| 534 | GskGpuImagecxx . . $ GskGpuImage# *imagecxx . . $ _GskGpuCachedTile#image.; |
| 535 | GdkColorStatecxx . . $ GdkColorState# *color_statecxx . . $ _GskGpuCachedTile#color_state.; |
| 536 | }; |
| 537 | |
| 538 | static void |
| 539 | gsk_gpu_cached_tile_freecxx . . $ gsk_gpu_cached_tile_free(5a53b82634f8e5da). (GskGpuCachedcxx . . $ GskGpuCached# *cached) |
| 540 | { |
| 541 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# *self = (GskGpuCachedTilecxx . . $ GskGpuCachedTile# *) cached; |
| 542 | GskGpuCachecxx . . $ GskGpuCache# *cache = cached->cachecxx . . $ _GskGpuCached#cache.; |
| 543 | gpointercxx . . $ gpointer# key, value; |
| 544 | |
| 545 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->image); |
| 546 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->color_state, gdk_color_state_unref); |
| 547 | |
| 548 | if (g_hash_table_steal_extendedcxx . . $ g_hash_table_steal_extended(af2aa9836613954a). (cache->tile_cachecxx . . $ _GskGpuCache#tile_cache., self, &key, &value)) |
| 549 | { |
| 550 | /* If the texture has been reused already, we put the entry back */ |
| 551 | if ((GskGpuCachedcxx . . $ GskGpuCached# *) value != cached) |
| 552 | g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (cache->tile_cachecxx . . $ _GskGpuCache#tile_cache., key, value); |
| 553 | } |
| 554 | |
| 555 | /* If the cached item itself is still in use by the texture, we leave |
| 556 | * it to the weak ref or render data to free it. |
| 557 | */ |
| 558 | if (g_atomic_int_dec_and_testcxx . . $ `<external>/742587799302188836/gatomic.h:167:9`! (&self->use_count)) |
| 559 | { |
| 560 | g_freecxx . . $ g_free(5d22bdacc48458e8). (self); |
| 561 | return; |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | static inline gbooleancxx . . $ gboolean# |
| 566 | gsk_gpu_cached_tile_is_invalidcxx . . $ gsk_gpu_cached_tile_is_invalid(dac1b336d4106b73). (GskGpuCachedTilecxx . . $ GskGpuCachedTile# *self) |
| 567 | { |
| 568 | /* If the use count is less than 2, the orignal texture has died, |
| 569 | * and the memory may have been reused for a new texture, so we |
| 570 | * can't hand out the image that is for the original texture. |
| 571 | */ |
| 572 | return g_atomic_int_getcxx . . $ `<external>/742587799302188836/gatomic.h:109:9`! (&self->use_count) < 2; |
| 573 | } |
| 574 | |
| 575 | static gbooleancxx . . $ gboolean# |
| 576 | gsk_gpu_cached_tile_should_collectcxx . . $ gsk_gpu_cached_tile_should_collect(8e8e89998884adad). (GskGpuCachedcxx . . $ GskGpuCached# *cached, |
| 577 | gint64cxx . . $ gint64# cache_timeout, |
| 578 | gint64cxx . . $ gint64# timestamp) |
| 579 | { |
| 580 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# *self = (GskGpuCachedTilecxx . . $ GskGpuCachedTile# *) cached; |
| 581 | |
| 582 | return gsk_gpu_cached_is_oldcxx . . $ gsk_gpu_cached_is_old(8e8e89998884adad). (cached, cache_timeout, timestamp) || |
| 583 | gsk_gpu_cached_tile_is_invalidcxx . . $ gsk_gpu_cached_tile_is_invalid(dac1b336d4106b73). (self); |
| 584 | } |
| 585 | |
| 586 | static const GskGpuCachedClasscxx . . $ GskGpuCachedClass# GSK_GPU_CACHED_TILE_CLASScxx . . $ GSK_GPU_CACHED_TILE_CLASS. = |
| 587 | { |
| 588 | sizeof (GskGpuCachedTilecxx . . $ GskGpuCachedTile#), |
| 589 | "Tile", |
| 590 | gsk_gpu_cached_tile_freecxx . . $ gsk_gpu_cached_tile_free(5a53b82634f8e5da)., |
| 591 | gsk_gpu_cached_tile_should_collectcxx . . $ gsk_gpu_cached_tile_should_collect(8e8e89998884adad). |
| 592 | }; |
| 593 | |
| 594 | /* Note: this function can run in an arbitrary thread, so it can |
| 595 | * only access things atomically |
| 596 | */ |
| 597 | static void |
| 598 | gsk_gpu_cached_tile_destroy_cbcxx . . $ gsk_gpu_cached_tile_destroy_cb(5d22bdacc48458e8). (gpointercxx . . $ gpointer# data) |
| 599 | { |
| 600 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# *self = data; |
| 601 | |
| 602 | if (!gsk_gpu_cached_tile_is_invalidcxx . . $ gsk_gpu_cached_tile_is_invalid(dac1b336d4106b73). (self)) |
| 603 | { |
| 604 | g_atomic_pointer_addcxx . . $ `<external>/742587799302188836/gatomic.h:278:9`! (self->dead_textures_counter, 1); |
| 605 | g_atomic_pointer_addcxx . . $ `<external>/742587799302188836/gatomic.h:278:9`! (self->dead_pixels_counter, ((GskGpuCached *) self)->pixels); |
| 606 | } |
| 607 | |
| 608 | if (g_atomic_int_dec_and_testcxx . . $ `<external>/742587799302188836/gatomic.h:167:9`! (&self->use_count)) |
| 609 | g_freecxx . . $ g_free(5d22bdacc48458e8). (self); |
| 610 | } |
| 611 | |
| 612 | static guintcxx . . $ guint# |
| 613 | gsk_gpu_cached_tile_hashcxx . . $ gsk_gpu_cached_tile_hash(b11f534102b1ad6). (gconstpointercxx . . $ gconstpointer# data) |
| 614 | { |
| 615 | const GskGpuCachedTilecxx . . $ GskGpuCachedTile# *self = data; |
| 616 | |
| 617 | return g_direct_hashcxx . . $ g_direct_hash(b11f534102b1ad6). (self->texturecxx . . $ _GskGpuCachedTile#texture.) ^ |
| 618 | self->tile_idcxx . . $ _GskGpuCachedTile#tile_id. ^ |
| 619 | (self->lod_levelcxx . . $ _GskGpuCachedTile#lod_level. << 24) ^ |
| 620 | (self->lod_linearcxx . . $ _GskGpuCachedTile#lod_linear. << 31); |
| 621 | } |
| 622 | |
| 623 | static gbooleancxx . . $ gboolean# |
| 624 | gsk_gpu_cached_tile_equalcxx . . $ gsk_gpu_cached_tile_equal(9148c8c3ff42c9d8). (gconstpointercxx . . $ gconstpointer# data_a, |
| 625 | gconstpointercxx . . $ gconstpointer# data_b) |
| 626 | { |
| 627 | const GskGpuCachedTilecxx . . $ GskGpuCachedTile# *a = data_a; |
| 628 | const GskGpuCachedTilecxx . . $ GskGpuCachedTile# *b = data_b; |
| 629 | |
| 630 | return a->texturecxx . . $ _GskGpuCachedTile#texture. == b->texturecxx . . $ _GskGpuCachedTile#texture. && |
| 631 | a->lod_levelcxx . . $ _GskGpuCachedTile#lod_level. == b->lod_levelcxx . . $ _GskGpuCachedTile#lod_level. && |
| 632 | a->lod_linearcxx . . $ _GskGpuCachedTile#lod_linear. == b->lod_linearcxx . . $ _GskGpuCachedTile#lod_linear. && |
| 633 | a->tile_idcxx . . $ _GskGpuCachedTile#tile_id. == b->tile_idcxx . . $ _GskGpuCachedTile#tile_id.; |
| 634 | } |
| 635 | |
| 636 | static GskGpuCachedTilecxx . . $ GskGpuCachedTile# * |
| 637 | gsk_gpu_cached_tile_newcxx . . $ gsk_gpu_cached_tile_new(80468fbc457ae2ac). (GskGpuCachecxx . . $ GskGpuCache# *cache, |
| 638 | GdkTexturecxx . . $ GdkTexture# *texture, |
| 639 | guintcxx . . $ guint# lod_level, |
| 640 | gbooleancxx . . $ gboolean# lod_linear, |
| 641 | guintcxx . . $ guint# tile_id, |
| 642 | GskGpuImagecxx . . $ GskGpuImage# *image, |
| 643 | GdkColorStatecxx . . $ GdkColorState# *color_state) |
| 644 | { |
| 645 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# *self; |
| 646 | |
| 647 | self = gsk_gpu_cached_newcxx . . $ gsk_gpu_cached_new(9c808eb1e438eb24). (cache, &GSK_GPU_CACHED_TILE_CLASScxx . . $ GSK_GPU_CACHED_TILE_CLASS.); |
| 648 | self->texturecxx . . $ _GskGpuCachedTile#texture. = texture; |
| 649 | self->lod_levelcxx . . $ _GskGpuCachedTile#lod_level. = lod_level; |
| 650 | self->lod_linearcxx . . $ _GskGpuCachedTile#lod_linear. = lod_linear; |
| 651 | self->tile_idcxx . . $ _GskGpuCachedTile#tile_id. = tile_id; |
| 652 | self->imagecxx . . $ _GskGpuCachedTile#image. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (image); |
| 653 | self->color_statecxx . . $ _GskGpuCachedTile#color_state. = gdk_color_state_refcxx . . $ `gdk/gdkcolorstateprivate.h:138:9`! (color_state); |
| 654 | ((GskGpuCachedcxx . . $ GskGpuCached# *)self)->pixelscxx . . $ _GskGpuCached#pixels. = gsk_gpu_image_get_widthcxx . . $ gsk_gpu_image_get_width(4bdeec44aa36e037). (image) * gsk_gpu_image_get_heightcxx . . $ gsk_gpu_image_get_height(4bdeec44aa36e037). (image); |
| 655 | self->dead_textures_countercxx . . $ _GskGpuCachedTile#dead_textures_counter. = &cache->dead_texturescxx . . $ _GskGpuCache#dead_textures.; |
| 656 | self->dead_pixels_countercxx . . $ _GskGpuCachedTile#dead_pixels_counter. = &cache->dead_texture_pixelscxx . . $ _GskGpuCache#dead_texture_pixels.; |
| 657 | self->use_countcxx . . $ _GskGpuCachedTile#use_count. = 2; |
| 658 | |
| 659 | g_object_weak_refcxx . . $ g_object_weak_ref(a513422a6c5b79d2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (texture), (GWeakNotifycxx . . $ GWeakNotify#) gsk_gpu_cached_tile_destroy_cbcxx . . $ gsk_gpu_cached_tile_destroy_cb(5d22bdacc48458e8)., self); |
| 660 | if (cache->tile_cachecxx . . $ _GskGpuCache#tile_cache. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 661 | cache->tile_cachecxx . . $ _GskGpuCache#tile_cache. = g_hash_table_newcxx . . $ g_hash_table_new(444186de27d60923). (gsk_gpu_cached_tile_hashcxx . . $ gsk_gpu_cached_tile_hash(b11f534102b1ad6)., |
| 662 | gsk_gpu_cached_tile_equalcxx . . $ gsk_gpu_cached_tile_equal(9148c8c3ff42c9d8).); |
| 663 | g_hash_table_addcxx . . $ g_hash_table_add(69c5b3b3568d4848). (cache->tile_cachecxx . . $ _GskGpuCache#tile_cache., self); |
| 664 | |
| 665 | return self; |
| 666 | } |
| 667 | |
| 668 | GskGpuImagecxx . . $ GskGpuImage# * |
| 669 | gsk_gpu_cache_lookup_tilecxx . . $ gsk_gpu_cache_lookup_tile(55153421a6b3bc1d). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 670 | GdkTexturecxx . . $ GdkTexture# *texture, |
| 671 | guintcxx . . $ guint# lod_level, |
| 672 | GskScalingFiltercxx . . $ GskScalingFilter# lod_filter, |
| 673 | gsizecxx . . $ gsize# tile_id, |
| 674 | GdkColorStatecxx . . $ GdkColorState# **out_color_state) |
| 675 | { |
| 676 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# *tile; |
| 677 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# lookup = { |
| 678 | .texture = texture, |
| 679 | .lod_level = lod_level, |
| 680 | .lod_linear = lod_filter == GSK_SCALING_FILTER_TRILINEARcxx . . $ GSK_SCALING_FILTER_TRILINEAR., |
| 681 | .tile_id = tile_id |
| 682 | }; |
| 683 | |
| 684 | if (self->tile_cachecxx . . $ _GskGpuCache#tile_cache. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 685 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 686 | |
| 687 | tile = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (self->tile_cachecxx . . $ _GskGpuCache#tile_cache., &lookup); |
| 688 | if (tile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 689 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 690 | |
| 691 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). ((GskGpuCachedcxx . . $ GskGpuCached# *) tile); |
| 692 | |
| 693 | *out_color_state = tile->color_statecxx . . $ _GskGpuCachedTile#color_state.; |
| 694 | |
| 695 | return g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (tile->image); |
| 696 | } |
| 697 | |
| 698 | void |
| 699 | gsk_gpu_cache_cache_tilecxx . . $ gsk_gpu_cache_cache_tile(b343153d3acdc0de). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 700 | GdkTexturecxx . . $ GdkTexture# *texture, |
| 701 | guintcxx . . $ guint# lod_level, |
| 702 | GskScalingFiltercxx . . $ GskScalingFilter# lod_filter, |
| 703 | gsizecxx . . $ gsize# tile_id, |
| 704 | GskGpuImagecxx . . $ GskGpuImage# *image, |
| 705 | GdkColorStatecxx . . $ GdkColorState# *color_state) |
| 706 | { |
| 707 | GskGpuCachedTilecxx . . $ GskGpuCachedTile# *tile; |
| 708 | |
| 709 | tile = gsk_gpu_cached_tile_newcxx . . $ gsk_gpu_cached_tile_new(80468fbc457ae2ac). (self, |
| 710 | texture, |
| 711 | lod_level, |
| 712 | lod_filter == GSK_SCALING_FILTER_TRILINEARcxx . . $ GSK_SCALING_FILTER_TRILINEAR., |
| 713 | tile_id, |
| 714 | image, |
| 715 | color_state); |
| 716 | |
| 717 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). ((GskGpuCachedcxx . . $ GskGpuCached# *) tile); |
| 718 | } |
| 719 | |
| 720 | /* }}} */ |
| 721 | /* {{{ GskGpuCache */ |
| 722 | |
| 723 | GskGpuDevicecxx . . $ GskGpuDevice# * |
| 724 | gsk_gpu_cache_get_devicecxx . . $ gsk_gpu_cache_get_device(9cc2f3a81a3e1cad). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 725 | { |
| 726 | return self->devicecxx . . $ _GskGpuCache#device.; |
| 727 | } |
| 728 | |
| 729 | /* |
| 730 | * gsk_gpu_cache_set_time: |
| 731 | * @self: a `GskGpuCache` |
| 732 | * @timestamp: time in whatever the frameclock uses |
| 733 | * |
| 734 | * Sets the timestamp to use for all following operations. |
| 735 | * Frames should set this when they start drawing. |
| 736 | **/ |
| 737 | void |
| 738 | gsk_gpu_cache_set_timecxx . . $ gsk_gpu_cache_set_time(a1a043d6c2f1c11e). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 739 | gint64cxx . . $ gint64# timestamp) |
| 740 | { |
| 741 | self->timestampcxx . . $ _GskGpuCache#timestamp. = timestamp; |
| 742 | } |
| 743 | |
| 744 | typedef structcxx . . $ $anonymous_type_7b3cfdbe59248839_1# |
| 745 | { |
| 746 | guintcxx . . $ guint# n_itemscxx . . $ $anonymous_type_7b3cfdbe59248839_1#n_items.; |
| 747 | guintcxx . . $ guint# n_stalecxx . . $ $anonymous_type_7b3cfdbe59248839_1#n_stale.; |
| 748 | } GskGpuCacheDatacxx . . $ GskGpuCacheData#; |
| 749 | |
| 750 | static void |
| 751 | print_cache_statscxx . . $ print_cache_stats(1573b146ca703b25). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 752 | { |
| 753 | GskGpuCachedcxx . . $ GskGpuCached# *cached; |
| 754 | GStringcxx . . $ GString# *message; |
| 755 | GStringcxx . . $ GString# *ratios = g_string_newcxx . . $ g_string_new(e8737c02110bb79b). (""); |
| 756 | GHashTablecxx . . $ GHashTable# *classes = g_hash_table_new_fullcxx . . $ g_hash_table_new_full(e2dd12b570de7430). (g_direct_hashcxx . . $ g_direct_hash(b11f534102b1ad6)., g_direct_equalcxx . . $ g_direct_equal(9148c8c3ff42c9d8)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, g_freecxx . . $ g_free(5d22bdacc48458e8).); |
| 757 | GHashTableItercxx . . $ GHashTableIter# iter; |
| 758 | gpointercxx . . $ gpointer# key, value; |
| 759 | |
| 760 | for (cached = self->first_cachedcxx . . $ _GskGpuCache#first_cached.; cached != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; cached = cached->nextcxx . . $ _GskGpuCached#next.) |
| 761 | { |
| 762 | GskGpuCacheDatacxx . . $ GskGpuCacheData# *cache_data = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (classes, cached->classcxx . . $ _GskGpuCached#class.); |
| 763 | if (cache_data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 764 | { |
| 765 | cache_data = g_new0cxx . . $ `<external>/1123956534522462559/gmem.h:335:9`! (GskGpuCacheData, 1); |
| 766 | g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (classes, (gpointercxx . . $ gpointer#) cached->classcxx . . $ _GskGpuCached#class., cache_data); |
| 767 | } |
| 768 | cache_data->n_itemscxx . . $ $anonymous_type_7b3cfdbe59248839_1#n_items.++; |
| 769 | if (cached->stalecxx . . $ _GskGpuCached#stale.) |
| 770 | cache_data->n_stalecxx . . $ $anonymous_type_7b3cfdbe59248839_1#n_stale.++; |
| 771 | |
| 772 | if (cached->classcxx . . $ _GskGpuCached#class. == &GSK_GPU_CACHED_ATLAS_CLASScxx . . $ GSK_GPU_CACHED_ATLAS_CLASS.) |
| 773 | { |
| 774 | double ratio; |
| 775 | |
| 776 | ratio = (double) cached->pixelscxx . . $ _GskGpuCached#pixels. / (double) (ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`! * ATLAS_SIZEcxx . . $ `gsk/gpu/gskgpucache.c:24:9`!); |
| 777 | |
| 778 | if (ratios->lencxx . . $ _GString#len. == 0) |
| 779 | g_string_appendcxx . . $ `<external>/2906017559248664336/gstring.h:270:9`! (ratios, " (ratios "); |
| 780 | else |
| 781 | g_string_appendcxx . . $ `<external>/2906017559248664336/gstring.h:270:9`! (ratios, ", "); |
| 782 | g_string_append_printfcxx . . $ g_string_append_printf(eeccf837eb821d11). (ratios, "%.2f", ratio); |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | if (ratios->lencxx . . $ _GString#len. > 0) |
| 787 | g_string_appendcxx . . $ `<external>/2906017559248664336/gstring.h:270:9`! (ratios, ")"); |
| 788 | |
| 789 | message = g_string_newcxx . . $ g_string_new(e8737c02110bb79b). ("Cached items"); |
| 790 | g_hash_table_iter_initcxx . . $ g_hash_table_iter_init(1fd6bbae530c3b4). (&iter, classes); |
| 791 | while (g_hash_table_iter_nextcxx . . $ g_hash_table_iter_next(1740d3f8cffea03c). (&iter, &key, &value)) |
| 792 | { |
| 793 | const GskGpuCachedClasscxx . . $ GskGpuCachedClass# *class = key; |
| 794 | const GskGpuCacheDatacxx . . $ GskGpuCacheData# *cache_data = value; |
| 795 | |
| 796 | g_string_append_printfcxx . . $ g_string_append_printf(eeccf837eb821d11). (message, "\n %s:%*s%5u (%u stale)", class->namecxx . . $ _GskGpuCachedClass#name., 12 - MINcxx . . $ `<external>/12741050725406041920/gmacros.h:978:9`! (12, (int) strlen (class->name)), "", cache_data->n_itemscxx . . $ $anonymous_type_7b3cfdbe59248839_1#n_items., cache_data->n_stalecxx . . $ $anonymous_type_7b3cfdbe59248839_1#n_stale.); |
| 797 | |
| 798 | if (class == &GSK_GPU_CACHED_ATLAS_CLASScxx . . $ GSK_GPU_CACHED_ATLAS_CLASS.) |
| 799 | g_string_append_printfcxx . . $ g_string_append_printf(eeccf837eb821d11). (message, "%s", ratios->strcxx . . $ _GString#str.); |
| 800 | else if (class == &GSK_GPU_CACHED_TEXTURE_CLASScxx . . $ GSK_GPU_CACHED_TEXTURE_CLASS.) |
| 801 | g_string_append_printfcxx . . $ g_string_append_printf(eeccf837eb821d11). (message, " (%u in hash)", g_hash_table_sizecxx . . $ g_hash_table_size(4b2d4d194d262c0c). (self->texture_cachecxx . . $ _GskGpuCache#texture_cache.)); |
| 802 | } |
| 803 | |
| 804 | gdk_debug_messagecxx . . $ gdk_debug_message(326aeb464d16410c). ("%s", message->strcxx . . $ _GString#str.); |
| 805 | g_string_freecxx . . $ `<external>/2906017559248664336/gstring.h:73:9`! (message, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 806 | g_hash_table_unrefcxx . . $ g_hash_table_unref(ce4eddf544b9218). (classes); |
| 807 | g_string_freecxx . . $ `<external>/2906017559248664336/gstring.h:73:9`! (ratios, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 808 | } |
| 809 | |
| 810 | /* Returns TRUE if everything was GC'ed */ |
| 811 | gbooleancxx . . $ gboolean# |
| 812 | gsk_gpu_cache_gccxx . . $ gsk_gpu_cache_gc(a2965bdc0c7e2616). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 813 | gint64cxx . . $ gint64# cache_timeout, |
| 814 | gint64cxx . . $ gint64# timestamp) |
| 815 | { |
| 816 | GskGpuCachedcxx . . $ GskGpuCached# *cached, *prev; |
| 817 | gint64cxx . . $ gint64# before G_GNUC_UNUSEDcxx . . $ `<external>/12741050725406041920/gmacros.h:647:9`! = GDK_PROFILER_CURRENT_TIMEcxx . . $ `gdk/gdkprofilerprivate.h:39:9`!; |
| 818 | gbooleancxx . . $ gboolean# is_empty = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 819 | |
| 820 | /* We walk the cache from the end so we don't end up with prev |
| 821 | * being a leftover glyph on the atlas we are freeing |
| 822 | */ |
| 823 | for (cached = self->last_cachedcxx . . $ _GskGpuCache#last_cached.; cached != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; cached = prev) |
| 824 | { |
| 825 | prev = cached->prevcxx . . $ _GskGpuCached#prev.; |
| 826 | if (gsk_gpu_cached_should_collectcxx . . $ gsk_gpu_cached_should_collect(8e8e89998884adad). (cached, cache_timeout, timestamp)) |
| 827 | gsk_gpu_cached_freecxx . . $ gsk_gpu_cached_free(5a53b82634f8e5da). (cached); |
| 828 | else |
| 829 | is_empty &= cached->stalecxx . . $ _GskGpuCached#stale.; |
| 830 | } |
| 831 | |
| 832 | g_atomic_pointer_setcxx . . $ `<external>/742587799302188836/gatomic.h:134:9`! (&self->dead_textures, 0); |
| 833 | g_atomic_pointer_setcxx . . $ `<external>/742587799302188836/gatomic.h:134:9`! (&self->dead_texture_pixels, 0); |
| 834 | |
| 835 | if (GSK_DEBUG_CHECKcxx . . $ `gsk/gskdebugprivate.h:31:9`! (CACHE)) |
| 836 | print_cache_statscxx . . $ print_cache_stats(1573b146ca703b25). (self); |
| 837 | |
| 838 | gdk_profiler_end_markcxx . . $ `gdk/gdkprofilerprivate.h:76:9`! (before, "Glyph cache GC", NULL); |
| 839 | |
| 840 | return is_empty; |
| 841 | } |
| 842 | |
| 843 | gsizecxx . . $ gsize# |
| 844 | gsk_gpu_cache_get_dead_texturescxx . . $ gsk_gpu_cache_get_dead_textures(184151cee3db78d1). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 845 | { |
| 846 | return GPOINTER_TO_SIZEcxx . . $ `<external>/12741050725406041920/gmacros.h:997:9`! (g_atomic_pointer_getcxx . . $ `<external>/742587799302188836/gatomic.h:126:9`! (&self->dead_textures)); |
| 847 | } |
| 848 | |
| 849 | gsizecxx . . $ gsize# |
| 850 | gsk_gpu_cache_get_dead_texture_pixelscxx . . $ gsk_gpu_cache_get_dead_texture_pixels(184151cee3db78d1). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 851 | { |
| 852 | return GPOINTER_TO_SIZEcxx . . $ `<external>/12741050725406041920/gmacros.h:997:9`! (g_atomic_pointer_getcxx . . $ `<external>/742587799302188836/gatomic.h:126:9`! (&self->dead_texture_pixels)); |
| 853 | } |
| 854 | |
| 855 | static void |
| 856 | gsk_gpu_cache_clear_cachecxx . . $ gsk_gpu_cache_clear_cache(1573b146ca703b25). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 857 | { |
| 858 | for (GskGpuCachedcxx . . $ GskGpuCached# *cached = self->first_cachedcxx . . $ _GskGpuCache#first_cached.; cached; cached = cached->nextcxx . . $ _GskGpuCached#next.) |
| 859 | { |
| 860 | if (cached->prevcxx . . $ _GskGpuCached#prev. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 861 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (self->first_cached == cached); |
| 862 | else |
| 863 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (cached->prev->next == cached); |
| 864 | if (cached->nextcxx . . $ _GskGpuCached#next. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 865 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (self->last_cached == cached); |
| 866 | else |
| 867 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (cached->next->prev == cached); |
| 868 | } |
| 869 | |
| 870 | /* We clear the cache from the end so glyphs get freed before their atlas */ |
| 871 | while (self->last_cachedcxx . . $ _GskGpuCache#last_cached.) |
| 872 | gsk_gpu_cached_freecxx . . $ gsk_gpu_cached_free(5a53b82634f8e5da). (self->last_cachedcxx . . $ _GskGpuCache#last_cached.); |
| 873 | |
| 874 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (self->last_cached == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 875 | } |
| 876 | |
| 877 | static void |
| 878 | gsk_gpu_cache_disposecxx . . $ gsk_gpu_cache_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 879 | { |
| 880 | GskGpuCachecxx . . $ GskGpuCache# *self = GSK_GPU_CACHEcxx . . $ `gsk/gpu/gskgpucacheprivate.h:10:9`! (object); |
| 881 | |
| 882 | gsk_gpu_cache_clear_cachecxx . . $ gsk_gpu_cache_clear_cache(1573b146ca703b25). (self); |
| 883 | |
| 884 | gsk_gpu_cached_stroke_finish_cachecxx . . $ gsk_gpu_cached_stroke_finish_cache(1573b146ca703b25). (self); |
| 885 | gsk_gpu_cached_fill_finish_cachecxx . . $ gsk_gpu_cached_fill_finish_cache(1573b146ca703b25). (self); |
| 886 | |
| 887 | #ifdef GDK_RENDERING_VULKANcxx . . $ `build/gdk/gdkconfig.h:22:9`! |
| 888 | gsk_vulkan_ycbcr_finish_cachecxx . . $ gsk_vulkan_ycbcr_finish_cache(1573b146ca703b25). (self); |
| 889 | #endif |
| 890 | gsk_gpu_cached_glyph_finish_cachecxx . . $ gsk_gpu_cached_glyph_finish_cache(1573b146ca703b25). (self); |
| 891 | |
| 892 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->tile_cache, g_hash_table_unref); |
| 893 | for (int i = 0; i < GDK_COLOR_STATE_N_IDScxx . . $ GDK_COLOR_STATE_N_IDS.; i++) |
| 894 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->ccs_texture_caches[i], g_hash_table_unref); |
| 895 | g_hash_table_unrefcxx . . $ g_hash_table_unref(ce4eddf544b9218). (self->texture_cachecxx . . $ _GskGpuCache#texture_cache.); |
| 896 | |
| 897 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gsk_gpu_cache_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object); |
| 898 | } |
| 899 | |
| 900 | static void |
| 901 | gsk_gpu_cache_finalizecxx . . $ gsk_gpu_cache_finalize(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 902 | { |
| 903 | GskGpuCachecxx . . $ GskGpuCache# *self = GSK_GPU_CACHEcxx . . $ `gsk/gpu/gskgpucacheprivate.h:10:9`! (object); |
| 904 | |
| 905 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self->devicecxx . . $ _GskGpuCache#device.); |
| 906 | |
| 907 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gsk_gpu_cache_parent_class)->finalizecxx . . $ _GObjectClass#finalize. (object); |
| 908 | } |
| 909 | |
| 910 | static void |
| 911 | gsk_gpu_cache_class_initcxx . . $ gsk_gpu_cache_class_init(4c24d9f83b2dc2dc). (GskGpuCacheClasscxx . . $ GskGpuCacheClass# *klass) |
| 912 | { |
| 913 | GObjectClasscxx . . $ GObjectClass# *object_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass); |
| 914 | |
| 915 | object_class->disposecxx . . $ _GObjectClass#dispose. = gsk_gpu_cache_disposecxx . . $ gsk_gpu_cache_dispose(6087475fa43034d3).; |
| 916 | object_class->finalizecxx . . $ _GObjectClass#finalize. = gsk_gpu_cache_finalizecxx . . $ gsk_gpu_cache_finalize(6087475fa43034d3).; |
| 917 | } |
| 918 | |
| 919 | static void |
| 920 | gsk_gpu_cache_initcxx . . $ gsk_gpu_cache_init(1573b146ca703b25). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 921 | { |
| 922 | self->texture_cachecxx . . $ _GskGpuCache#texture_cache. = g_hash_table_newcxx . . $ g_hash_table_new(444186de27d60923). (g_direct_hashcxx . . $ g_direct_hash(b11f534102b1ad6)., |
| 923 | g_direct_equalcxx . . $ g_direct_equal(9148c8c3ff42c9d8).); |
| 924 | |
| 925 | gsk_gpu_cached_glyph_init_cachecxx . . $ gsk_gpu_cached_glyph_init_cache(1573b146ca703b25). (self); |
| 926 | #ifdef GDK_RENDERING_VULKANcxx . . $ `build/gdk/gdkconfig.h:22:9`! |
| 927 | gsk_vulkan_ycbcr_init_cachecxx . . $ gsk_vulkan_ycbcr_init_cache(1573b146ca703b25). (self); |
| 928 | #endif |
| 929 | gsk_gpu_cached_fill_init_cachecxx . . $ gsk_gpu_cached_fill_init_cache(1573b146ca703b25). (self); |
| 930 | gsk_gpu_cached_stroke_init_cachecxx . . $ gsk_gpu_cached_stroke_init_cache(1573b146ca703b25). (self); |
| 931 | } |
| 932 | |
| 933 | GskGpuImagecxx . . $ GskGpuImage# * |
| 934 | gsk_gpu_cache_lookup_texture_imagecxx . . $ gsk_gpu_cache_lookup_texture_image(a1b6ff486b8a9cc). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 935 | GdkTexturecxx . . $ GdkTexture# *texture, |
| 936 | GdkColorStatecxx . . $ GdkColorState# *color_state) |
| 937 | { |
| 938 | GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *cache; |
| 939 | GHashTablecxx . . $ GHashTable# *texture_cache; |
| 940 | |
| 941 | texture_cache = gsk_gpu_cache_get_texture_hash_tablecxx . . $ gsk_gpu_cache_get_texture_hash_table(7a939245d1f919d0). (self, color_state); |
| 942 | if (texture_cache == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 943 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 944 | |
| 945 | cache = gdk_texture_get_render_datacxx . . $ gdk_texture_get_render_data(282e10688b8294a1). (texture, self); |
| 946 | /* color_state_equal() isn't necessary and if we'd use it, |
| 947 | * we'd need to check for NULLs before */ |
| 948 | if (cache == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || color_state != cache->color_statecxx . . $ _GskGpuCachedTexture#color_state.) |
| 949 | cache = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (texture_cache, texture); |
| 950 | |
| 951 | if (!cache || !cache->imagecxx . . $ _GskGpuCachedTexture#image. || gsk_gpu_cached_texture_is_invalidcxx . . $ gsk_gpu_cached_texture_is_invalid(4b2e8fb65a75fb0). (cache)) |
| 952 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 953 | |
| 954 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). ((GskGpuCachedcxx . . $ GskGpuCached# *) cache); |
| 955 | |
| 956 | return g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (cache->image); |
| 957 | } |
| 958 | |
| 959 | void |
| 960 | gsk_gpu_cache_cache_texture_imagecxx . . $ gsk_gpu_cache_cache_texture_image(434163e13d94f7cb). (GskGpuCachecxx . . $ GskGpuCache# *self, |
| 961 | GdkTexturecxx . . $ GdkTexture# *texture, |
| 962 | GskGpuImagecxx . . $ GskGpuImage# *image, |
| 963 | GdkColorStatecxx . . $ GdkColorState# *color_state) |
| 964 | { |
| 965 | GskGpuCachedTexturecxx . . $ GskGpuCachedTexture# *cache; |
| 966 | |
| 967 | cache = gsk_gpu_cached_texture_newcxx . . $ gsk_gpu_cached_texture_new(689e5cbe56367e7f). (self, texture, image, color_state); |
| 968 | if (cache == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 969 | return; |
| 970 | |
| 971 | gsk_gpu_cached_usecxx . . $ gsk_gpu_cached_use(5a53b82634f8e5da). ((GskGpuCachedcxx . . $ GskGpuCached# *) cache); |
| 972 | } |
| 973 | |
| 974 | GskGpuCachecxx . . $ GskGpuCache# * |
| 975 | gsk_gpu_cache_newcxx . . $ gsk_gpu_cache_new(71b3d06894263fec). (GskGpuDevicecxx . . $ GskGpuDevice# *device) |
| 976 | { |
| 977 | GskGpuCachecxx . . $ GskGpuCache# *self; |
| 978 | |
| 979 | self = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GSK_TYPE_GPU_CACHEcxx . . $ `gsk/gpu/gskgpucacheprivate.h:9:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 980 | self->devicecxx . . $ _GskGpuCache#device. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (device); |
| 981 | |
| 982 | return self; |
| 983 | } |
| 984 | |
| 985 | GskGpuCachePrivatecxx . . $ GskGpuCachePrivate# * |
| 986 | gsk_gpu_cache_get_privatecxx . . $ gsk_gpu_cache_get_private(15a7619203257844). (GskGpuCachecxx . . $ GskGpuCache# *self) |
| 987 | { |
| 988 | return gsk_gpu_cache_get_instance_privatecxx . . $ gsk_gpu_cache_get_instance_private(30e3a53fd1d02619). (self); |
| 989 | } |
| 990 | |
| 991 | /* }}} */ |
| 992 | /* vim:set foldmethod=marker: */ |