mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-18 03:24:15 -04:00
Optimize memory consumption of swizzled textures
This commit is contained in:
@ -92,7 +92,18 @@ namespace AssetStudio
|
||||
reader.GetData(buff);
|
||||
if (switchSwizzled)
|
||||
{
|
||||
buff = Texture2DSwitchDeswizzler.Unswizzle(buff, GetUncroppedSize(), blockSize, gobsPerBlock);
|
||||
var unswizzledData = BigArrayPool<byte>.Shared.Rent(reader.Size);
|
||||
try
|
||||
{
|
||||
Texture2DSwitchDeswizzler.Unswizzle(buff, GetUncroppedSize(), blockSize, gobsPerBlock, unswizzledData);
|
||||
BigArrayPool<byte>.Shared.Return(buff, clearArray: true);
|
||||
buff = unswizzledData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BigArrayPool<byte>.Shared.Return(unswizzledData, clearArray: true);
|
||||
Logger.Error(e.Message, e);
|
||||
}
|
||||
}
|
||||
|
||||
switch (m_TextureFormat)
|
||||
|
Reference in New Issue
Block a user