Texture.ConvertToHostCompatibleFormat(): dispose of result
in Astc decode branch
This commit is contained in:
parent
f3c73c77a9
commit
1928beff73
1 changed files with 25 additions and 22 deletions
|
@ -794,31 +794,34 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
// - BC4/BC5 is not supported on 3D textures.
|
// - BC4/BC5 is not supported on 3D textures.
|
||||||
if (!_context.Capabilities.SupportsAstcCompression && Format.IsAstc())
|
if (!_context.Capabilities.SupportsAstcCompression && Format.IsAstc())
|
||||||
{
|
{
|
||||||
if (!AstcDecoder.TryDecodeToRgba8P(
|
using (result)
|
||||||
result.Memory,
|
|
||||||
Info.FormatInfo.BlockWidth,
|
|
||||||
Info.FormatInfo.BlockHeight,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
sliceDepth,
|
|
||||||
levels,
|
|
||||||
layers,
|
|
||||||
out IMemoryOwner<byte> decoded))
|
|
||||||
{
|
{
|
||||||
string texInfo = $"{Info.Target} {Info.FormatInfo.Format} {Info.Width}x{Info.Height}x{Info.DepthOrLayers} levels {Info.Levels}";
|
if (!AstcDecoder.TryDecodeToRgba8P(
|
||||||
|
result.Memory,
|
||||||
Logger.Debug?.Print(LogClass.Gpu, $"Invalid ASTC texture at 0x{Info.GpuAddress:X} ({texInfo}).");
|
Info.FormatInfo.BlockWidth,
|
||||||
}
|
Info.FormatInfo.BlockHeight,
|
||||||
|
width,
|
||||||
if (GraphicsConfig.EnableTextureRecompression)
|
height,
|
||||||
{
|
sliceDepth,
|
||||||
using (decoded)
|
levels,
|
||||||
|
layers,
|
||||||
|
out IMemoryOwner<byte> decoded))
|
||||||
{
|
{
|
||||||
return BCnEncoder.EncodeBC7(decoded.Memory, width, height, sliceDepth, levels, layers);
|
string texInfo = $"{Info.Target} {Info.FormatInfo.Format} {Info.Width}x{Info.Height}x{Info.DepthOrLayers} levels {Info.Levels}";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return decoded;
|
Logger.Debug?.Print(LogClass.Gpu, $"Invalid ASTC texture at 0x{Info.GpuAddress:X} ({texInfo}).");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GraphicsConfig.EnableTextureRecompression)
|
||||||
|
{
|
||||||
|
using (decoded)
|
||||||
|
{
|
||||||
|
return BCnEncoder.EncodeBC7(decoded.Memory, width, height, sliceDepth, levels, layers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!_context.Capabilities.SupportsEtc2Compression && Format.IsEtc2())
|
else if (!_context.Capabilities.SupportsEtc2Compression && Format.IsEtc2())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue