OpenGL: Return error when calling writeTexture() on stencil aspect

This patch adds a missing check in QueueGL::WriteTexture() to return
a validation error when we try to call writeTexture() on the stencil
aspect on OpenGL backends as copying from a buffer into a stencil
texture is not supported on OpenGL.

BUG=dawn:439

Change-Id: I203d40aefe346aea663a492c5a065248b74f8ea3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56002
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/src/dawn_native/opengl/QueueGL.cpp b/src/dawn_native/opengl/QueueGL.cpp
index 9a6335e..977f8bf 100644
--- a/src/dawn_native/opengl/QueueGL.cpp
+++ b/src/dawn_native/opengl/QueueGL.cpp
@@ -56,6 +56,10 @@
                                        const void* data,
                                        const TextureDataLayout& dataLayout,
                                        const Extent3D& writeSizePixel) {
+        if (destination.aspect == wgpu::TextureAspect::StencilOnly) {
+            return DAWN_VALIDATION_ERROR("Writes to stencil textures unsupported on OpenGL");
+        }
+
         TextureCopy textureCopy;
         textureCopy.texture = destination.texture;
         textureCopy.mipLevel = destination.mipLevel;