add RageTextureID::TEX_PERMANENT
This commit is contained in:
@@ -53,7 +53,7 @@ struct RageTextureID
|
|||||||
* Note that this property is not considered for ordering/equality. Loading
|
* Note that this property is not considered for ordering/equality. Loading
|
||||||
* a texture with a different loading policy will reuse the same texture with
|
* a texture with a different loading policy will reuse the same texture with
|
||||||
* a different policy. */
|
* a different policy. */
|
||||||
enum TexPolicy { TEX_CACHED, TEX_VOLATILE, TEX_DEFAULT } Policy;
|
enum TexPolicy { TEX_PERMANENT, TEX_CACHED, TEX_VOLATILE, TEX_DEFAULT } Policy;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,11 @@
|
|||||||
* player could actually view all banners long enough to transition to them
|
* player could actually view all banners long enough to transition to them
|
||||||
* all in the course of one song select screen.
|
* all in the course of one song select screen.
|
||||||
*
|
*
|
||||||
* Policy priority is in the order CACHED, VOLATILE, DEFAULT. Textures that are
|
* Permanent: Never delete the texture.
|
||||||
* loaded DEFAULT can be changed to VOLATILE and CACHED; VOLATILE textures can only
|
* This is only used for BannerCache=2 mode.
|
||||||
|
*
|
||||||
|
* Policy priority is in the order PERMANENT, CACHED, VOLATILE, DEFAULT. Textures that
|
||||||
|
* are loaded DEFAULT can be changed to VOLATILE and CACHED; VOLATILE textures can only
|
||||||
* be changed to CACHED. CACHED flags are normally set explicitly on a per-texture
|
* be changed to CACHED. CACHED flags are normally set explicitly on a per-texture
|
||||||
* basis. VOLATILE flags are set for all banners, but banners which are explicitly
|
* basis. VOLATILE flags are set for all banners, but banners which are explicitly
|
||||||
* set to CACHED should stay CACHED. Finally, all textures, when they're finally used,
|
* set to CACHED should stay CACHED. Finally, all textures, when they're finally used,
|
||||||
@@ -153,6 +156,13 @@ void RageTextureManager::VolatileTexture( RageTextureID ID )
|
|||||||
UnloadTexture( pTexture );
|
UnloadTexture( pTexture );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RageTextureManager::PermanentTexture( RageTextureID ID )
|
||||||
|
{
|
||||||
|
RageTexture* pTexture = LoadTextureInternal( ID );
|
||||||
|
pTexture->GetPolicy() = min( pTexture->GetPolicy(), RageTextureID::TEX_PERMANENT );
|
||||||
|
UnloadTexture( pTexture );
|
||||||
|
}
|
||||||
|
|
||||||
void RageTextureManager::UnloadTexture( RageTexture *t )
|
void RageTextureManager::UnloadTexture( RageTexture *t )
|
||||||
{
|
{
|
||||||
t->m_iRefCount--;
|
t->m_iRefCount--;
|
||||||
@@ -161,6 +171,8 @@ void RageTextureManager::UnloadTexture( RageTexture *t )
|
|||||||
if( t->m_iRefCount )
|
if( t->m_iRefCount )
|
||||||
return; /* Can't unload textures that are still referenced. */
|
return; /* Can't unload textures that are still referenced. */
|
||||||
|
|
||||||
|
if( t->GetPolicy() == RageTextureID::TEX_PERMANENT )
|
||||||
|
return; /* Never unload TEX_PERMANENT textures. */
|
||||||
bool bDeleteThis = false;
|
bool bDeleteThis = false;
|
||||||
|
|
||||||
/* Always unload movies, so we don't waste time decoding.
|
/* Always unload movies, so we don't waste time decoding.
|
||||||
@@ -219,6 +231,8 @@ void RageTextureManager::GarbageCollect( GCType type )
|
|||||||
|
|
||||||
if( t->m_iRefCount )
|
if( t->m_iRefCount )
|
||||||
continue; /* Can't unload textures that are still referenced. */
|
continue; /* Can't unload textures that are still referenced. */
|
||||||
|
if( t->GetPolicy() == RageTextureID::TEX_PERMANENT )
|
||||||
|
return; /* Never unload TEX_PERMANENT textures. */
|
||||||
|
|
||||||
bool bDeleteThis = false;
|
bool bDeleteThis = false;
|
||||||
if( type==screen_changed )
|
if( type==screen_changed )
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public:
|
|||||||
void RegisterTexture( RageTextureID ID, RageTexture *p );
|
void RegisterTexture( RageTextureID ID, RageTexture *p );
|
||||||
void CacheTexture( RageTextureID ID );
|
void CacheTexture( RageTextureID ID );
|
||||||
void VolatileTexture( RageTextureID ID );
|
void VolatileTexture( RageTextureID ID );
|
||||||
|
void PermanentTexture( RageTextureID ID );
|
||||||
void UnloadTexture( RageTexture *t );
|
void UnloadTexture( RageTexture *t );
|
||||||
void ReloadAll();
|
void ReloadAll();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user