Bug 615314 - be silent on uninitialized textures - r=vlad, a=joe
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 06 Dec 2010 06:34:35 -0500
changeset 58675 b308f615ba23a60f75adeb1a77cf37c5a80ba472
parent 58674 512049001b964300f48c27f8a1bd973ab24348ed
child 58676 494159165d84025b9c8274f33dbaa6a718178dce
child 58726 25af9b539829ef7c04ba38515492a947c0c5aed9
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersvlad, joe
bugs615314
milestone2.0b8pre
Bug 615314 - be silent on uninitialized textures - r=vlad, a=joe
content/canvas/src/WebGLContext.h
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -1032,42 +1032,27 @@ public:
         // handle this case first, it's the generic case
         if (mFakeBlackStatus == DoNotNeedFakeBlack)
             return PR_FALSE;
 
         if (mFakeBlackStatus == DontKnowIfNeedFakeBlack) {
             // Determine if the texture needs to be faked as a black texture.
             // See 3.8.2 Shader Execution in the OpenGL ES 2.0.24 spec.
 
-            // First detect undefined images. These are typically not-yet-loaded textures.
-            // The generic fake-black-texture messages have been confusing in this case, see bug 594310.
-            // So generate a special message for that.
-
-            PRBool areAllLevel0ImagesDefined = PR_TRUE;
             for (size_t face = 0; face < mFacesCount; ++face) {
-                    areAllLevel0ImagesDefined &= ImageInfoAt(0, face).mIsDefined;
+                if (!ImageInfoAt(0, face).mIsDefined) {
+                    // In case of undefined texture image, we don't print any message because this is a very common
+                    // and often legitimate case, for example when doing asynchronous texture loading.
+                    // An extreme case of this is the photowall google demo.
+                    // Exiting early here allows us to avoid making noise on valid webgl code.
+                    mFakeBlackStatus = DoNeedFakeBlack;
+                    return PR_TRUE;
+                }
             }
 
-            if (!areAllLevel0ImagesDefined) {
-                if (mTarget == LOCAL_GL_TEXTURE_2D) {
-                    mContext->LogMessageIfVerbose(
-                        "We are currently drawing stuff, but some 2D texture has not yet been "
-                        "uploaded any image at level 0. Until it's uploaded, this texture will look black.");
-                } else {
-                    mContext->LogMessageIfVerbose(
-                        "We are currently drawing stuff, but some cube map texture has not yet been "
-                        "uploaded any image at level 0, for at least one of its six faces. "
-                        "Until it's uploaded, this texture will look black.");
-                }
-                mFakeBlackStatus = DoNeedFakeBlack;
-                return PR_TRUE;
-            }
-
-            // ok, done with the stupid special cases above. Now actually implementing the cases defined in section 3.8.2.
-
             const char *msg_rendering_as_black
                 = "A texture is going to be rendered as if it were black, as per the OpenGL ES 2.0.24 spec section 3.8.2, "
                   "because it";
 
             if (mTarget == LOCAL_GL_TEXTURE_2D)
             {
                 if (DoesMinFilterRequireMipmap())
                 {