OpenGL ES: enable StorageTextureTests.

Disable 32-bit-per-component RG* format tests, since those formats are
unsupported on OpenGL ES.

BUG=dawn:580, dawn:595

Change-Id: I0bc3b03c65bbf15c7c38937ed84629c61201ff76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34780
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/tests/end2end/StorageTextureTests.cpp b/src/tests/end2end/StorageTextureTests.cpp
index 536766a..985bf68 100644
--- a/src/tests/end2end/StorageTextureTests.cpp
+++ b/src/tests/end2end/StorageTextureTests.cpp
@@ -21,6 +21,14 @@
 #include "utils/TextureFormatUtils.h"
 #include "utils/WGPUHelpers.h"
 
+namespace {
+    bool OpenGLESSupportsStorageTexture(wgpu::TextureFormat format) {
+        // TODO(crbug.com/dawn/595): 32-bit RG* formats are unsupported on OpenGL ES.
+        return format != wgpu::TextureFormat::RG32Float &&
+               format != wgpu::TextureFormat::RG32Sint && format != wgpu::TextureFormat::RG32Uint;
+    }
+}  // namespace
+
 class StorageTextureTests : public DawnTest {
   public:
     static void FillExpectedData(void* pixelValuePtr,
@@ -707,6 +715,9 @@
         if (!utils::TextureFormatSupportsStorageTexture(format)) {
             continue;
         }
+        if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
+            continue;
+        }
 
         // Prepare the read-only storage texture and fill it with the expected data.
         const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
@@ -741,6 +752,9 @@
         if (!utils::TextureFormatSupportsStorageTexture(format)) {
             continue;
         }
+        if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
+            continue;
+        }
 
         // Prepare the read-only storage texture and fill it with the expected data.
         const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
@@ -781,6 +795,9 @@
         if (!utils::TextureFormatSupportsStorageTexture(format)) {
             continue;
         }
+        if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
+            continue;
+        }
 
         // Prepare the read-only storage texture and fill it with the expected data.
         const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
@@ -809,6 +826,9 @@
 
 // Test that write-only storage textures are supported in compute shader.
 TEST_P(StorageTextureTests, WriteonlyStorageTextureInComputeShader) {
+    // TODO(crbug.com/dawn/581): this test requires glClearTexSubImage(), unsupported on GLES.
+    DAWN_SKIP_TEST_IF(IsOpenGLES());
+
     for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
         if (!utils::TextureFormatSupportsStorageTexture(format)) {
             continue;
@@ -836,6 +856,8 @@
 // Test that reading from one read-only storage texture then writing into another write-only storage
 // texture in one dispatch are supported in compute shader.
 TEST_P(StorageTextureTests, ReadWriteDifferentStorageTextureInOneDispatchInComputeShader) {
+    // TODO(crbug.com/dawn/581): this test requires glClearTexSubImage(), unsupported on GLES.
+    DAWN_SKIP_TEST_IF(IsOpenGLES());
     for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
         if (!utils::TextureFormatSupportsStorageTexture(format)) {
             continue;
@@ -868,6 +890,8 @@
 
 // Test that write-only storage textures are supported in fragment shader.
 TEST_P(StorageTextureTests, WriteonlyStorageTextureInFragmentShader) {
+    // TODO(crbug.com/dawn/581): this test requires glClearTexSubImage(), unsupported on GLES.
+    DAWN_SKIP_TEST_IF(IsOpenGLES());
     for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
         if (!utils::TextureFormatSupportsStorageTexture(format)) {
             continue;
@@ -927,6 +951,8 @@
 
 // Verify 2D array write-only storage texture works correctly.
 TEST_P(StorageTextureTests, Writeonly2DArrayStorageTexture) {
+    // TODO(crbug.com/dawn/581): this test requires glClearTexSubImage(), unsupported on GLES.
+    DAWN_SKIP_TEST_IF(IsOpenGLES());
     constexpr uint32_t kArrayLayerCount = 3u;
 
     constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
@@ -947,6 +973,8 @@
 // Test that multiple dispatches to increment values by ping-ponging between a read-only storage
 // texture and a write-only storage texture are synchronized in one pass.
 TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
+    // TODO(crbug.com/dawn/581): this test requires glClearTexSubImage(), unsupported on GLES.
+    DAWN_SKIP_TEST_IF(IsOpenGLES());
     constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
     wgpu::Texture storageTexture1 = CreateTexture(
         kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u, 1u);
@@ -1022,6 +1050,8 @@
 // Test that multiple dispatches to increment values by ping-ponging between a sampled texture and
 // a write-only storage texture are synchronized in one pass.
 TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
+    // TODO(crbug.com/dawn/581): this test requires glClearTexSubImage(), unsupported on GLES.
+    DAWN_SKIP_TEST_IF(IsOpenGLES());
     constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
     wgpu::Texture storageTexture1 = CreateTexture(
         kTextureFormat,
@@ -1105,6 +1135,7 @@
                       D3D12Backend(),
                       MetalBackend(),
                       OpenGLBackend(),
+                      OpenGLESBackend(),
                       VulkanBackend());
 
 class StorageTextureZeroInitTests : public StorageTextureTests {