From 3fbac33ee8d6c66656c13ee19aa3f33787eb4a50 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 21 Mar 2023 13:18:16 +0900 Subject: [PATCH] [gl] Free alias model cache memory when clearing models Like sw, gl uses the cache for alias models and thus needs to free the cache memory when unloading the model. --- libs/models/alias/gl_model_alias.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/models/alias/gl_model_alias.c b/libs/models/alias/gl_model_alias.c index 5abc7e4d5..4dee2b98e 100644 --- a/libs/models/alias/gl_model_alias.c +++ b/libs/models/alias/gl_model_alias.c @@ -52,6 +52,14 @@ #include "compat.h" +static void +gl_alias_clear (model_t *m, void *data) +{ + m->needload = true; + + Cache_Free (&m->cache); +} + static void gl_Mod_LoadSkin (mod_alias_ctx_t *alias_ctx, byte *texels, int snum, int gnum, maliasskindesc_t *skindesc) @@ -124,6 +132,8 @@ gl_Mod_FinalizeAliasModel (mod_alias_ctx_t *alias_ctx) header->mdl.scale_origin[2] -= (22 + 8); VectorScale (header->mdl.scale, 2, header->mdl.scale); } + + alias_ctx->mod->clear = gl_alias_clear; } static void