Make alias model caching optional.

For now, only the glsl loader disables caching, but it stores the frame
vertices in GL memory, so its hunk usage is relatively lower (and will be
lower still when I get skins sorted out).
This commit is contained in:
Bill Currie 2012-01-17 11:44:28 +09:00
parent fb428f8067
commit 3669e3aa2e
9 changed files with 53 additions and 26 deletions

View file

@ -52,6 +52,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "d_iface.h"
#include "r_local.h"
extern int alias_cache; //FIXME extern
aliashdr_t *pheader;
stvert_t *stverts;
@ -377,12 +378,17 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
Mod_LoadExternalSkins (mod);
// move the complete, relocatable alias model to the cache
end = Hunk_LowMark ();
total = end - start;
if (alias_cache) {
end = Hunk_LowMark ();
total = end - start;
mem = allocator (&mod->cache, total, loadname);
if (mem)
memcpy (mem, pheader, total);
mem = allocator (&mod->cache, total, loadname);
if (mem)
memcpy (mem, pheader, total);
Hunk_FreeToLowMark (start);
Hunk_FreeToLowMark (start);
mod->aliashdr = 0;
} else {
mod->aliashdr = pheader;
}
}