Vulkan: Support RGB5A1 correctly

Bug: angleproject:2649
Bug: angleproject:2597
Change-Id: I2fd7185463d92737454e383fbfb7992e8d68fe68
Reviewed-on: https://chromium-review.googlesource.com/1097221
Commit-Queue: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/renderer_utils.cpp b/src/libANGLE/renderer/renderer_utils.cpp
index e2e3507..5bfecd1 100644
--- a/src/libANGLE/renderer/renderer_utils.cpp
+++ b/src/libANGLE/renderer/renderer_utils.cpp
@@ -329,21 +329,20 @@
         inputPitch = -inputPitch;
     }
 
-    const auto &sourceGLInfo = gl::GetSizedInternalFormatInfo(sourceFormat.glInternalFormat);
+    const gl::InternalFormat &internalFormat =
+        gl::GetInternalFormatInfo(params.format, params.type);
 
-    if (sourceGLInfo.format == params.format && sourceGLInfo.type == params.type)
+    if (sourceFormat.glInternalFormat == internalFormat.sizedInternalFormat)
     {
         // Direct copy possible
         for (int y = 0; y < params.area.height; ++y)
         {
             memcpy(destWithOffset + y * params.outputPitch, source + y * inputPitch,
-                   params.area.width * sourceGLInfo.pixelBytes);
+                   params.area.width * sourceFormat.pixelBytes);
         }
         return;
     }
 
-    ASSERT(sourceGLInfo.sized);
-
     gl::FormatType formatType(params.format, params.type);
     ColorCopyFunction fastCopyFunc =
         GetFastCopyFunction(sourceFormat.fastCopyFunctions, formatType);
@@ -358,7 +357,7 @@
             {
                 uint8_t *dest =
                     destWithOffset + y * params.outputPitch + x * destFormatInfo.pixelBytes;
-                const uint8_t *src = source + y * inputPitch + x * sourceGLInfo.pixelBytes;
+                const uint8_t *src = source + y * inputPitch + x * sourceFormat.pixelBytes;
 
                 fastCopyFunc(src, dest);
             }
@@ -381,7 +380,7 @@
         for (int x = 0; x < params.area.width; ++x)
         {
             uint8_t *dest      = destWithOffset + y * params.outputPitch + x * destFormatInfo.pixelBytes;
-            const uint8_t *src = source + y * inputPitch + x * sourceGLInfo.pixelBytes;
+            const uint8_t *src = source + y * inputPitch + x * sourceFormat.pixelBytes;
 
             // readFunc and writeFunc will be using the same type of color, CopyTexImage
             // will not allow the copy otherwise.