glTexSubImage2D should always allow non-power-of-two inputs

If GL_OES_texture_npot isn't active then ANGLE currently prevents
calls to glTexSubImage2D with:
- level > 0
- width/height NPOT

This isn't correct. It is legitimate to supply data to a NPOT subregion of a
POT texture via glTexSubImage2D.

Fixes these dEQP tests on 9_3:
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.a8_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.a8_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.l8_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.l8_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.la88_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.la88_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgb565_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgb565_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgb888_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgb888_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgba4444_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgba4444_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgba5551_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgba5551_cube
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgba8888_2d
dEQP-GLES2.functional.texture.specification.basic_texsubimage2d.rgba8888_cube

Change-Id: I5889a27edbfa807995fa20b16f36456f676b80fc
Reviewed-on: https://chromium-review.googlesource.com/304612
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Austin Kinross <aukinros@microsoft.com>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index d233931..b9ea872 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -243,15 +243,22 @@
     return level <= gl::log2(static_cast<int>(maxDimension));
 }
 
-bool ValidImageSize(const Context *context, GLenum target, GLint level,
-                    GLsizei width, GLsizei height, GLsizei depth)
+bool ValidImageSizeParameters(const Context *context,
+                              GLenum target,
+                              GLint level,
+                              GLsizei width,
+                              GLsizei height,
+                              GLsizei depth,
+                              bool isSubImage)
 {
     if (level < 0 || width < 0 || height < 0 || depth < 0)
     {
         return false;
     }
 
-    if (!context->getExtensions().textureNPOT &&
+    // TexSubImage parameters can be NPOT without textureNPOT extension,
+    // as long as the destination texture is POT.
+    if (!isSubImage && !context->getExtensions().textureNPOT &&
         (level != 0 && (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
     {
         return false;