mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-07 02:53:54 +01:00
ref_soft: Flush caches and clear textures on newmap correctly
This commit is contained in:
parent
c36f415793
commit
513381a322
@ -283,8 +283,8 @@ void Mod_BrushUnloadTextures( model_t *mod )
|
|||||||
if( !tx || tx->gl_texturenum == tr.defaultTexture )
|
if( !tx || tx->gl_texturenum == tr.defaultTexture )
|
||||||
continue; // free slot
|
continue; // free slot
|
||||||
|
|
||||||
//GL_FreeTexture( tx->gl_texturenum ); // main texture
|
GL_FreeTexture( tx->gl_texturenum ); // main texture
|
||||||
//GL_FreeTexture( tx->fb_texturenum ); // luma texture
|
GL_FreeTexture( tx->fb_texturenum ); // luma texture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1269,7 +1269,7 @@ void R_ScanEdges (void);
|
|||||||
//
|
//
|
||||||
// r_surf.c
|
// r_surf.c
|
||||||
//
|
//
|
||||||
void D_FlushCaches (void);
|
void D_FlushCaches( qboolean newmap );
|
||||||
|
|
||||||
//
|
//
|
||||||
// r_draw.c
|
// r_draw.c
|
||||||
|
2
r_main.c
2
r_main.c
@ -1767,6 +1767,8 @@ void R_NewMap (void)
|
|||||||
{
|
{
|
||||||
r_viewcluster = -1;
|
r_viewcluster = -1;
|
||||||
|
|
||||||
|
D_FlushCaches( true );
|
||||||
|
|
||||||
r_cnumsurfs = sw_maxsurfs->value;
|
r_cnumsurfs = sw_maxsurfs->value;
|
||||||
|
|
||||||
if (r_cnumsurfs <= MINSURFACES)
|
if (r_cnumsurfs <= MINSURFACES)
|
||||||
|
2
r_misc.c
2
r_misc.c
@ -324,7 +324,7 @@ void R_SetupFrameQ (void)
|
|||||||
if (r_fullbright->flags & FCVAR_CHANGED)
|
if (r_fullbright->flags & FCVAR_CHANGED)
|
||||||
{
|
{
|
||||||
r_fullbright->flags &= ~FCVAR_CHANGED;
|
r_fullbright->flags &= ~FCVAR_CHANGED;
|
||||||
D_FlushCaches (); // so all lighting changes
|
D_FlushCaches( false ); // so all lighting changes
|
||||||
}
|
}
|
||||||
|
|
||||||
r_framecount++;
|
r_framecount++;
|
||||||
|
15
r_surf.c
15
r_surf.c
@ -507,7 +507,7 @@ void R_InitCaches (void)
|
|||||||
sc_size = size;
|
sc_size = size;
|
||||||
if( sc_base )
|
if( sc_base )
|
||||||
{
|
{
|
||||||
D_FlushCaches();
|
D_FlushCaches( false );
|
||||||
Mem_Free( sc_base );
|
Mem_Free( sc_base );
|
||||||
}
|
}
|
||||||
sc_base = (surfcache_t *)Mem_Calloc(r_temppool,size);
|
sc_base = (surfcache_t *)Mem_Calloc(r_temppool,size);
|
||||||
@ -524,18 +524,19 @@ void R_InitCaches (void)
|
|||||||
D_FlushCaches
|
D_FlushCaches
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void D_FlushCaches (void)
|
void D_FlushCaches( qboolean newmap )
|
||||||
{
|
{
|
||||||
surfcache_t *c;
|
surfcache_t *c;
|
||||||
|
|
||||||
if (!sc_base)
|
// if newmap, surfaces already freed
|
||||||
return;
|
if( !newmap )
|
||||||
|
|
||||||
for (c = sc_base ; c ; c = c->next)
|
|
||||||
{
|
{
|
||||||
if (c->owner)
|
for(c = sc_base ; c ; c = c->next )
|
||||||
|
{
|
||||||
|
if ( c->owner )
|
||||||
*c->owner = NULL;
|
*c->owner = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sc_rover = sc_base;
|
sc_rover = sc_base;
|
||||||
sc_base->next = NULL;
|
sc_base->next = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user