Only validate that stencil refs and masks are the same on D3D renderers.

BUG=angleproject:1025

Change-Id: If79046f9f81ad20c5f2f7296245b0cb74a4102aa
Reviewed-on: https://chromium-review.googlesource.com/296680
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index cc8a73b..0e478d0 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1437,17 +1437,21 @@
         return false;
     }
 
-    const gl::DepthStencilState &depthStencilState = state.getDepthStencilState();
-    if (depthStencilState.stencilWritemask != depthStencilState.stencilBackWritemask ||
-        state.getStencilRef() != state.getStencilBackRef() ||
-        depthStencilState.stencilMask != depthStencilState.stencilBackMask)
+    if (context->getLimitations().noSeparateStencilRefsAndMasks)
     {
-        // Note: these separate values are not supported in WebGL, due to D3D's limitations.
-        // See Section 6.10 of the WebGL 1.0 spec
-        ERR("This ANGLE implementation does not support separate front/back stencil "
-            "writemasks, reference values, or stencil mask values.");
-        context->recordError(Error(GL_INVALID_OPERATION));
-        return false;
+        const gl::DepthStencilState &depthStencilState = state.getDepthStencilState();
+        if (depthStencilState.stencilWritemask != depthStencilState.stencilBackWritemask ||
+            state.getStencilRef() != state.getStencilBackRef() ||
+            depthStencilState.stencilMask != depthStencilState.stencilBackMask)
+        {
+            // Note: these separate values are not supported in WebGL, due to D3D's limitations. See
+            // Section 6.10 of the WebGL 1.0 spec
+            ERR(
+                "This ANGLE implementation does not support separate front/back stencil "
+                "writemasks, reference values, or stencil mask values.");
+            context->recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
     }
 
     const gl::Framebuffer *fbo = state.getDrawFramebuffer();