From e5917f896847b7d76ec98d846af87804fcd47a2e Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Tue, 11 Sep 2018 12:48:13 -0300
Subject: [PATCH] Fixup image error message and add G8R8 to size query (#410)

---
 Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs | 4 ++--
 Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs       | 2 +-
 Ryujinx.Graphics/Texture/ImageUtils.cs          | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs
index 1d4f4cf777..69c133a335 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs
@@ -176,7 +176,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
                 case GalImageFormat.D32_S8 | GalImageFormat.Uint:   return (PixelInternalFormat.Depth32fStencil8,  PixelFormat.DepthStencil,   PixelType.Float32UnsignedInt248Rev);
             }
 
-            throw new NotImplementedException(Format.ToString());
+            throw new NotImplementedException($"{Format & GalImageFormat.FormatMask} {Format & GalImageFormat.TypeMask}");
         }
 
         public static InternalFormat GetCompressedImageFormat(GalImageFormat Format)
@@ -195,7 +195,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
                 case GalImageFormat.BC5       | GalImageFormat.Unorm: return InternalFormat.CompressedRgRgtc2;
             }
 
-            throw new NotImplementedException(Format.ToString());
+            throw new NotImplementedException($"{Format & GalImageFormat.FormatMask} {Format & GalImageFormat.TypeMask}");
         }
 
         public static All GetTextureSwizzle(GalTextureSource Source)
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
index 82f9c9139c..7e1c0e5354 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs
@@ -82,7 +82,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
                         Image.Height,
                         1);
 
-                    Image.Format = GalImageFormat.R8G8 | (Image.Format & GalImageFormat.FormatMask);
+                    Image.Format = GalImageFormat.R8G8 | (Image.Format & GalImageFormat.TypeMask);
                 }
 
                 (PixelInternalFormat InternalFormat, PixelFormat Format, PixelType Type) = OGLEnumConverter.GetImageFormat(Image.Format);
diff --git a/Ryujinx.Graphics/Texture/ImageUtils.cs b/Ryujinx.Graphics/Texture/ImageUtils.cs
index ccea43ec1c..c09eaf8693 100644
--- a/Ryujinx.Graphics/Texture/ImageUtils.cs
+++ b/Ryujinx.Graphics/Texture/ImageUtils.cs
@@ -235,6 +235,7 @@ namespace Ryujinx.Graphics.Texture
                 case GalImageFormat.A1R5G5B5:
                 case GalImageFormat.B5G6R5:
                 case GalImageFormat.R8G8:
+                case GalImageFormat.G8R8:
                 case GalImageFormat.R16:
                 case GalImageFormat.D16:
                     return Image.Width * Image.Height * 2;