1
0
Fork 0
forked from fte/fteqw

Try to reduce memory usage.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5902 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-06-21 13:46:06 +00:00
parent b0e4884b7b
commit b34618507a
5 changed files with 22 additions and 19 deletions

View file

@ -6383,6 +6383,8 @@ double Host_Frame (double time)
cl.playerview[i].audio.reverbtype = 0;
VectorClear(cl.playerview[i].audio.velocity);
}
if (cls.state && r_worldentity.model && r_worldentity.model->loadstate == MLS_NOTLOADED)
Mod_LoadModel(cl.worldmodel, MLV_WARNSYNC);
if (SCR_UpdateScreen && !vid.isminimized)
{

View file

@ -37,14 +37,8 @@ cvar_t r_dodgytgafiles = CVARD("r_dodgytgafiles", "0", "Many old glquake engines
cvar_t r_dodgypcxfiles = CVARD("r_dodgypcxfiles", "0", "When enabled, this will ignore the palette stored within pcx files, for compatibility with quake2.");
#endif
cvar_t r_dodgymiptex = CVARD("r_dodgymiptex", "1", "When enabled, this will force regeneration of mipmaps, discarding mips1-4 like glquake did. This may eg solve fullbright issues with some maps, but may reduce distant detail levels.");
static void QDECL R_Image_BuggyCvar (struct cvar_s *var, char *oldvalue)
{ //force these cvars to value 1 if they're empty.
//cvars using this should be changed to 0 by default, once our engine bugs are debugged/fixed.
if (!*var->string)
var->ival = var->value = true;
}
cvar_t r_keepimages = CVARCD("r_keepimages", "", R_Image_BuggyCvar, "Retain unused images in memory for slightly faster map loading. FIXME: a setting of 0 may be crashy! (empty is treated as 1 for now).\n0: Redundant images will be purged after each map change.\n1: Images will be retained until vid_reload (potentially consuming a lot of ram).");
cvar_t r_ignoremapprefixes = CVARCD("r_ignoremapprefixes", "", R_Image_BuggyCvar, "Ignores when textures were loaded from map-specific paths. FIXME: empty is currently interpretted as 1 because the alternative is too memory hungary with r_keepimages 1.");
cvar_t r_keepimages = CVARD("r_keepimages", "0", "Retain unused images in memory for slightly faster map loading.\n0: Redundant images will be purged after each map change.\n1: Images will be retained until vid_reload (potentially consuming a lot of ram).");
cvar_t r_ignoremapprefixes = CVARD("r_ignoremapprefixes", "0", "Ignores when textures were loaded from map-specific paths.\n0: textures/foo/tex.tga will not be confused with textures/foo/tex.tga.\n1: The same texture might be loaded multiple times over.");
char *r_defaultimageextensions =
#ifdef IMAGEFMT_DDS

View file

@ -505,15 +505,18 @@ qboolean Mod_PurgeModel(model_t *mod, enum mod_purge_e ptype)
#ifdef TERRAIN
//we can safely flush all terrain sections at any time
if (mod->terrain && ptype != MP_MAPCHANGED)
if (mod->terrain)
{
if (ptype == MP_MAPCHANGED)
return false; //don't destroy any data there that the user might want to save. FIXME: handle better.
Terr_PurgeTerrainModel(mod, false, true);
}
#endif
//purge any vbos
if (mod->type == mod_brush)
{
//brush models cannot be safely flushed.
if (ptype != MP_RESET)
if (ptype == MP_FLUSH)
return false;
#ifndef SERVERONLY
Surf_Clear(mod);
@ -522,12 +525,7 @@ qboolean Mod_PurgeModel(model_t *mod, enum mod_purge_e ptype)
#ifdef TERRAIN
if (mod->type == mod_brush || mod->type == mod_heightmap)
{
//heightmap/terrain models cannot be safely flushed (brush models might have terrain embedded).
if (ptype != MP_RESET)
return false;
Terr_FreeModel(mod);
}
#endif
if (mod->type == mod_alias)
{
@ -1004,6 +1002,8 @@ void Mod_ModelLoaded(void *ctx, void *data, size_t a, size_t b)
if (mod->type == mod_brush)
{
Surf_BuildModelLightmaps(mod);
r_oldviewcluster = -1; //just in case.
r_oldviewcluster2 = -2;
}
if (mod->type == mod_sprite)
{

View file

@ -737,13 +737,16 @@ void R_PushDlights (void)
return;
#endif
if (r_dynamic.ival <= 0|| !cl.worldmodel)
if (r_dynamic.ival <= 0|| !r_worldentity.model)
return;
if (!cl.worldmodel->nodes)
if (r_worldentity.model->loadstate != MLS_LOADED)
return;
currentmodel = cl.worldmodel;
if (!r_worldentity.model->nodes)
return;
currentmodel = r_worldentity.model;
if (!currentmodel->funcs.MarkLights)
return;

View file

@ -5309,6 +5309,10 @@ float SV_Frame (void)
if (sv.state < ss_active) //whoops...
return delay;
//make sure the worldmodel is actually valid...
if (sv.world.worldmodel && sv.world.worldmodel->loadstate != MLS_LOADED)
Mod_LoadModel(sv.world.worldmodel, MLV_ERROR);
SV_CheckVars ();
// send messages back to the clients that had packets read this frame