WebGL requires GL_FRAMEBUFFER_UNSUPPORTED for identical FBO attachments.

If the same level of a texture is attached to multiple color
attachments of a framebuffer object, for example, the WebGL
conformance tests require generating a GL_FRAMEBUFFER_UNSUPPORTED
error. The Direct3D backend already had this restriction; apply it to
all backends when the WebGL compatibility extension is enabled.

Fixes the following WebGL conformance tests with the pass-through
command decoder in Chrome:
  conformance/extensions/webgl-draw-buffers-framebuffer-unsupported
  conformance2/rendering/framebuffer-unsupported

BUG=angleproject:2168

Change-Id: I340d06ca0ee969989c6c5725512b1b9542281477
Reviewed-on: https://chromium-review.googlesource.com/699856
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index 8fe577c..01d2761 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -285,7 +285,7 @@
     return gl::NoError();
 }
 
-bool FramebufferD3D::checkStatus() const
+bool FramebufferD3D::checkStatus(const gl::Context *context) const
 {
     // if we have both a depth and stencil buffer, they must refer to the same object
     // since we only support packed_depth_stencil and not separate depth and stencil
@@ -295,10 +295,15 @@
         return false;
     }
 
-    // D3D11 does not allow for overlapping RenderTargetViews
-    if (!mState.colorAttachmentsAreUniqueImages())
+    // D3D11 does not allow for overlapping RenderTargetViews.
+    // If WebGL compatibility is enabled, this has already been checked at a higher level.
+    ASSERT(!context->getExtensions().webglCompatibility || mState.colorAttachmentsAreUniqueImages());
+    if (!context->getExtensions().webglCompatibility)
     {
-        return false;
+        if (!mState.colorAttachmentsAreUniqueImages())
+        {
+            return false;
+        }
     }
 
     // D3D requires all render targets to have the same dimensions.