D3D: Validate that all color attachments are unique.

The previous logic of only checking the currently enabled draw buffers was
incorrect.  Also updated the logic to be more lenient and allow multiple
slices or mips of the same texture.

BUG=483282

Change-Id: I0d406d1a9a96e48342baefbaf11e0c2ecc6d390c
Reviewed-on: https://chromium-review.googlesource.com/361533
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index 2bf3b89..a45c945 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -309,33 +309,10 @@
         return false;
     }
 
-    // D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness by checking the
-    // enabled draw buffers
-    for (size_t firstDrawBufferIdx = 0; firstDrawBufferIdx < mState.getDrawBufferCount();
-         firstDrawBufferIdx++)
+    // D3D11 does not allow for overlapping RenderTargetViews
+    if (!mState.colorAttachmentsAreUniqueImages())
     {
-        const gl::FramebufferAttachment *firstAttachment = mState.getDrawBuffer(firstDrawBufferIdx);
-        if (firstAttachment == nullptr)
-        {
-            continue;
-        }
-
-        for (size_t secondDrawBufferIdx = firstDrawBufferIdx + 1;
-             secondDrawBufferIdx < mState.getDrawBufferCount(); secondDrawBufferIdx++)
-        {
-            const gl::FramebufferAttachment *secondAttachment =
-                mState.getDrawBuffer(secondDrawBufferIdx);
-            if (secondAttachment == nullptr)
-            {
-                continue;
-            }
-
-            if (firstAttachment->id() == secondAttachment->id() &&
-                firstAttachment->type() == secondAttachment->type())
-            {
-                return false;
-            }
-        }
+        return false;
     }
 
     // D3D requires all render targets to have the same dimensions.