Add InvalidateTextures; change reload behavior. (breaks reloading

until I get the rest committed in a moment)
This commit is contained in:
Glenn Maynard
2002-11-12 09:21:44 +00:00
parent 92bfe3d484
commit 58dbd9bdb3
3 changed files with 29 additions and 3 deletions
+2
View File
@@ -61,6 +61,8 @@ public:
int m_iRefCount;
int m_iTimeOfLastUnload;
/* only called by RageTextureManager::InvalidateTextures */
virtual void Invalidate() { }
virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay
protected:
+24 -2
View File
@@ -183,10 +183,32 @@ void RageTextureManager::ReloadAll()
}
}
void RageTextureManager::SetPrefs( int iTextureColorDepth, int iSecondsBeforeUnload )
/* In some cases, changing the display mode will reset the rendering context,
* releasing all textures. We don't want to reload immediately if that happens,
* since we might be changing texture preferences too, which also may have to reload
* textures. Instead, tell all textures that their texutre ID is invalid, so it
* doesn't try to free it later when we really do reload (since that ID might be
* associated with a different texture). Ack. */
void RageTextureManager::InvalidateTextures()
{
for( std::map<CString, RageTexture*>::iterator i = m_mapPathToTexture.begin();
i != m_mapPathToTexture.end(); ++i)
{
RageTexture* pTexture = i->second;
pTexture->Invalidate();
}
}
bool RageTextureManager::SetPrefs( int iTextureColorDepth, int iSecondsBeforeUnload )
{
bool need_reload = false;
if(m_iSecondsBeforeUnload != iSecondsBeforeUnload ||
m_iTextureColorDepth != iTextureColorDepth)
need_reload = true;
m_iSecondsBeforeUnload = iSecondsBeforeUnload;
m_iTextureColorDepth = iTextureColorDepth;
ASSERT( m_iTextureColorDepth==16 || m_iTextureColorDepth==32 );
ReloadAll();
return need_reload;
}
+3 -1
View File
@@ -27,10 +27,12 @@ public:
void UnloadTexture( CString sTexturePath );
void ReloadAll();
void SetPrefs( int iTextureColorDepth, int iSecsBeforeUnload );
bool SetPrefs( int iTextureColorDepth, int iSecsBeforeUnload );
int GetTextureColorDepth() { return m_iTextureColorDepth; };
int GetSecsBeforeUnload() { return m_iSecondsBeforeUnload; };
void InvalidateTextures();
protected:
void GCTextures();