diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Texture.cs | 35 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs | 21 |
2 files changed, 54 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index 904c908f..0995314d 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -911,7 +911,40 @@ namespace Ryujinx.Graphics.Gpu.Image } else if (!_context.Capabilities.SupportsR4G4Format && Format == Format.R4G4Unorm) { - result = PixelConverter.ConvertR4G4ToR4G4B4A4(result); + result = PixelConverter.ConvertR4G4ToR4G4B4A4(result, width); + + if (!_context.Capabilities.SupportsR4G4B4A4Format) + { + result = PixelConverter.ConvertR4G4B4A4ToR8G8B8A8(result, width); + } + } + else if (Format == Format.R4G4B4A4Unorm) + { + if (!_context.Capabilities.SupportsR4G4B4A4Format) + { + result = PixelConverter.ConvertR4G4B4A4ToR8G8B8A8(result, width); + } + } + else if (!_context.Capabilities.Supports5BitComponentFormat && Format.Is16BitPacked()) + { + switch (Format) + { + case Format.B5G6R5Unorm: + case Format.R5G6B5Unorm: + result = PixelConverter.ConvertR5G6B5ToR8G8B8A8(result, width); + break; + case Format.B5G5R5A1Unorm: + case Format.R5G5B5X1Unorm: + case Format.R5G5B5A1Unorm: + result = PixelConverter.ConvertR5G5B5ToR8G8B8A8(result, width, Format == Format.R5G5B5X1Unorm); + break; + case Format.A1B5G5R5Unorm: + result = PixelConverter.ConvertA1B5G5R5ToR8G8B8A8(result, width); + break; + case Format.R4G4B4A4Unorm: + result = PixelConverter.ConvertR4G4B4A4ToR8G8B8A8(result, width); + break; + } } return result; diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs index 642e03b6..7ec4c7ac 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs @@ -132,7 +132,26 @@ namespace Ryujinx.Graphics.Gpu.Image if (!caps.SupportsR4G4Format && info.FormatInfo.Format == Format.R4G4Unorm) { - return new FormatInfo(Format.R4G4B4A4Unorm, 1, 1, 2, 4); + if (caps.SupportsR4G4B4A4Format) + { + return new FormatInfo(Format.R4G4B4A4Unorm, 1, 1, 2, 4); + } + else + { + return new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4); + } + } + + if (info.FormatInfo.Format == Format.R4G4B4A4Unorm) + { + if (!caps.SupportsR4G4B4A4Format) + { + return new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4); + } + } + else if (!caps.Supports5BitComponentFormat && info.FormatInfo.Format.Is16BitPacked()) + { + return new FormatInfo(info.FormatInfo.Format.IsBgr() ? Format.B8G8R8A8Unorm : Format.R8G8B8A8Unorm, 1, 1, 4, 4); } return info.FormatInfo; |
