WebGL: Validate the read and write buffers for BlitFramebuffer are unique.

TEST=conformance2/rendering/blitframebuffer-test

BUG=angleproject:1990

Change-Id: I0caeaac824f1689867134f34f74e5ef2c2f1b016
Reviewed-on: https://chromium-review.googlesource.com/475990
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 348f4ad..a4efd03 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2648,6 +2648,15 @@
                         context->handleError(Error(GL_INVALID_OPERATION));
                         return false;
                     }
+
+                    if (context->getExtensions().webglCompatibility &&
+                        *readColorBuffer == *attachment)
+                    {
+                        context->handleError(
+                            Error(GL_INVALID_OPERATION,
+                                  "Read and write color attachments cannot be the same image."));
+                        return false;
+                    }
                 }
             }
 
@@ -2696,6 +2705,14 @@
                     context->handleError(Error(GL_INVALID_OPERATION));
                     return false;
                 }
+
+                if (context->getExtensions().webglCompatibility && *readBuffer == *drawBuffer)
+                {
+                    context->handleError(Error(
+                        GL_INVALID_OPERATION,
+                        "Read and write depth stencil attachments cannot be the same image."));
+                    return false;
+                }
             }
             // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
             else if (drawBuffer)