Enable all the tests which were blocked on WriteTexture.

Bug: dawn:483 dawn:643
Change-Id: Id6b6f0d1ff039eda3156bc371e6c722b3c72ac96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/tests/end2end/CopyTextureForBrowserTests.cpp b/src/tests/end2end/CopyTextureForBrowserTests.cpp
index d326d71..dcb425e 100644
--- a/src/tests/end2end/CopyTextureForBrowserTests.cpp
+++ b/src/tests/end2end/CopyTextureForBrowserTests.cpp
@@ -90,9 +90,6 @@
 
         wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
 
-        // Use writeTexture to populate the current slice of the texture in
-        // `level` mip level for all platforms except OpenGL.
-        // TODO(shaobo.yan@intel.com): OpenGL doesn't have 'WriteTexture' implementation.
         const utils::TextureDataCopyLayout copyLayout =
             utils::GetTextureDataCopyLayoutForTexture2DAtLevel(
                 kTextureFormat,
@@ -165,11 +162,6 @@
     // Tests skip due to crbug.com/dawn/592.
     DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
 
-    // OpenGL tests fails because 'WriteTexture' is unimplemented.
-    // Related bug : crbug.com/dawn/483
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     constexpr uint32_t kWidth = 10;
     constexpr uint32_t kHeight = 1;
 
@@ -186,11 +178,6 @@
     // Tests skip due to crbug.com/dawn/592.
     DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
 
-    // OpenGL tests fails because 'WriteTexture' is unimplemented.
-    // Related bug : crbug.com/dawn/483
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     constexpr uint32_t kWidth = 1000;
     constexpr uint32_t kHeight = 1;
 
@@ -207,11 +194,6 @@
     // Tests skip due to crbug.com/dawn/592.
     DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
 
-    // OpenGL tests fails because 'WriteTexture' is unimplemented.
-    // Related bug : crbug.com/dawn/483
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     constexpr uint32_t kWidth = 1;
     constexpr uint32_t kHeight = 1000;
 
@@ -228,11 +210,6 @@
     // Tests skip due to crbug.com/dawn/592.
     DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
 
-    // OpenGL tests fails because 'WriteTexture' is unimplemented.
-    // Related bug : crbug.com/dawn/483
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     constexpr uint32_t kWidth = 899;
     constexpr uint32_t kHeight = 999;
 
@@ -249,11 +226,6 @@
     // Tests skip due to crbug.com/dawn/592.
     DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
 
-    // OpenGL tests fails because 'WriteTexture' is unimplemented.
-    // Related bug : crbug.com/dawn/483
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     constexpr uint32_t kWidth = 901;
     constexpr uint32_t kHeight = 1001;
 
@@ -271,11 +243,6 @@
     // Tests skip due to crbug.com/dawn/592.
     DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
 
-    // OpenGL tests fails because 'WriteTexture' is unimplemented.
-    // Related bug : crbug.com/dawn/483
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     constexpr uint32_t kWidth = 1;
     constexpr uint32_t kHeight = 1001;
 
diff --git a/src/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/tests/end2end/GpuMemorySynchronizationTests.cpp
index e5f97f8..e0a8db7 100644
--- a/src/tests/end2end/GpuMemorySynchronizationTests.cpp
+++ b/src/tests/end2end/GpuMemorySynchronizationTests.cpp
@@ -237,10 +237,6 @@
 // Use an image as both sampled and readonly storage in a compute pass. This is a regression test
 // for the Vulkan backend choosing different layouts for Sampled and ReadOnlyStorage.
 TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
-    // TODO(dawn:483): Test is skipped on OpenGL because it uses WriteTexture which is
-    // unimplemented.
-    DAWN_SKIP_TEST_IF(IsOpenGL() || IsOpenGLES());
-
     // Create a storage + sampled texture of one texel initialized to 1
     wgpu::TextureDescriptor texDesc;
     texDesc.format = wgpu::TextureFormat::R32Uint;
diff --git a/src/tests/end2end/QueueTests.cpp b/src/tests/end2end/QueueTests.cpp
index d42ad6e..1f67082 100644
--- a/src/tests/end2end/QueueTests.cpp
+++ b/src/tests/end2end/QueueTests.cpp
@@ -178,13 +178,6 @@
 // Test a special code path: writing when dynamic uploader already contatins some unaligned
 // data, it might be necessary to use a ring buffer with properly aligned offset.
 TEST_P(QueueWriteBufferTests, UnalignedDynamicUploader) {
-    // TODO(dawn:483): Skipping test because WriteTexture inside UnalignDynamicUploader
-    // is not implemented. Moreover when using UnalignDynamicUploader we are assuming
-    // that WriteTexture implementation uses a DynamicUploader which might be false in the
-    // case of a future OpenGL implementation.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-    DAWN_SKIP_TEST_IF(IsOpenGLES());
-
     utils::UnalignDynamicUploader(device);
 
     wgpu::BufferDescriptor descriptor;
diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp
index 90fc5fa..959b531 100644
--- a/src/tests/end2end/TextureZeroInitTests.cpp
+++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -1453,9 +1453,6 @@
 
 // In this test WriteTexture fully overwrites a texture
 TEST_P(TextureZeroInitTest, WriteWholeTexture) {
-    // TODO(dawn:483): Remove this condition after implementing WriteTexture in those backends.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-
     wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
         1, 1, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc, kColorFormat);
     wgpu::Texture texture = device.CreateTexture(&descriptor);
@@ -1488,9 +1485,6 @@
 // Test WriteTexture to a subset of the texture, lazy init is necessary to clear the other
 // half.
 TEST_P(TextureZeroInitTest, WriteTextureHalf) {
-    // TODO(dawn:483): Remove this condition after implementing WriteTexture in those backends.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-
     wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
         4, 1,
         wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
@@ -1528,9 +1522,6 @@
 // In this test WriteTexture fully overwrites a range of subresources, so lazy initialization
 // is needed for neither the subresources involved in the write nor the other subresources.
 TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
-    // TODO(dawn:483): Remove this condition after implementing WriteTexture in those backends.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-
     wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
         1, 6, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc, kColorFormat);
     wgpu::Texture texture = device.CreateTexture(&descriptor);
@@ -1571,9 +1562,6 @@
 // Test WriteTexture to a subset of the subresource, lazy init is necessary to clear the other
 // half.
 TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
-    // TODO(dawn:483): Remove this condition after implementing WriteTexture in those backends.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-
     wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
         4, 6,
         wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
@@ -1618,9 +1606,6 @@
 
 // In this test WriteTexture fully overwrites a texture at mip level.
 TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
-    // TODO(dawn:483): Remove this condition after implementing WriteTexture in those backends.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-
     wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
         4, 1, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc, kColorFormat);
     wgpu::Texture texture = device.CreateTexture(&descriptor);
@@ -1657,9 +1642,6 @@
 // Test WriteTexture to a subset of the texture at mip level, lazy init is necessary to clear the
 // other half.
 TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
-    // TODO(dawn:483): Remove this condition after implementing WriteTexture in those backends.
-    DAWN_SKIP_TEST_IF(IsOpenGL());
-
     wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
         4, 1,
         wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
@@ -1860,6 +1842,9 @@
 
 // Test that 1 lazy clear count happens when we copy to half the texture
 TEST_P(CompressedTextureZeroInitTest, HalfCopyBufferToTexture) {
+    // TODO(crbug.com/dawn/643): diagnose and fix this failure on OpenGL.
+    DAWN_SKIP_TEST_IF(IsOpenGL());
+
     wgpu::TextureDescriptor textureDescriptor;
     textureDescriptor.usage =
         wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
@@ -1899,6 +1884,9 @@
 // Test that 1 lazy clear count happens when we copy buffer to half texture to a nonzero mip level
 // (with physical size different from the virtual mip size)
 TEST_P(CompressedTextureZeroInitTest, HalfCopyToNonZeroMipLevel) {
+    // TODO(crbug.com/dawn/643): diagnose and fix this failure on OpenGL.
+    DAWN_SKIP_TEST_IF(IsOpenGL());
+
     wgpu::TextureDescriptor textureDescriptor;
     textureDescriptor.usage =
         wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
@@ -1937,6 +1925,9 @@
 
 // Test that 1 lazy clear count happens when we copy buffer to half texture to a nonzero array layer
 TEST_P(CompressedTextureZeroInitTest, HalfCopyToNonZeroArrayLayer) {
+    // TODO(crbug.com/dawn/643): diagnose and fix this failure on OpenGL.
+    DAWN_SKIP_TEST_IF(IsOpenGL());
+
     wgpu::TextureDescriptor textureDescriptor;
     textureDescriptor.usage =
         wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
@@ -1998,6 +1989,9 @@
 
 // half copy texture to texture, lazy clears are needed for noncopied half
 TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
+    // TODO(crbug.com/dawn/643): diagnose and fix this failure on OpenGL.
+    DAWN_SKIP_TEST_IF(IsOpenGL());
+
     // create srcTexture with data
     wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
         3, 1,
@@ -2044,4 +2038,6 @@
 DAWN_INSTANTIATE_TEST(CompressedTextureZeroInitTest,
                       D3D12Backend({"nonzero_clear_resources_on_creation_for_testing"}),
                       MetalBackend({"nonzero_clear_resources_on_creation_for_testing"}),
+                      OpenGLBackend({"nonzero_clear_resources_on_creation_for_testing"}),
+                      OpenGLESBackend({"nonzero_clear_resources_on_creation_for_testing"}),
                       VulkanBackend({"nonzero_clear_resources_on_creation_for_testing"}));