Vulkan: dEQP-EGL.functional.image.modify.*

Determine the destination internalFormat correctly.

dEQP-EGL.functional.image.modify.renderbuffer_rgb565_tex_subimage_rgb8
dEQP-EGL.functional.image.modify.renderbuffer_rgba4_tex_subimage_rgba8
dEQP-EGL.functional.image.modify.tex_rgb565_tex_subimage_rgb8
dEQP-EGL.functional.image.modify.tex_rgba4_tex_subimage_rgba8
dEQP-EGL.functional.image.modify.tex_rgba8_tex_subimage_rgba5_a1
dEQP-EGL.functional.image.modify.tex_rgba8_tex_subimage_rgba4
dEQP-EGL.functional.image.modify.tex_rgba5_a1_tex_subimage_rgba8
dEQP-EGL.functional.image.modify.tex_rgba5_a1_tex_subimage_rgba4
dEQP-EGL.functional.image.modify.tex_rgba4_tex_subimage_rgba8
dEQP-EGL.functional.image.modify.tex_rgba4_tex_subimage_rgba5_a1
dEQP-EGL.functional.image.modify.renderbuffer_rgba4_tex_subimage_rgba8
dEQP-EGL.functional.image.modify.renderbuffer_rgba4_tex_subimage_rgba5_a1
dEQP-EGL.functional.image.modify.renderbuffer_rgb5_a1_tex_subimage_rgba8
dEQP-EGL.functional.image.modify.renderbuffer_rgb5_a1_tex_subimage_rgba4

Bug: angleproject:3170
Change-Id: Ic9870390b2d4a0dcbe561efd3fb1597faadb7d79
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1524404
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index ffbf24c..035ddff 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -1646,12 +1646,18 @@
             return false;
         }
 
-        if (format != GL_NONE)
+        if (format != textureInternalFormat.format)
+        {
+            context->validationError(GL_INVALID_OPERATION, err::kTextureFormatMismatch);
+            return false;
+        }
+
+        if (context->getExtensions().webglCompatibility)
         {
             if (GetInternalFormatInfo(format, type).sizedInternalFormat !=
                 textureInternalFormat.sizedInternalFormat)
             {
-                context->validationError(GL_INVALID_OPERATION, kTypeMismatch);
+                context->validationError(GL_INVALID_OPERATION, kTextureTypeMismatch);
                 return false;
             }
         }