Bug 860543 - Account for testing shadowed NaNs. - r=bjacob
☠☠ backed out by d68f2618ea70 ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 19 Jun 2013 15:45:39 -0700
changeset 147205 1715991888acb61f7413d8d5f96effc327934478
parent 147204 af744b5304d8987db9fece5df38d0c96aeecc94a
child 147206 4267a855665920e0d3ca7f03a0e2344ccfa4d69e
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs860543
milestone24.0a1
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
Bug 860543 - Account for testing shadowed NaNs. - r=bjacob
content/canvas/src/WebGLContext.cpp
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -1164,16 +1164,21 @@ WebGLContext::ClearScreen()
         clearMask |= LOCAL_GL_DEPTH_BUFFER_BIT;
     if (mOptions.stencil)
         clearMask |= LOCAL_GL_STENCIL_BUFFER_BIT;
 
     ForceClearFramebufferWithDefaultValues(clearMask);
     mIsScreenCleared = true;
 }
 
+// For NaNs, etc.
+static bool IsSameFloat(float a, float b) {
+    return (a == b) || (IsNaN(a) && IsNaN(b));
+}
+
 void
 WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask)
 {
     MakeContextCurrent();
 
     bool initializeColorBuffer = 0 != (mask & LOCAL_GL_COLOR_BUFFER_BIT);
     bool initializeDepthBuffer = 0 != (mask & LOCAL_GL_DEPTH_BUFFER_BIT);
     bool initializeStencilBuffer = 0 != (mask & LOCAL_GL_STENCIL_BUFFER_BIT);
@@ -1195,30 +1200,30 @@ WebGLContext::ForceClearFramebufferWithD
 
         gl->fGetBooleanv(LOCAL_GL_COLOR_WRITEMASK, colorWriteMask);
         gl->fGetFloatv(LOCAL_GL_COLOR_CLEAR_VALUE, colorClearValue);
 
         MOZ_ASSERT(colorWriteMask[0] == mColorWriteMask[0] &&
                    colorWriteMask[1] == mColorWriteMask[1] &&
                    colorWriteMask[2] == mColorWriteMask[2] &&
                    colorWriteMask[3] == mColorWriteMask[3]);
-        MOZ_ASSERT(colorClearValue[0] == mColorClearValue[0] &&
-                   colorClearValue[1] == mColorClearValue[1] &&
-                   colorClearValue[2] == mColorClearValue[2] &&
-                   colorClearValue[3] == mColorClearValue[3]);
+        MOZ_ASSERT(IsSameFloat(mColorClearValue[0], colorClearValue[0]) &&
+                   IsSameFloat(mColorClearValue[0], colorClearValue[0]) &&
+                   IsSameFloat(mColorClearValue[0], colorClearValue[0]) &&
+                   IsSameFloat(mColorClearValue[0], colorClearValue[0]));
 
 
         realGLboolean depthWriteMask = 2;
         GLfloat depthClearValue = -1.0f;
 
         gl->fGetBooleanv(LOCAL_GL_DEPTH_WRITEMASK, &depthWriteMask);
         gl->fGetFloatv(LOCAL_GL_DEPTH_CLEAR_VALUE, &depthClearValue);
 
-        MOZ_ASSERT(depthWriteMask  == mDepthWriteMask);
-        MOZ_ASSERT(depthClearValue == mDepthClearValue);
+        MOZ_ASSERT(depthWriteMask == mDepthWriteMask);
+        MOZ_ASSERT(IsSameFloat(mDepthClearValue, depthClearValue));
 
 
         GLuint stencilWriteMaskFront = 0xdeadbad1;
         GLuint stencilWriteMaskBack  = 0xdeadbad1;
         GLuint stencilClearValue     = 0xdeadbad1;
 
         gl->GetUIntegerv(LOCAL_GL_STENCIL_WRITEMASK,      &stencilWriteMaskFront);
         gl->GetUIntegerv(LOCAL_GL_STENCIL_BACK_WRITEMASK, &stencilWriteMaskBack);