public bool RecreateIfDefaultPool( D3D.Device device )
{
bool ret = false;
if ( this._d3dPool == D3D.Pool.Default )
{
ret = true;
LogManager.Instance.Write( "Recreating D3D9 default pool texture: {0}", Name );
// We just want to create the texture resources if:
// 1. This is a render texture, or
// 2. This is a manual texture with no loader, or
// 3. This was an unloaded regular texture (preserve unloaded state)
////Debug.Assert( false, "Recreation of D3D9 textures is not yet implemented" );
if ( ( IsManuallyLoaded && loader == null ) || ( Usage & TextureUsage.RenderTarget ) != 0 || !IsLoaded )
{
// Just recreate any internal resources
CreateInternalResources();
}
else
{
// Otherwise, this is a regular loaded texture, or a manual texture with a loader
// The internal resources already freed, need unload/load here:
// 1. Make sure resource memory usage statistic correction.
// 2. Don't call unload() in releaseIfDefaultPool() because we want
// the un-touched resource keep unload status after device reset.
this.Unload();
if ( IsManuallyLoaded )
{
this.CreateInternalResources();
}
this.Load();
}
LogManager.Instance.Write( "Recreated D3D9 default pool texture: {0}", Name );
}
return ret;
}