In ES3, validate that depth and stencil are the same image

BUG=605775

Change-Id: I9508c70a588270dae871dde79fea1df1c3fd1558
Reviewed-on: https://chromium-review.googlesource.com/341440
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 010c9b9..f2adc4f 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -575,6 +575,13 @@
         {
             return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
         }
+
+        // Starting from ES 3.0 stencil and depth, if present, should be the same image
+        if (data.clientVersion >= 3 && depthAttachment.isAttached() &&
+            stencilAttachment != depthAttachment)
+        {
+            return GL_FRAMEBUFFER_UNSUPPORTED;
+        }
     }
 
     // we need to have at least one attachment to be complete