mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Maybe improve error handling when unable to create mipmaps.
This commit is contained in:
parent
960c936f8d
commit
58c74e839c
1 changed files with 15 additions and 3 deletions
|
|
@ -130,9 +130,21 @@ public partial class CombinedTexture : IDisposable
|
|||
}
|
||||
|
||||
private static ScratchImage AddMipMaps( ScratchImage input, bool mipMaps )
|
||||
=> mipMaps
|
||||
? input.GenerateMipMaps( Math.Min( 13, 1 + BitOperations.Log2( ( uint )Math.Max( input.Meta.Width, input.Meta.Height ) ) ), FilterFlags.SeparateAlpha )
|
||||
: input;
|
||||
{
|
||||
if( !mipMaps )
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
var numMips = Math.Min( 13, 1 + BitOperations.Log2( ( uint )Math.Max( input.Meta.Width, input.Meta.Height ) ) );
|
||||
var ec = input.GenerateMipMaps( out var ret, numMips, FilterFlags.SeparateAlpha );
|
||||
if (ec != ErrorCode.Ok)
|
||||
{
|
||||
throw new Exception( $"Could not create the requested {numMips} mip maps, maybe retry with the top-right checkbox unchecked:\n{ec}" );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static ScratchImage CreateUncompressed( ScratchImage input, bool mipMaps )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue