mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 22:11:22 +00:00
TexMgr_ReloadImages: attempt to fix random texture recoloring after mode change (http://sourceforge.net/p/quakespasm/bugs/10/)
This removes the Cache_Flush() call that was here, which was there to fix the jam3_tronyn / low heapsize bug, and instead adds a different workaround for that issue. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1247 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
76909f07c2
commit
53a5fe5053
1 changed files with 16 additions and 5 deletions
|
@ -343,6 +343,9 @@ gltexture_t *TexMgr_NewTexture (void)
|
||||||
|
|
||||||
static void GL_DeleteTexture (gltexture_t *texture);
|
static void GL_DeleteTexture (gltexture_t *texture);
|
||||||
|
|
||||||
|
//ericw -- workaround for preventing TexMgr_FreeTexture during TexMgr_ReloadImages
|
||||||
|
static qboolean in_reload_images;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
TexMgr_FreeTexture
|
TexMgr_FreeTexture
|
||||||
|
@ -352,6 +355,9 @@ void TexMgr_FreeTexture (gltexture_t *kill)
|
||||||
{
|
{
|
||||||
gltexture_t *glt;
|
gltexture_t *glt;
|
||||||
|
|
||||||
|
if (in_reload_images)
|
||||||
|
return;
|
||||||
|
|
||||||
if (kill == NULL)
|
if (kill == NULL)
|
||||||
{
|
{
|
||||||
Con_Printf ("TexMgr_FreeTexture: NULL texture\n");
|
Con_Printf ("TexMgr_FreeTexture: NULL texture\n");
|
||||||
|
@ -1390,18 +1396,23 @@ void TexMgr_ReloadImages (void)
|
||||||
{
|
{
|
||||||
gltexture_t *glt;
|
gltexture_t *glt;
|
||||||
|
|
||||||
// ericw -- flush the cache before reloading textures. This avoids an obscure
|
// ericw -- tricky bug: if the hunk is almost full, an allocation in TexMgr_ReloadImage
|
||||||
// bug where, if the hunk is almost full, an allocation in TexMgr_ReloadImage
|
|
||||||
// triggers cache items to be freed, which calls back into TexMgr to free the
|
// triggers cache items to be freed, which calls back into TexMgr to free the
|
||||||
// texture. Calling TexMgr_FreeTexture within the loop below causes things to
|
// texture. If this frees 'glt' in the loop below, the active_gltextures
|
||||||
// go haywire. A test case is jam3_tronyn.bsp with -heapsize 65536
|
// list gets corrupted.
|
||||||
Cache_Flush();
|
// A test case is jam3_tronyn.bsp with -heapsize 65536, and do several mode
|
||||||
|
// switches/fullscreen toggles
|
||||||
|
// 2015-09-04 -- Cache_Flush workaround was causing issues (http://sourceforge.net/p/quakespasm/bugs/10/)
|
||||||
|
// switching to a boolean flag.
|
||||||
|
in_reload_images = true;
|
||||||
|
|
||||||
for (glt = active_gltextures; glt; glt = glt->next)
|
for (glt = active_gltextures; glt; glt = glt->next)
|
||||||
{
|
{
|
||||||
glGenTextures(1, &glt->texnum);
|
glGenTextures(1, &glt->texnum);
|
||||||
TexMgr_ReloadImage (glt, -1, -1);
|
TexMgr_ReloadImage (glt, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
in_reload_images = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue