Backed out changeset 586d0eef1de5 (bug 1444563) for webgl failures on test_2_conformance__misc__webgl-specific.html CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Thu, 15 Mar 2018 23:22:10 +0200
changeset 464516 cc25038c95f8b05d38af22b30c67f7e2b1bc6fdc
parent 464515 f1625f41dda7a51114cc0c51dc6b468897a01622
child 464517 ccecf0d22e69715db4f7326a0dd6b71c9cc200de
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1444563
milestone61.0a1
backs out586d0eef1de5935b10b7e08844430c9ba0207b05
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 586d0eef1de5 (bug 1444563) for webgl failures on test_2_conformance__misc__webgl-specific.html CLOSED TREE
dom/canvas/WebGLContext.h
dom/canvas/WebGLContextDraw.cpp
dom/canvas/WebGLContextValidate.cpp
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -1632,17 +1632,17 @@ protected:
     bool ValidateFaceEnum(GLenum face, const char* info);
     bool ValidateTexInputData(GLenum type, js::Scalar::Type jsArrayType,
                               WebGLTexImageFunc func, WebGLTexDimensions dims);
     bool ValidateDrawModeEnum(GLenum mode, const char* info);
     bool ValidateAttribIndex(GLuint index, const char* info);
     bool ValidateAttribPointer(bool integerMode, GLuint index, GLint size, GLenum type,
                                WebGLboolean normalized, GLsizei stride,
                                WebGLintptr byteOffset, const char* info);
-    bool ValidateStencilParamsForDrawCall(const char* funcName) const;
+    bool ValidateStencilParamsForDrawCall();
 
     bool ValidateCopyTexImage(TexInternalFormat srcFormat, TexInternalFormat dstformat,
                               WebGLTexImageFunc func, WebGLTexDimensions dims);
 
     bool ValidateTexImage(TexImageTarget texImageTarget,
                           GLint level, GLenum internalFormat,
                           GLint xoffset, GLint yoffset, GLint zoffset,
                           GLint width, GLint height, GLint depth,
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -214,59 +214,16 @@ WebGLContext::BindFakeBlack(uint32_t tex
     gl->fActiveTexture(LOCAL_GL_TEXTURE0 + texUnit);
     gl->fBindTexture(target.get(), fakeBlackTex->mGLName);
     gl->fActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
     return true;
 }
 
 ////////////////////////////////////////
 
-bool
-WebGLContext::ValidateStencilParamsForDrawCall(const char* const funcName) const
-{
-    const auto stencilBits = [&]() -> uint8_t {
-        if (!mStencilTestEnabled)
-            return 0;
-
-        if (!mBoundDrawFramebuffer)
-            return mOptions.stencil ? 8 : 0;
-
-        if (mBoundDrawFramebuffer->StencilAttachment().IsDefined())
-            return 8;
-
-        if (mBoundDrawFramebuffer->DepthStencilAttachment().IsDefined())
-            return 8;
-
-        return 0;
-    }();
-    const uint32_t stencilMax = (1 << stencilBits) - 1;
-
-    const auto fnMask = [&](const uint32_t x) { return x & stencilMax; };
-    const auto fnClamp = [&](const int32_t x) {
-        return std::max(0, std::min(x, (int32_t)stencilMax));
-    };
-
-    bool ok = true;
-    ok &= (fnMask(mStencilWriteMaskFront) == fnMask(mStencilWriteMaskBack));
-    ok &= (fnMask(mStencilValueMaskFront) == fnMask(mStencilValueMaskBack));
-    ok &= (fnClamp(mStencilRefFront) == fnClamp(mStencilRefBack));
-
-    if (!ok) {
-        ErrorInvalidOperation("%s: Stencil front/back state must effectively match."
-                              " (before front/back comparison, WRITEMASK and VALUE_MASK"
-                              " are masked with (2^s)-1, and REF is clamped to"
-                              " [0, (2^s)-1], where `s` is the number of enabled stencil"
-                              " bits in the draw framebuffer)",
-                              funcName);
-    }
-    return ok;
-}
-
-////////////////////////////////////////
-
 template<typename T>
 static bool
 DoSetsIntersect(const std::set<T>& a, const std::set<T>& b)
 {
     std::vector<T> intersection;
     std::set_intersection(a.begin(), a.end(), b.begin(), b.end(),
                           std::back_inserter(intersection));
     return bool(intersection.size());
@@ -291,17 +248,17 @@ public:
             return;
         }
 
         if (!mWebGL->ValidateDrawModeEnum(mode, funcName)) {
             *out_error = true;
             return;
         }
 
-        if (!mWebGL->ValidateStencilParamsForDrawCall(funcName)) {
+        if (!mWebGL->ValidateStencilParamsForDrawCall()) {
             *out_error = true;
             return;
         }
 
         if (!mWebGL->mActiveProgramLinkInfo) {
             mWebGL->ErrorInvalidOperation("%s: The current program is not linked.", funcName);
             *out_error = true;
             return;
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -361,16 +361,40 @@ WebGLContext::ValidateAttribIndex(GLuint
                               " MAX_VERTEX_ATTRIBS.", info);
         }
     }
 
     return valid;
 }
 
 bool
+WebGLContext::ValidateStencilParamsForDrawCall()
+{
+    const char msg[] = "%s set different front and back stencil %s. Drawing in"
+                       " this configuration is not allowed.";
+
+    if (mStencilRefFront != mStencilRefBack) {
+        ErrorInvalidOperation(msg, "stencilFuncSeparate", "reference values");
+        return false;
+    }
+
+    if (mStencilValueMaskFront != mStencilValueMaskBack) {
+        ErrorInvalidOperation(msg, "stencilFuncSeparate", "value masks");
+        return false;
+    }
+
+    if (mStencilWriteMaskFront != mStencilWriteMaskBack) {
+        ErrorInvalidOperation(msg, "stencilMaskSeparate", "write masks");
+        return false;
+    }
+
+    return true;
+}
+
+bool
 WebGLContext::InitAndValidateGL(FailureReason* const out_failReason)
 {
     MOZ_RELEASE_ASSERT(gl, "GFX: GL not initialized");
 
     // Unconditionally create a new format usage authority. This is
     // important when restoring contexts and extensions need to add
     // formats back into the authority.
     mFormatUsage = CreateFormatUsage(gl);