Fix inverted color for R5G6B5

Also add some other format that libnx might uses.
This commit is contained in:
Thog 2019-01-05 13:36:49 +01:00
commit 072d71e5ee
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
4 changed files with 10 additions and 3 deletions

View file

@ -24,6 +24,7 @@ namespace Ryujinx.Graphics.Gal
RGBA4, RGBA4,
RGB565, RGB565,
BGR565,
BGR5A1, BGR5A1,
RGB5A1, RGB5A1,
R8, R8,

View file

@ -157,6 +157,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
case GalImageFormat.BGR5A1 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgb5A1, PixelFormat.Rgba, PixelType.UnsignedShort5551); case GalImageFormat.BGR5A1 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgb5A1, PixelFormat.Rgba, PixelType.UnsignedShort5551);
case GalImageFormat.RGB5A1 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgb5A1, PixelFormat.Rgba, PixelType.UnsignedShort1555Reversed); case GalImageFormat.RGB5A1 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgb5A1, PixelFormat.Rgba, PixelType.UnsignedShort1555Reversed);
case GalImageFormat.RGB565 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgba, PixelFormat.Rgb, PixelType.UnsignedShort565Reversed); case GalImageFormat.RGB565 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgba, PixelFormat.Rgb, PixelType.UnsignedShort565Reversed);
case GalImageFormat.BGR565 | GalImageFormat.Unorm: return (PixelInternalFormat.Rgba, PixelFormat.Rgb, PixelType.UnsignedShort565);
case GalImageFormat.RG16 | GalImageFormat.Float: return (PixelInternalFormat.Rg16f, PixelFormat.Rg, PixelType.HalfFloat); case GalImageFormat.RG16 | GalImageFormat.Float: return (PixelInternalFormat.Rg16f, PixelFormat.Rg, PixelType.HalfFloat);
case GalImageFormat.RG16 | GalImageFormat.Sint: return (PixelInternalFormat.Rg16i, PixelFormat.RgInteger, PixelType.Short); case GalImageFormat.RG16 | GalImageFormat.Sint: return (PixelInternalFormat.Rg16i, PixelFormat.RgInteger, PixelType.Short);
case GalImageFormat.RG16 | GalImageFormat.Snorm: return (PixelInternalFormat.Rg16Snorm, PixelFormat.Rg, PixelType.Short); case GalImageFormat.RG16 | GalImageFormat.Snorm: return (PixelInternalFormat.Rg16Snorm, PixelFormat.Rg, PixelType.Short);

View file

@ -106,6 +106,7 @@ namespace Ryujinx.Graphics.Texture
{ GalImageFormat.BGR5A1, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) }, { GalImageFormat.BGR5A1, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
{ GalImageFormat.RGB5A1, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) }, { GalImageFormat.RGB5A1, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
{ GalImageFormat.RGB565, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) }, { GalImageFormat.RGB565, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
{ GalImageFormat.BGR565, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
{ GalImageFormat.BptcUnorm, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) }, { GalImageFormat.BptcUnorm, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
{ GalImageFormat.RG16, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) }, { GalImageFormat.RG16, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
{ GalImageFormat.RG8, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) }, { GalImageFormat.RG8, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },

View file

@ -356,11 +356,15 @@ namespace Ryujinx.HLE.HOS.Services.Android
switch (colorFormat) switch (colorFormat)
{ {
case ColorFormat.A8B8G8R8: case ColorFormat.A8B8G8R8:
return GalImageFormat.RGBA8 | GalImageFormat.Unorm; return GalImageFormat.RGBA8 | GalImageFormat.Unorm;
case ColorFormat.X8B8G8R8: case ColorFormat.X8B8G8R8:
return GalImageFormat.RGBX8 | GalImageFormat.Unorm; return GalImageFormat.RGBX8 | GalImageFormat.Unorm;
case ColorFormat.R5G6B5: case ColorFormat.R5G6B5:
return GalImageFormat.RGB565 | GalImageFormat.Unorm; return GalImageFormat.BGR565 | GalImageFormat.Unorm;
case ColorFormat.A8R8G8B8:
return GalImageFormat.BGRA8 | GalImageFormat.Unorm;
case ColorFormat.A4B4G4R4:
return GalImageFormat.RGBA4 | GalImageFormat.Unorm;
default: default:
throw new NotImplementedException($"Color Format \"{colorFormat}\" not implemented!"); throw new NotImplementedException($"Color Format \"{colorFormat}\" not implemented!");
} }