Fix CopyTexSubImage validation.

Now that we preserve the sized-ness information, we can validate
CopyTexSubImage and related methods correctly.

Fixed a lot of WebGL 2 tests when using ANGLE.

BUG=angleproject:1228

Change-Id: I959322c0a9bb16a2f16d60dce7cd1e63ca95b45a
Reviewed-on: https://chromium-review.googlesource.com/362618
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index ab575f1..1bbfe86 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1649,7 +1649,7 @@
                                         GLsizei width,
                                         GLsizei height,
                                         GLint border,
-                                        GLenum *textureFormatOut)
+                                        Format *textureFormatOut)
 {
     if (level < 0 || xoffset < 0 || yoffset < 0 || zoffset < 0 || width < 0 || height < 0)
     {
@@ -1786,7 +1786,10 @@
         }
     }
 
-    *textureFormatOut = texture->getFormat(target, level).asSized();
+    if (textureFormatOut)
+    {
+        *textureFormatOut = texture->getFormat(target, level);
+    }
     return true;
 }