Update end2end tests to function without EXT_texture_storage.

This also exposed an issue in our glTexSubImage2D validation where the
sized format would be used for the texture support check when the unsized
format was provided.  The GL_ALPHA32F format is not valid unless
EXT_texture_storage is present but using GL_ALPHA + GL_FLOAT is valid.

BUG=angleproject:1958

Change-Id: Ice0b7549c39559990942176481c5175df17aaf92
Reviewed-on: https://chromium-review.googlesource.com/491246
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/FramebufferTest.cpp b/src/tests/gl_tests/FramebufferTest.cpp
index f87b0b6..6ed4f8f 100644
--- a/src/tests/gl_tests/FramebufferTest.cpp
+++ b/src/tests/gl_tests/FramebufferTest.cpp
@@ -66,7 +66,15 @@
     {
         glGenTextures(1, &mTexture);
         glBindTexture(GL_TEXTURE_2D, mTexture);
-        glTexStorage2DEXT(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
+
+        if (getClientMajorVersion() >= 3)
+        {
+            glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
+        }
+        else
+        {
+            glTexStorage2DEXT(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
+        }
 
         glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0);
 
@@ -180,19 +188,34 @@
 
 TEST_P(FramebufferFormatsTest, RGBA4)
 {
+    if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"))
+    {
+        std::cout << "Test skipped due to missing ES3 or GL_EXT_texture_storage." << std::endl;
+        return;
+    }
+
     testTextureFormat(GL_RGBA4, 4, 4, 4, 4);
 }
 
 TEST_P(FramebufferFormatsTest, RGB565)
 {
+    if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"))
+    {
+        std::cout << "Test skipped due to missing ES3 or GL_EXT_texture_storage." << std::endl;
+        return;
+    }
+
     testTextureFormat(GL_RGB565, 5, 6, 5, 0);
 }
 
 TEST_P(FramebufferFormatsTest, RGB8)
 {
-    if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_rgb8_rgba8"))
+    if (getClientMajorVersion() < 3 &&
+        (!extensionEnabled("GL_OES_rgb8_rgba8") || !extensionEnabled("GL_EXT_texture_storage")))
     {
-        std::cout << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8." << std::endl;
+        std::cout
+            << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8 and GL_EXT_texture_storage."
+            << std::endl;
         return;
     }
 
@@ -201,9 +224,12 @@
 
 TEST_P(FramebufferFormatsTest, BGRA8)
 {
-    if (!extensionEnabled("GL_EXT_texture_format_BGRA8888"))
+    if (!extensionEnabled("GL_EXT_texture_format_BGRA8888") ||
+        (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage")))
     {
-        std::cout << "Test skipped due to missing GL_EXT_texture_format_BGRA8888." << std::endl;
+        std::cout << "Test skipped due to missing GL_EXT_texture_format_BGRA8888 or "
+                     "GL_EXT_texture_storage."
+                  << std::endl;
         return;
     }
 
@@ -212,9 +238,12 @@
 
 TEST_P(FramebufferFormatsTest, RGBA8)
 {
-    if (getClientMajorVersion() < 3 && !extensionEnabled("GL_OES_rgb8_rgba8"))
+    if (getClientMajorVersion() < 3 &&
+        (!extensionEnabled("GL_OES_rgb8_rgba8") || !extensionEnabled("GL_EXT_texture_storage")))
     {
-        std::cout << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8." << std::endl;
+        std::cout
+            << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8 and GL_EXT_texture_storage."
+            << std::endl;
         return;
     }