Bug 743753 - 2/4 - remove the webgl.verbose preference (always be verbose) - r=vlad
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 23 May 2012 12:07:19 -0400
changeset 94722 6ac4c324163e634e057d4460fe6abccf47d90fb5
parent 94721 69423dd75eb60e518ab0ee667e614c81ab26ba20
child 94723 b0dc5e163739d178ae94d0469ca6563180c0f7b4
push id22751
push useremorley@mozilla.com
push dateThu, 24 May 2012 14:48:49 +0000
treeherdermozilla-central@2552b0541f87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs743753
milestone15.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 743753 - 2/4 - remove the webgl.verbose preference (always be verbose) - r=vlad
content/canvas/src/WebGLContext.cpp
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextUtils.cpp
modules/libpref/src/init/all.js
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -75,17 +75,16 @@ WebGLContext::WebGLContext()
     : mCanvasElement(nsnull),
       gl(nsnull)
 {
     mEnabledExtensions.SetLength(WebGLExtensionID_Max);
 
     mGeneration = 0;
     mInvalidated = false;
     mResetLayer = true;
-    mVerbose = false;
     mOptionsFrozen = false;
 
     mActiveTexture = 0;
     mWebGLError = LOCAL_GL_NO_ERROR;
     mPixelStoreFlipY = false;
     mPixelStorePremultiplyAlpha = false;
     mPixelStoreColorspaceConversion = BROWSER_DEFAULT_WEBGL;
 
@@ -370,26 +369,22 @@ WebGLContext::SetDimensions(PRInt32 widt
         Preferences::GetBool("webgl.prefer-egl", false);
     bool preferOpenGL =
         Preferences::GetBool("webgl.prefer-native-gl", false);
 #endif
     bool forceEnabled =
         Preferences::GetBool("webgl.force-enabled", false);
     bool disabled =
         Preferences::GetBool("webgl.disabled", false);
-    bool verbose =
-        Preferences::GetBool("webgl.verbose", false);
 
     ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
 
     if (disabled)
         return NS_ERROR_FAILURE;
 
-    mVerbose = verbose;
-
     // We're going to create an entirely new context.  If our
     // generation is not 0 right now (that is, if this isn't the first
     // context we're creating), we may have to dispatch a context lost
     // event.
 
     // If incrementing the generation would cause overflow,
     // don't allow it.  Allowing this would allow us to use
     // resource handles created from older context generations.
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -1107,17 +1107,16 @@ protected:
     nsRefPtr<gl::GLContext> gl;
 
     CheckedUint32 mGeneration;
 
     WebGLContextOptions mOptions;
 
     bool mInvalidated;
     bool mResetLayer;
-    bool mVerbose;
     bool mOptionsFrozen;
     bool mMinCapability;
     bool mDisableExtensions;
     bool mHasRobustness;
 
     template<typename WebGLObjectType>
     void DeleteWebGLObjectsArray(nsTArray<WebGLObjectType>& array);
 
@@ -1367,18 +1366,16 @@ protected:
 #endif
 
     nsRefPtr<WebGLMemoryPressureObserver> mMemoryPressureObserver;
 
 public:
     // console logging helpers
     void LogMessage(const char *fmt, ...);
     void LogMessage(const char *fmt, va_list ap);
-    void LogMessageIfVerbose(const char *fmt, ...);
-    void LogMessageIfVerbose(const char *fmt, va_list ap);
 
     friend class WebGLTexture;
     friend class WebGLFramebuffer;
     friend class WebGLRenderbuffer;
     friend class WebGLProgram;
     friend class WebGLBuffer;
     friend class WebGLShader;
     friend class WebGLUniformLocation;
@@ -1978,72 +1975,72 @@ public:
                 = "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())
                 {
                     if (!IsMipmapTexture2DComplete()) {
-                        mContext->LogMessageIfVerbose
+                        mContext->LogMessage
                             ("%s is a 2D texture, with a minification filter requiring a mipmap, "
                              "and is not mipmap complete (as defined in section 3.7.10).", msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     } else if (!ImageInfoAt(0).IsPowerOfTwo()) {
-                        mContext->LogMessageIfVerbose
+                        mContext->LogMessage
                             ("%s is a 2D texture, with a minification filter requiring a mipmap, "
                              "and either its width or height is not a power of two.", msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     }
                 }
                 else // no mipmap required
                 {
                     if (!ImageInfoAt(0).IsPositive()) {
-                        mContext->LogMessageIfVerbose
+                        mContext->LogMessage
                             ("%s is a 2D texture and its width or height is equal to zero.",
                              msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     } else if (!AreBothWrapModesClampToEdge() && !ImageInfoAt(0).IsPowerOfTwo()) {
-                        mContext->LogMessageIfVerbose
+                        mContext->LogMessage
                             ("%s is a 2D texture, with a minification filter not requiring a mipmap, "
                              "with its width or height not a power of two, and with a wrap mode "
                              "different from CLAMP_TO_EDGE.", msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     }
                 }
             }
             else // cube map
             {
                 bool areAllLevel0ImagesPOT = true;
                 for (size_t face = 0; face < mFacesCount; ++face)
                     areAllLevel0ImagesPOT &= ImageInfoAt(0, face).IsPowerOfTwo();
 
                 if (DoesMinFilterRequireMipmap())
                 {
                     if (!IsMipmapCubeComplete()) {
-                        mContext->LogMessageIfVerbose("%s is a cube map texture, with a minification filter requiring a mipmap, "
+                        mContext->LogMessage("%s is a cube map texture, with a minification filter requiring a mipmap, "
                                    "and is not mipmap cube complete (as defined in section 3.7.10).",
                                    msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     } else if (!areAllLevel0ImagesPOT) {
-                        mContext->LogMessageIfVerbose("%s is a cube map texture, with a minification filter requiring a mipmap, "
+                        mContext->LogMessage("%s is a cube map texture, with a minification filter requiring a mipmap, "
                                    "and either the width or the height of some level 0 image is not a power of two.",
                                    msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     }
                 }
                 else // no mipmap required
                 {
                     if (!IsCubeComplete()) {
-                        mContext->LogMessageIfVerbose("%s is a cube map texture, with a minification filter not requiring a mipmap, "
+                        mContext->LogMessage("%s is a cube map texture, with a minification filter not requiring a mipmap, "
                                    "and is not cube complete (as defined in section 3.7.10).",
                                    msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     } else if (!AreBothWrapModesClampToEdge() && !areAllLevel0ImagesPOT) {
-                        mContext->LogMessageIfVerbose("%s is a cube map texture, with a minification filter not requiring a mipmap, "
+                        mContext->LogMessage("%s is a cube map texture, with a minification filter not requiring a mipmap, "
                                    "with some level 0 image having width or height not a power of two, and with a wrap mode "
                                    "different from CLAMP_TO_EDGE.", msg_rendering_as_black);
                         mFakeBlackStatus = DoNeedFakeBlack;
                     }
                 }
             }
 
             // we have exhausted all cases where we do need fakeblack, so if the status is still unknown,
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -499,17 +499,17 @@ WebGLContext::BufferData(WebGLenum targe
 
     if (!boundBuffer)
         return ErrorInvalidOperation("BufferData: no buffer bound!");
 
     MakeContextCurrent();
     
     GLenum error = CheckedBufferData(target, size, 0, usage);
     if (error) {
-        LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
+        LogMessage("bufferData generated error %s", ErrorName(error));
         return;
     }
 
     boundBuffer->SetByteLength(size);
     boundBuffer->InvalidateCachedMaxElements();
     if (!boundBuffer->ZeroDataIfElementArray())
         return ErrorOutOfMemory("bufferData: out of memory");
 }
@@ -541,17 +541,17 @@ WebGLContext::BufferData(WebGLenum targe
     if (!boundBuffer)
         return ErrorInvalidOperation("BufferData: no buffer bound!");
 
     MakeContextCurrent();
 
     GLenum error = CheckedBufferData(target, data->mLength, data->mData, usage);
 
     if (error) {
-        LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
+        LogMessage("bufferData generated error %s", ErrorName(error));
         return;
     }
 
     boundBuffer->SetByteLength(data->mLength);
     boundBuffer->InvalidateCachedMaxElements();
     if (!boundBuffer->CopyDataIfElementArray(data->mData))
         return ErrorOutOfMemory("bufferData: out of memory");
 }
@@ -577,17 +577,17 @@ WebGLContext::BufferData(WebGLenum targe
 
     if (!boundBuffer)
         return ErrorInvalidOperation("BufferData: no buffer bound!");
 
     MakeContextCurrent();
 
     GLenum error = CheckedBufferData(target, data.mLength, data.mData, usage);
     if (error) {
-        LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
+        LogMessage("bufferData generated error %s", ErrorName(error));
         return;
     }
 
     boundBuffer->SetByteLength(data.mLength);
     boundBuffer->InvalidateCachedMaxElements();
     if (!boundBuffer->CopyDataIfElementArray(data.mData))
         return ErrorOutOfMemory("bufferData: out of memory");
 }
@@ -1058,17 +1058,17 @@ WebGLContext::CopyTexImage2D(WebGLenum t
     }
 
     if (sizeMayChange) {
         UpdateWebGLErrorAndClearGLError();
         CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
         GLenum error = LOCAL_GL_NO_ERROR;
         UpdateWebGLErrorAndClearGLError(&error);
         if (error) {
-            LogMessageIfVerbose("copyTexImage2D generated error %s", ErrorName(error));
+            LogMessage("copyTexImage2D generated error %s", ErrorName(error));
             return;
         }          
     } else {
         CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
     }
     
     tex->SetImageInfo(target, level, width, height, internalformat, type);
 }
@@ -3779,17 +3779,17 @@ WebGLContext::ReadPixels(WebGLint x, Web
                          WebGLenum type, ArrayBufferView* pixels,
                          ErrorResult& rv)
 {
     if (!IsContextStable()) {
         return;
     }
 
     if (HTMLCanvasElement()->IsWriteOnly() && !nsContentUtils::IsCallerTrustedForRead()) {
-        LogMessageIfVerbose("ReadPixels: Not allowed");
+        LogMessage("ReadPixels: Not allowed");
         return rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     }
 
     if (width < 0 || height < 0)
         return ErrorInvalidValue("ReadPixels: negative size passed");
 
     const WebGLRectangleObject *framebufferRect = FramebufferRectangleObject();
     WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
@@ -4060,17 +4060,17 @@ WebGLContext::RenderbufferStorage(WebGLe
                        height != mBoundRenderbuffer->Height() ||
                        internalformat != mBoundRenderbuffer->InternalFormat();
     if (sizeChanges) {
         UpdateWebGLErrorAndClearGLError();
         gl->fRenderbufferStorage(target, internalformatForGL, width, height);
         GLenum error = LOCAL_GL_NO_ERROR;
         UpdateWebGLErrorAndClearGLError(&error);
         if (error) {
-            LogMessageIfVerbose("renderbufferStorage generated error %s", ErrorName(error));
+            LogMessage("renderbufferStorage generated error %s", ErrorName(error));
             return;
         }
     } else {
         gl->fRenderbufferStorage(target, internalformatForGL, width, height);
     }
 
     mBoundRenderbuffer->SetInternalFormat(internalformat);
     mBoundRenderbuffer->SetInternalFormatForGL(internalformatForGL);
@@ -4297,28 +4297,28 @@ WebGLContext::DOMElementToImageSurface(E
     // Canvas2D's.
 
     // part 1: check that the DOM element is same-origin, or has otherwise been
     // validated for cross-domain use.
     if (!res.mCORSUsed) {
         bool subsumes;
         nsresult rv = HTMLCanvasElement()->NodePrincipal()->Subsumes(res.mPrincipal, &subsumes);
         if (NS_FAILED(rv) || !subsumes) {
-            LogMessageIfVerbose("It is forbidden to load a WebGL texture from a cross-domain element that has not been validated with CORS. "
+            LogMessage("It is forbidden to load a WebGL texture from a cross-domain element that has not been validated with CORS. "
                                 "See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures");
             return NS_ERROR_DOM_SECURITY_ERR;
         }
     }
 
     // part 2: if the DOM element is a canvas, check that it's not write-only.
     // That would indicate a tainted canvas, i.e. a canvas that could contain
     // cross-domain image data.
     if (nsHTMLCanvasElement* canvas = nsHTMLCanvasElement::FromContent(imageOrCanvas)) {
         if (canvas->IsWriteOnly()) {
-            LogMessageIfVerbose("The canvas used as source for texImage2D here is tainted (write-only). It is forbidden "
+            LogMessage("The canvas used as source for texImage2D here is tainted (write-only). It is forbidden "
                                 "to load a WebGL texture from a tainted canvas. A Canvas becomes tainted for example "
                                 "when a cross-domain image is drawn on it. "
                                 "See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures");
             return NS_ERROR_DOM_SECURITY_ERR;
         }
     }
 
     // End of security checks, now we should be safe regarding cross-domain images
@@ -4774,17 +4774,17 @@ WebGLContext::ValidateProgram(WebGLProgr
     if (!ValidateObject("validateProgram", prog))
         return;
 
     MakeContextCurrent();
 
 #ifdef XP_MACOSX
     // see bug 593867 for NVIDIA and bug 657201 for ATI. The latter is confirmed with Mac OS 10.6.7
     if (gl->WorkAroundDriverBugs()) {
-        LogMessageIfVerbose("validateProgram: implemented as a no-operation on Mac to work around crashes");
+        LogMessage("validateProgram: implemented as a no-operation on Mac to work around crashes");
         return;
     }
 #endif
 
     WebGLuint progname = prog->GLName();
     gl->fValidateProgram(progname);
 }
 
@@ -5625,17 +5625,17 @@ WebGLContext::TexImage2D_base(WebGLenum 
 
         error = CheckedTexImage2D(target, level, internalformat,
                                   width, height, border, format, type, tempZeroData);
 
         free(tempZeroData);
     }
     
     if (error) {
-        LogMessageIfVerbose("texImage2D generated error %s", ErrorName(error));
+        LogMessage("texImage2D generated error %s", ErrorName(error));
         return;
     }
 
     tex->SetImageInfo(target, level, width, height, format, type);
 }
 
 NS_IMETHODIMP
 WebGLContext::TexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat,
--- a/content/canvas/src/WebGLContextUtils.cpp
+++ b/content/canvas/src/WebGLContextUtils.cpp
@@ -64,41 +64,16 @@ WebGLContext::LogMessage(const char *fmt
         if (mAlreadyReportedMessages == MaxReportedMessages) {
             JS_ReportWarning(ccx,
                 "WebGL: no further warnings will be reported for this WebGL context "
                 "(already reported %d warnings)", mAlreadyReportedMessages);
         }
     }
 }
 
-void
-WebGLContext::LogMessageIfVerbose(const char *fmt, ...)
-{
-    va_list ap;
-    va_start(ap, fmt);
-
-    LogMessageIfVerbose(fmt, ap);
-
-    va_end(ap);
-}
-
-void
-WebGLContext::LogMessageIfVerbose(const char *fmt, va_list ap)
-{
-    static bool firstTime = true;
-
-    if (mVerbose)
-        LogMessage(fmt, ap);
-    else if (firstTime)
-        LogMessage("There are WebGL warnings or messages in this page, but they are hidden. To see them, "
-                   "go to about:config, set the webgl.verbose preference, and reload this page.");
-
-    firstTime = false;
-}
-
 CheckedUint32
 WebGLContext::GetImageSize(WebGLsizei height, 
                            WebGLsizei width, 
                            uint32_t pixelSize,
                            uint32_t packOrUnpackAlignment)
 {
     CheckedUint32 checked_plainRowSize = CheckedUint32(width) * pixelSize;
 
@@ -128,72 +103,72 @@ WebGLContext::SynthesizeGLError(WebGLenu
         mWebGLError = err;
 }
 
 void
 WebGLContext::SynthesizeGLError(WebGLenum err, const char *fmt, ...)
 {
     va_list va;
     va_start(va, fmt);
-    LogMessageIfVerbose(fmt, va);
+    LogMessage(fmt, va);
     va_end(va);
 
     return SynthesizeGLError(err);
 }
 
 void
 WebGLContext::ErrorInvalidEnum(const char *fmt, ...)
 {
     va_list va;
     va_start(va, fmt);
-    LogMessageIfVerbose(fmt, va);
+    LogMessage(fmt, va);
     va_end(va);
 
     return SynthesizeGLError(LOCAL_GL_INVALID_ENUM);
 }
 
 void
 WebGLContext::ErrorInvalidOperation(const char *fmt, ...)
 {
     va_list va;
     va_start(va, fmt);
-    LogMessageIfVerbose(fmt, va);
+    LogMessage(fmt, va);
     va_end(va);
 
     return SynthesizeGLError(LOCAL_GL_INVALID_OPERATION);
 }
 
 void
 WebGLContext::ErrorInvalidValue(const char *fmt, ...)
 {
     va_list va;
     va_start(va, fmt);
-    LogMessageIfVerbose(fmt, va);
+    LogMessage(fmt, va);
     va_end(va);
 
     return SynthesizeGLError(LOCAL_GL_INVALID_VALUE);
 }
 
 void
 WebGLContext::ErrorInvalidFramebufferOperation(const char *fmt, ...)
 {
     va_list va;
     va_start(va, fmt);
-    LogMessageIfVerbose(fmt, va);
+    LogMessage(fmt, va);
     va_end(va);
 
     return SynthesizeGLError(LOCAL_GL_INVALID_FRAMEBUFFER_OPERATION);
 }
 
 void
 WebGLContext::ErrorOutOfMemory(const char *fmt, ...)
 {
     va_list va;
     va_start(va, fmt);
-    LogMessageIfVerbose(fmt, va);
+    LogMessage(fmt, va);
     va_end(va);
 
     return SynthesizeGLError(LOCAL_GL_OUT_OF_MEMORY);
 }
 
 const char *
 WebGLContext::ErrorName(GLenum error)
 {
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -3405,17 +3405,16 @@ pref("image.mem.max_bytes_for_sync_decod
 pref("image.mem.max_decoded_image_kb", 51200);
 
 // WebGL prefs
 pref("webgl.force-enabled", false);
 pref("webgl.disabled", false);
 pref("webgl.shader_validator", true);
 pref("webgl.force_osmesa", false);
 pref("webgl.osmesalib", "");
-pref("webgl.verbose", false);
 pref("webgl.prefer-native-gl", false);
 pref("webgl.min_capability_mode", false);
 pref("webgl.disable-extensions", false);
 pref("webgl.msaa-level", 2);
 pref("webgl.msaa-force", false);
 
 #ifdef XP_WIN
 // The default TCP send window on Windows is too small, and autotuning only occurs on receive